:root {
    --bg: #121214;
    --surface: #0e0e11;
    --surface-2: #19191c;
    --surface-3: #202024;
    --border: rgba(255,236,230,0.08);
    --border-strong: rgba(255,236,230,0.12);
    --text: #eceae8;
    --muted: rgba(236,234,232,0.58);
    --dim: rgba(236,234,232,0.36);
    --accent: #ec4899;
    --accent-light: #f472b6;
    --accent-soft: rgba(236,72,153,0.12);
    --ok: #4ade80;
    --ok-soft: rgba(74,222,128,0.10);
    --error: #f87171;
    --error-soft: rgba(248,113,113,0.10);
    --warn: #fbbf24;
    --chat-w: clamp(300px, 27vw, 380px);
    --curriculum-w: 280px;
    --drawer-w: 280px;
    --font: 'Plus Jakarta Sans', system-ui, sans-serif;
    --serif: 'Newsreader', Georgia, serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --shadow: 0 12px 40px rgba(6,4,8,0.48);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

.curriculum-list,
.canvas-column,
.chat-messages,
.drawer-list {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.curriculum-list::-webkit-scrollbar,
.canvas-column::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.drawer-list::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}
.curriculum-column,
.canvas-column,
.chat-column {
    position: relative;
}
.curriculum-column::after,
.canvas-column::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 42px;
    pointer-events: none;
    background: linear-gradient(transparent, var(--surface));
}

.hidden { display: none !important; }

/* —— Gate screens —— */
.gate-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(ellipse 80% 48% at 50% -8%, rgba(236,72,153,0.06), transparent 58%), var(--bg);
}
.gate-card {
    max-width: 440px;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px 28px;
    text-align: center;
}
.gate-card h1 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.75rem;
    margin: 0 0 8px;
}
.gate-card p { color: var(--muted); line-height: 1.55; margin: 0 0 20px; font-size: 0.92rem; }
.gate-card .btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

/* —— Shell —— */
#academy-app {
    display: grid;
    grid-template-rows: 52px 1fr;
    height: 100vh;
}

.academy-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(14,14,17,0.94);
    backdrop-filter: blur(10px);
    z-index: 20;
}
.hamburger {
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.academy-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--dim);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.academy-brand img { width: 96px; height: auto; display: block; }
.academy-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--dim);
}
.academy-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
}
.academy-close-btn:hover { color: var(--text); border-color: var(--accent); }
.curriculum-toggle {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}
.curriculum-toggle:hover { color: var(--text); border-color: var(--border-strong); }
body.academy-popup { overscroll-behavior: none; }
.credits-pill {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-light);
    border: 1px solid rgba(236,72,153,0.28);
    font-weight: 600;
}
.progress-pill {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
}

/* —— Main split —— */
.academy-main {
    display: flex;
    min-height: 0;
    position: relative;
}

/* Drawer — only visible when hamburger open */
.workspace-drawer {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: var(--drawer-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    display: flex;
    flex-direction: column;
}
.workspace-drawer.open { transform: translateX(0); }
.drawer-head {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 0.85rem; font-weight: 600; }
.drawer-head p { margin: 4px 0 0; font-size: 0.72rem; color: var(--dim); }
.drawer-list { flex: 1; overflow-y: auto; padding: 8px; }
.drawer-item {
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid transparent;
    margin-bottom: 4px;
}
.drawer-item:hover { background: rgba(255,255,255,0.04); }
.drawer-item.active { background: var(--accent-soft); border-color: rgba(201,109,132,0.25); }
.drawer-item-main {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    cursor: pointer;
}
.drawer-item .title { font-size: 0.82rem; font-weight: 500; }
.drawer-item .sub { font-size: 0.68rem; color: var(--dim); margin-top: 4px; }
.drawer-delete {
    flex-shrink: 0;
    width: 36px;
    border: none;
    background: transparent;
    color: var(--dim);
    cursor: pointer;
    border-radius: 0 10px 10px 0;
    font-size: 1.1rem;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.drawer-item:hover .drawer-delete,
.drawer-item.active .drawer-delete { opacity: 1; }
.drawer-delete:hover {
    color: #f87171;
    background: rgba(248,113,113,0.08);
}
.btn-new-ws {
    margin: 12px;
    padding: 10px;
    border-radius: 10px;
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
}
.btn-new-ws:hover { border-color: var(--accent); color: var(--accent); }
.drawer-social {
    display: flex;
    justify-content: center;
    padding: 0 12px 16px;
}

/* Chat column — always visible */
.chat-column {
    width: var(--chat-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--surface);
    min-width: 260px;
}
.chat-column-head {
    height: 58px;
    flex-shrink: 0;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-column-head strong {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
}
.chat-column-head small {
    display: block;
    margin-top: 2px;
    color: var(--dim);
    font-size: 0.66rem;
}
.tutor-presence {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chat-bubble {
    max-width: 100%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.86rem;
    line-height: 1.5;
}
.chat-bubble.model {
    background: var(--surface-2);
    border: 1px solid var(--border);
    align-self: flex-start;
}
.chat-bubble.user {
    background: var(--accent-soft);
    border: 1px solid rgba(236,72,153,0.22);
    align-self: flex-end;
}
.chat-rich { min-width: 0; }
.chat-rich > :first-child { margin-top: 0; }
.chat-rich > :last-child { margin-bottom: 0; }
.chat-rich p { margin: 0 0 0.7em; }
.chat-rich ul,
.chat-rich ol { margin: 0.55em 0; padding-left: 1.25rem; }
.chat-rich li { margin: 0.25em 0; }
.chat-rich code {
    font-family: var(--mono);
    font-size: 0.86em;
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--surface-3);
}
.chat-rich pre {
    margin: 0.65em 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #101014;
    overflow-x: auto;
}
.chat-rich pre code { padding: 0; background: none; }
.chat-rich .katex-display-wrap {
    margin: 0.7em 0;
    text-align: left;
}

/* Canvas — teaching material */
.canvas-column {
    flex: 1;
    overflow-y: auto;
    padding: 28px 36px 48px;
    min-width: 0;
}
.canvas-inner { max-width: 820px; margin: 0 auto; }

.canvas-title {
    font-family: var(--serif);
    font-size: 1.85rem;
    font-weight: 500;
    margin: 0 0 8px;
    line-height: 1.25;
}
.canvas-sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 28px; }

.section-heading {
    font-family: var(--serif);
    font-size: 1.25rem;
    margin: 28px 0 12px;
    color: var(--text);
}
.section-p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(236,234,232,0.82);
    margin: 0 0 16px;
}

/* Rich markdown lesson body */
.lesson-rich {
    font-size: 0.95rem;
    line-height: 1.75;
    color: rgba(236,234,232,0.82);
}
.lesson-rich h1, .lesson-rich h2, .lesson-rich h3, .lesson-rich h4 {
    font-family: var(--serif);
    color: var(--text);
    margin: 1.6em 0 0.6em;
    line-height: 1.3;
}
.lesson-rich h1 { font-size: 1.5rem; }
.lesson-rich h2 { font-size: 1.28rem; }
.lesson-rich h3 { font-size: 1.1rem; }
.lesson-rich p { margin: 0 0 1em; }
.lesson-rich strong, .lesson-rich b { color: #f5eef8; font-weight: 600; }
.lesson-rich em, .lesson-rich i { color: #e8dce8; }
.lesson-rich ul, .lesson-rich ol {
    margin: 0 0 1em;
    padding-left: 1.4em;
}
.lesson-rich li { margin-bottom: 0.35em; }
.lesson-rich blockquote {
    margin: 1em 0;
    padding: 12px 16px;
    border-left: 3px solid var(--accent);
    background: rgba(255,255,255,0.03);
    border-radius: 0 10px 10px 0;
    color: var(--muted);
}
.lesson-rich code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: rgba(0,0,0,0.35);
    padding: 2px 6px;
    border-radius: 4px;
}
.lesson-rich pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 1em 0;
}
.lesson-rich pre code { background: none; padding: 0; }
.lesson-rich a { color: var(--accent); }
.lesson-rich hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5em 0;
}
.lesson-rich img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: block;
    margin: 0.5em 0;
}
.lesson-figure {
    margin: 1.2em 0;
    padding: 0;
}
.lesson-figure.image-unavailable img { display: none; }
.lesson-image-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    border: 1px dashed var(--border-strong);
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--dim);
    font-size: 0.82rem;
}
.lesson-figure figcaption {
    font-size: 0.78rem;
    color: var(--dim);
    margin-top: 8px;
    line-height: 1.45;
    font-style: italic;
}
.katex-display-wrap {
    margin: 1em 0;
    overflow-x: auto;
    text-align: center;
}
.katex-inline-wrap .katex { font-size: 1.02em; }
.callout {
    padding: 14px 16px;
    border-radius: 12px;
    margin: 16px 0;
    font-size: 0.88rem;
    line-height: 1.55;
    border-left: 3px solid var(--accent);
    background: rgba(255,255,255,0.03);
}
.callout.pitfall { border-left-color: var(--warn); }
.callout.exam_trap { border-left-color: #f87171; }

.example-block {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
}
.example-block h4 { margin: 0 0 10px; font-size: 0.9rem; }
.example-steps { margin: 0; padding-left: 20px; font-size: 0.88rem; line-height: 1.6; }

/* Flow diagram */
.flow-diagram {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
}
.flow-diagram h4 { margin: 0 0 16px; font-size: 0.85rem; color: var(--muted); }
.flow-canvas {
    position: relative;
    min-height: 180px;
    min-width: 400px;
}
.flow-node {
    position: absolute;
    padding: 10px 14px;
    border-radius: 10px;
    background: #252030;
    border: 1px solid rgba(201,109,132,0.35);
    font-size: 0.78rem;
    font-weight: 500;
    max-width: 140px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.flow-svg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

/* Roadmap */
.roadmap-list { list-style: none; padding: 0; margin: 0; }
.roadmap-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.roadmap-num {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.roadmap-body h3 { margin: 0 0 4px; font-size: 0.95rem; }
.roadmap-body p { margin: 0; font-size: 0.82rem; color: var(--muted); line-height: 1.45; }

/* Intake form */
.intake-form { display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-size: 0.78rem; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field input, .field textarea, .field select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
}
.field textarea { min-height: 72px; resize: vertical; }

/* Exam */
.exam-q {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
}
.exam-question {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    margin-bottom: 12px;
}
.exam-question > span {
    width: 32px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--surface-3);
    color: var(--dim);
    font: 700 0.64rem var(--mono);
}
.exam-options { display: flex; flex-direction: column; gap: 8px; }
.exam-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.86rem;
}
.exam-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.exam-option input { margin-top: 3px; }
.exam-options--binary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.exam-numerical-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.exam-numerical-wrap .exam-numerical {
    min-height: 0;
    height: 44px;
}
.exam-numerical-wrap > span {
    color: var(--muted);
    font-size: 0.82rem;
}
.exam-textarea, .exam-code {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0a090c;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    resize: vertical;
}
.exam-ide-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #0a090c;
}
.exam-ide-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dim);
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border);
}
.exam-ide-hint { text-transform: none; letter-spacing: 0; font-size: 0.65rem; }
.exam-ide-wrap .CodeMirror {
    min-height: 180px;
    height: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
}
.exam-ide-wrap .exam-code { display: none; }
.exam-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.exam-result {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 11px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}
.exam-result.is-correct { border-color: rgba(74,222,128,0.36); background: var(--ok-soft); }
.exam-result.is-incorrect { border-color: rgba(248,113,113,0.36); background: var(--error-soft); }
.exam-result-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--surface-3);
    color: var(--dim);
    font-size: 0.7rem;
}
.exam-result.is-correct .exam-result-icon { color: var(--ok); background: var(--ok-soft); }
.exam-result.is-incorrect .exam-result-icon { color: var(--error); background: var(--error-soft); }
.exam-result-copy > span {
    display: block;
    margin-bottom: 4px;
    color: var(--dim);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.exam-result-copy > p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.5;
}
.exam-result-copy > p strong { color: inherit; }

/* Inline lesson practice */
.lesson-practice {
    margin-top: 36px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}
.practice-heading { margin-bottom: 18px; }
.practice-kicker,
.assessment-kicker {
    margin: 0 0 6px;
    color: var(--accent-light);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.practice-heading h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 500;
}
.practice-heading > p:last-child {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}
.practice-card {
    margin-bottom: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    transition: border-color 0.16s ease, background 0.16s ease;
}
.practice-card.is-correct {
    border-color: rgba(74,222,128,0.42);
    background: var(--ok-soft);
}
.practice-card.is-incorrect,
.practice-card.needs-answer {
    border-color: rgba(248,113,113,0.42);
    background: var(--error-soft);
}
.practice-question {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    margin-bottom: 14px;
}
.practice-question > span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--surface-3);
    color: var(--dim);
    font-size: 0.66rem;
    font-weight: 700;
}
.practice-prompt {
    min-width: 0;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.55;
}
.practice-prompt > :first-child { margin-top: 0; }
.practice-prompt > :last-child { margin-bottom: 0; }
.practice-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.practice-options--binary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.practice-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255,255,255,0.015);
    color: var(--muted);
    cursor: pointer;
    font-size: 0.84rem;
    line-height: 1.45;
}
.practice-option:hover { border-color: var(--border-strong); color: var(--text); }
.practice-option:has(input:checked) {
    border-color: rgba(236,72,153,0.42);
    background: var(--accent-soft);
    color: var(--text);
}
.practice-option input { margin-top: 3px; accent-color: var(--accent); }
.practice-numerical-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.practice-answer {
    width: 100%;
    height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: #101014;
    color: var(--text);
    font: 0.86rem var(--mono);
}
.practice-answer--long {
    min-height: 100px;
    height: auto;
    resize: vertical;
    line-height: 1.55;
}
.practice-answer:focus {
    border-color: rgba(236,72,153,0.42);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.practice-unit {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 0.82rem;
}
.practice-feedback {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 12px;
    padding: 10px 11px;
    border-radius: 10px;
    font-size: 0.8rem;
    line-height: 1.5;
}
.practice-feedback.correct { color: var(--ok); background: var(--ok-soft); }
.practice-feedback.incorrect { color: var(--error); background: var(--error-soft); }
.practice-feedback i { margin-top: 3px; }
.practice-feedback strong { color: inherit; }
.practice-check-btn {
    margin-top: 12px;
    padding: 8px 13px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font: 600 0.76rem var(--font);
}
.practice-check-btn:hover { border-color: rgba(236,72,153,0.42); color: var(--accent-light); }
.practice-check-btn:disabled { opacity: 0.55; cursor: wait; }

/* Actions */
.canvas-actions {
    display: flex;
    gap: 10px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.btn-primary {
    padding: 12px 22px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.88rem;
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost {
    padding: 12px 22px;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.88rem;
}

/* Bottom chat input */
.chat-composer {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.chat-composer input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
}
.chat-composer button {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    padding: 0;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 1px solid rgba(236,72,153,0.28);
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
}

/* Curriculum */
.curriculum-column {
    width: var(--curriculum-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-left: 1px solid var(--border);
    background: var(--surface);
}
.curriculum-head {
    height: 58px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
}
.curriculum-head p {
    margin: 0 0 2px;
    color: var(--dim);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.curriculum-head h2 {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 600;
}
.curriculum-close {
    display: none;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    font-size: 1.05rem;
}
.curriculum-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 10px 20px;
}
.curriculum-empty {
    margin: 0;
    padding: 16px 8px;
    color: var(--dim);
    font-size: 0.76rem;
    line-height: 1.5;
}
.curriculum-module { margin-bottom: 14px; }
.curriculum-module-head {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 5px 7px 7px;
}
.curriculum-module-head > span {
    color: var(--dim);
    font: 600 0.62rem var(--mono);
}
.curriculum-module-head strong,
.curriculum-module-head small {
    display: block;
}
.curriculum-module-head strong {
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.35;
}
.curriculum-module-head small {
    margin-top: 3px;
    color: var(--dim);
    font-size: 0.62rem;
}
.curriculum-topics {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.curriculum-topic,
.curriculum-assessment {
    width: 100%;
    min-width: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    text-align: left;
    font-family: var(--font);
}
.curriculum-topic {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-height: 34px;
    padding: 6px 7px;
    border-radius: 9px;
    font-size: 0.72rem;
    line-height: 1.4;
}
.curriculum-topic:hover:not(:disabled) { background: rgba(255,255,255,0.04); color: var(--text); }
.curriculum-topic.viewing {
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text);
}
.curriculum-topic.done { color: var(--muted); }
.curriculum-topic.active { color: var(--text); }
.curriculum-topic:disabled { cursor: default; opacity: 0.5; }
.curriculum-topic-icon,
.curriculum-status-icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--dim);
    font-size: 0.56rem;
}
.curriculum-topic.done .curriculum-topic-icon {
    color: var(--ok);
    background: var(--ok-soft);
}
.curriculum-topic.active .curriculum-topic-icon {
    color: var(--accent-light);
    background: var(--accent-soft);
}
.curriculum-assessment {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    margin: 8px 0 16px;
    padding: 10px;
    border-radius: 11px;
    border-color: var(--border);
    background: var(--surface-2);
}
.curriculum-assessment:not(:disabled):hover { border-color: rgba(236,72,153,0.38); }
.curriculum-assessment:disabled { cursor: default; opacity: 0.58; }
.curriculum-assessment.active {
    border-color: rgba(236,72,153,0.34);
    background: var(--accent-soft);
}
.curriculum-assessment.passed {
    border-color: rgba(74,222,128,0.28);
    background: var(--ok-soft);
}
.curriculum-assessment.passed .curriculum-status-icon { color: var(--ok); background: var(--ok-soft); }
.curriculum-assessment-copy strong,
.curriculum-assessment-copy small { display: block; }
.curriculum-assessment-copy strong {
    color: var(--text);
    font-size: 0.74rem;
    font-weight: 600;
}
.curriculum-assessment-copy small {
    margin-top: 3px;
    color: var(--dim);
    font-size: 0.62rem;
}
.curriculum-backdrop {
    position: absolute;
    inset: 0;
    z-index: 34;
    background: rgba(0,0,0,0.52);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.curriculum-backdrop.open { opacity: 1; pointer-events: auto; }

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--dim);
    padding: 48px;
    font-style: italic;
}
.spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 25;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

@media (max-width: 1180px) {
    .curriculum-toggle { display: flex; }
    .curriculum-column {
        position: absolute;
        z-index: 35;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(var(--curriculum-w), calc(100vw - 36px));
        box-shadow: var(--shadow);
        transform: translateX(100%);
        transition: transform 0.22s ease;
    }
    .curriculum-column.open { transform: translateX(0); }
    .curriculum-close { display: grid; place-items: center; }
}

@media (max-width: 900px) {
    :root { --chat-w: 100%; }
    .academy-topbar { padding: 0 10px; }
    .academy-meta { gap: 7px; }
    .academy-main { flex-direction: column; }
    .chat-column {
        width: 100%;
        min-width: 0;
        max-height: 34vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .chat-column-head { height: 46px; }
    .chat-messages { padding: 12px; }
    .chat-composer { padding: 9px 12px; }
    .canvas-column { flex: 1; padding: 24px 18px 42px; }
}

@media (max-width: 560px) {
    .academy-brand img { width: 84px; }
    .academy-brand > span { display: none; }
    .credits-pill { display: none; }
    .progress-pill { padding: 4px 8px; }
    .canvas-title { font-size: 1.55rem; }
    .practice-options--binary,
    .exam-options--binary { grid-template-columns: 1fr; }
    .practice-card,
    .exam-q { padding: 14px; }
}
