/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* ── Arcade Modern · light (default) ── */
    --ink:          #F2F5FA;   /* page ground (legacy name kept) */
    --surface:      #FFFFFF;   /* cards */
    --surface2:     #EDF1F7;   /* wells, inline chips */
    --line:         #E2E8F2;
    --line-strong:  #C9D4E4;
    --text:         #232A3B;
    --muted:        #5C6780;
    --faint:        #93A5C4;

    /* accent spectrum (tier + action colors) */
    --focus:        #F5940C;   /* XP / stars / streak — warm arcade orange */
    --cyan:         #1D6FC2;   /* links, info (readable blue on light) */
    --teal:         #1E9E63;   /* success green */
    --amber:        #DB8009;   /* medium (text-safe orange) */
    --coral:        #E5484D;   /* hard / danger red */
    --mint:         #3BAF74;
    --purple:       #7C4FC9;   /* applied-design tier */

    /* semantic */
    --green:        var(--teal);   /* legacy alias (was referenced but never defined) */
    --easy:         var(--teal);
    --medium:       var(--amber);
    --hard:         var(--coral);
    --star-on:      #F5A623;
    --star-off:     #D4DCE9;
    --success:      var(--teal);
    --danger:       #D64550;

    /* elevated chrome (nav bars / glass strips) */
    --glass:        rgba(255,255,255,.9);

    /* legacy compat */
    --bg:           var(--ink);
    --bg-card:      var(--surface);
    --bg-card-2:    var(--surface2);
    --bg-input:     #FFFFFF;
    --border:       var(--line);
    --accent:       var(--focus);
    --accent-dim:   #FDEBD2;
    --text-muted:   var(--muted);
    --text-faint:   var(--faint);

    --radius:       16px;
    --radius-sm:    10px;
    --shadow:       0 4px 16px rgba(35,50,90,.08);

    --mono:         'JetBrains Mono', ui-monospace, monospace;
    --disp:         'Nunito', 'Outfit', system-ui, sans-serif;
    --body:         'Nunito', 'Plus Jakarta Sans', system-ui, sans-serif;

    --ring:         var(--cyan); /* keyboard focus ring — distinct from --focus (orange, used for XP/hover state) */
}

/* ── Arcade Modern · dark ("arcade night") ── */
html[data-theme="dark"] {
    --ink:          #161A24;
    --surface:      #1F2532;
    --surface2:     #29303F;
    --line:         #323B4E;
    --line-strong:  #45506A;
    --text:         #E8ECF4;
    --muted:        #9AA5BC;
    --faint:        #66718C;

    --focus:        #FFA733;
    --cyan:         #5AA7F0;
    --teal:         #45C583;
    --amber:        #F2A93B;
    --coral:        #F26D72;
    --mint:         #5CD196;
    --purple:       #A77FE8;

    --star-on:      #FFB454;
    --star-off:     #3A4356;
    --danger:       #F26D72;

    --glass:        rgba(22,26,36,.92);

    --bg-input:     #161A24;
    --accent-dim:   #3D2E14;
    --shadow:       0 6px 24px rgba(0,0,0,.4);
}

html { scroll-behavior: smooth; color-scheme: light; background: var(--ink); }
html[data-theme="dark"] { color-scheme: dark; }

body {
    font-family: var(--body);
    background: var(--ink);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    line-height: 1.7;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--focus); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Keyboard focus ring ──────────────────────────────────────────────────
   :focus-visible so mouse/touch clicks stay ring-free while Tab navigation
   always gets a visible indicator — covers every interactive element by
   default; a handful of custom controls (stars, quest links, palette items)
   get their own rule below because they're divs/spans/anchors that need the
   ring drawn slightly differently (inset, or on a child) to look right. */
a, button, .btn, input, select, textarea, summary, [tabindex] {
    outline: none;
}
a:focus-visible, button:focus-visible, .btn:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
summary:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Skip-to-content link ─────────────────────────────────────────────────
   First focusable element on every page (header.php). Off-screen until
   tabbed to, so it costs sighted mouse users nothing but saves keyboard
   users ~35 sidebar stops before reaching the page content. */
.skip-link {
    position: absolute;
    top: -3rem;
    left: .75rem;
    z-index: 1000;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: .6rem 1rem;
    font-size: .85rem;
    font-weight: 700;
    transition: top .15s ease;
}
.skip-link:focus {
    top: .75rem;
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

code {
    font-family: var(--mono);
    background: var(--surface2);
    color: var(--cyan);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .85em;
    overflow-wrap: anywhere;   /* long inline snippets wrap instead of overflowing */
}

/* Fallback for any bare <pre>/<pre><code> block that isn't covered by a more
   specific rule below (schema previews, quiz code viewers, etc.) — without
   this they inherit the 16px body font, which reads noticeably larger than
   every other code surface in the app. */
pre {
    font-family: var(--mono);
    font-size: .82rem;
    line-height: 1.6;
}

/* Multi-line code blocks reformatted from run-on inline pseudocode
   (tools/reformat_inline_code.php). Self-contained so it looks right in hints,
   approach/statement, and concept sections alike; pre-wrap keeps long lines
   from overflowing on mobile. */
.code-lines {
    display: block;
    background: var(--surface2);
    border-left: 3px solid var(--cyan);
    border-radius: var(--radius-sm);
    padding: .7rem .9rem;
    margin: .55rem 0;
    font-family: var(--mono);
    font-size: .8rem;
    line-height: 1.75;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow-x: auto;
}
.code-lines code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
    border-radius: 0;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 56px;
    background: var(--glass);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-family: var(--mono);
    font-size: .88rem;
    font-weight: 700;
    color: var(--focus);
    letter-spacing: .05em;
    text-transform: uppercase;
}
.nav-brand:hover { text-decoration: none; color: var(--text); }

.nav-links {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex: 1;
    padding-left: 1.5rem;
}
.nav-link {
    font-size: .82rem;
    color: var(--muted);
    padding: .3rem .55rem;
    border-radius: 20px;
    transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--text); background: var(--surface2); text-decoration: none; }
.nav-sep { color: var(--faint); font-size: .8rem; }

.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-user { font-family: var(--mono); font-size: .75rem; color: var(--muted); letter-spacing: .05em; }

/* ── Sticky progress strip ────────────────────────────────────────────────── */
.progress-strip {
    position: sticky;
    top: 56px;
    z-index: 99;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 2rem;
    height: 32px;
    background: var(--glass);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.progress-strip-track {
    flex: 1;
    height: 4px;
    background: var(--surface2);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}
.progress-strip-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--teal);
    border-radius: 99px;
    transition: width .5s ease;
}
.progress-strip-label {
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--muted);
    white-space: nowrap;
    letter-spacing: .08em;
    text-transform: uppercase;
    min-width: 130px;
    text-align: right;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    font-family: var(--mono);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    transition: background .15s, opacity .15s, transform .1s, border-color .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--focus); color: var(--ink); border-color: var(--focus); }
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: var(--line);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--muted); }

.btn-outline {
    background: transparent;
    color: var(--focus);
    border-color: var(--accent-dim);
}
.btn-outline:hover { background: color-mix(in srgb, var(--focus) 10%, transparent); border-color: var(--focus); }

.btn-sm { padding: .32rem .7rem; font-size: .7rem; }
.btn-lg { padding: .75rem 1.6rem; font-size: .85rem; }

.btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
}
.page-header .eyebrow {
    font-family: var(--disp);
    font-weight: 800;
    font-size: .7rem;
    letter-spacing: .09em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: .6rem;
}
.page-header h1 {
    font-family: var(--disp);
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: .4rem;
}
.page-header p { color: var(--muted); font-size: .92rem; max-width: 600px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.card + .card { margin-top: 1rem; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.progress-wrap { margin: .6rem 0 0; }
.progress-bar-track {
    height: 5px;
    background: var(--surface2);
    border-radius: 99px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--teal);
    border-radius: 99px;
    transition: width .4s ease;
}
.progress-label {
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--muted);
    margin-top: .35rem;
    letter-spacing: .04em;
}

/* ── Progress ring ────────────────────────────────────────────────────────── */
.ring { display: block; flex-shrink: 0; }
.ring-track { stroke: var(--surface2); }
.ring-fill { stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring-label {
    font-family: var(--disp);
    font-weight: 800;
    fill: var(--text);
    font-size: 1.3rem;
}
.ring-good .ring-fill { stroke: var(--teal); }
.ring-mid  .ring-fill { stroke: var(--amber); }
.ring-low  .ring-fill { stroke: var(--danger); }
.ring-good .ring-label { fill: var(--teal); }
.ring-mid  .ring-label { fill: var(--amber); }
.ring-low  .ring-label { fill: var(--danger); }

/* ── Delta chip ("+4 this week") ──────────────────────────────────────────── */
.delta-chip {
    font-family: var(--mono);
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}
.delta-up   { color: var(--teal); }
.delta-down { color: var(--danger); }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.badge-easy   { background: color-mix(in srgb, var(--teal) 12%, transparent);  color: var(--easy);   border: 1px solid color-mix(in srgb, var(--teal) 25%, transparent); }
.badge-medium { background: color-mix(in srgb, var(--amber) 12%, transparent);  color: var(--medium); border: 1px solid color-mix(in srgb, var(--amber) 25%, transparent); }
.badge-hard   { background: color-mix(in srgb, var(--coral) 12%, transparent);  color: var(--hard);   border: 1px solid color-mix(in srgb, var(--coral) 25%, transparent); }
.badge-tag    { background: var(--surface2); color: var(--muted); border: 1px solid var(--line); font-weight: 500; text-transform: none; letter-spacing: 0; font-family: var(--body); font-size: .72rem; }
/* Sentence-case modifier for badges carrying a natural-language phrase
   (domain names, readiness titles, "Tagged for X") instead of a short status
   code — those stay uppercase mono, this stays readable. Stack alongside the
   existing color modifier, e.g. class="badge badge-hard badge-natural". */
.badge-natural { text-transform: none; letter-spacing: 0; font-family: var(--body); font-weight: 600; }

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    padding: 1rem;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}
.login-logo { font-size: 2rem; text-align: center; margin-bottom: .5rem; }
.login-card h1 {
    font-family: var(--disp);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: .3rem;
    letter-spacing: -.02em;
}
.login-card .subtitle {
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
    margin-bottom: 2rem;
}
.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block;
    font-family: var(--mono);
    font-size: .7rem;
    color: var(--muted);
    margin-bottom: .45rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .65rem .9rem;
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .95rem;
    font-family: var(--body);
    transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--focus); }
.form-group select { cursor: pointer; }
.form-group input[type="date"] { color-scheme: dark; }
.form-error {
    background: color-mix(in srgb, var(--danger) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
    border-left: 3px solid var(--danger);
    color: var(--danger);
    padding: .6rem .9rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: .85rem;
    margin-bottom: 1rem;
}

/* ── Dashboard ────────────────────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
}
.stat-card .stat-num {
    font-family: var(--mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--focus);
    line-height: 1;
    letter-spacing: -.02em;
}
.stat-card .stat-label {
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--muted);
    margin-top: .5rem;
    text-transform: uppercase;
    letter-spacing: .1em;
}

.topics-grid {
    column-width: 280px;
    column-gap: 1rem;
}

.topic-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    transition: border-color .2s, transform .15s;
    position: relative;
    overflow: hidden;
    break-inside: avoid;
    margin-bottom: 1rem;
    width: 100%;
}
.topic-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--teal), var(--cyan));
    opacity: 0;
    transition: opacity .2s;
}
.topic-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.topic-card:hover::before { opacity: 1; }

.topic-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.topic-day {
    font-family: var(--mono);
    font-size: .65rem;
    color: var(--focus);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
    background: color-mix(in srgb, var(--focus) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--focus) 18%, transparent);
    padding: 2px 8px;
    border-radius: 5px;
    display: inline-block;
}
.topic-title {
    font-family: var(--disp);
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: .4rem;
    letter-spacing: -.01em;
}
.topic-desc {
    font-size: .82rem;
    color: var(--muted);
    line-height: 1.55;
    flex: 1;
}

.topic-card-footer { display: flex; justify-content: space-between; align-items: center; }
.coming-soon {
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .1em;
}

/* ── Topic / question list ───────────────────────────────────────────────── */
.question-list { display: flex; flex-direction: column; gap: .5rem; }

.q-row {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .9rem 1.2rem;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .1s;
    text-decoration: none;
    color: var(--text);
}
.q-row:hover { border-color: var(--line-strong); background: var(--surface2); text-decoration: none; transform: translateX(2px); }

.qr-line1 { display: flex; align-items: center; gap: .75rem; }
.qr-line2 { display: flex; align-items: center; justify-content: space-between; padding-left: calc(22px + .75rem); }

.qr-num {
    font-family: var(--mono);
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    flex-shrink: 0;
    min-width: 22px;
}
.qr-title { flex: 1; font-weight: 500; font-size: .92rem; min-width: 0; }
.qr-pattern { flex-shrink: 0; }
.qr-left { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }

.q-rating { display: flex; gap: 2px; flex-shrink: 0; }
.q-rating .s { font-size: .72rem; color: var(--star-off); }
.q-rating .s.on { color: var(--star-on); }

/* ── Mock question row (2-line layout) ──────────────────────────────────── */
.q-row-mock {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .9rem 1.25rem;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .1s;
    text-decoration: none;
    color: var(--text);
}
.q-row-mock:hover { border-color: var(--line-strong); background: var(--surface2); text-decoration: none; transform: translateX(2px); }

.qm-line1 {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.qm-difficulty { flex-shrink: 0; }
.qm-title {
    flex: 1;
    font-weight: 500;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
}
.qm-duration {
    flex-shrink: 0;
    font-size: .78rem;
    color: var(--muted);
    font-family: var(--mono);
    white-space: nowrap;
}

.qm-line2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.qm-companies {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}
.qm-stars {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}
.qm-stars .s { font-size: .8rem; color: var(--star-off); cursor: default; }
.qm-stars .s.on { color: var(--star-on); }

/* ── Question page ────────────────────────────────────────────────────────── */
.q-header { margin-bottom: 1.5rem; }
.q-header-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .75rem; }
.q-header h1 {
    font-family: var(--disp);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -.02em;
}
.q-tags { display: flex; gap: .4rem; flex-wrap: wrap; }

.q-external {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: .25rem .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    transition: color .15s, border-color .15s;
}
.q-external:hover { color: var(--focus); border-color: color-mix(in srgb, var(--focus) 40%, transparent); text-decoration: none; }

/* Two explicit, equally-weighted "how to solve it" paths on question.php */
.solve-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .85rem;
    margin: 1.25rem 0;
}
.solve-option {
    display: flex;
    align-items: center;
    gap: .85rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    text-decoration: none;
    transition: border-color .15s, transform .1s;
}
.solve-option:hover { border-color: var(--focus); transform: translateY(-1px); text-decoration: none; }
.solve-option-icon {
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border-radius: 50%;
    background: var(--surface2);
}
.solve-option-body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.solve-option-title { font-weight: 700; color: var(--text); font-size: .95rem; }
.solve-option-sub { font-size: .78rem; color: var(--muted); }

.mock-bar {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.mock-bar-idle,
.mock-bar-active,
.mock-bar-done {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.mock-bar-info { display: flex; align-items: center; gap: .75rem; }
.mock-bar-icon { font-size: 1.3rem; flex-shrink: 0; }
.mock-bar-title { font-weight: 700; font-size: .9rem; }
.mock-bar-sub { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.mock-bar-right { display: flex; align-items: center; gap: .85rem; }
.mock-timer {
    font-family: var(--mono);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--focus);
    min-width: 3.2rem;
    text-align: right;
}
.mock-bar.mock-bar-warn { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.mock-bar.mock-bar-warn .mock-timer { color: var(--danger); }
.mock-bar-done { color: var(--green); }
.mock-bar-done .mock-bar-title { color: var(--green); }

.section-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    overflow: hidden;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1.4rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface2);
}
.section-title {
    font-family: var(--mono);
    font-weight: 700;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--muted);
}
.section-body { padding: 1.2rem 1.4rem; }
.section-body p { margin-bottom: .75rem; color: var(--muted); line-height: 1.75; font-size: .92rem; }
.section-body p:last-child { margin-bottom: 0; }

/* Problem statement example blocks */
pre.example-block {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--focus);
    border-radius: var(--radius-sm);
    padding: .85rem 1rem;
    font-family: var(--mono);
    font-size: .78rem;
    color: var(--text);
    white-space: pre-wrap;
    margin: .75rem 0;
}
ul.constraints {
    margin: .5rem 0 0 1rem;
    padding: 0;
    font-size: .85rem;
    color: var(--text-muted);
    list-style: disc;
}
ul.constraints li { margin-bottom: .2rem; }

/* Approach numbered steps */
.approach-hidden ol, .approach-hidden.revealed ol {
    padding-left: .3rem;
    margin: .5rem 0 .75rem;
}
.approach-hidden ol li { margin-bottom: .5rem; font-size: .9rem; color: var(--muted); line-height: 1.7; }

/* Hints */
.hint-list { display: flex; flex-direction: column; gap: .75rem; }
.hint-item {
    background: color-mix(in srgb, var(--cyan) 4%, transparent);
    border-left: 3px solid var(--cyan);
    padding: .9rem 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: .9rem;
    color: var(--muted);
    display: none;
}
.hint-item.revealed { display: block; animation: fadeIn .3s ease; }
.hint-num {
    font-family: var(--mono);
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--cyan);
    font-weight: 700;
    margin-bottom: .3rem;
}

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

/* Approach */
.approach-hidden {
    display: none;
    /* The border-left comes from game.css; without this the ol's own list
       indent gave numbered steps some breathing room but any sibling
       paragraph or table sat flush against the line. */
    padding: .2rem 0 .2rem 1.1rem;
    /* Scroll container for .complexity-table when it's too wide to fit —
       keeps the table's own column widths natural/readable instead of
       squeezing them to fit. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.approach-hidden.revealed { display: block; animation: fadeIn .3s ease; }

/* Complexity table */
.complexity-table {
    /* width:100% stretches the table when it comfortably fits; when content
       can't fit even at its minimum wrap width, the browser safely ignores
       this and renders at the wider natural width instead of force-wrapping
       — the actual overflow protection is the ancestor's overflow-x:auto
       (.approach-hidden below), which clips/scrolls a too-wide table while
       leaving a comfortably-sized one to stretch normally. No table-layout:
       fixed / no max-width here — those are what caused the squeeze. */
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
    margin-top: .75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}
.complexity-table th, .complexity-table td {
    padding: .55rem 1rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
}
.complexity-table tr:last-child th,
.complexity-table tr:last-child td { border-bottom: none; }
.complexity-table th {
    background: var(--surface2);
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
}
.complexity-table td { font-family: var(--mono); color: var(--teal); font-size: .82rem; }

/* Rating */
.rating-section { text-align: center; padding: 1.75rem 1.4rem; }
.rating-label {
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--muted);
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: .1em;
}
.stars-row { display: inline-flex; gap: .5rem; margin-bottom: 1rem; }
.star-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 2rem;
    color: var(--star-off);
    transition: color .15s, transform .1s;
    padding: 0 2px;
}
.star-btn:hover, .star-btn.hover { color: var(--star-on); transform: scale(1.2); }
.star-btn.active { color: var(--star-on); }
.rating-sublabel {
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--muted);
    min-height: 1.2em;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.save-indicator {
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--success);
    min-height: 1.4em;
    margin-top: .5rem;
    opacity: 0;
    transition: opacity .3s;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.save-indicator.show { opacity: 1; }

/* Notes */
.notes-area {
    width: 100%;
    min-height: 110px;
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .88rem;
    padding: .8rem 1rem;
    resize: vertical;
    font-family: var(--body);
    line-height: 1.65;
    transition: border-color .15s;
}
.notes-area:focus { outline: none; border-color: var(--focus); }
.notes-hint {
    font-family: var(--mono);
    font-size: .65rem;
    color: var(--muted);
    margin-top: .4rem;
    text-transform: uppercase;
    letter-spacing: .1em;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    margin-top: auto;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;        /* wrap between crumbs, not inside them */
    row-gap: .25rem;
    gap: .45rem;
    font-family: var(--body);
    font-weight: 600;
    font-size: .8rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}
/* Keep each link crumb + separator on a single line so a crumb never breaks
   mid-word; the whole breadcrumb wraps as units instead. The final current-page
   label (a plain <span>) may still wrap normally when it's very long. */
.breadcrumb a, .breadcrumb-sep { white-space: nowrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--focus); text-decoration: none; }
.breadcrumb-sep { color: var(--faint); }

/* ── Dashboard header section ─────────────────────────────────────────────── */
.dash-header {
    padding: 2.5rem 0 2rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2rem;
}
.dash-header .eyebrow {
    font-family: var(--disp);
    font-weight: 800;
    font-size: .7rem;
    letter-spacing: .09em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: .75rem;
}
.dash-header h1 {
    font-family: var(--disp);
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.1;
    margin-bottom: .5rem;
}
.dash-header .sub {
    color: var(--muted);
    font-size: .9rem;
    max-width: 560px;
}

/* ── Section labels ───────────────────────────────────────────────────────── */
.section-label {
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .16em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* ── Topic page header ────────────────────────────────────────────────────── */
.topic-page-header {
    margin-bottom: 2rem;
}
.topic-page-header .eyebrow {
    font-family: var(--disp);
    font-weight: 800;
    font-size: .7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .09em;
    margin-bottom: .5rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.topic-page-header h1 {
    font-family: var(--disp);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: .4rem;
}
.topic-page-header p { color: var(--muted); font-size: .88rem; max-width: 600px; }

/* ── Hub page ─────────────────────────────────────────────────────────────── */
.hub-header { margin-bottom: 2rem; }
.hub-streak-banner {
    background: color-mix(in srgb, var(--focus) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--focus) 18%, transparent);
    border-radius: var(--radius-sm);
    padding: .65rem 1rem;
    font-size: .88rem;
    color: var(--muted);
    margin-bottom: 1.75rem;
}
.hub-streak-banner strong { color: var(--focus); }

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.hub-card {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    transition: border-color .18s, box-shadow .18s;
}
.hub-card-active {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    border-color: var(--line);
}
.hub-card-active:hover,
.hub-card-active:focus,
.hub-card-active:active { text-decoration: none; }
.hub-card-active:hover {
    border-color: var(--focus);
    box-shadow: 0 0 0 1px var(--focus), var(--shadow);
}
.hub-card-soon { opacity: .55; cursor: default; }

.hub-card-icon {
    font-size: 1.6rem;
    font-family: var(--mono);
    color: var(--focus);
    line-height: 1;
}
.hub-card-soon .hub-card-icon { color: var(--muted); }

.hub-card-body { flex: 1; }
.hub-card-title {
    font-family: var(--disp);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: .4rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.hub-card-desc { font-size: .85rem; color: var(--muted); line-height: 1.55; }
.hub-card-stat {
    font-family: var(--mono);
    font-size: .75rem;
    color: var(--focus);
    margin-top: .4rem;
}
.hub-card-arrow {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.1rem;
    color: var(--muted);
    transition: color .15s, transform .15s;
}
.hub-card-active:hover .hub-card-arrow { color: var(--focus); transform: translateX(3px); }

.hub-soon-badge {
    font-size: .65rem;
    font-family: var(--mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    padding: .15rem .5rem;
    border-radius: 20px;
}

/* ── LeetCode sync bar ────────────────────────────────────────────────────── */
.lc-sync-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.lc-sync-left { display: flex; align-items: center; gap: .85rem; }
.lc-logo { font-size: 1.4rem; color: var(--focus); }
.lc-sync-title { font-weight: 600; font-size: .9rem; margin-bottom: .15rem; }
.lc-sync-sub { font-size: .8rem; color: var(--muted); }
.lc-sync-sub strong { color: var(--text); }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.75rem;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}
.modal-title {
    font-family: var(--disp);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: .4rem;
}
.modal-sub { font-size: .85rem; color: var(--muted); line-height: 1.5; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    margin-top: 1.25rem;
}

/* ── Command palette (⌘K) ────────────────────────────────────────────────── */
.palette-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 300;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 1rem 1rem;
}
.palette-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    width: 100%;
    max-width: 560px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.palette-input {
    border: none;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    font-size: 1.05rem;
    padding: 1rem 1.25rem;
    font-family: inherit;
}
.palette-input:focus { outline: none; }
.palette-meta {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    padding: .65rem 1.25rem .35rem;
}
.palette-list { overflow-y: auto; padding: 0 .5rem .5rem; }
.palette-item {
    display: flex;
    flex-direction: column;
    padding: .55rem .75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
}
.palette-item-title { font-weight: 500; }
.palette-item-sub { font-size: .75rem; color: var(--muted); margin-top: .1rem; }
.palette-item-active, .palette-item:hover { background: var(--surface2); text-decoration: none; }
.palette-empty { padding: 1rem 1.25rem; color: var(--muted); font-size: .85rem; }
.palette-hint {
    font-size: .7rem;
    color: var(--muted);
    padding: .5rem 1.25rem;
    border-top: 1px solid var(--line);
}

/* ── LeetCode preview list ────────────────────────────────────────────────── */
.lc-preview-list {
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.lc-match-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .85rem;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background .12s;
    flex-wrap: wrap;
}
.lc-match-row:last-child { border-bottom: none; }
.lc-match-row:hover { background: var(--surface2); }
.lc-match-row.already-done { opacity: .55; cursor: default; }
.lc-match-title { flex: 1; font-size: .85rem; min-width: 0; }
.lc-match-date { font-size: .75rem; color: var(--muted); margin-left: auto; }
.lc-match-check { accent-color: var(--focus); cursor: pointer; flex-shrink: 0; }
.lc-empty { color: var(--muted); font-size: .85rem; padding: 1rem 0; text-align: center; }
.badge-done { background: color-mix(in srgb, var(--teal) 10%, transparent); color: var(--teal); border: 1px solid color-mix(in srgb, var(--teal) 20%, transparent); }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.lc-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--line);
    border-top-color: var(--focus);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth tabs (login / signup) ───────────────────────────────────────────── */
.auth-tabs {
    display: flex;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.auth-tab {
    flex: 1;
    padding: .6rem 1rem;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: .9rem;
    font-family: var(--body);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.auth-tab.active {
    background: var(--surface2);
    color: var(--text);
    font-weight: 600;
}
.field-hint {
    font-size: .75rem;
    color: var(--muted);
    margin-top: .3rem;
}

/* ── Streak badge ─────────────────────────────────────────────────────────── */
.streak-badge {
    font-size: .8rem;
    font-weight: 700;
    color: var(--focus);
    background: color-mix(in srgb, var(--focus) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--focus) 20%, transparent);
    padding: .25rem .6rem;
    border-radius: 20px;
    white-space: nowrap;
}
.streak-card .stat-num { color: var(--focus); }

/* ── Daily practice CTA ───────────────────────────────────────────────────── */
.daily-cta {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
}
.daily-cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.daily-cta-title { font-weight: 700; font-size: 1rem; margin-bottom: .2rem; }
.daily-cta-sub   { color: var(--muted); font-size: .85rem; }

/* ── Topic filters ────────────────────────────────────────────────────────── */
.topic-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.filter-group { display: flex; flex-direction: column; gap: .4rem; }
.filter-label {
    font-family: var(--mono);
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--muted);
}
.filter-btns { display: flex; gap: .4rem; flex-wrap: wrap; }
.filter-btn {
    padding: .3rem .75rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: transparent;
    color: var(--muted);
    font-size: .8rem;
    cursor: pointer;
    font-family: var(--body);
    transition: all .15s;
}
.filter-btn.active, .filter-btn:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--focus);
}
.filter-select {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    font-family: var(--body);
    font-size: .82rem;
    padding: .3rem .6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.no-results {
    text-align: center;
    color: var(--muted);
    padding: 2rem;
    font-size: .9rem;
}
.badge-company {
    background: color-mix(in srgb, var(--cyan) 10%, transparent);
    color: var(--cyan);
    border: 1px solid color-mix(in srgb, var(--cyan) 20%, transparent);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--body);
    font-size: .72rem;
}

/* ── Discussion ───────────────────────────────────────────────────────────── */
.section-count {
    font-size: .75rem;
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: .15rem .5rem;
    color: var(--muted);
}
.discussion-list { margin-bottom: 1.25rem; }
.discussion-empty { color: var(--muted); font-size: .85rem; padding: .5rem 0; }
.discussion-comment {
    border-top: 1px solid var(--line);
    padding: .85rem 0;
}
.discussion-comment:first-child { border-top: none; }
.comment-meta { display: flex; gap: .75rem; margin-bottom: .4rem; }
.comment-user { font-size: .8rem; font-weight: 600; color: var(--text); }
.comment-time { font-size: .78rem; color: var(--muted); }
.comment-text { font-size: .88rem; color: var(--muted); line-height: 1.55; white-space: pre-wrap; }
.discussion-form { border-top: 1px solid var(--line); padding-top: 1rem; }

/* ── Daily practice page ──────────────────────────────────────────────────── */
.daily-legend {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1rem;
    font-size: .8rem;
    color: var(--muted);
}
.legend-item { display: flex; align-items: center; gap: .4rem; }
.legend-dot {
    width: 8px; height: 8px; border-radius: 50%;
}
.legend-dot.overdue  { background: var(--hard); }
.legend-dot.review   { background: var(--focus); }
.legend-dot.new      { background: var(--teal); }

.q-row-daily .q-topic-label {
    display: block;
    font-size: .72rem;
    color: var(--muted);
    margin-top: .15rem;
}
.daily-type-overdue { color: var(--hard) !important; }
.daily-type-review  { color: var(--focus) !important; }
.daily-type-new     { color: var(--teal) !important; }

.badge-overdue { background: color-mix(in srgb, var(--coral) 10%, transparent); color: var(--hard); border: 1px solid color-mix(in srgb, var(--coral) 25%, transparent); }
.badge-due     { background: color-mix(in srgb, var(--focus) 10%, transparent); color: var(--focus); border: 1px solid color-mix(in srgb, var(--focus) 25%, transparent); }
.badge-new     { background: color-mix(in srgb, var(--teal) 10%, transparent); color: var(--teal); border: 1px solid color-mix(in srgb, var(--teal) 25%, transparent); }

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--muted);
}
.empty-state h2 { font-size: 1.4rem; margin: .75rem 0 .5rem; }

/* ── Roadmap ──────────────────────────────────────────────────────────────── */
.roadmap-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.roadmap-tab {
    padding: .5rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    color: var(--muted);
    font-size: .85rem;
    text-decoration: none;
    transition: all .15s;
}
.roadmap-tab.active, .roadmap-tab:hover {
    border-color: var(--focus);
    color: var(--text);
    background: var(--surface2);
}
.roadmap-desc { color: var(--muted); font-size: .88rem; margin-bottom: 1.5rem; }
.roadmap-overall { margin-bottom: 2rem; }

.roadmap-timeline { display: flex; flex-direction: column; gap: 0; }
.roadmap-step {
    display: flex;
    gap: 1.25rem;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--line);
}
.roadmap-step:last-child { border-bottom: none; }
.roadmap-step-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
}
.roadmap-step.done    .roadmap-step-marker { border-color: var(--teal);  color: var(--teal); }
.roadmap-step.in-progress .roadmap-step-marker { border-color: var(--focus); color: var(--focus); }

.roadmap-step-body { flex: 1; min-width: 0; }
.roadmap-step-top  { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .4rem; }
.roadmap-step-day  { font-size: .72rem; color: var(--muted); font-family: var(--mono); margin-bottom: .15rem; }
.roadmap-step-title { font-weight: 600; font-size: .95rem; }
.roadmap-step-pct  { font-family: var(--mono); font-size: .82rem; color: var(--focus); }
.roadmap-step-progress { display: flex; flex-direction: column; gap: .3rem; }

/* ── Mobile nav ───────────────────────────────────────────────────────────── */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    padding: .25rem .5rem;
}
.nav-mobile-menu {
    display: none;
    flex-direction: column;
    background: var(--surface2);
    border-bottom: 1px solid var(--line);
    padding: .75rem 1rem;
    gap: .1rem;
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-menu a {
    padding: .6rem .5rem;
    color: var(--muted);
    text-decoration: none;
    font-size: .9rem;
    border-radius: var(--radius-sm);
    transition: background .15s;
}
.nav-mobile-menu a:hover { background: var(--surface); color: var(--text); }
.nav-mobile-menu .upgrade-link { color: var(--focus); font-weight: 600; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-hamburger { display: block; }
    .nav-signout { display: none; }
    .daily-cta-inner { flex-direction: column; align-items: flex-start; }
    .pricing-cards { grid-template-columns: 1fr; }
    .roadmap-step-top { flex-direction: column; gap: .3rem; }
    .topic-filters { flex-direction: column; gap: .75rem; }
}

@media (max-width: 600px) {
    .main-content { padding: 1.5rem 1rem; }
    .navbar { padding: 0 1rem; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .topics-grid { grid-template-columns: 1fr; }
    .q-row { flex-wrap: wrap; }
    .progress-strip { padding: 0 1rem; }
    .dash-header h1 { font-size: 1.5rem; }
}

/* ── System Design ────────────────────────────────────────────────────────── */

/* Page tabs (Concepts / Mock Questions) */
.sd-page-tabs {
    display: flex;
    gap: .375rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: .5rem;
}
.sd-tab {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.1rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    text-decoration: none;
    transition: color .15s, border-color .15s;
}
.sd-tab:hover { color: var(--text); text-decoration: none; }
.sd-tab-active {
    color: var(--text);
    border-bottom-color: var(--focus);
    background: transparent;
}
.sd-tab-count {
    font-size: .75rem;
    background: var(--surface2);
    border: 1px solid var(--line);
    color: var(--muted);
    padding: 1px 6px;
    border-radius: 10px;
}
.sd-tab-active .sd-tab-count {
    background: color-mix(in srgb, var(--focus) 12%, transparent);
    border-color: color-mix(in srgb, var(--focus) 30%, transparent);
    color: var(--focus);
}

/* Dashboard grid */
.sd-group-grid {
    /* Multi-column (not grid) so a short card lets the next card in its
       column flow up into the freed space, Pinterest-style, instead of
       every row reserving the height of its tallest card. */
    column-width: 310px;
    column-gap: 1.25rem;
    margin-top: 1rem;
}
.sd-group-card {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: border-color .2s;
    break-inside: avoid;
    margin-bottom: 1.25rem;
    display: inline-block;
    width: 100%;
}
.sd-group-card:hover { border-color: var(--focus); }
.sd-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .6rem;
}
.sd-group-title { font-weight: 700; font-size: .95rem; }
.sd-group-pct { font-family: var(--mono); font-size: .8rem; color: var(--focus); }
.sd-concept-list { display: flex; flex-direction: column; gap: .3rem; margin-top: .75rem; }
.sd-concept-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .4rem .55rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    font-size: .85rem;
    transition: background .12s;
    gap: .5rem;
}
.sd-concept-row:hover { background: var(--surface); text-decoration: none; }
.sd-concept-mastered .sd-concept-name { color: var(--green); }
.sd-concept-name { flex: 1; }
.sd-check { color: var(--green); font-weight: 700; font-size: .9rem; }

.pattern-solid-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 4px;
    background: var(--focus);
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    font-family: var(--mono);
    flex-shrink: 0;
    margin-right: .2rem;
}
.pattern-solid-tag-lg {
    width: 1.8rem;
    height: 1.8rem;
    font-size: .85rem;
    border-radius: 5px;
}

/* ── Patterns page ──────────────────────────────────────────────────────── */
.pat-group-grid {
    column-width: 280px;
    column-gap: 1rem;
    margin-top: 1rem;
}
.pat-group-card {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem 1rem;
    break-inside: avoid;
    margin-bottom: 1rem;
    width: 100%;
}
.pat-group-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: .55rem;
}
.pat-group-title {
    font-weight: 700;
    font-size: .9rem;
    color: var(--text);
}
.pat-group-frac {
    font-family: var(--mono);
    font-size: .75rem;
    color: var(--focus);
}
.pat-progress {
    height: 2px;
    background: var(--line);
    border-radius: 2px;
    margin-bottom: .9rem;
}
.pat-progress-fill {
    height: 100%;
    background: var(--focus);
    border-radius: 2px;
    transition: width .3s;
}
.pat-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.pat-row {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .38rem .45rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-size: .85rem;
    transition: background .12s;
}
.pat-row:hover { background: var(--surface); text-decoration: none; }
.pat-row-done .pat-name { color: var(--green); }
.pat-row-soon { cursor: default; opacity: .45; }
.pat-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 4px;
    background: var(--focus);
    color: #fff;
    font-size: .68rem;
    font-weight: 800;
    font-family: var(--mono);
    flex-shrink: 0;
}
.pat-name { flex: 1; min-width: 0; }
.pat-name-soon { color: var(--muted); }
.pat-check { color: var(--green); font-size: .82rem; font-weight: 700; flex-shrink: 0; }
.pat-diff {
    font-family: var(--mono);
    font-size: .62rem;
    font-weight: 800;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pat-diff-easy   { background: color-mix(in srgb, var(--teal) 15%, transparent); color: var(--green); }
.pat-diff-medium { background: color-mix(in srgb, var(--amber) 12%, transparent); color: var(--amber); }
.pat-diff-hard   { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.pat-soon-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
    opacity: .5;
}

.badge-soon {
    display: inline-block;
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: var(--surface);
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: .4rem;
    vertical-align: middle;
}

/* ── SD Concept layout ──────────────────────────────────────────────────── */
.sd-concept-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    align-items: start;
}
.sd-concept-main { min-width: 0; }
.sd-concept-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 1rem;
}

/* Visual diagram */
.sd-visual {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.sd-visual-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--muted);
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface2);
}
.sd-visual-body {
    padding: 1.5rem;
    overflow-x: auto;
    text-align: center;
}
/* Fix SVG font rendering — force font inheritance into SVG text nodes */
.sd-visual-body svg { max-width: 100%; display: block; margin: 0 auto; }
.sd-visual-body svg text { font-family: 'Inter', system-ui, sans-serif; }

/* Explanation card */
.sd-explanation-card {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.sd-explanation-card > .sd-section-block:first-child { border-top: none; }
.sd-section-block {
    border-top: 1px solid var(--line);
    padding: 1.5rem 1.75rem;
}

/* --- Heading hierarchy --- */
.sd-section-block h2 {
    font-family: var(--disp);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--focus);
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    letter-spacing: -.01em;
}
.sd-section-block h2::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 1.1em;
    background: var(--focus);
    border-radius: 2px;
    flex-shrink: 0;
}
.sd-section-block h3 {
    font-family: var(--disp);
    font-size: .875rem;
    font-weight: 600;
    color: var(--cyan);
    margin: 1.4rem 0 .5rem;
    letter-spacing: .01em;
}
.sd-section-block h3:first-child { margin-top: 0; }

/* --- Body text --- */
.sd-section-block p {
    color: var(--text);
    line-height: 1.85;
    margin-bottom: .85rem;
    font-size: .9rem;
}
.sd-section-block ul, .sd-section-block ol {
    padding-left: 1.4rem;
    margin-bottom: .85rem;
    color: var(--text);
    font-size: .9rem;
    line-height: 1.85;
}
.sd-section-block li { margin-bottom: .45rem; }
.sd-section-block strong { color: var(--amber); font-weight: 600; }

/* --- Inline code --- */
.sd-section-block code {
    font-family: var(--mono);
    font-size: .8em;
    background: color-mix(in srgb, var(--cyan) 10%, transparent);
    color: var(--cyan);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid color-mix(in srgb, var(--cyan) 18%, transparent);
}

/* --- Code blocks --- */
.sd-section-block pre {
    background: #1A2030;
    border: 1px solid var(--line);
    border-left: 3px solid var(--cyan);
    border-radius: var(--radius-sm);
    padding: 1.1rem 1.25rem;
    font-family: var(--mono);
    font-size: .8rem;
    color: var(--text);
    overflow-x: auto;
    margin: .85rem 0 1.1rem;
    line-height: 1.65;
}
.sd-section-block pre code {
    background: none;
    border: none;
    color: inherit;
    padding: 0;
    font-size: 1em;
}

/* --- Callout --- */
.sd-section-block .callout {
    background: color-mix(in srgb, var(--focus) 6%, transparent);
    border-left: 3px solid var(--focus);
    padding: .9rem 1.1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 1rem 0 .5rem;
    font-size: .875rem;
    color: var(--muted);
    line-height: 1.7;
}

/* --- Typed callouts (content presentation standard) ---
   Authored inside item content HTML or rendered via ui_callout().
   Base .callout gives the shape; the modifier sets accent + tint. */
.callout .callout-label {
    display: block;
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-bottom: .35rem;
    opacity: .85;
}
.callout--analogy { border-left-color: var(--cyan);  background: color-mix(in srgb, var(--cyan) 6%, transparent);  color: var(--text); }
.callout--signal  { border-left-color: var(--mint);  background: color-mix(in srgb, var(--mint) 6%, transparent); color: var(--text); }
.callout--gotcha  { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, transparent);  color: var(--text); }
.callout--hook    { border-left-color: var(--teal);  background: color-mix(in srgb, var(--teal) 6%, transparent);  color: var(--text); }
.callout--info    { border-left-color: var(--cyan);  background: color-mix(in srgb, var(--cyan) 6%, transparent);  color: var(--text); }
.callout--tip     { border-left-color: var(--mint);  background: color-mix(in srgb, var(--mint) 6%, transparent); color: var(--text); }
.callout--warn    { border-left-color: var(--coral); background: color-mix(in srgb, var(--coral) 7%, transparent); color: var(--text); }

/* --- TL;DR card (top of concept pages) --- */
.tldr-card {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--focus);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: .92rem;
    line-height: 1.7;
}
.tldr-card .tldr-label {
    display: block;
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--focus);
    margin-bottom: .4rem;
}

/* --- Recap card (bottom of concept pages, feeds future flashcards) --- */
.recap-card {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}
.recap-card .recap-label {
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--teal);
    margin-bottom: .6rem;
}
.recap-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .45rem; }
.recap-card ul li { font-size: .88rem; line-height: 1.6; padding-left: 1.2rem; position: relative; }
.recap-card ul li::before { content: '▸'; position: absolute; left: 0; color: var(--teal); }
.recap-card .recap-say {
    margin-top: .9rem;
    padding-top: .9rem;
    border-top: 1px dashed var(--line);
    font-size: .85rem;
    color: var(--muted);
}
.recap-card .recap-say strong { color: var(--focus); }

/* --- MCQ quiz (ui_quiz) --- */
.c-quiz {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.c-quiz-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    font-family: var(--mono);
    font-size: .78rem;
    color: var(--muted);
}
.c-quiz-progress .c-quiz-idx { color: var(--focus); font-weight: 700; }
.c-quiz-score { color: var(--teal); }
.c-quiz-best  { margin-left: auto; color: var(--muted); }
.c-quiz-code {
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .9rem 1.1rem;
    margin-bottom: 1rem;
    font-size: .82rem;
    overflow-x: auto;
}
.c-quiz-q { font-size: 1.02rem; line-height: 1.6; margin-bottom: 1.1rem; font-weight: 500; }
.c-quiz-opts { display: flex; flex-direction: column; gap: .6rem; }
.c-quiz-opt {
    text-align: left;
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    color: var(--text);
    font-size: .92rem;
    line-height: 1.5;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.c-quiz-opt:hover:not(:disabled) { border-color: var(--focus); }
.c-quiz-opt:disabled { cursor: default; }
.c-quiz-correct-opt { border-color: var(--success) !important; background: color-mix(in srgb, var(--teal) 10%, transparent); color: var(--text); }
.c-quiz-wrong-opt   { border-color: var(--danger)  !important; background: color-mix(in srgb, var(--danger) 8%, transparent); }
.c-quiz-explain {
    margin-top: 1rem;
    padding: .9rem 1.1rem;
    background: color-mix(in srgb, var(--focus) 6%, transparent);
    border-left: 3px solid var(--focus);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: .88rem;
    line-height: 1.7;
    color: var(--muted);
}
.c-quiz-explain strong { color: var(--text); }
.c-quiz-nav { margin-top: 1.1rem; display: flex; justify-content: flex-end; }
.c-quiz-done { text-align: center; padding: 1.5rem 0; }
.c-quiz-done-score { font-family: var(--disp); font-size: 2rem; font-weight: 800; color: var(--focus); margin-bottom: .4rem; }
.c-quiz-done-sub { color: var(--muted); font-size: .9rem; margin-bottom: 1.25rem; }

/* --- Data-interpretation tables (aptitude DI set summaries) --- */
.di-table { width: 100%; border-collapse: collapse; margin: .75rem 0; font-size: .88rem; }
.di-table th, .di-table td { border: 1px solid var(--line); padding: .45rem .7rem; text-align: center; }
.di-table th { background: var(--surface); color: var(--muted); font-family: var(--disp); font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.di-table td:first-child, .di-table th:first-child { text-align: left; }

/* --- Company intelligence (company_track.php) --- */
.co-tier-label { font-family: var(--disp); font-weight: 800; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 1rem 0 .4rem; }
.co-tabs { margin-bottom: .5rem; flex-wrap: wrap; }
.co-facts { display: grid; grid-template-columns: minmax(160px, 1fr) 2fr; gap: 1rem; margin: 1.5rem 0; }
.co-readiness { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .3rem; }
.co-readiness-num { font-family: var(--disp); font-size: 2.6rem; font-weight: 800; color: var(--focus); line-height: 1; }
.co-readiness-num span { font-size: 1.2rem; color: var(--muted); }
.co-readiness-label { font-size: .78rem; color: var(--text); line-height: 1.4; }
.co-readiness-label span { color: var(--muted); font-size: .72rem; }
.co-quickfacts { display: flex; flex-direction: column; gap: .6rem; justify-content: center; }
.co-quickfacts > div { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; border-bottom: 1px dashed var(--line); padding-bottom: .5rem; }
.co-quickfacts > div:last-child { border-bottom: none; padding-bottom: 0; }
.co-fact-k { color: var(--muted); font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.co-fact-v { color: var(--text); text-align: right; }

.co-rounds { display: flex; flex-direction: column; gap: .1rem; }
.co-round { display: flex; gap: 1rem; padding: .2rem 0; position: relative; }
.co-round-num { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 1px solid var(--focus); color: var(--focus); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: .82rem; font-weight: 700; }
.co-round:not(:last-child) .co-round-num::after { content: ''; position: absolute; left: 13px; top: 30px; width: 2px; height: calc(100% - 24px); background: var(--line); }
.co-round-body { padding-bottom: 1rem; }
.co-round-name { font-weight: 600; font-size: .95rem; }
.co-round-dur { color: var(--muted); font-family: var(--mono); font-size: .74rem; margin-left: .4rem; }
.co-round-fmt { color: var(--muted); font-size: .85rem; margin-top: .15rem; }

.co-focus { display: flex; flex-direction: column; gap: .9rem; }
.co-focus-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .3rem; }
.co-focus-name { font-size: .9rem; font-weight: 500; }
.co-focus-weight { color: var(--focus); font-family: var(--mono); font-size: .78rem; margin-left: .3rem; }
.co-focus-cov { color: var(--muted); font-family: var(--mono); font-size: .76rem; }
.co-focus-track { height: 10px; background: var(--ink); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; min-width: 60px; }
.co-focus-fill { height: 100%; background: linear-gradient(90deg, var(--teal), var(--focus)); border-radius: 6px; }

@media (max-width: 640px) { .co-facts { grid-template-columns: 1fr; } }

/* --- Mock exams (mock_exam.php) --- */
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; margin-top: 1.5rem; }
.exam-card { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; }
.exam-card-tier { align-self: flex-start; font-family: var(--mono); font-size: .64rem; text-transform: uppercase; letter-spacing: .12em; color: var(--focus); border: 1px solid var(--line); border-radius: 20px; padding: .15rem .6rem; margin-bottom: .75rem; }
.exam-card h3 { margin-bottom: .4rem; }
.exam-card-blurb { color: var(--muted); font-size: .86rem; line-height: 1.6; flex: 1; }
.exam-card-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0 .6rem; font-family: var(--mono); font-size: .76rem; color: var(--text); }
.exam-card-sections { display: flex; gap: .4rem; flex-wrap: wrap; }
.exam-sec-chip { font-size: .72rem; color: var(--muted); background: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: .18rem .5rem; }

.exam-bar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.25rem; margin-bottom: 1.5rem; }
.exam-bar-name { font-weight: 700; }
.exam-bar-sub { color: var(--muted); font-size: .8rem; font-family: var(--mono); }
.exam-timer { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; color: var(--teal); }
.exam-timer-warn { color: var(--coral); animation: exampulse 1s infinite; }
@keyframes exampulse { 50% { opacity: .5; } }

.exam-section-label { font-family: var(--disp); font-weight: 800; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--focus); margin: 1.5rem 0 .75rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.exam-q { display: flex; gap: 1rem; background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.1rem 1.25rem; margin-bottom: .9rem; }
.exam-q-num { flex-shrink: 0; font-family: var(--mono); font-size: .8rem; font-weight: 700; color: var(--muted); padding-top: .15rem; }
.exam-q-body { flex: 1; }
.exam-q-text { font-size: .96rem; line-height: 1.55; margin-bottom: .8rem; }
.exam-q-opts { display: flex; flex-direction: column; gap: .5rem; }
.exam-opt { display: flex; gap: .6rem; align-items: flex-start; background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .8rem; cursor: pointer; font-size: .9rem; line-height: 1.45; transition: border-color .12s; }
.exam-opt:hover { border-color: var(--focus); }
.exam-opt input { margin-top: .2rem; accent-color: var(--focus); }

.exam-actions { display: flex; align-items: center; gap: 1rem; margin: 1.5rem 0 2rem; }
.exam-actions-note { color: var(--muted); font-size: .82rem; }

.exam-score-card { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem; text-align: center; }
.exam-score-num { font-family: var(--disp); font-size: 2.4rem; font-weight: 800; color: var(--focus); }
.exam-score-num span { font-size: 1.3rem; color: var(--muted); }
.exam-score-sub { color: var(--text); margin: .5rem 0 1rem; }
.exam-score-sections { display: flex; flex-direction: column; gap: .4rem; max-width: 360px; margin: 0 auto; }
.exam-score-sec { display: flex; justify-content: space-between; font-size: .88rem; font-family: var(--mono); color: var(--muted); border-bottom: 1px dashed var(--line); padding-bottom: .35rem; }

.exam-review { border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--radius-sm); padding: 1rem 1.2rem; margin-bottom: .8rem; }
.exam-review-ok  { border-left-color: var(--success); }
.exam-review-bad { border-left-color: var(--danger); }
.exam-review-opts { display: flex; flex-direction: column; gap: .35rem; margin-top: .7rem; }
.exam-review-opt { font-size: .86rem; padding: .4rem .7rem; border-radius: 6px; background: var(--ink); color: var(--muted); }
.exam-opt-correct { background: color-mix(in srgb, var(--teal) 12%, transparent); color: var(--text); border: 1px solid var(--success); }
.exam-opt-wrong   { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--text); border: 1px solid var(--danger); }
.exam-review .c-quiz-explain { margin-top: .7rem; }

/* --- In-browser code runner (question.php) --- */
.runner-lang { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.runner-editor {
    width: 100%;
    min-height: 190px;
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--mono);
    font-size: .8rem;
    line-height: 1.6;
    padding: .9rem 1rem;
    resize: vertical;
    tab-size: 2;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}
.runner-editor:focus { outline: none; border-color: var(--focus); }

/* CodeMirror wrapper — replaces .runner-editor/.sd-notes when the vendor lib
   loaded; kept visually identical (same colors as assets/vendor/prism.css so
   a static code sample and a live editor read as one system). */
.cm-s-bbs.CodeMirror {
    background: var(--ink);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: .8rem;
    line-height: 1.6;
    height: auto;
}
.cm-s-bbs .CodeMirror-gutters { background: var(--ink); border-right: 1px solid var(--line); }
.cm-s-bbs .CodeMirror-linenumber { color: var(--muted); }
.cm-s-bbs .CodeMirror-cursor { border-left: 1px solid var(--text); }
.cm-s-bbs .CodeMirror-selected { background: color-mix(in srgb, var(--focus) 25%, transparent); }
.cm-s-bbs .CodeMirror-matchingbracket { color: var(--focus) !important; font-weight: 700; }
.cm-s-bbs .cm-comment                { color: #999; }
.cm-s-bbs .cm-string, .cm-s-bbs .cm-string-2 { color: #7ec699; }
.cm-s-bbs .cm-number                 { color: #f08d49; }
.cm-s-bbs .cm-atom                   { color: #f08d49; }
.cm-s-bbs .cm-keyword                { color: #cc99cd; }
.cm-s-bbs .cm-def, .cm-s-bbs .cm-variable-2 { color: #6196cc; }
.cm-s-bbs .cm-property, .cm-s-bbs .cm-attribute { color: #f8c555; }
.cm-s-bbs .cm-operator                { color: #67cdcc; }
.cm-s-bbs.CodeMirror-focused { border-color: var(--focus); }

.runner-actions { display: flex; align-items: center; gap: .75rem; margin-top: .8rem; flex-wrap: wrap; }
.runner-status { font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.runner-status.runner-ok   { color: var(--success); }
.runner-status.runner-fail { color: var(--danger); }
.runner-results { margin-top: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.runner-case { border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--radius-sm); padding: .6rem .9rem; font-size: .84rem; }
.runner-case.runner-pass      { border-left-color: var(--success); }
.runner-case.runner-fail-case { border-left-color: var(--danger); }
.runner-case-head { font-family: var(--mono); font-weight: 700; margin-bottom: .25rem; }
.runner-pass .runner-case-head      { color: var(--success); }
.runner-fail-case .runner-case-head { color: var(--danger); }
.runner-case-io { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.runner-case-io code { color: var(--text); background: var(--surface); padding: .05rem .35rem; border-radius: 4px; font-size: .82rem; }

/* --- Design mock (design_mock.php) --- */
.dm-prompt { background: var(--surface2); border: 1px solid var(--line); border-left: 3px solid var(--focus); border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin-bottom: 1.5rem; font-size: .95rem; line-height: 1.6; }
.dm-stage { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1rem; }
.dm-stage-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .5rem; }
.dm-stage-num { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 1px solid var(--focus); color: var(--focus); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: .8rem; font-weight: 700; }
.dm-stage-name { font-weight: 700; font-size: 1rem; }
.dm-stage-time { margin-left: auto; font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.dm-stage-guide { color: var(--muted); font-size: .88rem; line-height: 1.6; margin-bottom: .9rem; }
.dm-rubric { border-top: 1px dashed var(--line); padding-top: .8rem; }
.dm-rubric-label { font-family: var(--disp); font-weight: 800; font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .6rem; }
.dm-rubric-item { display: flex; gap: .6rem; align-items: flex-start; font-size: .89rem; line-height: 1.5; padding: .35rem 0; cursor: pointer; }
.dm-rubric-item input { margin-top: .2rem; accent-color: var(--success); flex-shrink: 0; }
.dm-rubric-item input:checked + span { color: var(--muted); text-decoration: line-through; }

/* --- Leaderboard (leaderboard.php) --- */
.lb-optnote { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem 1rem; margin: 1rem 0; font-size: .88rem; color: var(--muted); }
.lb-optnote strong { color: var(--focus); }
.lb-table { display: flex; flex-direction: column; gap: .4rem; margin-top: 1.25rem; }
.lb-row { display: flex; align-items: center; gap: 1rem; background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem 1rem; }
.lb-row-me { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 6%, transparent); }
.lb-pos { flex-shrink: 0; width: 34px; text-align: center; font-family: var(--mono); font-weight: 700; color: var(--muted); font-size: .95rem; }
.lb-pos-1, .lb-pos-2, .lb-pos-3 { font-size: 1.2rem; }
.lb-av { flex-shrink: 0; font-size: 1.5rem; width: 36px; text-align: center; }
.lb-name { flex: 1; min-width: 0; }
.lb-name-main { font-weight: 600; }
.lb-you { font-family: var(--mono); font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; background: var(--focus); color: var(--ink); border-radius: 4px; padding: .05rem .35rem; margin-left: .4rem; vertical-align: middle; }
.lb-name-sub { color: var(--muted); font-size: .78rem; font-family: var(--mono); }
.lb-metric { flex-shrink: 0; font-family: var(--mono); font-weight: 700; color: var(--focus); }
.lb-privacy { margin: 1.5rem 0; text-align: center; font-size: .82rem; color: var(--muted); }
.lb-opt-toggle { background: none; border: none; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: inherit; font-family: inherit; }
.lb-opt-toggle:hover { color: var(--focus); }

/* --- Global search (search.php) --- */
.search-box { margin: 1.25rem 0 .5rem; }
#search-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1.05rem;
    font-family: var(--body);
    padding: .95rem 1.2rem;
}
#search-input:focus { outline: none; border-color: var(--focus); }
.search-meta { font-family: var(--mono); font-size: .76rem; color: var(--muted); min-height: 1rem; margin-bottom: .5rem; }
.search-results { display: flex; flex-direction: column; gap: .4rem; }
.search-hit { display: flex; align-items: center; gap: .9rem; background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .65rem .9rem; text-decoration: none; transition: border-color .12s; }
.search-hit:hover { border-color: var(--focus); text-decoration: none; }
.search-badge { flex-shrink: 0; font-family: var(--disp); font-weight: 700; font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; padding: .2rem .5rem; border-radius: 5px; background: var(--surface); color: var(--muted); border: 1px solid var(--line); min-width: 92px; text-align: center; }
.search-hit-body { display: flex; flex-direction: column; min-width: 0; }
.search-hit-title { color: var(--text); font-weight: 500; }
.search-hit-sub { display: flex; gap: .5rem; margin-top: .1rem; }
.search-grp { color: var(--muted); font-size: .78rem; }
.search-co { color: var(--focus); font-size: .74rem; font-family: var(--mono); }
.search-empty { color: var(--muted); padding: 1.5rem; text-align: center; }
/* per-track badge accents */
.search-badge-code, .search-badge-dsa, .search-badge-programming_basics { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 35%, transparent); }
.search-badge-aptitude, .search-badge-cs_fundamentals, .search-badge-bigo { color: var(--mint); border-color: color-mix(in srgb, var(--mint) 35%, transparent); }
.search-badge-sd, .search-badge-lld, .search-badge-api_design, .search-badge-sd_mock { color: var(--focus); border-color: color-mix(in srgb, var(--focus) 35%, transparent); }
.search-badge-behavioral, .search-badge-patterns { color: var(--coral); border-color: color-mix(in srgb, var(--coral) 35%, transparent); }
.search-badge-sql, .search-badge-cheatsheets { color: var(--teal); border-color: color-mix(in srgb, var(--teal) 35%, transparent); }

/* --- Continue-where-you-left-off resume card (home.php) --- */
.resume-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--surface2); border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: var(--radius); padding: 1rem 1.4rem; margin-bottom: 1.5rem; text-decoration: none; transition: border-color .12s, transform .12s; }
.resume-card:hover { border-color: var(--teal); transform: translateY(-1px); text-decoration: none; }
.resume-card-eyebrow { font-family: var(--disp); font-weight: 800; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--teal); margin-bottom: .25rem; }
.resume-card-title { font-weight: 700; font-size: 1.02rem; color: var(--text); }
.resume-card-sub { color: var(--muted); font-size: .82rem; margin-top: .15rem; }
.resume-card-go { flex-shrink: 0; font-family: var(--disp); font-size: .85rem; color: var(--cyan); font-weight: 800; }

/* --- Flashcards (flashcards.php) --- */
.fc-bar { display: flex; justify-content: space-between; align-items: center; margin: 1.25rem 0; font-family: var(--mono); }
.fc-bar-name { font-weight: 700; }
.fc-bar-progress { color: var(--muted); font-size: .82rem; }
.fc-card { position: relative; min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.5rem 2rem; cursor: pointer; transition: border-color .12s; }
.fc-card:hover, .fc-card:focus { border-color: var(--focus); outline: none; }
.fc-face { font-size: 1.15rem; line-height: 1.7; max-width: 640px; }
.fc-front { font-weight: 600; }
.fc-back { color: var(--text); }
.fc-back .fc-beats { color: var(--muted); font-size: .88rem; }
.fc-back .fc-recap { list-style: none; padding: 0; margin: 0; text-align: left; display: inline-block; }
.fc-back .fc-recap li { padding-left: 1.2rem; position: relative; margin: .3rem 0; font-size: .96rem; }
.fc-back .fc-recap li::before { content: '▸'; position: absolute; left: 0; color: var(--teal); }
.fc-mnemonic { margin-top: .8rem; color: var(--focus); font-size: .92rem; }
.fc-track { font-family: var(--mono); font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: .1rem .4rem; vertical-align: middle; margin-left: .4rem; }
.fc-hint { position: absolute; bottom: .8rem; font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.fc-actions { display: flex; gap: .8rem; justify-content: center; margin-top: 1.25rem; }
.fc-controls { text-align: center; margin-top: .9rem; }

/* Floating print button (injected by app.js on concept pages) */
.print-fab { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 40; background: var(--surface2); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: .6rem .95rem; font-size: .82rem; cursor: pointer; box-shadow: var(--shadow); font-family: var(--body); }
.print-fab:hover { border-color: var(--focus); color: var(--focus); }

/* ── Print / revision-sheet stylesheet ─────────────────────────────────────── */
@media print {
    body { background: #fff !important; color: #000 !important; }
    /* Hide chrome: sidebar, nav, footers, interactive controls */
    .quest-log, aside, .site-footer, .breadcrumb, .sd-prevnext, .sd-reveal-btn,
    .btn, .star-rating, .sd-notes, .sd-notes-hint, .loot-hint, .nav-hamburger,
    .runner-card, .c-quiz, .exam-actions, .fc-actions, .fc-controls,
    .discussion, #discussion-list, .mock-bar, .print-fab { display: none !important; }
    .game-shell, .game-content, main { display: block !important; margin: 0 !important; padding: 0 !important; width: 100% !important; max-width: 100% !important; }
    .card, .sd-section, .sd-explanation-card, .tldr-card, .recap-card { background: #fff !important; border: 1px solid #ccc !important; color: #000 !important; box-shadow: none !important; page-break-inside: avoid; }
    .sd-section-hidden { display: block !important; } /* expand reveals for the printout */
    h1, h2, h3, .section-title, .sd-section-header h3 { color: #000 !important; }
    a { color: #000 !important; text-decoration: none !important; }
    pre, code { background: #f4f4f4 !important; color: #000 !important; border-color: #ddd !important; }
    .print-hint { display: none !important; }
}

/* --- Table --- */
.sd-section-block table {
    width: 100%;
    border-collapse: collapse;
    font-size: .855rem;
    margin: .75rem 0 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.sd-section-block th {
    background: var(--surface);
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .5rem .75rem;
    text-align: left;
}
.sd-section-block td {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    vertical-align: top;
}
.sd-section-block tr:last-child td { border-bottom: none; }

/* Resources */
.sd-resources { display: flex; flex-direction: column; gap: .5rem; }
.sd-resource-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .9rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    font-size: .875rem;
    transition: border-color .15s, background .15s;
}
.sd-resource-card:hover { border-color: var(--focus); background: var(--surface2); text-decoration: none; }
.sd-resource-icon { font-size: 1rem; width: 1.5rem; text-align: center; flex-shrink: 0; }
.sd-resource-title { flex: 1; font-size: .85rem; }
.sd-resource-type {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 2px 6px;
}
.sd-resource-arrow { color: var(--muted); font-size: .85rem; margin-left: .25rem; }

/* Sidebar cards */
.sd-sidebar-card {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.sd-sidebar-card-header {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--muted);
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.sd-sidebar-card-body { padding: 1rem; }

/* Star rating (SD) */
.star-rating {
    display: flex;
    gap: .35rem;
    margin-bottom: .5rem;
}
.star-rating .s {
    font-size: 1.5rem;
    color: var(--star-off);
    cursor: pointer;
    transition: color .1s, transform .1s;
    line-height: 1;
    user-select: none;
    background: none;
    border: none;
    font-family: inherit;
    /* Taller (not wider) hit area — widening would overlap neighboring
       stars in this tightly-packed row; the glyph itself is already ~26px,
       clearing WCAG's 24px small-target floor. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 2px;
    margin: -10px -2px;
}
.star-rating .s:hover { transform: scale(1.2); }
.star-rating .s.on { color: var(--star-on); }
.star-rating .s:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 3px;
    border-radius: 3px;
}
.star-rating-labels {
    display: flex;
    justify-content: space-between;
    font-size: .7rem;
    color: var(--muted);
    margin-bottom: .75rem;
}

/* Notes textarea */
.sd-notes {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--mono);
    font-size: .8rem;
    padding: .6rem .8rem;
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}
.sd-notes:focus { outline: none; border-color: var(--focus); }
.sd-notes-hint { font-size: .72rem; color: var(--muted); margin-top: .35rem; }

/* Prev/next */
.sd-prevnext {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-top: 1.5rem;
    gap: 1rem;
}
.sd-prevnext-side:first-child { justify-self: start; }
.sd-prevnext-side:last-child { justify-self: end; }
.sd-prevnext-pos {
    justify-self: center;
    font-size: .8rem;
    color: var(--muted);
    white-space: nowrap;
}

/* ── SD Mock page ───────────────────────────────────────────────────────── */
.sd-framework { background: var(--surface2); }
.sd-framework-title {
    font-weight: 700;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
    margin-bottom: .75rem;
}
.sd-framework-steps { display: flex; flex-direction: column; gap: .4rem; }
.sd-framework-step {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
    cursor: pointer;
    color: var(--text-muted);
}
.sd-framework-step input { accent-color: var(--focus); }

.sd-section {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--focus);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: .85rem;
    transition: border-color .2s;
}
.sd-section-hidden {
    display: none;
}
.sd-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.sd-section-header h3 {
    margin: 0;
    font-family: var(--disp);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -.01em;
}
.sd-reveal-btn { min-width: 80px; }
.sd-section-content {
    color: var(--text);
    line-height: 1.85;
    font-size: .9rem;
    /* Scroll container for any table that's too wide to fit — keeps table
       column widths natural/readable instead of squeezing them to fit.
       Safe on a container with no fixed height (nothing here ever needs to
       clip vertically, text just wraps normally as it always did). */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.sd-section-content h2 {
    font-family: var(--disp);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--focus);
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    letter-spacing: -.01em;
}
.sd-section-content h2::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 1.1em;
    background: var(--focus);
    border-radius: 2px;
    flex-shrink: 0;
}
.sd-section-content h3 {
    font-family: var(--disp);
    font-size: .875rem;
    font-weight: 600;
    color: var(--cyan);
    margin: 1.4rem 0 .5rem;
    letter-spacing: .01em;
}
.sd-section-content h3:first-child { margin-top: 0; }
.sd-section-content p { margin-bottom: .85rem; }
.sd-section-content ul, .sd-section-content ol {
    padding-left: 1.4rem;
    margin-bottom: .85rem;
    font-size: .9rem;
    line-height: 1.85;
}
.sd-section-content li { margin-bottom: .45rem; }
.sd-section-content strong { color: var(--amber); font-weight: 600; }
.sd-section-content code {
    font-family: var(--mono);
    font-size: .8em;
    background: color-mix(in srgb, var(--cyan) 10%, transparent);
    color: var(--cyan);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid color-mix(in srgb, var(--cyan) 18%, transparent);
}
.sd-section-content pre {
    background: #1A2030;
    border: 1px solid var(--line);
    border-left: 3px solid var(--cyan);
    border-radius: var(--radius-sm);
    padding: 1.1rem 1.25rem;
    font-family: var(--mono);
    font-size: .76rem;
    color: var(--text);
    overflow-x: auto;
    margin: .85rem 0 1.1rem;
    line-height: 1.65;
}
.sd-section-content pre code {
    background: none;
    border: none;
    color: inherit;
    padding: 0;
    font-size: 1em;
}
.sd-section-content .callout {
    background: color-mix(in srgb, var(--focus) 6%, transparent);
    border-left: 3px solid var(--focus);
    padding: .9rem 1.1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 1rem 0 .5rem;
    font-size: .875rem;
    color: var(--muted);
    line-height: 1.7;
}
.sd-section-content ol { padding-left: 1.6rem; }
.sd-section-content ol li { list-style: decimal; }
.sd-section-content table {
    /* width:100% stretches when content fits; the browser safely ignores it
       (renders wider) rather than force-wrapping when it doesn't. The
       .sd-section-content container below is the actual scroll boundary. */
    width: 100%;
    border-collapse: collapse;
    font-size: .855rem;
    margin: .75rem 0 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.sd-section-content th {
    background: var(--surface);
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .5rem .75rem;
    text-align: left;
}
.sd-section-content td {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    vertical-align: top;
}
.sd-section-content tr:last-child td { border-bottom: none; }

@media (max-width: 900px) {
    .sd-concept-layout { grid-template-columns: 1fr; }
    .sd-concept-sidebar { position: static; }
}
@media (max-width: 600px) {
    .sd-group-grid { column-width: auto; column-count: 1; }
    .pat-group-grid { column-width: auto; column-count: 1; }
    .topics-grid { column-width: auto; column-count: 1; }
    .sd-prevnext { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: .5rem; }
    .sd-prevnext-side:first-child, .sd-prevnext-side:last-child { justify-self: center; }
    .sd-prevnext-pos { order: -1; }
}

/* ── Behavioral ───────────────────────────────────────────────────────────── */

/* Top bar: progress + tabs */
.beh-topbar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.beh-progress-wrap { width: 100%; }
.beh-progress-label {
    font-size: .8rem;
    color: var(--muted);
    margin-top: .35rem;
}
.beh-tabs {
    display: flex;
    gap: .5rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0;
}
.beh-tab {
    text-decoration: none;
    font-family: var(--mono);
    font-size: .8rem;
    font-weight: 500;
    letter-spacing: .04em;
    padding: .55rem 1.1rem;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color .15s, border-color .15s;
    margin-bottom: -1px;
}
.beh-tab:hover { color: var(--text); }
.beh-tab.beh-tab-active {
    color: var(--focus);
    border-bottom-color: var(--focus);
}

/* Panels */
.beh-panel { display: none; }
.beh-panel.beh-panel-active { display: block; }

/* Story chip badges */
.beh-story-chip {
    font-family: var(--mono);
    font-size: .72rem;
    font-weight: 600;
    color: var(--focus);
    background: color-mix(in srgb, var(--focus) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--focus) 25%, transparent);
    border-radius: 999px;
    padding: 1px 8px;
    white-space: nowrap;
}

/* Legend below question list */
.beh-star-legend {
    font-size: .78rem;
    color: var(--muted);
    margin-top: 1.25rem;
    font-family: var(--mono);
}

/* Memory hook callout */
.beh-hook {
    background: color-mix(in srgb, var(--focus) 7%, transparent);
    border: 1px solid color-mix(in srgb, var(--focus) 20%, transparent);
    border-left: 3px solid var(--focus);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: .75rem 1rem;
    font-family: var(--mono);
    font-size: .85rem;
    color: var(--focus);
    line-height: 1.6;
    margin-bottom: 1.25rem;
}
.beh-hook-lg {
    font-size: .9rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.beh-hook-label {
    display: block;
    font-size: .68rem;
    letter-spacing: .12em;
    color: var(--amber);
    margin-bottom: .3rem;
    opacity: .7;
}

/* Story accordion */
.beh-accordion {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    overflow: hidden;
    transition: border-color .15s;
}
.beh-accordion:hover { border-color: color-mix(in srgb, var(--focus) 30%, transparent); }
.beh-accordion-head {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}
.beh-accordion-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
}
.beh-accordion-left {
    display: flex;
    align-items: center;
    gap: .85rem;
}
.beh-story-num {
    font-family: var(--mono);
    font-size: .72rem;
    font-weight: 700;
    color: var(--focus);
    background: color-mix(in srgb, var(--focus) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--focus) 25%, transparent);
    border-radius: var(--radius-sm);
    padding: .25rem .6rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.beh-accordion-title {
    font-family: var(--disp);
    font-size: .95rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
}
.beh-accordion-sub {
    font-size: .78rem;
    color: var(--muted);
    margin-top: .15rem;
}
.beh-impact-pill {
    font-family: var(--mono);
    font-size: .7rem;
    color: var(--teal);
    background: color-mix(in srgb, var(--teal) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--teal) 20%, transparent);
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
    align-self: flex-start;
}
.beh-chev {
    color: var(--focus);
    font-family: var(--mono);
    font-size: 1.1rem;
    transition: transform .2s;
    flex-shrink: 0;
}
.beh-accordion.beh-open .beh-chev { transform: rotate(90deg); }
.beh-accordion-body {
    display: none;
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid var(--line);
}
.beh-accordion.beh-open .beh-accordion-body { display: block; }

/* STAR grid inside accordion / question page */
.beh-star-grid { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.beh-star-row { display: grid; grid-template-columns: 1.5rem 1fr; gap: .75rem; }
.beh-star-key {
    font-family: var(--mono);
    font-size: .85rem;
    font-weight: 700;
    color: var(--focus);
    padding-top: .15rem;
    flex-shrink: 0;
}
.beh-star-val {
    font-size: .875rem;
    color: var(--muted);
    line-height: 1.65;
}
.beh-star-val strong { color: var(--text); }

/* Use-for tags */
.beh-use-for { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.beh-use-for-label {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .1em;
    color: var(--muted);
    margin-right: .25rem;
}
.beh-tag {
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--cyan);
    background: color-mix(in srgb, var(--cyan) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--cyan) 20%, transparent);
    border-radius: 999px;
    padding: 2px 9px;
}

/* STAR timing card */
.beh-timing-card {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    margin-top: 1.5rem;
}
.beh-timing-title {
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: .1em;
    color: var(--muted);
    margin-bottom: .85rem;
    text-transform: uppercase;
}
.guide-table-scroll {
    /* Scroll container — keeps .guide-table's own column widths natural
       instead of squeezing them to fit. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.guide-table th {
    text-align: left;
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 .6rem .6rem;
    border-bottom: 1px solid var(--line);
}
.guide-table td {
    padding: .65rem .6rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    color: var(--text);
}
.guide-table tr:last-child td { border-bottom: none; }
.guide-table td:nth-child(3),
.guide-table td:nth-child(4) {
    font-family: var(--mono);
    font-size: .8rem;
    color: var(--focus);
    white-space: nowrap;
}
.beh-timing-grid { display: flex; flex-direction: column; gap: .5rem; }
.beh-timing-row {
    display: grid;
    grid-template-columns: 1.5rem 1fr auto;
    gap: .75rem;
    align-items: center;
    font-size: .85rem;
}
.beh-timing-label { color: var(--muted); }
.beh-timing-val {
    font-family: var(--mono);
    font-size: .78rem;
    color: var(--focus);
    white-space: nowrap;
}

/* Stories intro text */
.beh-stories-intro {
    font-size: .875rem;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    max-width: 620px;
}

/* Key beats list on question page */
.beh-beats-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}
.beh-beats-list li {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    font-size: .875rem;
    color: var(--text);
    line-height: 1.6;
}
.beh-beats-list li::before {
    content: "✓";
    color: var(--mint);
    font-size: .8rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: .2rem;
}

/* Principal-level tip */
.beh-tip-card {
    background: color-mix(in srgb, var(--cyan) 5%, transparent);
    border: 1px solid color-mix(in srgb, var(--cyan) 18%, transparent);
    border-left: 3px solid var(--cyan);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.beh-tip-label {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .12em;
    color: var(--cyan);
    margin-bottom: .4rem;
    opacity: .8;
}
.beh-tip-body {
    font-size: .875rem;
    color: var(--text);
    line-height: 1.7;
}

/* Behavioral star rating */
.beh-star-rating { display: flex; gap: .35rem; margin-bottom: .6rem; cursor: pointer; }
.beh-star {
    font-size: 1.6rem;
    color: var(--star-off);
    transition: color .1s, transform .1s;
    user-select: none;
}
.beh-star.on  { color: var(--star-on); }
.beh-star.hover { color: var(--focus); transform: scale(1.15); }

/* Mock drill */
.beh-mock-wrap { width: 100%; }
.beh-mock-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    text-align: center;
}
.beh-mock-meta {
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: .12em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: .85rem;
}
.beh-mock-q {
    font-family: var(--disp);
    font-size: 1.15rem;
    line-height: 1.4;
    color: var(--text);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .75rem;
}
.beh-mock-timer {
    font-family: var(--mono);
    font-size: .95rem;
    color: var(--mint);
    min-height: 1.4rem;
    margin-bottom: 1rem;
}
.beh-mock-btns { display: flex; gap: .65rem; justify-content: center; flex-wrap: wrap; }
.beh-mock-hint {
    display: none;
    margin-top: 1.25rem;
    text-align: left;
    background: var(--surface2);
    border-radius: var(--radius-sm);
    padding: 1rem 1.1rem;
}
.beh-mock-hint.beh-mock-hint-show { display: block; }
.beh-mock-beat {
    font-size: .855rem;
    color: var(--text);
    padding: .3rem 0;
    border-bottom: 1px solid var(--line);
    line-height: 1.55;
}
.beh-mock-beat:last-child { border-bottom: none; }

/* Self-score checklist */
.beh-self-score {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
}
.beh-self-score-title {
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: .1em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: .75rem;
}
.beh-checklist {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.beh-checklist li {
    font-size: .855rem;
    color: var(--muted);
    padding: .4rem 0 .4rem 1.5rem;
    position: relative;
    border-bottom: 1px solid var(--line);
    line-height: 1.5;
}
.beh-checklist li:last-child { border-bottom: none; }
.beh-checklist li::before {
    content: "☐";
    position: absolute;
    left: 0;
    color: var(--teal);
    font-size: .9rem;
}

/* Story accordion on question page variant */
.beh-accordion-story { margin-bottom: .85rem; }

@media (max-width: 600px) {
    .beh-accordion-head { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .beh-mock-q { font-size: 1rem; min-height: 60px; }
}

/* ── Scroll-spy TOC (Phase 6.5) ───────────────────────────────────────────── */
/* Floats in the right gutter beside the 900px content column. Position and
 * visibility are driven by assets/scrollspy.js, which measures the real gutter
 * (the quest-log sidebar offsets the content) and only reveals the panel via
 * `.is-visible` when it fits without overlapping — falls back to nothing. */
.spy-toc {
    display: none;
    position: fixed;
    top: 96px;
    right: 1rem;
    width: 190px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding: .9rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 24px rgba(0,0,0,.35);
    font-family: var(--body);
    z-index: 40;
}
.spy-toc.is-visible { display: block; }

.spy-toc-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .6rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--line);
}
.spy-toc-title {
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}
.spy-toc-count {
    font-size: .68rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-weight: 700;
}
.spy-toc.is-complete .spy-toc-count { color: var(--success); }

.spy-toc-list { list-style: none; margin: 0; padding: 0; }

.spy-toc-item {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .1rem 0;
}

.spy-toc-tick {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    margin-top: .28rem;
    padding: 0;
    border: 1.5px solid var(--faint);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: border-color .12s ease, background .12s ease;
}
.spy-toc-tick:hover { border-color: var(--muted); }
.spy-toc-item.is-read .spy-toc-tick {
    background: var(--success);
    border-color: var(--success);
}
.spy-toc-item.is-read .spy-toc-tick::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid var(--ink);
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.spy-toc-link {
    flex: 1 1 auto;
    display: block;
    font-size: .82rem;
    line-height: 1.35;
    color: var(--muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    padding-left: .5rem;
    margin-left: -.1rem;
    transition: color .12s ease, border-color .12s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.spy-toc-link:hover { color: var(--text); }
.spy-toc-item.is-active .spy-toc-link {
    color: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}
.spy-toc-item.is-read .spy-toc-link { color: var(--muted); }
.spy-toc-item.is-read.is-active .spy-toc-link { color: var(--accent); }

/* Callout / note block (inserted by the admin WYSIWYG editor). */
.callout {
    margin: 1rem 0; padding: .85rem 1rem; border-radius: 10px;
    background: var(--bg-card-2, rgba(127,127,127,.08));
    border-left: 3px solid var(--accent, #6366f1);
    font-size: .95rem;
}
