/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #fafafa;
    --bg-secondary: #f5f5f5;
    --bg-card: #ffffff;
    --accent-primary: #c9a962;
    --accent-secondary: #1a1a1a;
    --accent-gradient: linear-gradient(135deg, #c9a962 0%, #e8d5a3 50%, #c9a962 100%);
    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-muted: #999999;
    --success: #2d8a4e;
    --warning: #c9a962;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.08);
    --border-color: #e8e8e8;
}

body {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
    background: var(--bg-primary);
    background-image: linear-gradient(rgba(250, 250, 250, 0.9), rgba(250, 250, 250, 0.8)), url('images/bg.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    background-size: cover;
    color: var(--text-primary);
    min-height: 100vh;
    letter-spacing: 0.02em;
}

/* Navigation Bar */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-brand {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.08em;
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.nav-brand:hover {
    opacity: 0.8;
}

.nav-logo {
    height: 32px;
    width: auto;
    display: block;
}

.nav-current {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 24px;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.03em;
}

/* Service Selector */
.service-selector {
    margin-bottom: 16px;
    text-align: center;
}

.service-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.service-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.service-option {
    cursor: pointer;
}

.service-option input {
    display: none;
}

.service-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 140px;
}

.service-btn small {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 400;
}

.service-option input:checked+.service-btn {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.1), rgba(201, 169, 98, 0.05));
}

.service-option:hover .service-btn {
    border-color: var(--accent-primary);
}

.custom-size-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.custom-size-input input {
    width: 80px;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    text-align: center;
}

.custom-size-input input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.custom-size-unit {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.current-limit {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.current-limit strong {
    color: var(--accent-primary);
}

/* Service Info */
.service-info {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(201, 169, 98, 0.08);
    border: 1px solid rgba(201, 169, 98, 0.2);
    border-radius: 8px;
    text-align: center;
}

.service-info-item {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.info-label {
    color: var(--text-muted);
    font-weight: 500;
}

.info-divider {
    margin: 0 8px;
    color: var(--border-color);
}

/* Format Selector (subtle) */
.format-selector {
    margin-top: 12px;
    margin-bottom: 8px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.format-selector:hover {
    opacity: 1;
}

.format-label {
    display: inline;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 8px;
}

.format-options {
    display: inline-flex;
    gap: 8px;
}

.format-option {
    cursor: pointer;
}

.format-option input {
    display: none;
}

.format-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.format-option input:checked+.format-btn {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.format-option:hover .format-btn {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.recommended {
    font-size: 0.55rem;
    padding: 1px 4px;
    background: var(--text-muted);
    color: var(--bg-primary);
    border-radius: 3px;
    font-weight: 600;
}

/* Settings Panel */
.settings-panel {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.setting-item input,
.setting-item select {
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid var(--accent-secondary);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    min-width: 150px;
    transition: all 0.3s ease;
}

.setting-item input:focus,
.setting-item select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
}

/* Drop Zone */
.drop-zone {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.03) 0%, rgba(201, 169, 98, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
}

.drop-zone.drag-over {
    transform: scale(1.02);
    border-width: 2px;
    animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {

    0%,
    100% {
        border-color: var(--accent-primary);
        box-shadow: 0 0 0 0 rgba(201, 169, 98, 0.4);
    }

    50% {
        border-color: var(--accent-secondary);
        box-shadow: 0 0 20px 5px rgba(201, 169, 98, 0.2);
    }
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
    opacity: 1;
}

.drop-zone.drag-over::before {
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.08) 0%, rgba(201, 169, 98, 0.15) 50%, rgba(201, 169, 98, 0.08) 100%);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.drop-zone-content {
    position: relative;
    z-index: 1;
}

.drop-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.8;
}

.drop-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.drop-subtext {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.file-select-btn {
    display: inline-block;
    padding: 14px 36px;
    background: var(--accent-secondary);
    color: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}

.file-select-btn:hover {
    background: #333333;
    box-shadow: var(--shadow);
}

/* Processing Indicator */
.processing-indicator {
    display: none;
    text-align: center;
    padding: 40px;
}

.processing-indicator.active {
    display: block;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-text {
    font-weight: 500;
    color: var(--text-primary);
}

.progress-count {
    font-size: 0.9rem;
    color: var(--accent-primary);
    font-weight: 600;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-file {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Results Container */
.results-container {
    display: none;
    margin-top: 40px;
}

.results-container.active {
    display: block;
}

.results-container h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    text-align: center;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Result Card */
.result-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 24px;
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 24px;
    align-items: center;
    box-shadow: var(--shadow);
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-preview {
    width: 200px;
    height: 112px;
    object-fit: cover;
    border-radius: 10px;
    background: var(--bg-secondary);
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-filename {
    font-weight: 600;
    font-size: 1.1rem;
    word-break: break-all;
}

.result-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    font-size: 1rem;
}

/* Result Note */
.result-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Accordion */
.accordion-container {
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
}

.accordion-trigger {
    width: 100%;
    padding: 8px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.accordion-trigger:hover {
    background: rgba(201, 169, 98, 0.05);
    color: var(--text-primary);
}

.accordion-icon {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.accordion-trigger.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(201, 169, 98, 0.03);
}

.accordion-content.active {
    max-height: 500px;
    /* Adjust based on content */
    border-top: 1px solid var(--border-color);
}

.accordion-inner {
    padding: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    text-align: left;
}

.accordion-inner strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.accordion-inner p {
    margin-bottom: 8px;
}

.accordion-inner p:last-child {
    margin-bottom: 0;
}

/* Tech Info (below drop zone) */
.tech-info {
    margin-top: 16px;
    margin-bottom: 0;
}



.stat-value.success {
    color: var(--success);
}

.stat-value.reduction {
    color: var(--accent-primary);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-btn {
    padding: 12px 24px;
    background: var(--accent-secondary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.download-btn:hover {
    background: #333333;
    box-shadow: var(--shadow);
}

.download-all-btn {
    margin-top: 32px;
    padding: 14px 36px;
    background: var(--accent-secondary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    transition: all 0.3s ease;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.download-all-btn:hover {
    background: #333333;
    box-shadow: var(--shadow);
}

/* Skipped Card */
.skipped-card {
    border: 2px solid var(--success);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(0, 210, 106, 0.1) 100%);
}

.skipped-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(0, 210, 106, 0.15);
    border-radius: 10px;
    border-left: 4px solid var(--success);
}

.skipped-icon {
    font-size: 1.5rem;
}

.skipped-text {
    font-weight: 600;
    color: var(--success);
}

.skipped-badge {
    padding: 10px 20px;
    background: rgba(0, 210, 106, 0.2);
    color: var(--success);
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 16px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-lang {
    margin: 0;
}

.footer-lang select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.footer-lang select:hover,
.footer-lang select:focus {
    border-color: var(--text-secondary);
}

.footer-privacy {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 24px;
}

.footer-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.footer-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    font-size: 0.8rem;
    opacity: 0.6;
}

.footer-copyright {
    margin: 0;
}

.footer-links {
    margin: 0;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
    opacity: 1;
}

/* Terms Page Styles */
.terms-wrapper {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 24px;
}

.terms-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 64px;
    border: 1px solid var(--border-color);
}

.terms-title {
    text-align: center;
    margin-bottom: 48px;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 24px;
}

.terms-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.terms-section {
    margin-bottom: 40px;
}

.terms-section h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.terms-section h2::before {
    content: '';
    display: block;
    width: 4px;
    height: 24px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.terms-section p,
.terms-section li {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.terms-section ul {
    padding-left: 24px;
    margin-bottom: 12px;
}

.terms-section li {
    margin-bottom: 8px;
}

.last-updated {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 40px;
    margin-top: -32px;
}


/* Share Buttons (Icon only) */
.share-container {
    margin: 0;
    /* Reset margin for inline use */
    text-align: center;
}

.share-buttons {
    /* No longer needed if single button, but kept for structure */
    display: flex;
    justify-content: center;
}

.share-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    /* Circle */
    color: var(--text-muted);
    /* Muted color by default */
    background-color: rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition: all 0.2s ease;
}

.share-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.share-btn:hover {
    transform: translateY(-2px);
    color: white;
    /* Bright on hover */
    background-color: #000000;
    /* X Brand color on hover */
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    color: var(--text-primary);
}

.toast.error {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.toast.success {
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.toast.warning {
    border-color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 1.2rem;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@media (max-width: 480px) {
    .share-buttons {
        gap: 0.8rem;
    }

    /* Keep share button size fixed on mobile */
    .share-btn {
        width: 32px;
        height: 32px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }

    .result-card {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .result-preview {
        margin: 0 auto;
    }

    .result-stats {
        justify-content: center;
    }

    .settings-panel {
        flex-direction: column;
        align-items: center;
    }
}