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

:root {
    --blue: #007aff;
    --blue-hover: #0062cc;
    --red: #ff3b30;
    --green: #34c759;
    --orange: #ff9500;
    --bg: #ffffff;
    --bg-secondary: #f5f5f7;
    --text: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #aeaeb2;
    --border: #d2d2d7;
    --border-light: #e5e5ea;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ──────────────────────────────────────── */
.nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-light);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 100;
}
.nav-logo { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.nav-logo:hover { text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-quota { font-size: 0.85rem; color: var(--text-secondary); }
.nav-user { display: flex; align-items: center; gap: 8px; }
#nav-email { font-size: 0.85rem; color: var(--text-secondary); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px; border: none; border-radius: var(--radius);
    font-family: var(--font); font-size: 0.95rem; font-weight: 500;
    cursor: pointer; transition: all 0.15s ease;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); }
.btn-outline { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:hover:not(:disabled) { background: rgba(0,122,255,0.06); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-secondary); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ── Hero ─────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 80px 24px 40px;
    position: relative;
    overflow: hidden;
}
.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    background: var(--bg-secondary);
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}
.hero h1 {
    font-size: 3rem; font-weight: 700;
    letter-spacing: -0.03em; line-height: 1.15;
    margin-bottom: 16px;
    color: var(--text);
}
.hero-sub {
    font-size: 1.15rem; color: var(--text-secondary);
    max-width: 420px; margin: 0 auto 40px;
}
.hero-waveform {
    display: flex; align-items: flex-end; justify-content: center;
    gap: 4px; height: 80px; opacity: 0.5;
}
.wave-bar {
    width: 4px; border-radius: 2px;
    background: var(--blue);
    animation: wave 1s ease-in-out infinite alternate;
}
.w1  { height: 50%; animation-delay: 0.0s; }
.w2  { height: 60%; animation-delay: 0.1s; }
.w3  { height: 35%; animation-delay: 0.2s; }
.w4  { height: 80%; animation-delay: 0.3s; }
.w5  { height: 45%; animation-delay: 0.4s; }
.w6  { height: 70%; animation-delay: 0.5s; }
.w7  { height: 55%; animation-delay: 0.6s; }
.w8  { height: 90%; animation-delay: 0.7s; }
.w9  { height: 40%; animation-delay: 0.8s; }
.w10 { height: 65%; animation-delay: 0.9s; }
.w11 { height: 50%; animation-delay: 1.0s; }
.w12 { height: 75%; animation-delay: 1.1s; }
@keyframes wave {
    0% { transform: scaleY(0.6); }
    100% { transform: scaleY(1.4); }
}

/* ── Tool Section ─────────────────────────────── */
.tool-section { padding: 0 24px 60px; }
.tool-card {
    max-width: 580px; margin: 0 auto;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}

/* Tabs */
.tool-tabs {
    display: flex; gap: 8px; margin-bottom: 24px;
    background: var(--bg-secondary); border-radius: var(--radius);
    padding: 4px;
}
.tool-tab {
    flex: 1; padding: 10px 16px; border: none; border-radius: 8px;
    background: transparent; color: var(--text-secondary);
    font-family: var(--font); font-size: 0.9rem; font-weight: 500;
    cursor: pointer; transition: all 0.15s ease;
}
.tool-tab.active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }
.tool-tab:hover:not(.active) { color: var(--text); }

/* Panel */
.tool-panel { display: none; }
.tool-panel.active { display: block; }

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 16px;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--blue);
    background: rgba(0,122,255,0.03);
}
.upload-icon { font-size: 2.5rem; margin-bottom: 12px; }
.upload-text { font-size: 1rem; font-weight: 500; color: var(--text); margin-bottom: 8px; }
.upload-hint { font-size: 0.85rem; color: var(--text-tertiary); }

/* File preview */
.file-preview {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--bg-secondary);
    border-radius: var(--radius); margin-bottom: 16px;
}
.file-preview-name { font-size: 0.9rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-remove {
    background: none; border: none; font-size: 1.2rem;
    color: var(--text-tertiary); cursor: pointer; padding: 0 4px;
}
.file-preview-remove:hover { color: var(--red); }

/* URL input */
.url-input-wrap { margin-bottom: 16px; }
.url-input {
    width: 100%; padding: 14px 16px;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    font-family: var(--font); font-size: 0.95rem;
    outline: none; transition: border-color 0.15s;
}
.url-input:focus { border-color: var(--blue); }
.url-input::placeholder { color: var(--text-tertiary); }

/* Loading */
.tool-loading { text-align: center; padding: 24px 0; }
.loading-stage { font-size: 0.9rem; color: var(--text-secondary); margin-top: 16px; }

/* Gauge */
.gauge-ring { position: relative; width: 120px; height: 120px; margin: 0 auto; }
.gauge-ring svg { transform: rotate(-90deg); width: 120px; height: 120px; }
.gauge-bg { fill: none; stroke: var(--border-light); stroke-width: 8; }
.gauge-fg {
    fill: none; stroke: var(--blue); stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 327; /* 2*pi*52 ≈ 326.7 */
    stroke-dashoffset: 327;
    transition: stroke-dashoffset 0.5s ease;
}
.gauge-text {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    font-size: 1.6rem; font-weight: 700; color: var(--text);
}

/* Result */
.tool-result { text-align: center; padding: 24px 0; }
.result-verdict { font-size: 1.3rem; font-weight: 600; margin: 16px 0 8px; }
.result-meta { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 4px; }
.result-hint {
    font-size: 0.8rem; color: var(--text-tertiary);
    max-width: 360px; margin: 8px auto 20px;
}
.result-gauge { position: relative; width: 120px; height: 120px; margin: 0 auto; }
.result-gauge svg { transform: rotate(-90deg); width: 120px; height: 120px; }

/* Verdict colors */
.verdict-ai .gauge-fg { stroke: var(--orange); }
.verdict-human .gauge-fg { stroke: var(--green); }
.verdict-uncertain .gauge-fg { stroke: var(--text-tertiary); }
.verdict-ai .result-verdict { color: var(--orange); }
.verdict-human .result-verdict { color: var(--green); }
.verdict-uncertain .result-verdict { color: var(--text-secondary); }

/* Error */
.error-icon { font-size: 3rem; margin-bottom: 12px; }
.error-msg { font-size: 1rem; color: var(--red); margin-bottom: 20px; }

/* Rate limit */
.rate-limit-msg { font-size: 1.1rem; font-weight: 600; margin: 8px 0 4px; }
.rate-limit-hint { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 20px; }

/* ── History ─────────────────────────────────── */
.history-section {
    max-width: 580px; margin: 0 auto; padding: 0 24px 60px;
}
.history-section h2 {
    font-size: 1.3rem; font-weight: 600; margin-bottom: 16px; text-align: left;
}
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--bg-secondary);
    border-radius: var(--radius); gap: 12px;
}
.history-item-name {
    font-size: 0.9rem; color: var(--text); flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-item-pct {
    font-size: 0.9rem; font-weight: 600; white-space: nowrap;
}
.history-item-time { font-size: 0.8rem; color: var(--text-tertiary); white-space: nowrap; }
.history-empty { text-align: center; color: var(--text-tertiary); font-size: 0.9rem; padding: 24px 0; }

/* ── Pricing ──────────────────────────────────── */
.pricing-section, .faq-section {
    max-width: 960px; margin: 0 auto; padding: 60px 24px;
    text-align: center;
}
.pricing-section h2, .faq-section h2 {
    font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px;
}
.section-sub { color: var(--text-secondary); margin-bottom: 40px; }
.pricing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.pricing-card {
    background: var(--bg); border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); padding: 28px 20px;
    text-align: center; transition: box-shadow 0.2s;
}
.pricing-card:hover { box-shadow: var(--shadow); }
.pricing-tier { font-size: 0.95rem; font-weight: 600; margin-bottom: 12px; }
.pricing-price { font-size: 2rem; font-weight: 700; margin-bottom: 16px; }
.pricing-price span { font-size: 0.9rem; font-weight: 400; color: var(--text-secondary); }
.pricing-features { list-style: none; margin-bottom: 24px; }
.pricing-features li {
    padding: 6px 0; font-size: 0.88rem; color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}
.pricing-features li:last-child { border-bottom: none; }

/* ── FAQ ──────────────────────────────────────── */
.faq-list { max-width: 640px; margin: 0 auto; text-align: left; }
.faq-item {
    border-bottom: 1px solid var(--border-light);
}
.faq-item summary {
    padding: 18px 0; font-size: 1rem; font-weight: 500;
    cursor: pointer; list-style: none;
    display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: "+"; font-size: 1.2rem; color: var(--text-tertiary);
    transition: transform 0.2s;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item p {
    padding: 0 0 18px; font-size: 0.92rem;
    color: var(--text-secondary); line-height: 1.7;
}

/* ── Footer ───────────────────────────────────── */
.footer {
    text-align: center; padding: 40px 24px;
    border-top: 1px solid var(--border-light);
    color: var(--text-tertiary); font-size: 0.85rem;
}
.footer a { color: var(--text-secondary); }
.footer-disclaimer { margin-top: 8px; font-size: 0.8rem; }

/* ── Modal ────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 200; }
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal-card {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    background: var(--bg); border-radius: var(--radius-lg);
    padding: 40px 32px 32px; width: 380px; max-width: 90vw;
    box-shadow: var(--shadow);
}
.modal-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; font-size: 1.5rem;
    color: var(--text-tertiary); cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-card h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: 24px; text-align: center; }
.modal-card label { display: block; margin-bottom: 14px; font-size: 0.85rem; color: var(--text-secondary); }
.modal-card input {
    display: block; width: 100%; margin-top: 4px;
    padding: 12px 14px; border: 1.5px solid var(--border);
    border-radius: var(--radius); font-family: var(--font); font-size: 0.95rem;
    outline: none;
}
.modal-card input:focus { border-color: var(--blue); }
.form-error { color: var(--red); font-size: 0.85rem; margin-bottom: 14px; }
.form-switch { text-align: center; margin-top: 16px; font-size: 0.88rem; color: var(--text-secondary); }

/* Buy modal */
.buy-desc { text-align: center; color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 16px; }
.buy-wechat {
    text-align: center; padding: 14px; background: var(--bg-secondary);
    border-radius: var(--radius); font-size: 1rem; margin-bottom: 12px;
}
.buy-note { text-align: center; color: var(--text-tertiary); font-size: 0.82rem; margin-bottom: 20px; }

/* ── Toast ────────────────────────────────────── */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--text); color: #fff; padding: 12px 24px;
    border-radius: var(--radius); font-size: 0.9rem;
    z-index: 300; box-shadow: var(--shadow);
    transition: opacity 0.3s ease;
}

/* ── Utility ──────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .hero-sub { font-size: 0.92rem; }
    .pricing-grid { grid-template-columns: repeat(2, 1fr); }
    .tool-card { padding: 20px 16px; }
}
@media (max-width: 480px) {
    .pricing-grid { grid-template-columns: 1fr; }
    .nav { padding: 10px 16px; }
    .hero { padding: 40px 16px 24px; }
}
