/**
 * Lossless Audio Checker (LAC) - Main Stylesheet
 * 遵从现代 H5 规范与深色科技风设计系统
 */

/* ==========================================================================
   1. 设计变量与基础重置 (Variables & Reset)
   ========================================================================== */
:root {
    --bg-color: #0b0f17;
    --panel-bg: #141b26;
    --panel-card: #1c2433;
    --panel-hover: #242e42;
    --text-main: #f0f6fc;
    --text-muted: #8b949e;
    --text-dim: #6e7681;
    --border: #303a4b;
    --accent: #388bfd;
    --accent-glow: rgba(56, 139, 253, 0.25);
    --real-color: #3fb950;
    --real-glow: rgba(63, 185, 80, 0.2);
    --warn-color: #d29922;
    --warn-glow: rgba(210, 153, 34, 0.2);
    --fake-color: #f85149;
    --fake-glow: rgba(248, 81, 73, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1040px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   2. 页面头部与标题 (Header & Subtitle)
   ========================================================================== */
header {
    margin-bottom: 24px;
    text-align: center;
}

h1 {
    margin: 0 0 8px 0;
    font-size: 24px;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 14px 0;
}

.badges {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-family: ui-monospace, monospace;
}

/* ==========================================================================
   3. 拖拽上传区域 (Dropzone)
   ========================================================================== */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.015);
    margin-bottom: 20px;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: translateY(-1px);
}

.dropzone-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.dropzone-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.dropzone-desc {
    font-size: 13px;
    color: var(--text-muted);
}

#fileInput {
    display: none;
}

/* ==========================================================================
   4. 进度条指示器 (Progress Bar)
   ========================================================================== */
.progress-wrapper {
    display: none;
    margin-bottom: 24px;
    background: var(--panel-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #388bfd, #58a6ff);
    transition: width 0.1s ease;
}

/* ==========================================================================
   5. 分析结果区域与核心卡片 (Result Section & Verdict)
   ========================================================================== */
.result-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.verdict-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    background: var(--panel-card);
}

.verdict-card.real {
    border-color: var(--real-color);
    background: linear-gradient(135deg, var(--panel-card) 60%, var(--real-glow));
}

.verdict-card.warn {
    border-color: var(--warn-color);
    background: linear-gradient(135deg, var(--panel-card) 60%, var(--warn-glow));
}

.verdict-card.fake {
    border-color: var(--fake-color);
    background: linear-gradient(135deg, var(--panel-card) 60%, var(--fake-glow));
}

.verdict-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.verdict-score-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    font-family: ui-monospace, monospace;
    border: 3px solid;
    flex-shrink: 0;
}

.verdict-card.real .verdict-score-ring {
    border-color: var(--real-color);
    color: var(--real-color);
    box-shadow: 0 0 12px var(--real-glow);
}

.verdict-card.warn .verdict-score-ring {
    border-color: var(--warn-color);
    color: var(--warn-color);
    box-shadow: 0 0 12px var(--warn-glow);
}

.verdict-card.fake .verdict-score-ring {
    border-color: var(--fake-color);
    color: var(--fake-color);
    box-shadow: 0 0 12px var(--fake-glow);
}

.verdict-score-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: -2px;
}

.verdict-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.verdict-summary {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.verdict-actions {
    display: flex;
    gap: 10px;
}

.btn {
    background: var(--panel-hover);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    border-color: var(--accent);
    background: rgba(56, 139, 253, 0.15);
}

/* ==========================================================================
   6. 4 维核心指标网格 (Metrics Grid)
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.metric-card {
    background: var(--panel-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
}

.metric-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

.metric-value {
    font-size: 17px;
    font-weight: 700;
    font-family: ui-monospace, monospace;
    margin-bottom: 4px;
}

.metric-sub {
    font-size: 11px;
    color: var(--text-dim);
}

.panel-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   7. 文件基础信息与声学取证面板 (File Info & Forensics Panel)
   ========================================================================== */
.file-info-forensics-panel {
    background: var(--panel-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 22px;
    margin-bottom: 22px;
}

.forensics-panel {
    margin-top: 22px;
}

.forensics-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.forensics-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.forensics-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.forensics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 860px) {
    .forensics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 540px) {
    .forensics-grid {
        grid-template-columns: 1fr;
    }
}

.forensics-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: 0.15s;
    min-height: 76px;
    box-sizing: border-box;
}

.forensics-item:hover {
    border-color: rgba(56, 139, 253, 0.4);
    background: rgba(56, 139, 253, 0.03);
}

.forensics-item.full-width {
    grid-column: 1 / -1;
    background: rgba(56, 139, 253, 0.06);
    border-color: rgba(56, 139, 253, 0.35);
}

.forensics-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.forensics-label {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    font-weight: 700;
    color: #79c0ff;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.forensics-label-en {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: normal;
    font-family: ui-monospace, monospace;
}

.forensics-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
    letter-spacing: 0.3px;
}

.forensics-val {
    font-size: 17px;
    font-weight: 700;
    font-family: ui-monospace, monospace;
    color: var(--text-main);
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forensics-desc {
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.4;
}

/* 诊断解读面板 */
.diagnosis-box {
    background: rgba(0, 0, 0, 0.25);
    border-left: 3px solid var(--accent);
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 20px;
    color: var(--text-main);
}

.diagnosis-box strong {
    color: #79c0ff;
}

/* ==========================================================================
   8. 频谱分析模块与声学 HUD 探针 (Spectrogram & HUD)
   ========================================================================== */
.spectrogram-section {
    background: var(--panel-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 22px;
    margin-bottom: 22px;
}

/* 声学瞬态 HUD 仪表面板 */
.acoustic-hud {
    background: var(--panel-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    min-height: 156px;
    box-sizing: border-box;
}

.hud-main {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    flex-shrink: 0;
}

@media (max-width: 680px) {
    .hud-main {
        grid-template-columns: 1fr;
    }
}

.hud-stat {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
}

.hud-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 4px;
}

.hud-val {
    font-size: 20px;
    font-weight: 700;
    font-family: ui-monospace, monospace;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-sub {
    font-size: 11px;
    color: var(--text-dim);
    display: block;
    margin-top: 4px;
}

.hud-color-pill {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.2);
}

.hud-analysis {
    background: rgba(56, 139, 253, 0.08);
    border-left: 3px solid var(--accent);
    padding: 8px 14px;
    border-radius: 0 6px 6px 0;
    height: 62px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.hud-analysis-title {
    font-weight: 600;
    color: #79c0ff;
    margin-bottom: 3px;
    font-size: 12px;
    line-height: 1.2;
    flex-shrink: 0;
}

.hud-analysis-body {
    color: var(--text-main);
    font-size: 12px;
    line-height: 1.45;
    height: 35px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 声谱图 Canvas 画布堆栈 */
.spectrogram-wrapper {
    position: relative;
    background: #000;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    user-select: none;
}

.canvas-stack {
    position: relative;
    width: 100%;
    height: 480px;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#spectrogramOverlay {
    cursor: crosshair;
}

.spectrogram-legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #070a10;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 8px;
}

.legend-tags {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.legend-tag {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* 浮动信息框 Tooltip */
.hover-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(13, 17, 23, 0.95);
    border: 1px solid var(--accent);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-family: ui-monospace, monospace;
    color: #fff;
    display: none;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.85);
    white-space: nowrap;
    line-height: 1.5;
}

/* ==========================================================================
   9. 深度解读与名词指南 (Guide Panel)
   ========================================================================== */
.guide-panel {
    background: var(--panel-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 22px;
    margin-top: 22px;
}

.guide-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.guide-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    font-size: 13px;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .guide-grid {
        grid-template-columns: 1fr;
    }
}

.guide-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
}

.guide-box h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #79c0ff;
}

.color-sample-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    font-size: 12px;
}

.color-dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.15);
}
