/* ===== Global Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #ffffff;
    --text: #111111;
    --muted: #4b4b4b;
    --line: #dcdcdc;
    --soft: #f6f6f6;
    --red: #c81e1e;
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 12px;
}

html, body {
    width: 100%;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== Page Layout ===== */
.page {
    width: min(1180px, 100%);
    flex: 1;
    margin: 0 auto;
}

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: #fff;
    box-shadow: var(--shadow);
}

.left-panel {
    padding: 24px 22px 18px;
    overflow: hidden;
}

/* ===== Brand ===== */
.brand {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: color 0.2s;
}

.brand a:hover { color: var(--primary); }

/* ===== Title ===== */
.title-cn {
    font-size: clamp(1.9rem, 2.6vw, 2.6rem);
    line-height: 1.18;
    font-weight: 800;
    color: var(--text);
}

.title-en {
    margin-top: 8px;
    font-size: clamp(0.95rem, 1.25vw, 1.1rem);
    line-height: 1.5;
    color: var(--muted);
    font-weight: 500;
}

.hero-copy {
    margin-top: 16px;
    margin-bottom: 12px;
}

.hero-copy .cn,
.hero-copy .en {
    line-height: 1.6;
}

.hero-share {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    min-height: 28px;
}

.hero-share .btn-text {
    padding: 0;
    color: var(--primary);
    font-weight: 700;
}

#shareStatus {
    color: var(--muted);
    font-size: 0.75rem;
}

.hero-copy .cn {
    font-size: 1rem;
    color: var(--text);
}

.hero-copy .en {
    margin-top: 4px;
    font-size: 0.88rem;
    color: var(--muted);
}

/* ===== Comparison Section ===== */
.compare-header {
    margin-top: 2px;
    margin-bottom: 10px;
}

.compare-header .cn {
    font-size: clamp(1.3rem, 1.9vw, 1.8rem);
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
}

.compare-header .en {
    margin-top: 4px;
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--muted);
}

.compare-frame {
    height: 43vh;
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #fff;
}

/* ===== Upload Card ===== */
.upload-card {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--soft);
}

.account-card {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid #93c5fd;
    border-radius: var(--radius-lg);
    background: var(--primary-light);
}
.account-card-pending { border-color: var(--line); background: var(--soft); }

.account-copy, .account-status {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--gray-700);
}

.account-label { display: block; margin-top: 12px; font-size: 0.8rem; font-weight: 700; }
.account-input { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.account-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; align-items: center; }
.btn-secondary, .btn-text { border: none; font: inherit; font-weight: 700; cursor: pointer; }
.btn-secondary { padding: 9px 12px; border-radius: 10px; background: var(--primary); color: #fff; }
.btn-secondary:disabled { cursor: not-allowed; opacity: 0.62; }
.btn-text { padding: 7px 0; background: transparent; color: var(--primary-dark); font-size: 0.82rem; }
.account-status { min-height: 1.25em; margin-top: 8px; }

.authorisation-check {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-top: 12px;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--gray-700);
    font-size: 0.76rem;
    line-height: 1.45;
    cursor: pointer;
}

.authorisation-check input { margin-top: 3px; accent-color: var(--primary); }

.section-label {
    margin-bottom: 12px;
}

.section-label .cn {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}

.section-label .en {
    margin-top: 3px;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.35;
}

/* ===== Effect Selector ===== */
.effect-selector {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.effect-option {
    display: grid;
    grid-template-columns: 16px 1fr;
    gap: 8px;
    align-items: start;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.effect-option:hover {
    border-color: var(--primary);
}

.effect-option input {
    margin-top: 2px;
    accent-color: var(--primary);
}

.effect-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.effect-option .cn {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

.effect-option .en {
    margin-top: 2px;
    font-size: 0.76rem;
    line-height: 1.3;
    color: var(--muted);
}

/* ===== Dropzone ===== */
.dropzone {
    padding: 16px 14px;
    border: 1px dashed #9d9d9d;
    border-radius: var(--radius-md);
    background: #fff;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.dropzone:hover,
.dropzone.dragover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.dropzone-icon {
    font-size: 1.35rem;
    line-height: 1;
    margin-bottom: 8px;
}

.dropzone .cn {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text);
}

.dropzone .en {
    margin-top: 4px;
    font-size: 0.76rem;
    line-height: 1.35;
    color: var(--muted);
}

/* ===== File Info ===== */
.file-info {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.file-info.show {
    display: flex;
}

.file-icon {
    font-size: 1rem;
}

.file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 700;
}

.file-size {
    color: var(--muted);
    font-size: 0.74rem;
}

.btn-remove {
    border: none;
    background: transparent;
    color: var(--red);
    font-size: 1rem;
    cursor: pointer;
}

/* ===== Upload Button ===== */
.btn-upload {
    width: 100%;
    margin-top: 10px;
    padding: 11px 14px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.btn-upload:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-upload:disabled {
    background: #959595;
    cursor: not-allowed;
}

/* ===== Error Message ===== */
.error-message {
    display: none;
    margin-top: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1px solid #f1b7b7;
    background: #fff5f5;
    color: var(--red);
    font-size: 0.78rem;
    line-height: 1.45;
}

/* ===== Progress Overlay ===== */
.progress-overlay {
    display: none;
    margin-top: 10px;
    padding: 20px;
    text-align: center;
    border-radius: var(--radius-md);
    background: var(--soft);
}

.progress-overlay.show {
    display: block;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--line);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.progress-text {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
}

/* ===== Success Result ===== */
.success-result {
    display: none;
    margin-top: 10px;
}

.success-result.show {
    display: block;
}

.success-icon {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 6px;
}

.success-result h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--success);
    text-align: center;
    margin-bottom: 4px;
}

.result-info {
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 12px;
}

.download-area {
    text-align: center;
    padding: 16px;
    background: var(--success-light);
    border-radius: var(--radius-md);
}

.btn-download {
    display: inline-block;
    padding: 10px 28px;
    background: var(--success);
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.88rem;
    transition: background 0.2s ease, transform 0.15s ease;
}

.btn-download:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.download-hint {
    margin-top: 8px;
    font-size: 0.72rem;
    color: var(--muted);
}

/* ===== Search-friendly product FAQ ===== */
.marketing-faq {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--soft);
    color: var(--gray-700);
    line-height: 1.55;
}

.marketing-faq h2 {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 1.05rem;
}

.marketing-faq ol {
    margin: 0 0 12px;
    padding-left: 20px;
    font-size: 0.82rem;
}

.marketing-faq details {
    padding: 9px 0;
    border-top: 1px solid var(--line);
    font-size: 0.82rem;
}

.marketing-faq summary {
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.marketing-faq details p {
    margin: 7px 0 0;
}

/* ===== Ad Spacing ===== */
.ad-spacing-buffer {
    height: 48px;
}

.ad-spacing-buffer-large {
    height: 80px;
}

/* ===== Legal Warning ===== */
.legal-box {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.legal-title-cn {
    color: var(--red);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.35;
}

.legal-title-en {
    margin-top: 3px;
    color: var(--red);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.35;
}

.legal-text-cn,
.legal-text-en {
    line-height: 1.55;
}

.legal-text-cn {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text);
}

.legal-text-en {
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--muted);
}

/* ===== Ad Placeholder ===== */
.ad-placeholder {
    margin-top: 16px;
    padding: 16px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
    text-align: center;
    color: var(--muted);
    font-size: 0.76rem;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Footer ===== */
.site-footer {
    margin-top: 20px;
    padding: 20px 0 10px;
    border-top: 1px solid var(--line);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-col {
    text-align: left;
}

.footer-col h4 {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.footer-col a {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
    text-decoration: none;
    line-height: 2;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-privacy {
    font-size: 0.72rem;
    color: var(--muted);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.copyright {
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--muted);
}

/* ===== Result Page ===== */
.result-page {
    width: min(800px, 100%);
    margin: 0 auto;
    padding: 24px 0;
}

.result-page .panel {
    padding: 32px;
}

.result-page .success-icon-large {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 8px;
}

.result-page h1 {
    font-size: 1.5rem;
    color: var(--success);
    text-align: center;
    margin-bottom: 4px;
}

.result-page .success-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.result-file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.result-file-info .file-icon { font-size: 2rem; }
.result-filename { font-weight: 700; font-size: 1rem; }
.result-meta, .result-expiry { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.download-area-center { text-align: center; }

.btn-download-large {
    display: inline-block;
    padding: 14px 40px;
    background: var(--success);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.05rem;
    transition: all 0.2s;
}

.btn-download-large:hover { background: #15803d; transform: translateY(-1px); }

.download-hint-center {
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--muted);
}

.new-upload-area { text-align: center; margin-top: 20px; }

.btn-new-upload {
    display: inline-block;
    padding: 10px 28px;
    background: var(--soft);
    color: var(--muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.2s;
}

.btn-new-upload:hover { background: var(--line); }

/* ===== Admin Pages ===== */
.admin-body {
    background: var(--soft);
    padding: 0;
}

.admin-login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.admin-login-card {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.admin-login-card h1 { margin-bottom: 4px; }
.admin-subtitle { color: var(--muted); font-size: 0.85rem; margin-bottom: 24px; }

.admin-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.88rem;
}

.admin-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    font-size: 1rem;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

.admin-input:focus { outline: none; border-color: var(--primary); }

.btn-admin-login {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-admin-login:hover { background: var(--primary-dark); }

.admin-back {
    display: inline-block;
    margin-top: 16px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
}

.admin-panel { max-width: 900px; margin: 0 auto; padding: 32px 20px; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.admin-header h1 { font-size: 1.5rem; }

.btn-logout {
    color: var(--danger);
    text-decoration: none;
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 24px 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-icon { font-size: 2rem; margin-bottom: 8px; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

.admin-info {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.admin-info p { margin-bottom: 4px; }

.admin-actions { display: flex; gap: 16px; }

.btn-cleanup, .btn-back-home {
    padding: 10px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-cleanup { background: var(--warning); color: #fff; }
.btn-cleanup:hover { background: #d97706; }

.btn-back-home { background: var(--soft); color: var(--muted); }
.btn-back-home:hover { background: var(--line); }

.cleanup-result {
    margin-top: 24px;
    padding: 16px 20px;
    background: var(--success-light);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.cleanup-result ul { padding-left: 20px; margin-top: 8px; }

/* ===== Error Page ===== */
.error-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--soft);
    padding: 20px;
}

.error-container {
    text-align: center;
    padding: 40px;
    max-width: 500px;
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.error-icon-large { font-size: 4rem; margin-bottom: 16px; }
.error-container h1 { font-size: 1.5rem; margin-bottom: 16px; }
.error-message-zh { font-size: 1.05rem; margin-bottom: 8px; color: var(--gray-700); }
.error-message-en { font-size: 0.9rem; color: var(--gray-500); margin-bottom: 24px; }

.btn-back {
    display: inline-block;
    padding: 12px 32px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: background 0.2s;
}

.btn-back:hover { background: var(--primary-dark); }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    body {
        padding: 12px;
    }

    .page {
        min-height: auto;
    }

    .left-panel {
        overflow: visible;
    }

    .compare-frame {
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

@media (max-width: 640px) {
    .left-panel {
        padding: 16px;
    }

    .title-cn {
        font-size: 1.55rem;
    }

    .compare-header .cn {
        font-size: 1.2rem;
    }
}
