*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root {
    --bg: #080810;
    --surface: #0f0f1c;
    --surface-2: #151528;
    --surface-hover: #1a1a34;
    --border: #252542;
    --text: #e6e6f2;
    --text-dim: #7878a0;
    --accent: #00d4aa;
    --accent-light: #33e8c4;
    --accent-glow: rgba(0,212,170,0.15);
    --red: #ef4444;
    --red-glow: rgba(239,68,68,0.15);
    --orange: #f59e0b;
    --orange-glow: rgba(245,158,11,0.15);
    --green: #22c55e;
    --green-glow: rgba(34,197,94,0.15);
    --blue: #3b82f6;
    --radius: 14px;
    --radius-sm: 10px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(0,212,170,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 90%, rgba(59,130,246,0.04) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

/* Header */
header {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    background: rgba(8,8,16,0.85);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.back-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.2s;
}
.back-link:hover { color: var(--accent) }
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-icon { font-size: 1.7rem }
h1 {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00d4aa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}
.tagline {
    font-size: 0.76rem;
    color: var(--text-dim);
}

/* Main */
main {
    flex: 1;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 80px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Upload */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(0,212,170,0.03);
}
.upload-content svg { color: var(--text-dim); margin-bottom: 16px }
.upload-zone h2 { font-size: 1.25rem; margin-bottom: 8px }
.upload-zone p { color: var(--text-dim); font-size: 0.92rem }
.upload-formats { font-size: 0.78rem !important; opacity: 0.6; margin-top: 8px }
.upload-progress { padding: 16px 0 }
.progress-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-bottom: 12px }
.progress-fill { height: 100%; background: linear-gradient(90deg, #00d4aa, #3b82f6); border-radius: 3px; width: 0%; transition: width 0.3s }

/* Analyzing */
.analyzing-state {
    text-align: center;
    padding: 60px 20px;
}
.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg) } }
.analyzing-state p { color: var(--text-dim) }

/* Verdict */
.verdict-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.verdict-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.verdict-card.genuine { border-color: var(--green) }
.verdict-card.genuine::before { background: var(--green) }
.verdict-card.fake { border-color: var(--red) }
.verdict-card.fake::before { background: var(--red) }
.verdict-card.lossy { border-color: var(--orange) }
.verdict-card.lossy::before { background: var(--orange) }
.verdict-card.hq { border-color: var(--blue) }
.verdict-card.hq::before { background: var(--blue) }

.verdict-badge {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}
.genuine .verdict-badge { background: var(--green-glow); color: var(--green) }
.fake .verdict-badge { background: var(--red-glow); color: var(--red) }
.lossy .verdict-badge { background: var(--orange-glow); color: var(--orange) }
.hq .verdict-badge { background: rgba(59,130,246,0.15); color: var(--blue) }

.verdict-card h2 { font-size: 1.3rem; margin-bottom: 8px }
.verdict-card p { color: var(--text-dim); font-size: 0.92rem; max-width: 600px; margin: 0 auto; line-height: 1.6 }

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
}
.info-card h3 {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 12px;
    font-weight: 600;
}
.info-table {
    width: 100%;
    font-size: 0.88rem;
}
.info-table td {
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.info-table td:first-child {
    color: var(--text-dim);
    width: 45%;
}
.info-table td:last-child {
    font-weight: 500;
    text-align: right;
}

/* Chart */
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.chart-card h3 {
    font-size: 0.95rem;
    margin-bottom: 16px;
}
.chart-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    background: var(--bg);
    padding: 8px;
}
.chart-wrap canvas {
    width: 100%;
    height: 300px;
}
.chart-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-dim);
}
.legend-item { display: flex; align-items: center; gap: 6px }
.legend-dot {
    width: 10px; height: 10px;
    border-radius: 2px;
}
.dot-spectrum { background: var(--accent) }
.dot-cutoff { background: var(--red) }

/* Spectrogram */
.spectrogram-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.spectrogram-card h3 { font-size: 0.95rem; margin-bottom: 16px }
.spectrogram-wrap {
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}
.spectrogram-wrap img {
    width: 100%;
    display: block;
}

/* Action */
.action-bar { display: flex; justify-content: center }
.btn-new {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-new:hover { border-color: var(--accent); color: var(--accent) }

/* How it works */
.how-it-works {
    padding-top: 16px;
}
.how-it-works h2 {
    font-size: 1.15rem;
    margin-bottom: 20px;
    text-align: center;
}
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.step {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 24px 18px;
    text-align: center;
}
.step-icon { font-size: 1.8rem; margin-bottom: 10px }
.step h4 { font-size: 0.95rem; margin-bottom: 8px }
.step p { font-size: 0.82rem; color: var(--text-dim); line-height: 1.5 }

.bitrate-ref {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
}
.bitrate-ref h4 {
    font-size: 0.88rem;
    color: var(--text-dim);
    margin-bottom: 12px;
}
.ref-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.chip {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    background: rgba(255,255,255,0.04);
    color: var(--text-dim);
    border: 1px solid rgba(255,255,255,0.06);
}
.chip.good {
    background: var(--green-glow);
    color: var(--green);
    border-color: rgba(34,197,94,0.2);
}

/* Footer */
footer {
    text-align: center;
    padding: 24px;
    color: var(--text-dim);
    font-size: 0.82rem;
    border-top: 1px solid var(--border);
}
footer a { color: var(--accent); text-decoration: none }
footer a:hover { text-decoration: underline }

/* Responsive */
@media (max-width: 700px) {
    .info-grid { grid-template-columns: 1fr }
    .steps-grid { grid-template-columns: 1fr }
    .upload-zone { padding: 32px 16px }
    main { padding: 20px 16px 60px }
    .header-inner { flex-direction: column; gap: 6px }
    .verdict-card { padding: 24px 16px }
    .batch-item-meta { display: none }
    .batch-detail-grid { grid-template-columns: 1fr }
}

/* ===================== Batch Mode ===================== */
.batch-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.batch-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}
.batch-header h2 {
    font-size: 1.15rem;
}
.batch-progress-text {
    font-size: 0.85rem;
    color: var(--text-dim);
}
.batch-progress-bar {
    margin-bottom: 4px;
}

/* Batch item */
.batch-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.2s;
}
.batch-item:hover {
    border-color: rgba(255,255,255,0.12);
}
.batch-item.expanded {
    border-color: var(--accent);
}

.batch-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    gap: 12px;
    user-select: none;
}
.batch-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.batch-item-badge {
    font-size: 1rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}
.batch-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.batch-item-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}
.batch-item-status {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}
.batch-item-status.pending { color: var(--text-dim) }
.batch-item-status.genuine { color: var(--green) }
.batch-item-status.fake { color: var(--red) }
.batch-item-status.lossy { color: var(--orange) }
.batch-item-status.hq { color: var(--blue) }
.batch-item-status.error { color: var(--red) }

.batch-item-meta {
    font-size: 0.78rem;
    color: var(--text-dim);
    white-space: nowrap;
}

.batch-chevron {
    color: var(--text-dim);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.batch-item.expanded .batch-chevron {
    transform: rotate(180deg);
}

/* Batch details (expanded) */
.batch-item-details {
    border-top: 1px solid var(--border);
    padding: 0;
}
.batch-item-details[style*="block"] {
    padding: 18px;
}

.batch-detail-verdict {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.batch-detail-verdict.genuine { background: var(--green-glow); border-left: 3px solid var(--green) }
.batch-detail-verdict.fake { background: var(--red-glow); border-left: 3px solid var(--red) }
.batch-detail-verdict.lossy { background: var(--orange-glow); border-left: 3px solid var(--orange) }
.batch-detail-verdict.hq { background: rgba(59,130,246,0.1); border-left: 3px solid var(--blue) }
.batch-detail-verdict strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.95rem;
}
.batch-detail-verdict p {
    font-size: 0.84rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0;
}

.batch-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.batch-detail-card {
    background: var(--surface-2);
    border-radius: 8px;
    padding: 14px;
}
.batch-detail-card h4 {
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    font-weight: 600;
}
.batch-detail-card .info-table {
    font-size: 0.82rem;
}
.batch-detail-card .info-table td {
    padding: 3px 0;
}

.batch-detail-chart {
    background: var(--bg);
    border-radius: 8px;
    padding: 6px;
    margin-bottom: 12px;
}
.batch-spectrum-canvas {
    width: 100%;
    height: 200px;
}
.batch-detail-spectrogram {
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}
.batch-detail-spectrogram img {
    width: 100%;
    display: block;
}
