/* INFS2001 Exam Studio — Editorial High-Contrast Stylesheet */
:root {
    --bg-page: #F6F2EA;
    --bg-surface: #FFFDF8;
    --bg-subtle: #EDE7DA;
    --bg-rail: #161614;
    --bg-code: #1A1B1E;
    --ink-primary: #141413;
    --ink-secondary: #4D4B45;
    --ink-muted: #767268;
    --ink-rail: #EAE4D7;
    --ink-rail-muted: #9E988B;
    --border-hairline: #D8D0C0;
    --border-strong: #141413;
    --accent: #C4452B;
    --accent-hover: #A6361F;
    --emerald: #1D5A47;
    --emerald-bg: #E5F1EC;
    --ochre: #B8862B;
    --ochre-bg: #FBF3E1;
    --danger-bg: #FBE9E5;
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
    --radius-sm: 4px;
    --radius-md: 8px;
    --shadow-card: 0 1px 0 rgba(20, 20, 19, 0.08);
}

[data-theme="dark"] {
    --bg-page: #111214;
    --bg-surface: #181A1D;
    --bg-subtle: #22252A;
    --bg-rail: #0B0C0E;
    --bg-code: #0D0E10;
    --ink-primary: #ECE6DA;
    --ink-secondary: #B7B1A4;
    --ink-muted: #847F74;
    --border-hairline: #2B2F36;
    --border-strong: #59554C;
    --accent: #E06246;
    --accent-hover: #F07357;
    --emerald: #3CA07E;
    --emerald-bg: rgba(60, 160, 126, 0.14);
    --ochre: #D9A648;
    --ochre-bg: rgba(217, 166, 72, 0.14);
    --danger-bg: rgba(224, 98, 70, 0.15);
    --shadow-card: 0 1px 0 rgba(0, 0, 0, 0.45);
}

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

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-page);
    color: var(--ink-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    letter-spacing: -0.015em;
}

code, pre {
    font-family: var(--font-mono);
    font-size: 0.88em;
}

.hidden { display: none !important; }
.muted { color: var(--ink-muted); font-size: 0.88rem; }
.text-accent { color: var(--accent); }

/* Layout Shell */
.app-shell {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    min-height: 100vh;
}

.mobile-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--bg-rail);
    color: var(--ink-rail);
    border-bottom: 1px solid #2A2A26;
    position: sticky;
    top: 0;
    z-index: 40;
}

.brand-compact { display: flex; align-items: center; gap: 10px; }
.brand-code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 2px 7px;
    background: var(--accent);
    color: #fff;
    border-radius: 3px;
}
.brand-title { font-family: var(--font-display); font-weight: 700; }

/* Editorial Sidebar Rail */
.sidebar {
    background: var(--bg-rail);
    color: var(--ink-rail);
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid #262622;
}

.course-stamp {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.stamp-code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--accent);
    color: #FFFDF8;
    padding: 3px 8px;
    border-radius: 3px;
    letter-spacing: 0.06em;
}

.stamp-meta {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--ink-rail-muted);
    letter-spacing: 0.04em;
}

.site-heading {
    font-size: 1.55rem;
    color: #FFFDF8;
    margin-bottom: 8px;
}
.site-heading em { font-style: italic; color: #E2856E; }

.site-subtitle {
    font-size: 0.82rem;
    color: var(--ink-rail-muted);
    margin: 0;
    line-height: 1.45;
}

/* Rail Confidence Meter */
.rail-confidence {
    padding: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
}

.rail-conf-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: var(--font-mono);
    font-size: 0.73rem;
    color: var(--ink-rail-muted);
    margin-bottom: 8px;
}
.rail-conf-head strong { font-size: 1.05rem; color: #FFFDF8; }

.rail-bar-track {
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 99px;
    overflow: visible;
    margin-bottom: 8px;
}
.rail-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 99px;
    transition: width 0.35s ease, background 0.35s ease;
}
.rail-hurdle-mark {
    position: absolute;
    left: 40%;
    top: -3px;
    bottom: -3px;
    width: 2px;
    background: #FFFDF8;
}
.rail-conf-status {
    font-size: 0.78rem;
    color: var(--ink-rail-muted);
}

/* Navigation */
.nav-list { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--ink-rail-muted);
    border: 1px solid transparent;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.15s ease;
}
.nav-item:hover {
    color: #FFFDF8;
    background: rgba(255, 255, 255, 0.05);
}
.nav-item.active {
    color: #FFFDF8;
    background: rgba(196, 69, 43, 0.18);
    border-color: rgba(196, 69, 43, 0.55);
}
.nav-idx {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--accent);
    font-weight: 600;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: auto;
}
.dot-ok { background: #3CA07E; }
.dot-warn { background: #D9A648; }

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.sidebar .btn-outline {
    color: var(--ink-rail);
    border-color: rgba(255, 255, 255, 0.18);
    background: transparent;
}
.sidebar .btn-outline:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar .btn-danger-ghost {
    color: #E88673;
    border-color: rgba(224, 98, 70, 0.35);
    background: transparent;
}

/* Buttons */
button, .file-trigger {
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: #FFFDF8;
    border: 1px solid var(--accent);
    padding: 9px 16px;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
    background: var(--emerald);
    color: #FFFDF8;
    border: 1px solid var(--emerald);
    padding: 9px 16px;
}
.btn-secondary:hover { filter: brightness(1.08); }

.btn-outline {
    background: var(--bg-surface);
    color: var(--ink-primary);
    border: 1px solid var(--border-hairline);
    padding: 8px 14px;
}
.btn-outline:hover { border-color: var(--ink-primary); }

.btn-danger-ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border-hairline);
    padding: 8px 12px;
}
.btn-danger-ghost:hover { background: var(--danger-bg); border-color: var(--accent); }

.btn-ghost {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 12px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    padding: 2px 4px;
    font-size: 0.82rem;
    text-decoration: underline;
}

.btn-sm { padding: 6px 11px; font-size: 0.8rem; }

/* Workspace */
.workspace {
    padding: 32px 38px 64px;
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
}

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.2s ease; }

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

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 18px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-strong);
}

.eyebrow {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.09em;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 5px;
}

.view-header h2 { font-size: 2rem; }

.sprint-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
}
.sprint-pill .divider { color: var(--border-hairline); }

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-md);
    padding: 22px;
    box-shadow: var(--shadow-card);
}

.card-kicker {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
}

/* Dashboard Asymmetric Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.confidence-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-top: 4px solid var(--accent);
}

.conf-hero {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin: 4px 0 18px;
}

.conf-number {
    font-family: var(--font-display);
    font-size: 3.6rem;
    font-weight: 700;
    line-height: 1;
}

.conf-verdict {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    background: var(--bg-subtle);
}

.conf-meter-wrap { margin: 8px 0 26px; }
.conf-meter-track {
    position: relative;
    height: 14px;
    background: var(--bg-subtle);
    border-radius: 99px;
    border: 1px solid var(--border-hairline);
}
.conf-meter-fill {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: var(--accent);
    transition: width 0.4s ease, background 0.4s ease;
}

.meter-marker {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: var(--ink-primary);
}
.meter-marker span {
    position: absolute;
    top: 20px;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-muted);
}
.marker-40 { left: 40%; background: var(--accent); }
.marker-75 { left: 75%; background: var(--emerald); }

.conf-formula {
    font-size: 0.83rem;
    color: var(--ink-secondary);
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-hairline);
}

.kpi-stack { display: grid; grid-template-rows: repeat(3, 1fr); gap: 12px; }
.kpi-card { padding: 15px 18px; display: flex; flex-direction: column; justify-content: center; }
.kpi-val { font-family: var(--font-display); font-size: 1.65rem; font-weight: 700; line-height: 1.15; }
.kpi-sub { font-size: 0.82rem; color: var(--ink-muted); margin-top: 3px; }

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 28px 0 14px;
}
.section-head h3 { font-size: 1.3rem; }

/* 7-Day Sprint Grid */
.sprint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.sprint-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sprint-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.sprint-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.day-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--danger-bg);
    padding: 2px 8px;
    border-radius: 3px;
}
.sprint-card h4 { font-size: 1.05rem; }
.sprint-card p { margin: 0; font-size: 0.84rem; color: var(--ink-secondary); }
.mini-progress {
    height: 6px;
    background: var(--bg-subtle);
    border-radius: 99px;
    overflow: hidden;
    margin-top: auto;
}
.mini-progress > div { height: 100%; background: var(--emerald); transition: width 0.3s ease; }

/* Module Matrix */
.module-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.matrix-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-sm);
    padding: 13px 14px;
    cursor: pointer;
}
.matrix-item:hover { border-color: var(--ink-primary); }
.matrix-head {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-bottom: 5px;
}
.matrix-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; line-height: 1.3; }

/* Study Guide View */
.day-filter-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill {
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    color: var(--ink-secondary);
    border-radius: 4px;
    font-size: 0.8rem;
}
.filter-pill.active {
    background: var(--ink-primary);
    color: var(--bg-surface);
    border-color: var(--ink-primary);
}

.guide-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.module-toc {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: sticky;
    top: 20px;
}

.toc-btn {
    text-align: left;
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    color: var(--ink-primary);
}
.toc-btn.active {
    border-color: var(--accent);
    border-left: 4px solid var(--accent);
    background: var(--bg-surface);
}
.toc-meta {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-muted);
}
.toc-name { font-size: 0.9rem; font-weight: 600; }

.module-reader { padding: 28px 32px; }
.reader-header {
    border-bottom: 1px solid var(--border-hairline);
    padding-bottom: 18px;
    margin-bottom: 22px;
}
.reader-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.73rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 3px;
    background: var(--bg-subtle);
    color: var(--ink-primary);
}
.badge-ok { background: var(--emerald-bg); color: var(--emerald); }
.badge-warn { background: var(--ochre-bg); color: var(--ochre); }
.badge-accent { background: var(--danger-bg); color: var(--accent); }

.reader-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.checklist-box {
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin: 22px 0;
}
.checklist-box h4 { font-size: 1.05rem; margin-bottom: 12px; }
.check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 0;
    cursor: pointer;
    font-size: 0.92rem;
}
.check-item input[type="checkbox"] {
    margin-top: 4px;
    accent-color: var(--emerald);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.check-item.checked span {
    text-decoration: line-through;
    color: var(--ink-muted);
}

.notes-block h4 {
    font-size: 1.15rem;
    margin: 24px 0 10px;
    color: var(--ink-primary);
    border-bottom: 1px dashed var(--border-hairline);
    padding-bottom: 5px;
}
.notes-block p { margin: 0 0 12px; color: var(--ink-secondary); }
.notes-block ul { margin: 0 0 14px; padding-left: 20px; color: var(--ink-secondary); }
.notes-block li { margin-bottom: 6px; }
.notes-block pre {
    background: var(--bg-code);
    color: #EAE4D7;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 12px 0 16px;
    line-height: 1.5;
}
.notes-block table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0 18px;
    font-size: 0.88rem;
}
.notes-block th, .notes-block td {
    border: 1px solid var(--border-hairline);
    padding: 9px 11px;
    text-align: left;
}
.notes-block th { background: var(--bg-subtle); font-weight: 600; }

.exam-trap-box {
    border-left: 4px solid var(--accent);
    background: var(--danger-bg);
    padding: 13px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-top: 20px;
    font-size: 0.9rem;
}

/* SQL Query IDE */
.db-switcher { display: flex; flex-wrap: wrap; gap: 6px; }
.db-tab {
    padding: 8px 13px;
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    color: var(--ink-secondary);
}
.db-tab.active {
    background: var(--ink-primary);
    color: var(--bg-surface);
    border-color: var(--ink-primary);
}

.ide-layout {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.ide-sidebar { display: flex; flex-direction: column; gap: 16px; }
.ide-panel { padding: 16px; }
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.panel-head h4 { font-size: 1rem; }

.challenge-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 360px;
    overflow-y: auto;
}
.challenge-item {
    text-align: left;
    background: var(--bg-page);
    border: 1px solid var(--border-hairline);
    padding: 10px 11px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    color: var(--ink-primary);
}
.challenge-item.active {
    border-color: var(--accent);
    background: var(--bg-surface);
    box-shadow: inset 3px 0 0 var(--accent);
}
.challenge-item.passed { border-left: 3px solid var(--emerald); }
.ch-top {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-muted);
}
.ch-title { font-size: 0.85rem; font-weight: 600; }

.schema-tree { display: flex; flex-direction: column; gap: 10px; font-size: 0.82rem; }
.schema-table {
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.schema-table-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-subtle);
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-weight: 600;
}
.schema-cols { padding: 6px 10px; display: flex; flex-direction: column; gap: 3px; }
.schema-col {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.76rem;
}
.pk-pill {
    font-size: 0.65rem;
    background: var(--ochre-bg);
    color: var(--ochre);
    padding: 0 5px;
    border-radius: 3px;
    margin-left: 5px;
}

.ide-main { display: flex; flex-direction: column; gap: 16px; }
.task-banner { padding: 18px 20px; border-left: 4px solid var(--emerald); }
.task-banner h3 { font-size: 1.2rem; margin: 4px 0 8px; }
.task-banner p { margin: 0; color: var(--ink-secondary); }
.hint-box {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--ochre-bg);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.editor-card { padding: 0; overflow: hidden; }
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-hairline);
}
.mono-label { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.sql-textarea {
    width: 100%;
    min-height: 180px;
    padding: 16px;
    background: var(--bg-code);
    color: #F4EFE6;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.55;
    border: none;
    resize: vertical;
    outline: none;
    display: block;
}

.tsql-callout {
    padding: 10px 14px;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-hairline);
    font-size: 0.82rem;
    color: var(--ink-secondary);
}

.verify-banner {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.88rem;
    font-weight: 600;
}
.verify-pass { background: var(--emerald-bg); color: var(--emerald); border: 1px solid var(--emerald); }
.verify-fail { background: var(--danger-bg); color: var(--accent); border: 1px solid var(--accent); }

.table-scroll { overflow-x: auto; }
.result-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}
.result-table th, .result-table td {
    border: 1px solid var(--border-hairline);
    padding: 7px 10px;
    text-align: left;
    white-space: nowrap;
}
.result-table th { background: var(--bg-subtle); }
.null-val { color: var(--ink-muted); font-style: italic; }
.empty-state { color: var(--ink-muted); margin: 8px 0; font-size: 0.9rem; }

/* Tryouts & Mock Exam */
.mode-switch { display: flex; flex-wrap: wrap; gap: 8px; }
.tryout-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
    padding: 16px 20px;
}
.control-group { display: flex; align-items: center; gap: 8px; }
.control-group label { font-size: 0.84rem; font-weight: 600; color: var(--ink-secondary); }
select, input[type="password"] {
    background: var(--bg-page);
    color: var(--ink-primary);
    border: 1px solid var(--border-hairline);
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.86rem;
}
.control-stats { margin-left: auto; font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-secondary); }

.mock-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    border-left: 5px solid var(--accent);
}
.mock-right { display: flex; align-items: center; gap: 12px; }
.timer-display {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--bg-code);
    color: #FFFDF8;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
}

.quiz-stack { display: flex; flex-direction: column; gap: 16px; }
.quiz-card { padding: 20px 22px; }
.quiz-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.quiz-q { font-size: 1.02rem; font-weight: 600; margin: 0 0 14px; white-space: pre-line; }
.quiz-code {
    background: var(--bg-code);
    color: #EAE4D7;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 0 0 14px;
}

.options-list { display: flex; flex-direction: column; gap: 8px; }
.option-btn {
    justify-content: flex-start;
    text-align: left;
    background: var(--bg-page);
    color: var(--ink-primary);
    border: 1px solid var(--border-hairline);
    padding: 11px 14px;
    font-weight: 500;
    line-height: 1.45;
}
.option-btn:hover:not(:disabled) { border-color: var(--ink-primary); }
.option-btn.selected {
    border-color: var(--accent);
    background: var(--danger-bg);
}
.option-btn.correct {
    border-color: var(--emerald);
    background: var(--emerald-bg);
    color: var(--ink-primary);
}
.option-btn.wrong {
    border-color: var(--accent);
    background: var(--danger-bg);
}

.solution-box {
    margin-top: 14px;
    padding: 14px 16px;
    background: var(--bg-subtle);
    border-left: 3px solid var(--emerald);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.9rem;
}

/* AI Tutor */
.tutor-shell {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 190px);
    min-height: 540px;
    overflow: hidden;
}
.tutor-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-hairline);
}
.quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border-hairline);
    background: var(--bg-surface);
}
.chip {
    background: var(--bg-page);
    color: var(--ink-secondary);
    border: 1px solid var(--border-hairline);
    padding: 5px 11px;
    border-radius: 99px;
    font-size: 0.78rem;
    font-weight: 500;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.chat-feed {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.chat-msg {
    max-width: 86%;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-hairline);
}
.msg-ai { align-self: flex-start; background: var(--bg-page); }
.msg-user {
    align-self: flex-end;
    background: var(--ink-primary);
    color: var(--bg-surface);
    border-color: var(--ink-primary);
}
.msg-role {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    opacity: 0.7;
    margin-bottom: 6px;
    font-weight: 600;
}
.msg-body p { margin: 0 0 9px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body pre {
    background: var(--bg-code);
    color: #EAE4D7;
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 8px 0;
}
.msg-body ul, .msg-body ol { margin: 6px 0 10px; padding-left: 20px; }
.warn-note {
    background: var(--ochre-bg);
    color: var(--ink-primary);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
}

.chat-form {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--border-hairline);
    background: var(--bg-surface);
}
.chat-form textarea {
    flex: 1;
    background: var(--bg-page);
    color: var(--ink-primary);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    resize: none;
    outline: none;
}
.chat-form textarea:focus { border-color: var(--accent); }

/* Responsive */
@media (max-width: 1040px) {
    .app-shell { grid-template-columns: 1fr; }
    .mobile-bar { display: flex; }
    .sidebar {
        position: fixed;
        inset: 53px 0 0 0;
        height: calc(100vh - 53px);
        z-index: 35;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .workspace { padding: 22px 18px 48px; }
    .metrics-grid, .guide-layout, .ide-layout { grid-template-columns: 1fr; }
    .module-toc { position: static; flex-direction: row; overflow-x: auto; }
    .toc-btn { min-width: 210px; }
}
