/* ============================================================
   我不是考神 · 期末复习助手 —— 现代玻璃拟态设计系统
   ============================================================ */

:root {
    --bg: #0f0f1a;
    --bg-elevated: rgba(255, 255, 255, 0.045);
    --bg-card: rgba(255, 255, 255, 0.055);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-glass: rgba(20, 20, 35, 0.72);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b8;
    --text-muted: #6e6e8a;
    --accent: #7c3aed;
    --accent-secondary: #06b6d4;
    --accent-tertiary: #f59e0b;
    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    --accent-gradient-soft: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(6, 182, 212, 0.2) 100%);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
    --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.18);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
}

[data-theme="light"] {
    --bg: #f4f6fb;
    --bg-elevated: rgba(255, 255, 255, 0.8);
    --bg-card: rgba(255, 255, 255, 0.72);
    --bg-card-hover: rgba(255, 255, 255, 0.92);
    --bg-glass: rgba(255, 255, 255, 0.82);
    --border: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.1);
    --text-primary: #1e1e2e;
    --text-secondary: #4a4a5e;
    --text-muted: #7a7a92;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.12);
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* 动态背景光晕 */
body::before,
body::after {
    content: "";
    position: fixed;
    width: 60vmax;
    height: 60vmax;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    z-index: -1;
    pointer-events: none;
    animation: float 20s ease-in-out infinite;
}

body::before {
    background: radial-gradient(circle, rgba(124, 58, 237, 0.5), transparent 60%);
    top: -20vmax;
    left: -20vmax;
}

body::after {
    background: radial-gradient(circle, rgba(6, 182, 212, 0.45), transparent 60%);
    bottom: -20vmax;
    right: -20vmax;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* 玻璃容器 */
#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* 顶部导航 */
#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 26px;
    margin-bottom: 24px;
    position: sticky;
    top: 16px;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--accent-gradient);
    display: grid;
    place-items: center;
    font-size: 22px;
    box-shadow: var(--shadow-glow);
}

.brand h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 按钮系统 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--accent-gradient-soft);
    border: 1px solid rgba(124, 58, 237, 0.25);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
}

.btn-ghost:hover {
    border-color: var(--border-strong);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* 首页英雄区 */
.hero {
    text-align: center;
    padding: 50px 20px 40px;
    margin-bottom: 30px;
}

.hero h2 {
    font-size: 42px;
    font-weight: 800;
    margin: 0 0 14px;
    letter-spacing: -1px;
    line-height: 1.2;
}

.hero h2 span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 28px;
}

/* 输入卡片网格 */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.input-card {
    padding: 22px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.input-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-glow);
}

.input-card .card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 24px;
    margin-bottom: 14px;
}

.input-card.ppt .card-icon { background: rgba(245, 158, 11, 0.15); }
.input-card.audio .card-icon { background: rgba(6, 182, 212, 0.15); }
.input-card.notes .card-icon { background: rgba(124, 58, 237, 0.15); }

.input-card h3 {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 700;
}

.input-card p {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.file-drop {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-elevated);
}

.file-drop:hover, .file-drop.dragover {
    border-color: var(--accent);
    background: var(--accent-gradient-soft);
    color: var(--text-primary);
}

.file-drop input { display: none; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 12px;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.status-pill.active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

/* 录音控制 */
.audio-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.rec-visualizer {
    height: 60px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    padding: 10px;
    overflow: hidden;
}

.rec-bar {
    width: 5px;
    border-radius: 3px;
    background: var(--accent-gradient);
    transition: height 0.1s ease;
    height: 8px;
}

.timer {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 10px;
}

/* 文本域 */
textarea, input[type="text"], select {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

textarea:focus, input[type="text"]:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

textarea::placeholder, input::placeholder {
    color: var(--text-muted);
}

/* 功能网格 */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.feature-card {
    padding: 18px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.feature-card .icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 20px;
    margin: 0 auto 12px;
    background: var(--accent-gradient-soft);
}

.feature-card h4 {
    margin: 0 0 6px;
    font-size: 15px;
}

.feature-card p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

/* 进度步骤 */
.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 28px;
    position: relative;
}

.progress-steps::before {
    content: "";
    position: absolute;
    top: 14px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
    flex: 1;
}

.step-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--border-strong);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    transition: var(--transition);
}

.step.active .step-dot {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.step.done .step-dot {
    background: var(--success);
    border-color: transparent;
    color: #fff;
}

.step-label {
    font-size: 12px;
    color: var(--text-muted);
}

.step.active .step-label {
    color: var(--text-primary);
    font-weight: 600;
}

/* 加载骨架屏 */
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card-hover) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 结果页标签 */
.tabs {
    display: flex;
    gap: 8px;
    padding: 6px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.tab:hover:not(.active) {
    color: var(--text-secondary);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Markdown 内容区 */
.md-content {
    font-size: 15px;
    line-height: 1.85;
    color: var(--text-primary);
}

.md-content h1 {
    font-size: 26px;
    font-weight: 800;
    margin: 32px 0 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.md-content h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 28px 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.md-content h2::before {
    content: "";
    width: 5px;
    height: 22px;
    border-radius: 3px;
    background: var(--accent-gradient);
}

.md-content h3 {
    font-size: 17px;
    font-weight: 700;
    margin: 22px 0 10px;
    color: var(--text-secondary);
}

.md-content p {
    margin: 12px 0;
}

.md-content ul, .md-content ol {
    padding-left: 24px;
    margin: 10px 0;
}

.md-content li {
    margin: 6px 0;
}

.md-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    font-size: 14px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.md-content th, .md-content td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}

.md-content th {
    background: var(--bg-elevated);
    font-weight: 700;
}

.md-content tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

.md-content blockquote {
    margin: 16px 0;
    padding: 14px 18px;
    border-left: 4px solid var(--accent);
    background: var(--bg-elevated);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

.md-content pre {
    background: #0d0d15;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
}

.md-content code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--bg-elevated);
    padding: 2px 7px;
    border-radius: 5px;
    color: var(--accent-secondary);
}

.md-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* 闪卡 */
/* 闪卡 */
.flashcard {
    perspective: 1000px;
    height: 240px;
    cursor: pointer;
    margin-bottom: 16px;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow-y: auto;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: var(--accent-gradient-soft);
}

.flashcard-hint {
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.flashcard-front p, .flashcard-back p {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    word-break: break-word;
}

.flashcard-tags {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.flashcard-tags .tag {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* 自测题 */
.quiz-panel {
    padding: 22px;
}

.quiz-setup {
    margin-bottom: 18px;
}

.quiz-setup-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
}

.quiz-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.quiz-field input, .quiz-field select {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    min-width: 160px;
}

.quiz-field input { min-width: 240px; }

.quiz-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.quiz-state-error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px dashed rgba(239, 68, 68, 0.35);
    border-radius: var(--radius-sm);
}

.quiz-state-error h4 { margin: 12px 0 6px; color: var(--danger); }

.quiz-error-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 14px;
}

.quiz-raw {
    text-align: left;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-top: 14px;
    max-height: 260px;
    overflow: auto;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

.quiz-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin: 18px 0;
    padding: 14px 18px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.quiz-progress {
    flex: 1;
    min-width: 220px;
}

.quiz-progress span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.quiz-score-bar {
    height: 6px;
    background: var(--bg-card);
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.quiz-score-fill {
    height: 100%;
    width: 0%;
    transition: width .4s ease;
    border-radius: 4px;
    background: var(--text-muted);
}

.quiz-score-fill.high { background: var(--success); }
.quiz-score-fill.mid { background: var(--warning); }
.quiz-score-fill.low { background: var(--danger); }

.quiz-card {
    padding: 22px;
    margin-bottom: 18px;
    border-left: 4px solid var(--accent);
    transition: var(--transition);
}

.quiz-card.graded { border-left-color: var(--success); }

.quiz-head {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.quiz-type {
    background: var(--accent-gradient-soft);
    color: var(--text-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 12px;
}

.quiz-num { font-weight: 600; }

.quiz-question {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 14px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 16px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg-elevated);
    border: 1px solid transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.quiz-option:hover { border-color: var(--accent); background: var(--bg-card-hover); }
.quiz-option.selected { border-color: var(--accent); background: var(--accent-gradient-soft); }

.quiz-opt-label {
    flex: 0 0 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 700;
}

.quiz-opt-text { flex: 1; line-height: 1.4; }

.quiz-answer-box { margin-bottom: 12px; }

.quiz-answer-text {
    width: 100%;
    min-height: 80px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    resize: vertical;
}

.quiz-actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quiz-reveal {
    margin-top: 14px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px dashed var(--border-strong);
}

.quiz-reveal-inner strong { color: var(--text-secondary); }

.quiz-analysis { margin-top: 8px; color: var(--text-secondary); }

.grade-result { margin-top: 14px; }

.grade-pending {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
}

.grade-result-box {
    padding: 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border-left: 4px solid var(--accent);
}

.grade-result-box.high { border-left-color: var(--success); background: rgba(34, 197, 94, 0.08); }
.grade-result-box.mid { border-left-color: var(--warning); background: rgba(245, 158, 11, 0.08); }
.grade-result-box.low { border-left-color: var(--danger); background: rgba(239, 68, 68, 0.08); }

.grade-score {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: 800;
    color: #fff;
    font-size: 14px;
}

.score-badge.high { background: var(--success); }
.score-badge.mid { background: var(--warning); }
.score-badge.low { background: var(--danger); }

.grade-label { font-weight: 700; color: var(--text-primary); }

.grade-feedback { color: var(--text-secondary); margin-top: 6px; }

.grade-suggestion {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

/* 关键词卡片 */
.keyword-cloud {
    padding: 6px;
}

.keyword-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.keyword-card {
    padding: 18px 18px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.keyword-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    background: var(--bg-card-hover);
}

.keyword-title {
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.keyword-def {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 复习计划重点高亮 */
.plan-emphasis {
    font-weight: 800;
    color: var(--accent);
    background: var(--accent-gradient-soft);
    padding: 0 4px;
    border-radius: 4px;
}

/* 聊天 */
#chat-box {
    max-height: 360px;
    overflow-y: auto;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    margin-bottom: 12px;
}

.message {
    display: flex;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
}

.message.user {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 78%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
}

.message.user .message-bubble {
    background: var(--accent-gradient);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

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

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 0;
}

/* Toast */
#toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
    box-shadow: var(--shadow);
    display: none;
    align-items: center;
    gap: 10px;
    max-width: 420px;
    animation: slideIn 0.3s ease;
}

#toast.show { display: flex; }
#toast.error { border-left: 4px solid var(--danger); }
#toast.success { border-left: 4px solid var(--success); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 响应式 */
@media (max-width: 768px) {
    #app { padding: 14px; }
    .hero h2 { font-size: 28px; }
    .input-grid { grid-template-columns: 1fr; }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
    #header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .progress-steps { display: none; }
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 打印 */
@media print {
    body { background: #fff !important; color: #000 !important; }
    body::before, body::after { display: none !important; }
    .glass { box-shadow: none !important; border-color: #ddd !important; }
    .tabs, .toolbar, #header, #toast { display: none !important; }
}

/* ============================================================
   多标签并发任务状态组件
   ============================================================ */

.tab-status {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.tab-status.running { display: flex; }
.tab-status.done { display: flex; border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.08); color: var(--success); }
.tab-status.error { display: flex; border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.08); color: var(--danger); }

.status-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

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

.status-step {
    flex: 1;
}

.status-model {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 20px;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 42px;
    margin-bottom: 12px;
    opacity: 0.7;
}

/* 已完成结果的轻量提示条 */
.result-done-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    font-size: 13px;
    color: var(--success);
}

.result-done-bar .model {
    color: var(--text-muted);
    font-size: 12px;
}

/* 标签页小圆点状态 */
.tab .tab-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    margin-left: 6px;
    display: inline-block;
    opacity: 0.5;
    transition: var(--transition);
}

.tab.active .tab-dot.running { background: var(--accent-secondary); opacity: 1; box-shadow: 0 0 8px var(--accent-secondary); }
.tab.active .tab-dot.done { background: var(--success); opacity: 1; }
.tab.active .tab-dot.error { background: var(--danger); opacity: 1; }
.tab .tab-dot.done { background: var(--success); opacity: 1; }
.tab .tab-dot.error { background: var(--danger); opacity: 1; }

/* 修复按钮组 */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.toolbar input, .toolbar select {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 14px;
    outline: none;
}

.toolbar input:focus, .toolbar select:focus {
    border-color: var(--accent-secondary);
}

/* 多文件列表 */
.file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.file-chip {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-chip.ok { border-color: rgba(46, 204, 113, .5); color: var(--text-primary); }
.file-chip.err { border-color: rgba(231, 76, 60, .5); color: #e74c3c; }

/* 设置抽屉 */
.drawer-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 199;
    display: none;
}
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    max-width: 86vw;
    padding: 100px 22px 22px;
    z-index: 200;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform .25s ease;
    border-left: 1px solid var(--border);
    border-radius: 0 0 0 var(--radius);
    display: none;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.drawer-head h3 { margin: 0; font-size: 18px; }
.drawer-tip { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-secondary); margin-bottom: 14px; }
.field select {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    outline: none;
}
.field select:focus { border-color: var(--accent-secondary); }

/* 资料提问框 */
.material-qa { margin-top: 20px; }
.qa-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 4px;
}
.qa-message { display: flex; }
.qa-message.user { justify-content: flex-end; }
.qa-message.assistant { justify-content: flex-start; }
.qa-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}
.qa-message.user .qa-bubble {
    background: var(--accent-secondary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.qa-message.assistant .qa-bubble {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.qa-bubble p { margin: 0 0 8px; }
.qa-bubble p:last-child { margin-bottom: 0; }
.qa-bubble pre { white-space: pre-wrap; }

/* ============ 备案信息 footer（公安备案告知书第五条） ============ */
.site-footer {
    margin-top: 40px;
    padding: 18px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    text-align: center;
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 18px;
    max-width: 1100px;
    margin: 0 auto;
    font-size: 12.5px;
    color: var(--text-secondary);
}
.footer-inner a {
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px dashed var(--text-secondary);
    padding-bottom: 1px;
}
.footer-inner a:hover {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}
.gongan-beian {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============ 全局字体缩小 & 紧凑排版（2026-07-14 优化） ============ */
body { font-size: 14px; }
.brand h1 { font-size: 18px; }
.brand p { font-size: 11px; }
.hero { padding: 38px 18px 28px; }
.hero h2 { font-size: 32px; }
.hero p { font-size: 15px; margin-bottom: 20px; }
.input-card { padding: 18px; }
.input-card .card-icon { width: 42px; height: 42px; font-size: 21px; margin-bottom: 10px; }
.input-card h3 { font-size: 15px; }
.input-card p { font-size: 12px; margin-bottom: 12px; }
.feature-card { padding: 15px; }
.feature-card .icon { width: 40px; height: 40px; font-size: 18px; }
.feature-card h4 { font-size: 14px; }
.feature-card p { font-size: 11px; }
.md-content { font-size: 14px; line-height: 1.7; }
.md-content h1 { font-size: 22px; margin: 22px 0 12px; }
.md-content h2 { font-size: 17px; margin: 20px 0 10px; }
.md-content h2::before { height: 18px; }
.md-content h3 { font-size: 15px; margin: 16px 0 8px; }
.md-content p { margin: 8px 0; }
.md-content table { font-size: 13px; }
.md-content pre { font-size: 12px; padding: 12px; }
.quiz-question { font-size: 15px; }
.quiz-option { font-size: 13px; padding: 10px 12px; }
.flashcard-front p, .flashcard-back p { font-size: 16px; }
.timer { font-size: 16px; }

/* ============ 结果页双栏布局：右侧索引框 ============ */
#result-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 20px;
    align-items: start;
}
#result-main { min-width: 0; }
#right-index {
    position: sticky;
    top: 86px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding: 18px;
    border-radius: var(--radius);
}
#right-index h4 { margin: 0 0 12px; font-size: 14px; color: var(--text-secondary); }
#right-index ul { list-style: none; padding: 0; margin: 0; }
#right-index li { margin: 0; }
#right-index a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}
#right-index a:hover, #right-index a.active {
    background: var(--accent-gradient-soft);
    color: var(--text-primary);
}
@media (max-width: 900px) {
    #result-layout { grid-template-columns: 1fr; }
    #right-index { display: none; }
}

/* ============ 浮动材料提问框 ============ */
#material-qa-floating {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: min(960px, calc(100vw - 28px));
    max-width: 960px;
    z-index: 150;
    padding: 14px 16px;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.18);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
#material-qa-floating.minimized {
    width: auto;
    transform: none;
    left: auto;
    right: 18px;
    bottom: 18px;
    padding: 10px 16px;
    cursor: pointer;
}
#material-qa-floating.minimized .qa-minimized-only { display: flex; }
#material-qa-floating.minimized .qa-expanded { display: none !important; }
.qa-minimized-only { display: none; align-items: center; gap: 8px; font-size: 14px; color: var(--text-primary); }
.qa-expanded { display: block; }
.qa-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.qa-head h4 { margin: 0; font-size: 14px; }
.qa-head .qa-actions { display: flex; gap: 6px; }
.qa-head .qa-actions button {
    background: transparent; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.qa-head .qa-actions button:hover { background: var(--bg-elevated); color: var(--text-primary); }
.qa-source-row {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    margin-bottom: 10px; font-size: 12px; color: var(--text-muted);
}
.qa-source-chip {
    padding: 4px 10px; border-radius: 20px; background: var(--bg-elevated); border: 1px solid var(--border);
    cursor: pointer; color: var(--text-secondary); transition: var(--transition); font-size: 12px;
}
.qa-source-chip:hover, .qa-source-chip.active { border-color: var(--accent); background: var(--accent-gradient-soft); color: var(--text-primary); }
.qa-source-chip.all { font-weight: 700; }
.qa-input-row { display: flex; gap: 8px; }
.qa-input-row input { flex: 1; padding: 10px 12px; font-size: 14px; }

/* ============ 回答气泡绿色（助手回答） ============ */
.qa-message.assistant .qa-bubble {
    background: rgba(34, 197, 94, 0.12) !important;
    border: 1px solid rgba(34, 197, 94, 0.25) !important;
    color: var(--text-primary) !important;
}

/* ============ 选择题去掉输入框 ============ */
.quiz-card[data-type="选择题"] .quiz-answer-box,
.quiz-card[data-type="选择"] .quiz-answer-box,
.quiz-card[data-type="单选题"] .quiz-answer-box,
.quiz-card[data-type="多选题"] .quiz-answer-box { display: none; }
.quiz-card[data-type="选择题"] .quiz-grade-btn,
.quiz-card[data-type="选择"] .quiz-grade-btn,
.quiz-card[data-type="单选题"] .quiz-grade-btn,
.quiz-card[data-type="多选题"] .quiz-grade-btn { display: none; }
.quiz-card[data-type="选择题"] .quiz-option.selected { background: rgba(34, 197, 94, 0.15); border-color: var(--success); }

/* ============ 词云图容器 ============ */
#wordcloud-canvas { width: 100%; height: 360px; display: block; margin: 0 auto; }
#keywords-cloud { position: relative; min-height: 360px; }
.wordcloud-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

/* ============ 导出下拉 ============ */
.export-dropdown { position: relative; display: inline-block; }
.export-menu {
    display: none; position: absolute; right: 0; top: 100%; margin-top: 6px;
    background: var(--bg-glass); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow); min-width: 150px; z-index: 50; overflow: hidden;
}
.export-menu.show { display: block; }
.export-menu button {
    width: 100%; text-align: left; padding: 10px 14px; border: none; background: transparent;
    color: var(--text-primary); font-size: 14px; cursor: pointer; transition: var(--transition);
}
.export-menu button:hover { background: var(--bg-elevated); }

/* ============ 录音列表 / 文件列表 ============ */
.upload-list {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.upload-chip {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; padding: 5px 10px; border-radius: 999px;
    background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary);
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.upload-chip.ok { border-color: rgba(34, 197, 94, 0.5); }
.upload-chip .del { cursor: pointer; color: var(--text-muted); font-weight: 700; }
.upload-chip .del:hover { color: var(--danger); }

/* ============ 录音暂停按钮 ============ */
#pause-btn { display: none; }
#pause-btn.visible { display: inline-flex; }

/* ============ 职业规划自测页 ============ */
.career-section { max-width: 860px; margin: 0 auto; }
.career-question { padding: 18px; margin-bottom: 14px; border-left: 4px solid var(--accent-secondary); }
.career-option {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; margin: 6px 0;
    border-radius: 10px; background: var(--bg-elevated); border: 1px solid transparent;
    color: var(--text-primary); cursor: pointer; font-size: 14px; transition: var(--transition);
}
.career-option:hover, .career-option.selected { border-color: var(--accent); background: var(--accent-gradient-soft); }
.career-progress { margin: 18px 0; }
.career-progress-bar { height: 6px; background: var(--bg-card); border-radius: 4px; overflow: hidden; }
.career-progress-fill { height: 100%; background: var(--accent-gradient); width: 0%; transition: width .3s; }
.career-result { padding: 22px; margin-top: 18px; }
.career-result h3 { margin: 0 0 10px; font-size: 18px; }
.service-card { padding: 14px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--border); margin-bottom: 10px; }
.service-card strong { color: var(--accent-secondary); }

/* ============ 字体适度缩小（用户反馈原字号偏大） ============ */
.md-content { font-size: 14.5px; line-height: 1.72; }
.md-content h1 { font-size: 22px; }
.md-content h2 { font-size: 19px; }
.md-content h3 { font-size: 16.5px; }
.quiz-question { font-size: 15px; line-height: 1.6; }
.quiz-option { font-size: 14px; }
.quiz-reveal { font-size: 14px; }
.qa-bubble { font-size: 14px; line-height: 1.65; }
.keyword-title { font-size: 18px !important; }
.summary-content, #summary-content, #plan-content { font-size: 14.5px; line-height: 1.72; }
.card-front p, .card-back p { font-size: 14.5px; }
.service-card { font-size: 14px; }

