:root {
    --ink: #0f172a;
    --ink-light: #334155;
    --ink-muted: #64748b;
    --gold: #d4a853;
    --gold-light: #e8cc8c;
    --gold-bg: rgba(212, 168, 83, 0.08);
    --ivory: #faf8f5;
    --ivory-dark: #f0ede6;
    --paper: #ffffff;
    --paper-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --paper-shadow-hover: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
    --paper-shadow-elevated: 0 8px 24px rgba(15, 23, 42, 0.1), 0 4px 8px rgba(15, 23, 42, 0.06);
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --info: #2563eb;
    --info-bg: #eff6ff;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --font-display: "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
    --font-body: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --ink: #e2e8f0;
    --ink-light: #cbd5e1;
    --ink-muted: #94a3b8;
    --ivory: #0f172a;
    --ivory-dark: #1e293b;
    --paper: #1e293b;
    --paper-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    --paper-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.3);
    --paper-shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.4);
    --success-bg: #052e16;
    --danger-bg: #450a0a;
    --warning-bg: #451a03;
    --info-bg: #172554;
    --gold-bg: rgba(212, 168, 83, 0.12);
}

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

body {
    font-family: var(--font-body);
    background: var(--ivory);
    color: var(--ink);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold); color: var(--ivory); }

.navbar {
    background: #0f172a;
    color: white;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid var(--gold);
}

[data-theme="dark"] .navbar { background: #0c1222; }

.nav-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}

.logo {
    color: white;
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-wrap: wrap;
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: white; }
.nav-link-logout { color: rgba(255, 255, 255, 0.5); }

.nav-user {
    color: var(--gold-light);
    font-size: 0.82rem;
    margin-right: 0.4rem;
    font-weight: 500;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 1.5rem; }

main.container { padding-top: 2rem; padding-bottom: 3rem; }

h1 {
    font-family: var(--font-display);
    font-size: 1.65rem;
    color: var(--ink);
    margin-bottom: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--ink-light);
    margin-bottom: 1rem;
    font-weight: 600;
}

.card {
    background: var(--paper);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--paper-shadow);
    border: 1px solid rgba(15, 23, 42, 0.04);
    transition: var(--transition);
    animation: cardIn 0.4s ease-out both;
}

[data-theme="dark"] .card { border-color: rgba(255, 255, 255, 0.06); }

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

.form-group { margin-bottom: 1.1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--ink-light);
    font-size: 0.88rem;
    letter-spacing: 0.01em;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1.5px solid var(--ivory-dark);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: var(--font-body);
    transition: var(--transition);
    background: var(--paper);
    color: var(--ink);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group select {
    border-color: rgba(255, 255, 255, 0.1);
    background: var(--ivory-dark);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-bg);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-row-2col { grid-template-columns: 1fr 1fr; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    background: var(--ink);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn:hover { background: var(--ink-light); transform: translateY(-1px); box-shadow: var(--paper-shadow-hover); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--gold); color: var(--ink); font-weight: 600; }
.btn-primary:hover { background: var(--gold-light); }

.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--ivory-dark); }
[data-theme="dark"] .btn-outline { border-color: rgba(255, 255, 255, 0.15); color: var(--ink-light); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-bg); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-block { display: flex; width: 100%; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--paper);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1rem;
    text-align: center;
    box-shadow: var(--paper-shadow);
    border: 1px solid rgba(15, 23, 42, 0.04);
    transition: var(--transition);
}

[data-theme="dark"] .stat-card { border-color: rgba(255, 255, 255, 0.06); }
.stat-card:hover { box-shadow: var(--paper-shadow-hover); transform: translateY(-2px); }

.stat-number { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.stat-label { color: var(--ink-muted); font-size: 0.82rem; margin-top: 0.3rem; letter-spacing: 0.02em; }
.stat-correct .stat-number { color: var(--success); }
.stat-wrong .stat-number { color: var(--danger); }

.badge { display: inline-flex; align-items: center; padding: 0.15rem 0.55rem; border-radius: 20px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; }
.badge-subject { background: var(--info-bg); color: var(--info); }
.badge-chapter { background: var(--ivory-dark); color: var(--ink-muted); }
.badge-semester { background: #ecfdf5; color: #047857; }
.badge-custom { background: #faf5ff; color: #7c3aed; }
.badge-correct, .badge-success { background: var(--success-bg); color: var(--success); }
.badge-wrong { background: var(--danger-bg); color: var(--danger); }
.badge-diff-1 { background: var(--success-bg); color: var(--success); }
.badge-diff-2 { background: var(--warning-bg); color: var(--warning); }
.badge-diff-3 { background: var(--danger-bg); color: var(--danger); }
.badge-type-choice { background: var(--info-bg); color: var(--info); }
.badge-type-multi_choice { background: #faf5ff; color: #7c3aed; }
.badge-type-fill { background: var(--warning-bg); color: var(--warning); }
.badge-type-judge { background: var(--danger-bg); color: var(--danger); }

.auth-card {
    max-width: 440px;
    margin: 3rem auto;
    background: var(--paper);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    box-shadow: var(--paper-shadow-elevated);
    border: 1px solid rgba(15, 23, 42, 0.04);
}

[data-theme="dark"] .auth-card { border-color: rgba(255, 255, 255, 0.06); }
.auth-card h1 { font-family: var(--font-display); text-align: center; margin-bottom: 1.8rem; font-size: 1.5rem; }
.auth-switch { text-align: center; margin-top: 1.5rem; color: var(--ink-muted); font-size: 0.88rem; }
.auth-switch a { color: var(--gold); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.88rem; border: 1px solid transparent; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: rgba(220, 38, 38, 0.15); }
.alert-success { background: var(--success-bg); color: var(--success); border-color: rgba(22, 163, 74, 0.15); }
.alert-weak { border: 2px solid var(--warning); background: var(--warning-bg); }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.88rem; }
.data-table th { background: var(--ivory-dark); padding: 0.75rem 0.8rem; text-align: left; font-weight: 600; color: var(--ink-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 2px solid rgba(15, 23, 42, 0.06); }
.data-table td { padding: 0.75rem 0.8rem; border-bottom: 1px solid rgba(15, 23, 42, 0.04); color: var(--ink-light); }
[data-theme="dark"] .data-table th { background: var(--ivory-dark); border-bottom-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .data-table td { border-bottom-color: rgba(255, 255, 255, 0.04); }
.data-table tr:hover td { background: var(--gold-bg); }

.hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.hero h1 { font-family: var(--font-display); font-size: 2.4rem; color: var(--ink); margin-bottom: 0.6rem; font-weight: 700; }
.hero-sub { color: var(--ink-muted); font-size: 1.05rem; line-height: 1.6; }
.welcome-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.8rem; }
.subject-card { display: block; background: var(--paper); border: 1.5px solid rgba(15, 23, 42, 0.06); border-radius: var(--radius-lg); padding: 1.1rem 0.8rem; text-align: center; text-decoration: none; color: var(--ink); transition: var(--transition); box-shadow: var(--paper-shadow); }
.subject-card:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: var(--paper-shadow-hover); }
.subject-name { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.subject-count { color: var(--ink-muted); font-size: 0.78rem; margin-top: 0.3rem; }

.question-card { border-left: 4px solid var(--gold); }
.question-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.8rem; }
.question-number { font-weight: 600; color: var(--ink); font-size: 0.9rem; }
.question-content { font-size: 1.02rem; margin-bottom: 1rem; line-height: 1.8; white-space: pre-wrap; }
.question-content .katex { font-size: 1.1em; }
.question-content .katex-display { margin: 0.8rem 0; overflow-x: auto; }
.question-image { margin-bottom: 0.8rem; text-align: center; }
.question-image img { max-width: 100%; max-height: 300px; border-radius: var(--radius); border: 1px solid rgba(15, 23, 42, 0.06); }

.options-group { display: flex; flex-direction: column; gap: 0.6rem; }
.option-label { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.75rem 1rem; border: 1.5px solid rgba(15, 23, 42, 0.08); border-radius: var(--radius); cursor: pointer; transition: var(--transition); }
.option-label:hover { border-color: var(--gold); background: var(--gold-bg); }
.option-label input[type="radio"] { margin-top: 0.25rem; accent-color: var(--gold); }
.option-label input[type="radio"]:checked + .option-text { color: var(--gold); font-weight: 500; }
.option-label:has(input:checked) { border-color: var(--gold); background: var(--gold-bg); }
.option-text { font-size: 0.95rem; }

.submit-bar { position: sticky; bottom: 0; background: var(--paper); padding: 1rem 1.5rem; border-radius: var(--radius-lg); box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.08); display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.submit-info { color: var(--ink-muted); font-size: 0.88rem; }

.result-card { border-left: 4px solid var(--ink-muted); }
.result-correct { border-left-color: var(--success); }
.result-wrong { border-left-color: var(--danger); }
.result-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.result-detail { margin-top: 0.8rem; display: flex; gap: 1.5rem; font-size: 0.9rem; }
.correct-answer { color: var(--success); }
.result-explanation { margin-top: 0.8rem; padding: 0.9rem 1rem; background: var(--gold-bg); border-radius: var(--radius); font-size: 0.9rem; color: var(--ink-light); line-height: 1.7; border-left: 3px solid var(--gold); }

.question-list { display: flex; flex-direction: column; gap: 0.8rem; }
.question-item { padding: 1rem 0; border-bottom: 1px solid rgba(15, 23, 42, 0.04); }
.question-item:last-child { border-bottom: none; }
.question-meta { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; }
.question-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }
.question-answer { color: var(--success); font-size: 0.85rem; font-weight: 500; }

.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.filter-group { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.record-item { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 0; border-bottom: 1px solid rgba(15, 23, 42, 0.04); }
.record-item:last-child { border-bottom: none; }
.record-correct { border-left: 3px solid var(--success); padding-left: 0.8rem; }
.record-wrong { border-left: 3px solid var(--danger); padding-left: 0.8rem; }
.record-info { display: flex; align-items: center; gap: 0.5rem; }
.record-content { font-size: 0.9rem; color: var(--ink-light); }
.record-result { display: flex; align-items: center; gap: 0.8rem; }
.record-result small { color: var(--ink-muted); }

.role-select { display: flex; gap: 1rem; }

.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.feature-item { text-align: center; padding: 1.3rem 0.8rem; border-radius: var(--radius-lg); background: var(--gold-bg); }
.feature-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.feature-title { font-family: var(--font-display); font-weight: 600; color: var(--ink); margin-bottom: 0.3rem; }
.feature-desc { color: var(--ink-muted); font-size: 0.85rem; }

.empty { color: var(--ink-muted); text-align: center; padding: 2.5rem 0; font-size: 0.95rem; }

.fill-input { width: 100%; padding: 0.7rem 1rem; border: 2px dashed rgba(15, 23, 42, 0.12); border-radius: var(--radius); font-size: 1rem; font-family: var(--font-body); transition: var(--transition); background: var(--paper); color: var(--ink); }
.fill-input:focus { outline: none; border-color: var(--gold); border-style: solid; box-shadow: 0 0 0 3px var(--gold-bg); }

.mistake-card { border-left: 4px solid var(--danger); }
.mistake-mastered { border-left-color: var(--success); opacity: 0.75; }
.mistake-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.mistake-detail { display: flex; gap: 1.5rem; margin-top: 0.5rem; font-size: 0.9rem; }
.wrong-answer { color: var(--danger); }
.mistake-time { margin-top: 0.5rem; color: var(--ink-muted); }

.weak-section { margin-top: 1rem; }
.weak-section h3 { font-size: 0.95rem; color: var(--warning); margin-bottom: 0.5rem; }
.weak-list { display: flex; flex-direction: column; gap: 0.5rem; }
.weak-item { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1rem; background: var(--paper); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: var(--transition); border: 1px solid rgba(15, 23, 42, 0.06); }
.weak-item:hover { border-color: var(--gold); transform: translateX(4px); }
.weak-name { flex: 1; font-weight: 500; }
.weak-accuracy { color: var(--danger); font-weight: bold; font-size: 1.1rem; }
.weak-action { color: var(--gold); font-size: 0.85rem; }

.bar-chart { display: flex; flex-direction: column; gap: 0.8rem; }
.bar-row { display: flex; align-items: center; gap: 0.8rem; }
.bar-label { width: 80px; text-align: right; font-size: 0.88rem; color: var(--ink-muted); flex-shrink: 0; }
.bar-track { flex: 1; height: 24px; background: var(--ivory-dark); border-radius: 12px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 12px; transition: width 0.5s ease; min-width: 2px; }
.bar-good { background: linear-gradient(90deg, var(--success), #22c55e); }
.bar-warning { background: linear-gradient(90deg, var(--warning), #f59e0b); }
.bar-danger { background: linear-gradient(90deg, var(--danger), #ef4444); }
.bar-value { width: 50px; text-align: right; font-weight: bold; font-size: 0.88rem; color: var(--ink); }
.bar-detail { width: 50px; text-align: right; font-size: 0.8rem; color: var(--ink-muted); }

.stats-row-4 { grid-template-columns: repeat(4, 1fr); }
.filter-divider { color: rgba(15, 23, 42, 0.12); margin: 0 0.3rem; }
.accuracy-badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 10px; font-size: 0.8rem; font-weight: 600; }

.multi-hint { color: #7c3aed; font-size: 0.85rem; margin-bottom: 0.5rem; font-weight: 500; }
.multi-answer-group { display: flex; gap: 1rem; flex-wrap: wrap; }
.multi-answer-label { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem; border: 2px solid rgba(15, 23, 42, 0.08); border-radius: var(--radius); cursor: pointer; font-weight: 500; transition: var(--transition); }
.multi-answer-label:has(input:checked) { border-color: #7c3aed; background: #faf5ff; color: #7c3aed; }
.multi-answer-label input { accent-color: #7c3aed; }

.btn-group { display: flex; gap: 0.5rem; }
.file-input { padding: 0.8rem; border: 2px dashed rgba(15, 23, 42, 0.12); border-radius: var(--radius); width: 100%; background: var(--ivory-dark); cursor: pointer; transition: var(--transition); }
.file-input:hover { border-color: var(--gold); }
.format-example { background: var(--ink); color: var(--gold-light); padding: 1rem 1.2rem; border-radius: var(--radius); font-family: var(--font-mono); font-size: 0.82rem; overflow-x: auto; line-height: 1.5; white-space: pre; }
.format-hint { color: var(--ink-muted); font-size: 0.85rem; margin-bottom: 0.5rem; }

.trend-chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding: 0.5rem 0; overflow-x: auto; }
.trend-day { display: flex; flex-direction: column; align-items: center; min-width: 36px; flex: 1; }
.trend-bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.trend-bar { width: 100%; max-width: 28px; background: linear-gradient(180deg, var(--gold), var(--gold-light)); border-radius: 4px 4px 0 0; min-height: 4px; }
.trend-label { font-size: 0.7rem; color: var(--ink-muted); margin-top: 4px; }
.trend-count { font-size: 0.7rem; color: var(--gold); font-weight: 600; }

.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; }
.action-card { display: flex; flex-direction: column; align-items: center; padding: 1.1rem 0.5rem; background: var(--gold-bg); border-radius: var(--radius-lg); text-decoration: none; color: var(--ink); transition: var(--transition); position: relative; border: 1px solid transparent; }
.action-card:hover { background: var(--paper); border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--paper-shadow-hover); }
.action-icon { font-size: 1.8rem; margin-bottom: 0.3rem; }
.action-text { font-size: 0.85rem; font-weight: 500; }
.action-badge { position: absolute; top: 4px; right: 8px; background: var(--danger); color: white; font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 8px; font-weight: 600; }

.breadcrumb { display: flex; align-items: center; gap: 0.3rem; margin-bottom: 1.2rem; font-size: 0.88rem; flex-wrap: wrap; }
.breadcrumb-item { color: var(--gold); text-decoration: none; padding: 0.2rem 0.4rem; border-radius: var(--radius-sm); transition: var(--transition); }
.breadcrumb-item:hover { background: var(--gold-bg); }
.breadcrumb-item.active { color: var(--ink); font-weight: 600; cursor: default; }
.breadcrumb-item.active:hover { background: transparent; }
.breadcrumb-sep { color: var(--ink-muted); font-size: 1rem; }

.semester-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.8rem; }
.semester-card { display: block; background: var(--paper); border: 1.5px solid rgba(15, 23, 42, 0.06); border-radius: var(--radius-lg); padding: 1rem 0.8rem; text-align: center; text-decoration: none; color: var(--ink); transition: var(--transition); box-shadow: var(--paper-shadow); }
.semester-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--paper-shadow-hover); }
.semester-name { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; }
.semester-count { color: var(--ink-muted); font-size: 0.8rem; margin-top: 0.3rem; }

.chapter-list { display: flex; flex-direction: column; gap: 0.5rem; }
.chapter-item { display: flex; align-items: center; gap: 1rem; padding: 0.85rem 1rem; background: var(--paper); border: 1.5px solid rgba(15, 23, 42, 0.06); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: var(--transition); }
.chapter-item:hover { border-color: var(--gold); background: var(--gold-bg); transform: translateX(4px); }
.chapter-name { flex: 1; font-weight: 500; }
.chapter-count { color: var(--ink-muted); font-size: 0.85rem; }
.chapter-action { color: var(--gold); font-size: 0.85rem; font-weight: 500; }

.question-preview-list { display: flex; flex-direction: column; gap: 0.5rem; }
.question-preview-item { padding: 0.7rem 1rem; background: var(--ivory-dark); border-radius: var(--radius-sm); border-left: 3px solid var(--gold); }
.question-preview-meta { display: flex; gap: 0.4rem; margin-bottom: 0.3rem; }
.question-preview-content { font-size: 0.9rem; color: var(--ink-light); line-height: 1.5; }

.section-title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; color: var(--ink-light); margin-bottom: 0.8rem; padding-bottom: 0.4rem; border-bottom: 1px dashed rgba(15, 23, 42, 0.1); }
.custom-fields-section { margin-top: 1rem; padding-top: 1rem; border-top: 2px solid var(--ivory-dark); }
.inline-input { padding: 0.3rem 0.5rem; border: 1px solid rgba(15, 23, 42, 0.1); border-radius: var(--radius-sm); font-size: 0.85rem; width: 100%; max-width: 200px; font-family: var(--font-body); }
.inline-select { padding: 0.3rem 0.5rem; border: 1px solid rgba(15, 23, 42, 0.1); border-radius: var(--radius-sm); font-size: 0.85rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.3rem; cursor: pointer; font-size: 0.9rem; }
.hint { color: var(--ink-muted); font-size: 0.85rem; margin-bottom: 0.8rem; }
code { background: var(--ivory-dark); padding: 0.1rem 0.4rem; border-radius: 3px; font-family: var(--font-mono); font-size: 0.85rem; color: var(--danger); }

.achievement-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.achievement-item { text-align: center; padding: 1rem 0.5rem; background: var(--gold-bg); border-radius: var(--radius-lg); }
.achievement-icon { font-size: 1.6rem; margin-bottom: 0.3rem; }
.achievement-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: bold; color: var(--ink); }
.achievement-label { color: var(--ink-muted); font-size: 0.8rem; margin-top: 0.2rem; }
.achievement-progress-track { height: 6px; background: var(--ivory-dark); border-radius: 3px; margin-top: 0.5rem; overflow: hidden; }
.achievement-progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 3px; transition: width 0.4s ease; }

.accuracy-up { color: var(--success); }
.accuracy-down { color: var(--danger); }
.accuracy-flat { color: var(--ink-muted); }

.badge-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(15, 23, 42, 0.06); }
.badge-section-title { font-size: 0.9rem; font-weight: 600; color: var(--ink-light); margin-bottom: 0.6rem; }
.badge-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chapter-badge { display: inline-block; padding: 0.3rem 0.7rem; background: linear-gradient(135deg, var(--success-bg), #dcfce7); color: var(--success); border-radius: 14px; font-size: 0.8rem; font-weight: 500; }

[data-theme="dark"] .chapter-badge { background: #052e16; color: #4ade80; }
[data-theme="dark"] .achievement-item { background: rgba(212, 168, 83, 0.08); }
[data-theme="dark"] .feature-item { background: rgba(212, 168, 83, 0.08); }
[data-theme="dark"] .action-card { background: rgba(212, 168, 83, 0.08); }
[data-theme="dark"] .action-card:hover { background: var(--paper); }
[data-theme="dark"] .subject-card, [data-theme="dark"] .semester-card { background: var(--paper); border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .chapter-item { background: var(--paper); border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .chapter-item:hover { background: var(--gold-bg); }
[data-theme="dark"] .question-preview-item { background: var(--ivory-dark); border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .weak-item { background: var(--paper); border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .result-explanation { background: rgba(212, 168, 83, 0.08); }
[data-theme="dark"] .format-example { background: #0c1222; }
[data-theme="dark"] .hero h1 { color: var(--ink); }

#feedback-widget { position: fixed; bottom: 20px; right: 20px; z-index: 1000; }
#feedback-toggle { background: var(--gold); color: var(--ink); border: none; padding: 0.6rem 1.2rem; border-radius: 20px; cursor: pointer; font-size: 0.85rem; font-weight: 600; font-family: var(--font-body); box-shadow: 0 2px 8px rgba(212, 168, 83, 0.3); transition: var(--transition); }
#feedback-toggle:hover { background: var(--gold-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(212, 168, 83, 0.4); }
#feedback-form-wrap { position: absolute; bottom: 50px; right: 0; width: 300px; background: var(--paper); border: 1px solid rgba(15, 23, 42, 0.08); border-radius: var(--radius-lg); padding: 1rem; box-shadow: var(--paper-shadow-elevated); }
#feedback-form textarea { width: 100%; padding: 0.6rem; border: 1.5px solid rgba(15, 23, 42, 0.1); border-radius: var(--radius); font-size: 0.85rem; resize: vertical; margin-bottom: 0.5rem; box-sizing: border-box; font-family: var(--font-body); background: var(--paper); color: var(--ink); }
#feedback-form button[type="submit"] { width: 100%; padding: 0.5rem; background: var(--gold); color: var(--ink); border: none; border-radius: var(--radius); cursor: pointer; font-size: 0.85rem; font-weight: 600; font-family: var(--font-body); transition: var(--transition); }
#feedback-form button[type="submit"]:hover { background: var(--gold-light); }
#feedback-success { text-align: center; color: var(--success); font-weight: 500; margin: 0; padding: 0.5rem 0; }
[data-theme="dark"] #feedback-form-wrap { border-color: rgba(255, 255, 255, 0.08); }

.theme-toggle { background: none; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.theme-toggle:hover { background: rgba(255, 255, 255, 0.08); transform: rotate(15deg); }

@media (max-width: 600px) {
    .stats-row { grid-template-columns: repeat(3, 1fr); }
    .stats-row-4 { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .form-row-2col { grid-template-columns: 1fr; }
    .feature-grid { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .nav-links { gap: 0.15rem; }
    .nav-link { padding: 0.25rem 0.4rem; font-size: 0.78rem; }
    .bar-label { width: 50px; font-size: 0.8rem; }
    .btn-group { flex-wrap: wrap; }
    .filter-group { margin-bottom: 0.5rem; }
    .flex-between { flex-direction: column; align-items: flex-start; }
    .option-label { padding: 0.8rem; min-height: 44px; }
    .submit-bar { padding: 0.8rem; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.3rem; }
    .semester-grid { grid-template-columns: repeat(2, 1fr); }
    .chapter-item { padding: 0.7rem; }
    .achievement-grid { grid-template-columns: 1fr; }
    .auth-card { margin: 1.5rem auto; padding: 1.5rem; }
}
