/* Doctor Feelbad — design system.
   One stylesheet for the whole site. Tokens first (light, then dark), then
   Bootstrap overrides, then the site's own components. Legacy --hospital-*
   names are kept as aliases so older templates keep working untouched. */

:root {
    --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

    --bg: #f3f8f7;
    --surface: #ffffff;
    --surface-2: #eef4f3;
    --surface-3: #e3ecea;
    --ink: #16302d;
    --ink-2: #44605c;
    --muted: #7a918d;
    --border: #d9e6e3;
    --border-strong: #b9cfca;

    --primary: #0f9d8f;
    --primary-ink: #0b6b62;
    --primary-deep: #0d3f3a;
    --primary-soft: #d6f2ed;
    --primary-glow: rgba(15,157,143,.18);

    --accent: #ff7a59;
    --accent-ink: #c2410c;
    --accent-soft: #ffe7de;

    --ok: #16a34a;      --ok-ink: #14532d;   --ok-soft: #dcfce7;
    --bad: #e5484d;     --bad-ink: #9f1239;  --bad-soft: #fee2e2;
    --warn: #f5a524;    --warn-ink: #92400e; --warn-soft: #fff3d6;
    --info: #3b82f6;    --info-ink: #1e3a8a; --info-soft: #dbeafe;
    --violet: #7c3aed;  --violet-soft: #ede9fe;

    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow-1: 0 1px 2px rgba(22,48,45,.05), 0 6px 20px rgba(22,48,45,.06);
    --shadow-2: 0 10px 34px rgba(22,48,45,.14);
    --shadow-glow: 0 0 0 4px var(--primary-glow);

    /* Aliases for older templates */
    --hospital-bg: var(--bg);
    --hospital-primary: var(--primary);
    --hospital-dark: var(--primary-deep);
    --hospital-accent: #14b8a6;
    --hospital-light: var(--primary-soft);
    --hospital-border: var(--border);
    --hospital-correct: var(--ok);
    --hospital-wrong: var(--bad);
    --hospital-warn: var(--warn);

    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0e1817;
    --surface: #152322;
    --surface-2: #1b2c2a;
    --surface-3: #223634;
    --ink: #e4efed;
    --ink-2: #b4c8c4;
    --muted: #7e9692;
    --border: #253c39;
    --border-strong: #35524e;

    --primary: #2fd3c0;
    --primary-ink: #8ff0e2;
    --primary-deep: #cdeee9;
    --primary-soft: #133d38;
    --primary-glow: rgba(47,211,192,.22);

    --accent: #ff8f73;
    --accent-ink: #ffb59f;
    --accent-soft: #3c231c;

    --ok: #34d399;      --ok-ink: #a7f3d0;   --ok-soft: #12352a;
    --bad: #f87171;     --bad-ink: #fecaca;  --bad-soft: #3b1d1f;
    --warn: #fbbf24;    --warn-ink: #fde68a; --warn-soft: #3a2e14;
    --info: #60a5fa;    --info-ink: #bfdbfe; --info-soft: #1a2a45;
    --violet: #a78bfa;  --violet-soft: #2b2249;

    --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --shadow-2: 0 12px 40px rgba(0,0,0,.5);
    --hospital-accent: #2fd3c0;
    color-scheme: dark;
}

/* ---------- base ---------- */
html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex; flex-direction: column;
}
body > .page-body { flex: 1 0 auto; }
a { color: var(--primary-ink); }
a:hover { color: var(--primary); }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.text-muted { color: var(--muted) !important; }
code, pre, .mono { font-family: var(--mono); }
hr { border-color: var(--border); opacity: 1; }
[x-cloak] { display: none !important; }
::selection { background: var(--primary-soft); }

/* ---------- Bootstrap re-skin ---------- */
.card {
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-1);
}
.card .card { box-shadow: none; }
.btn { border-radius: 999px; font-weight: 700; letter-spacing: .01em;
       transition: transform .12s ease, box-shadow .12s ease, background .12s ease; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-ink); border-color: var(--primary-ink); color: #fff; box-shadow: var(--shadow-glow); }
[data-theme="dark"] .btn-primary { color: #06201d; }
[data-theme="dark"] .btn-primary:hover { color: #06201d; background: var(--primary-ink); border-color: var(--primary-ink); }
.btn-outline-primary { color: var(--primary-ink); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-outline-secondary { color: var(--ink-2); border-color: var(--border-strong); }
.btn-outline-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--ink); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-ink); }
.btn-soft:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-link { color: var(--primary-ink); }
.btn-outline-danger { color: var(--bad); border-color: var(--bad); }
.btn-outline-danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-outline-warning { color: var(--warn-ink); border-color: var(--warn); }
.btn-outline-light { color: #fff; border-color: rgba(255,255,255,.5); }
.form-control, .form-select {
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: var(--shadow-glow); background: var(--surface); color: var(--ink); }
.form-control::placeholder { color: var(--muted); }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--ink-2); }
.badge { border-radius: 999px; font-weight: 700; }
.table { color: var(--ink); --bs-table-bg: transparent; --bs-table-color: var(--ink);
         --bs-table-border-color: var(--border); --bs-table-hover-bg: var(--surface-2); --bs-table-hover-color: var(--ink); }
.table-light, .table > thead.table-light th { background: var(--surface-2); color: var(--ink-2); --bs-table-bg: var(--surface-2); --bs-table-color: var(--ink-2); }
.alert { border-radius: var(--radius-sm); }
.alert-success { background: var(--ok-soft); color: var(--ok-ink); border-color: transparent; }
.alert-danger { background: var(--bad-soft); color: var(--bad-ink); border-color: transparent; }
.alert-warning { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.alert-info { background: var(--info-soft); color: var(--info-ink); border-color: transparent; }
.dropdown-menu { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
                 box-shadow: var(--shadow-2); padding: .4rem; }
.dropdown-item { color: var(--ink); border-radius: var(--radius-xs); font-weight: 600; display: flex; align-items: center; gap: .55rem; }
.dropdown-item:hover { background: var(--surface-2); color: var(--ink); }
.dropdown-item.active, .dropdown-item:active { background: var(--primary); color: #fff; }
.dropdown-item.disabled { opacity: .45; }
.dropdown-divider { border-color: var(--border); }
.bg-white { background: var(--surface) !important; }
.border { border-color: var(--border) !important; }
.text-dark { color: var(--ink) !important; }
.bg-light { background: var(--surface-2) !important; }
.modal-content { background: var(--surface); color: var(--ink); border-radius: var(--radius); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.list-group-item { background: var(--surface); color: var(--ink); border-color: var(--border); }

/* ---------- icons ---------- */
.lucide, svg.lucide { width: 1.1em; height: 1.1em; vertical-align: -0.2em; stroke-width: 2.2; }
.ico { display: inline-flex; align-items: center; justify-content: center; }
.ico-lg .lucide { width: 1.6em; height: 1.6em; }

/* ---------- navbar ---------- */
.navbar { background: var(--primary-deep) !important; padding: .55rem 0; }
[data-theme="dark"] .navbar { background: #0a1514 !important; border-bottom: 1px solid var(--border); }
.navbar-brand { color: #fff !important; display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), #5eead4);
              display: inline-flex; align-items: center; justify-content: center; color: #06201d; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.brand-mark .lucide { width: 18px; height: 18px; stroke-width: 2.6; }
.navbar .nav-link { color: rgba(255,255,255,.78) !important; font-weight: 700; border-radius: 999px; padding: .38rem .8rem !important;
                    display: inline-flex; align-items: center; gap: .4rem; }
.navbar .nav-link:hover { color: #fff !important; background: rgba(255,255,255,.08); }
.navbar .nav-link.nav-active { color: #fff !important; background: rgba(255,255,255,.14); box-shadow: none; }
.navbar-toggler { border-color: rgba(255,255,255,0.3); }
.navbar-toggler-icon { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); }
.nav-icon-btn { color: rgba(255,255,255,.8); background: rgba(255,255,255,.08); border: none; width: 36px; height: 36px;
                border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.nav-icon-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.scope-picker .scope-current {
    display: inline-flex; flex-direction: column; line-height: 1.1; align-items: flex-start;
    background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22);
    border-radius: 12px; padding: .28rem .7rem !important; margin-left: .25rem;
}
.scope-picker .scope-current:hover { background: rgba(255,255,255,.18); }
.scope-label { font-size: .58rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; font-weight: 700; }
.scope-value { font-size: .86rem; font-weight: 800; color: #fff; }
.scope-menu { min-width: 260px; max-height: 70vh; overflow-y: auto; }
.scope-heading { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; padding: .35rem .9rem .15rem; }
.dropdown-submenu { position: relative; }
.dropdown-submenu > .dropdown-menu { top: 0; left: 100%; margin-top: -0.35rem; }
@media (max-width: 991.98px) {
    .scope-picker .scope-current { margin: .4rem 0; }
    .navbar .nav-link { display: flex; }
}

/* ---------- page header ---------- */
.page-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: .9rem 0 1rem; margin-bottom: 1.5rem; }
.page-crumb { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--primary-ink); font-weight: 800; }
.page-crumb .crumb-sep { opacity: .5; margin: 0 .2rem; }
.page-crumb .crumb-section { color: var(--muted); }
.page-title { font-size: 1.45rem; font-weight: 800; margin: 0; color: var(--ink); }

/* ---------- system colour chips ----------
   One hue per system, used everywhere a system is named so the eye learns
   them: question badges, stats bars, the mastery grid, game decks. */
.sys-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .16em .6em; border-radius: 999px;
            font-size: .68rem; font-weight: 800; letter-spacing: .01em;
            background: color-mix(in srgb, var(--sys, var(--primary)) 18%, var(--surface));
            color: color-mix(in srgb, var(--sys, var(--primary)) 70%, var(--ink)); }
[data-theme="dark"] .sys-chip { background: color-mix(in srgb, var(--sys, var(--primary)) 26%, var(--surface));
                                color: color-mix(in srgb, var(--sys, var(--primary)) 70%, #fff); }
.sys-dot { width: .6em; height: .6em; border-radius: 50%; background: var(--sys, var(--primary)); display: inline-block; }
.sci-chip { --sys: var(--violet); }
.tag-chip { display: inline-flex; align-items: center; gap: .25rem; padding: .16em .55em; border-radius: 999px;
            font-size: .64rem; font-weight: 800; background: var(--surface-2); color: var(--ink-2);
            font-family: var(--mono); letter-spacing: 0; }

/* ---------- pills / meters ---------- */
.pill { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .2em .7em; font-weight: 800; font-size: .72rem; }
.pill-ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill-bad { background: var(--bad-soft); color: var(--bad-ink); }
.pill-warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill-info { background: var(--info-soft); color: var(--info-ink); }
.pill-soft { background: var(--primary-soft); color: var(--primary-ink); }
.meter { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .4s ease; }
.ring { --p: 0; --size: 44px; width: var(--size); height: var(--size); border-radius: 50%;
        background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-3) 0);
        display: inline-grid; place-items: center; }
.ring::after { content: ''; width: calc(var(--size) - 10px); height: calc(var(--size) - 10px); border-radius: 50%; background: var(--surface); grid-area: 1/1; }
.ring > span { grid-area: 1/1; z-index: 1; font-size: .62rem; font-weight: 800; color: var(--ink); }

/* ---------- hero / feature cards ---------- */
.hero-card { border-radius: var(--radius); background: linear-gradient(135deg, var(--primary-deep), #0f9d8f 140%); color: #fff; padding: 1.4rem 1.6rem; position: relative; overflow: hidden; }
.hero-card::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.07); }
.hero-card .btn-light { color: var(--primary-deep); font-weight: 800; }
.feature-card { display: flex; gap: 1rem; align-items: flex-start; text-decoration: none; color: inherit; transition: transform .18s ease, box-shadow .18s ease; }
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); color: inherit; }
.feature-icon { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
                background: var(--primary-soft); color: var(--primary-ink); }
.feature-icon .lucide { width: 22px; height: 22px; }
.feature-icon.accent { background: var(--accent-soft); color: var(--accent-ink); }
.feature-icon.warn { background: var(--warn-soft); color: var(--warn-ink); }
.feature-icon.info { background: var(--info-soft); color: var(--info-ink); }

/* ---------- mascot ---------- */
.mascot { position: relative; display: inline-block; }
.mascot img { display: block; width: 100%; height: auto; filter: drop-shadow(0 6px 14px rgba(22,48,45,.18)); }
.mascot-idle img { animation: mascot-breathe 3.2s ease-in-out infinite; }
.mascot-thinking img { animation: mascot-sway 2.4s ease-in-out infinite; }
.mascot-happy img { animation: mascot-hop .8s cubic-bezier(.34,1.56,.64,1) 2; }
.mascot-sick img { animation: mascot-shiver .5s ease-in-out 3; }
@keyframes mascot-breathe { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-3px) scale(1.015); } }
@keyframes mascot-sway { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
@keyframes mascot-hop { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-14px) scale(1.05); } 100% { transform: translateY(0) scale(1); } }
@keyframes mascot-shiver { 0%,100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-4px) rotate(-3deg); } 75% { transform: translateX(4px) rotate(3deg); } }
.speech { display: inline-block; background: var(--surface); border: 1.5px solid var(--border); border-radius: 16px;
          padding: .35rem .8rem; font-weight: 700; font-size: .8rem; color: var(--ink); position: relative; box-shadow: var(--shadow-1); max-width: 100%; }
.speech::before { content: ''; position: absolute; top: -7px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-bottom-color: var(--border); }
.speech::after { content: ''; position: absolute; top: -5px; left: 50%; margin-left: -5px; border: 5px solid transparent; border-bottom-color: var(--surface); }
.speech-ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok-ink); }
.speech-ok::after { border-bottom-color: var(--ok-soft); } .speech-ok::before { border-bottom-color: var(--ok); }
.speech-bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad-ink); }
.speech-bad::after { border-bottom-color: var(--bad-soft); } .speech-bad::before { border-bottom-color: var(--bad); }
.mascot-pick { cursor: pointer; border: 2px solid var(--border); border-radius: var(--radius); padding: .8rem; background: var(--surface); transition: all .15s ease; text-align: center; height: 100%; }
.mascot-pick:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.mascot-pick.is-current { border-color: var(--primary); box-shadow: var(--shadow-glow); }
.mascot-pick img { width: 110px; height: auto; }
.mascot-states { display: flex; justify-content: center; gap: .3rem; margin-top: .4rem; }
.mascot-states img { width: 34px; height: auto; opacity: .85; }
@media (prefers-reduced-motion: reduce) { .mascot img, .heartbeat-path, .confetti-burst { animation: none !important; } }

/* ---------- question page ---------- */
.q-shell { max-width: 1120px; margin: 0 auto; }
.hud-bar { background: var(--primary-deep); color: #fff; border-radius: var(--radius-sm); padding: .4rem .75rem; margin-bottom: .5rem;
           display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
[data-theme="dark"] .hud-bar { background: var(--surface-2); border: 1px solid var(--border); color: var(--ink); }
.hud-btn { font-size: .78rem; font-weight: 700; color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
           border-radius: 999px; padding: .16rem .7rem; display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; }
.hud-btn:hover { background: rgba(255,255,255,.22); color: #fff; }
[data-theme="dark"] .hud-btn { color: var(--ink); background: var(--surface-3); border-color: var(--border); }
.hud-btn .lucide { width: .95em; height: .95em; }
.hud-round { display: inline-flex; align-items: center; gap: .45rem; font-size: .74rem; font-weight: 700; margin-left: auto; }
.hud-round .ring { --size: 30px; }
.hud-round .ring::after { background: var(--primary-deep); }
[data-theme="dark"] .hud-round .ring::after { background: var(--surface-2); }
.hud-round .ring > span { color: #fff; font-size: .55rem; }
[data-theme="dark"] .hud-round .ring > span { color: var(--ink); }
.hud-timer { font-family: var(--mono); font-size: .78rem; opacity: .85; }

.q-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 1rem 1.15rem; margin-bottom: .6rem; }
.q-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
.q-layout.rail-hidden { grid-template-columns: minmax(0, 1fr); }
.q-layout.rail-hidden .q-rail { display: none; }
.q-stem { font-size: 1.02rem; line-height: 1.6; color: var(--ink); }
.q-rail { position: sticky; top: .75rem; }
.rail-toggle { position: absolute; right: .6rem; top: .6rem; }
.q-fig-img { max-height: 280px; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: zoom-in;
             transition: border-color .15s ease, box-shadow .15s ease; }
.q-fig-img:hover { border-color: var(--primary); box-shadow: var(--shadow-1); }
.fig-hint { font-size: .65rem; color: var(--muted); display: flex; gap: .5rem; justify-content: center;
            align-items: center; margin-top: .25rem; }
.fig-hint .lucide { width: .9em; height: .9em; }
/* The exhibit lives in the rail on a wide screen with the panel open. Any time
   the rail is not showing it, the inline copy under the stem takes over. */
.inline-figs { display: none; }
.q-layout.rail-hidden .inline-figs { display: block; }
.q-layout.rail-hidden .q-fig-img { max-height: 420px; }

.answer-btn { text-align: left; width: 100%; background: var(--surface); color: var(--ink);
              border: 2px solid var(--border); border-radius: 12px; padding: .6rem .85rem .6rem .7rem; font-size: .95rem; line-height: 1.4;
              display: flex; align-items: flex-start; gap: .6rem; transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease; }
.answer-btn .key { flex: 0 0 1.5rem; height: 1.5rem; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); font-size: .7rem; font-weight: 800;
                   display: inline-flex; align-items: center; justify-content: center; margin-top: .05rem; font-family: var(--mono); }
.answer-btn:hover:not(:disabled):not(.stricken) { transform: translateX(4px); border-color: var(--primary); background: var(--primary-soft); box-shadow: var(--shadow-1); }
.answer-btn:hover:not(:disabled):not(.stricken) .key { background: var(--primary); color: #fff; }
.answer-btn:disabled { cursor: default; }
.answer-btn.stricken { text-decoration: line-through; opacity: .38; background: var(--surface-2); }
.answer-btn.correct { background: var(--ok-soft) !important; border-color: var(--ok) !important; color: var(--ok-ink) !important; font-weight: 700; animation: answer-pop .35s ease; }
.answer-btn.correct .key { background: var(--ok); color: #fff; }
.answer-btn.incorrect { background: var(--bad-soft) !important; border-color: var(--bad) !important; color: var(--bad-ink) !important; animation: answer-shake .4s ease; }
.answer-btn.incorrect .key { background: var(--bad); color: #fff; }
@keyframes answer-pop { 0% { transform: scale(1); } 40% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes answer-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.strike-btn { flex: 0 0 auto; border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); border-radius: 10px; width: 2rem; font-size: .8rem; }
.strike-btn:hover { border-color: var(--bad); color: var(--bad); }
.strike-btn.on { background: var(--bad-soft); border-style: solid; border-color: var(--bad); color: var(--bad); }
.result-banner { border-radius: 12px; padding: .6rem .9rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.expl-card { border-left: 5px solid var(--warn); background: var(--warn-soft); border-radius: var(--radius-sm); padding: .9rem 1rem; color: var(--ink); animation: rise .3s ease; }
[data-theme="dark"] .expl-card { background: #2a2416; }
.expl-card .rich-text { font-size: .93rem; line-height: 1.55; }
.kbd { font-family: var(--mono); font-size: .66rem; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35em; color: var(--ink-2); background: var(--surface-2); }
.shortcut-hint { font-size: .68rem; color: var(--muted); display: flex; gap: .8rem; flex-wrap: wrap; }

.study-tools { display: flex; gap: .5rem; align-items: stretch; }
.hl-col { flex: 0 0 auto; display: flex; flex-direction: column; gap: 3px; }
.hl-title { font-size: .58rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); line-height: 1.1; }
.hl-row { display: flex; align-items: center; gap: 4px; }
.hl-chip { flex: 0 0 16px; width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid rgba(0,0,0,.12); cursor: pointer; padding: 0; position: relative; transition: transform .1s, box-shadow .1s; }
.hl-chip:hover { transform: scale(1.15); }
.hl-chip.active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--primary-glow); }
.hl-pink { background: #fbcfe8; } .hl-blue { background: #bfdbfe; } .hl-green { background: #bbf7d0; } .hl-yellow { background: #fef08a; }
.hl-erase { border-style: dashed; border-color: var(--border-strong); background: var(--surface); font-size: .55rem; line-height: 1; }
.hl-erase.active { border-style: solid; background: var(--surface-2); }
.hl-label { width: 78px; font-size: .6rem; line-height: 1.15; color: var(--muted); background: none; border: none; padding: 0 2px;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; border-radius: 3px; }
.hl-label:hover { background: var(--surface-2); color: var(--ink); }
.hl-label:focus { outline: 1px solid var(--primary); background: var(--surface); color: var(--ink); }
.hl-label-static { color: var(--muted); cursor: default; }
.notes-col { flex: 1 1 auto; min-width: 0; display: flex; }
.notes-wrap { position: relative; flex: 1 1 auto; display: flex; }
.notes-box { width: 100%; resize: none; font-size: .78rem; line-height: 1.35; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
             padding: .35rem .5rem; color: var(--ink); background: var(--surface); min-height: 92px; }
.notes-box:focus { outline: none; border-color: var(--primary); }
.notes-count { position: absolute; right: 6px; bottom: 4px; font-size: .55rem; color: var(--muted); line-height: 1; background: var(--surface); padding-left: 3px; pointer-events: none; }
.rich-text mark.hl { padding: 0; border-radius: 2px; color: inherit; background-color: transparent; }
mark.hl-c-pink { background-color: #fbcfe8 !important; } mark.hl-c-blue { background-color: #bfdbfe !important; }
mark.hl-c-green { background-color: #bbf7d0 !important; } mark.hl-c-yellow { background-color: #fef08a !important; }
[data-theme="dark"] mark.hl { color: #111 !important; }
.q-stem.arming { cursor: text; }

.scoreboard { border-left: 5px solid var(--primary); }
.score-inline { font-size: .82rem; display: flex; justify-content: center; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.score-inline .score-pct { font-weight: 800; font-size: 1rem; }
.score-inline .score-detail { color: var(--muted); font-size: .7rem; }
.score-window-input { width: 3.6em; font-size: .8rem; font-weight: 700; text-align: center; color: var(--ink-2); background: transparent;
                      border: 1px solid transparent; border-bottom-color: var(--border-strong); border-radius: 3px; padding: 0 2px; margin: 0 1px; -moz-appearance: textfield; }
.score-window-input::-webkit-outer-spin-button, .score-window-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-window-input:focus { outline: none; color: var(--ink); background: var(--surface); border-color: var(--primary); }
.cat-groups { display: flex; gap: .9rem; align-items: flex-start; }
.cat-group-system { flex: 1 1 58%; min-width: 0; } .cat-group-science { flex: 1 1 42%; min-width: 0; border-left: 1px solid var(--border); padding-left: .75rem; }
.cat-group-title { font-size: .6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; line-height: 1.2; }
.cat-title-system { color: var(--primary-ink); } .cat-title-science { color: var(--violet); }
.cat-stat-row { font-size: .66rem; padding: .12rem .25rem; line-height: 1.3; display: flex; justify-content: space-between; align-items: center; gap: .3rem; }
.pct-high { color: var(--ok); font-weight: 800; } .pct-medium { color: var(--warn); font-weight: 800; } .pct-low { color: var(--bad); font-weight: 800; }
.heartbeat-svg { width: 100%; height: 10px; color: var(--primary); opacity: .3; }
.heartbeat-path { stroke-dasharray: 800; stroke-dashoffset: 800; animation: heartbeat-draw 4s linear infinite; }
@keyframes heartbeat-draw { 0% { stroke-dashoffset: 800; } 100% { stroke-dashoffset: 0; } }

/* Readiness widget in the practice rail. The full breakdown lives on the
   readiness page; this is the at-a-glance version. */
.readiness-widget .stat-label { margin-bottom: .15rem; }
.readiness-widget .widget-figure { display: flex; align-items: baseline; gap: .4rem; line-height: 1.1; }
.readiness-widget .widget-figure > span:first-child { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.readiness-widget .widget-row { display: flex; align-items: baseline; gap: .35rem; flex-wrap: wrap; font-size: .74rem; margin-top: .2rem; }
.readiness-widget .band { font-size: .58rem; }
.readiness-widget .heartbeat-svg { height: 8px; }
.readiness-widget .widget-link { display: inline-flex; align-items: center; gap: .25rem; margin-top: .5rem;
                                 font-size: .72rem; font-weight: 800; color: var(--primary-ink); text-decoration: none; }
.readiness-widget .widget-link:hover { color: var(--primary); }
.readiness-widget .widget-link .lucide { width: .9em; height: .9em; }

.round-summary { text-align: center; }
.round-summary .big { font-size: 3.4rem; font-weight: 800; line-height: 1; color: var(--primary-ink); }

@media (max-width: 991.98px) {
    .q-layout { grid-template-columns: 1fr; }
    .q-rail { position: static; }
    .rail-figs { display: none; }      /* the inline copy under the stem takes over */
    .inline-figs { display: block; }
}
@media (max-width: 575.98px) {
    .cat-groups { flex-direction: column; gap: .4rem; }
    .cat-group-science { border-left: none; padding-left: 0; }
    .cat-stats-grid .col-3, .cat-stats-grid .col-4 { flex: 0 0 50%; max-width: 50%; }
    .q-stem { font-size: .98rem; }
}

/* ---------- image zoom / calculator / labs (question page overlays) ---------- */
.image-modal-overlay { position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; flex-direction: column; }
.image-modal-controls { position: absolute; top: 1rem; right: 1rem; display: flex; gap: .5rem; z-index: 9001; }
.image-modal-controls button, .image-modal-controls span { min-width: 36px; text-align: center; }
.image-modal-scroll { overflow: auto; max-height: 85vh; max-width: 95vw; border-radius: 8px; }
.image-modal-scroll img { display: block; border-radius: 8px; transition: width .15s ease; max-width: 85vw; max-height: 80vh; }
.calc-panel { position: fixed; z-index: 8000; width: 260px; background: var(--primary-deep); border-radius: 14px; box-shadow: var(--shadow-2); overflow: hidden; user-select: none; }
[data-theme="dark"] .calc-panel { background: #0a1514; border: 1px solid var(--border); }
.calc-titlebar { display: flex; justify-content: space-between; align-items: center; padding: .4rem .75rem; color: #fff; font-size: .8rem; font-weight: 700; cursor: grab; background: rgba(0,0,0,.2); }
.calc-titlebar:active { cursor: grabbing; }
.calc-display { background: #0f3d38; color: #5eead4; font-family: var(--mono); font-size: 1.5rem; font-weight: 700; text-align: right; padding: .5rem .75rem; min-height: 2.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calc-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 4px; }
.calc-btn { background: #1a5c54; color: #fff; border: none; padding: .6rem 0; font-size: 1rem; font-weight: 600; border-radius: 6px; cursor: pointer; transition: background .1s; }
.calc-btn:hover { background: #1e6e64; } .calc-btn:active { background: #0d4a44; transform: scale(.96); }
.calc-fn { background: #2d7a70; color: #b2f5ea; } .calc-fn:hover { background: #359085; }
.calc-op { background: #0d9488; color: #fff; } .calc-op:hover { background: #0fb9ab; } .calc-op.active { background: #14b8a6; box-shadow: inset 0 0 0 2px #5eead4; }
.calc-eq { background: #10b981; color: #fff; } .calc-eq:hover { background: #34d399; } .calc-zero { grid-column: span 2; }
.lab-overlay { position: fixed; inset: 0; z-index: 8500; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.lab-panel { background: var(--surface); color: var(--ink); border-radius: 14px; width: 100%; max-width: 720px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-2); overflow: hidden; }
.lab-header { background: var(--primary-deep); color: #fff; padding: .5rem .75rem; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
[data-theme="dark"] .lab-header { background: var(--surface-3); color: var(--ink); }
.lab-tabs { display: flex; gap: 2px; padding: .3rem .5rem; background: var(--surface-2); overflow-x: auto; flex-shrink: 0; -webkit-overflow-scrolling: touch; }
.lab-tabs::-webkit-scrollbar { height: 3px; } .lab-tabs::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.lab-tab { padding: .25rem .6rem; font-size: .72rem; font-weight: 700; border: none; border-radius: 999px; background: transparent; color: var(--ink-2); cursor: pointer; white-space: nowrap; transition: all .15s; }
.lab-tab:hover { background: var(--surface-3); color: var(--ink); } .lab-tab.active { background: var(--primary); color: #fff; }
.lab-body { overflow-y: auto; padding: .5rem; flex: 1; -webkit-overflow-scrolling: touch; }
.lab-section-title { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--primary-ink); padding: .3rem .4rem .15rem; margin-top: .3rem; border-bottom: 2px solid var(--border); }
.lab-table { width: 100%; border-collapse: collapse; font-size: .75rem; margin-bottom: .5rem; }
.lab-table th { text-align: left; font-size: .65rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: .2rem .4rem; border-bottom: 1px solid var(--border); }
.lab-table td { padding: .25rem .4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.lab-table tr:nth-child(even) td { background: var(--surface-2); }
.lab-table .lab-test { font-weight: 700; color: var(--ink); min-width: 140px; }
.lab-table .lab-val { color: var(--ink-2); white-space: nowrap; font-family: var(--mono); font-size: .72rem; }
.lab-table .lab-si { color: var(--muted); font-size: .7rem; white-space: nowrap; }
.lab-note { font-size: .68rem; color: var(--muted); font-style: italic; padding-left: .4rem; }
@media (max-width: 576px) { .lab-panel { max-width: 100%; max-height: 92vh; border-radius: 8px; } .lab-table .lab-si { display: none; } .lab-tab { font-size: .65rem; padding: .2rem .45rem; } }

/* ---------- legacy question-page bars (admin pages still use these) ---------- */
.hospital-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .75rem; margin-bottom: .5rem; box-shadow: var(--shadow-1); }
.explanation-box { background: var(--warn-soft); border-left: 4px solid var(--warn); border-radius: var(--radius-xs); color: var(--ink); }
.stat-card { border-left: 4px solid var(--primary); }
.tag-badge { cursor: pointer; font-size: .7rem; } .tag-badge:hover { opacity: .8; }
.system-badge { font-size: .6rem; padding: .2em .55em; font-weight: 700; letter-spacing: .3px; }

/* ---------- exam block ---------- */
.exam-bar { position: sticky; top: 0; z-index: 50; background: var(--primary-deep); color: #fff; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
            padding: .5rem .9rem; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; box-shadow: var(--shadow-1); }
[data-theme="dark"] .exam-bar { background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); }
.exam-timer { font-family: var(--mono); font-size: 1.15rem; font-weight: 700; letter-spacing: .02em; }
.exam-timer.low { color: #fecaca; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.exam-cell { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
             font-size: .7rem; font-weight: 800; display: flex; align-items: center; justify-content: center; text-decoration: none; position: relative; }
.exam-cell.done { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); }
.exam-cell.now { outline: 2px solid var(--accent); outline-offset: 1px; }
.exam-cell.marked::after { content: ''; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.exam-cell:hover { border-color: var(--primary); }
.exam-result-hero { display: grid; grid-template-columns: auto 1fr; gap: 1.4rem; align-items: center; }
.exam-score { font-size: 3.6rem; font-weight: 800; line-height: 1; color: var(--primary-ink); }
.exam-item { border-left: 4px solid var(--border); padding-left: .9rem; }
.exam-item.right { border-left-color: var(--ok); } .exam-item.wrong { border-left-color: var(--bad); } .exam-item.skipped { border-left-color: var(--warn); }
.rank-row { display: flex; align-items: center; gap: .7rem; padding: .45rem .5rem; border-radius: var(--radius-xs); }
.rank-row.me { background: var(--primary-soft); }
.rank-num { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); font-weight: 800; font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; }
.rank-row:first-child .rank-num { background: var(--warn); color: #fff; }
@media (max-width: 575.98px) { .exam-result-hero { grid-template-columns: 1fr; text-align: center; } }

/* ---------- statistics ---------- */
.viz { --viz-1: var(--info); --viz-2: #eb6834; --viz-cov: #9ec5f4; --viz-pos: var(--info); --viz-neg: var(--bad);
       --viz-grid: var(--border); --viz-axis: var(--border-strong); --viz-mute: var(--muted); --viz-ink: var(--ink); --viz-ink2: var(--ink-2); }
.stat-row { display: grid; gap: .75rem; margin-bottom: 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow-1); }
.stat-hero { background: linear-gradient(135deg, var(--surface) 55%, var(--primary-soft)); }
.stat-label { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-sub { font-weight: 600; text-transform: none; letter-spacing: 0; opacity: .85; }
.stat-value { font-size: 2.1rem; font-weight: 800; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-hero .stat-value { font-size: 2.8rem; color: var(--primary-ink); }
.stat-unit { font-size: 1rem; font-weight: 700; color: var(--muted); margin-left: 1px; }
.stat-ci { font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.stat-foot { font-size: .72rem; color: var(--ink-2); margin-top: .2rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.band { font-weight: 800; border-radius: 999px; padding: .05rem .5rem; font-size: .64rem; text-transform: uppercase; letter-spacing: .05em; color: #fff; }
.band-strong { background: var(--ok); } .band-on-track { background: var(--ok); opacity: .85; } .band-shaky { background: var(--warn); } .band-needs-work { background: var(--bad); }
.delta { font-weight: 800; } .delta-up { color: var(--ok); } .delta-down { color: var(--bad); } .delta-flat { color: var(--muted); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.panel-title { font-weight: 800; margin: 0; color: var(--ink); font-size: .98rem; display: inline-flex; align-items: center; gap: .4rem; }
.panel-title .lucide { color: var(--primary-ink); }
.panel-note { font-size: .68rem; color: var(--muted); }
.focus-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .5rem; border-radius: var(--radius-sm); text-decoration: none; color: inherit; border-bottom: 1px solid var(--border); }
.focus-row:last-child { border-bottom: none; } .focus-row:hover { background: var(--surface-2); color: inherit; }
.focus-rank { width: 1.6rem; height: 1.6rem; flex-shrink: 0; border-radius: 50%; background: var(--sys, var(--viz-1)); color: #fff; font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.focus-body { flex: 1; min-width: 0; } .focus-name { display: block; font-weight: 700; font-size: .88rem; color: var(--ink); }
.focus-why { display: block; font-size: .7rem; color: var(--ink-2); } .focus-go { font-size: .7rem; font-weight: 800; color: var(--primary-ink); white-space: nowrap; }
.strength-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .45rem; }
.strength-name { flex: 0 0 42%; font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: .35rem; }
.strength-bar { flex: 1; height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.strength-bar i { display: block; height: 100%; background: var(--sys, var(--viz-1)); border-radius: 4px; }
.strength-pct { font-size: .76rem; font-weight: 800; width: 3rem; text-align: right; font-variant-numeric: tabular-nums; }
.chart-box { position: relative; height: 260px; } .chart-short { height: 170px; }
.legend { display: flex; gap: 1rem; justify-content: center; margin-top: .5rem; font-size: .7rem; color: var(--ink-2); flex-wrap: wrap; }
.key { display: inline-flex; align-items: center; gap: .35rem; } .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; } .swatch-thin { height: 4px; }
.cat-row { display: flex; align-items: center; gap: .5rem; padding: .2rem 0; } .cat-thin { opacity: .55; }
.cat-name { flex: 0 0 38%; font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: .35rem; }
.cat-track { flex: 1; height: 12px; background: var(--surface-3); border-radius: 3px; position: relative; overflow: hidden; }
.cat-fill { position: absolute; left: 0; top: 0; height: 8px; background: var(--sys, var(--viz-1)); border-radius: 3px; }
.cat-ci { position: absolute; top: 2px; height: 4px; background: rgba(0,0,0,.18); border-radius: 2px; }
[data-theme="dark"] .cat-ci { background: rgba(255,255,255,.28); }
.cat-cov { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--viz-cov); }
.cat-pct { font-size: .74rem; font-weight: 800; width: 2.9rem; text-align: right; font-variant-numeric: tabular-nums; }
.cat-n { font-size: .64rem; color: var(--muted); width: 2.2rem; text-align: right; font-variant-numeric: tabular-nums; }
.cat-key { display: flex; gap: .8rem; font-size: .64rem; color: var(--muted); margin-top: .5rem; align-items: center; flex-wrap: wrap; }
.cat-key span { display: inline-flex; align-items: center; gap: .3rem; } .cat-key-end { margin-left: auto; }
.move-row { display: flex; align-items: center; gap: .5rem; padding: .18rem 0; }
.move-name { flex: 0 0 26%; font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move-track { flex: 1; height: 12px; position: relative; background: var(--surface-2); border-radius: 3px; }
.move-zero { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--viz-axis); }
.move-bar { position: absolute; top: 2px; height: 8px; border-radius: 3px; } .move-pos { background: var(--viz-pos); } .move-neg { background: var(--viz-neg); }
.move-val { font-size: .72rem; font-weight: 800; width: 3rem; text-align: right; font-variant-numeric: tabular-nums; }
.move-detail { font-size: .66rem; color: var(--muted); width: 6.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.table-toggle { background: none; border: none; font-size: .8rem; font-weight: 800; color: var(--ink); padding: 0; }
.table-wrap { overflow-x: auto; margin-top: .6rem; }
.stat-table { width: 100%; font-size: .72rem; border-collapse: collapse; }
.stat-table th, .stat-table td { padding: .3rem .5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.stat-table th { text-align: left; color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: .62rem; letter-spacing: .04em; }
.stat-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.gate-row { display: flex; align-items: center; gap: .7rem; padding: .5rem .3rem; border-bottom: 1px solid var(--border); font-size: .84rem; }
.gate-row:last-child { border-bottom: none; }
.gate-ok { color: var(--ok); } .gate-no { color: var(--muted); }
.gate-val { margin-left: auto; font-size: .7rem; color: var(--ink-2); text-align: right; }
.grid-wrap { overflow-x: auto; }
.mastery { border-collapse: separate; border-spacing: 3px; font-size: .68rem; }
.mastery th { font-weight: 800; color: var(--ink-2); font-size: .62rem; text-align: left; padding: .1rem .3rem; white-space: nowrap; }
.mastery th.col { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; padding: .3rem .1rem; }
.mastery td { width: 34px; height: 30px; border-radius: 6px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--muted); }
.mastery td.has { color: #fff; }
.mastery td.thin { opacity: .55; border: 1px dashed var(--border-strong); }
.mastery td.none { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 3px, var(--surface-3) 3px, var(--surface-3) 6px); }
.mastery td.sticky, .mastery th.sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; width: auto; min-width: 150px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 991.98px) { .stat-row { grid-template-columns: 1fr 1fr; } .stat-hero { grid-column: 1 / -1; } }
@media (max-width: 575.98px) { .stat-row { grid-template-columns: 1fr; } .cat-name, .strength-name { flex-basis: 45%; } .move-detail { display: none; } }

/* ---------- games ---------- */
.game-card, .deck-card { transition: all .18s ease; border: 1px solid var(--border); display: flex; flex-direction: column; }
a .game-card:hover, a .deck-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--primary); }
.game-empty { opacity: .5; }
.game-icon { width: 44px; height: 44px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-ink); display: inline-flex; align-items: center; justify-content: center; margin-bottom: .5rem; }
.game-icon .lucide { width: 22px; height: 22px; }
.game-count { font-size: .68rem; color: var(--primary-ink); font-weight: 800; margin-top: .5rem; }
.deck-meta { font-size: .68rem; color: var(--muted); margin-top: .5rem; display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.deck-best { margin-left: auto; color: var(--primary-ink); font-weight: 800; }
.badge.level-easy { background: var(--ok); } .badge.level-medium { background: var(--warn); } .badge.level-hard { background: var(--bad); }
.game-wrap { max-width: 900px; margin: 0 auto; }
.game-bar { display: flex; align-items: center; gap: .75rem; background: var(--primary-deep); color: #fff; border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: .5rem .75rem; }
[data-theme="dark"] .game-bar { background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); border-bottom: none; }
.game-back { border-color: rgba(255,255,255,.4); color: #fff !important; padding: 0 .5rem; }
.game-title { display: flex; align-items: baseline; gap: .5rem; font-weight: 800; min-width: 0; }
.game-bar-icon { font-size: 1.1rem; } .game-bar-sub { font-size: .68rem; opacity: .7; font-weight: 400; white-space: nowrap; }
.game-stats { margin-left: auto; display: flex; gap: .6rem; font-size: .78rem; }
.game-stat { background: rgba(255,255,255,.14); border-radius: 999px; padding: .1rem .55rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.game-stat-miss { color: #fecaca; }
.game-progress { height: 4px; background: var(--surface-3); } .game-progress-fill { height: 100%; background: var(--accent); transition: width .3s ease; }
.game-board { background: var(--surface); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding: 1rem; }
.game-shake { animation: gshake .35s; } @keyframes gshake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.game-note { background: var(--warn-soft); border-left: 4px solid var(--warn); border-radius: var(--radius-xs); padding: .6rem .8rem; margin-top: .75rem; font-size: .84rem; color: var(--ink); }
.game-note-title { font-weight: 800; color: var(--ink); margin-bottom: .15rem; }
.game-done { text-align: center; margin-top: 1rem; }
.game-done-score { font-size: 3rem; font-weight: 800; color: var(--primary-ink); line-height: 1; }
.game-new-best { color: var(--warn-ink); font-weight: 800; margin-bottom: .5rem; }
.game-how { font-size: .72rem; text-align: center; margin-top: .75rem; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.match-head { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .3rem; }
.match-card { display: block; width: 100%; text-align: left; margin-bottom: .3rem; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); border-radius: 10px; padding: .45rem .6rem; font-size: .8rem; transition: all .15s; }
.match-card:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.match-picked { background: var(--info-soft) !important; border-color: var(--info) !important; font-weight: 700; }
.match-live { border-style: dashed; }
.match-done { background: var(--ok-soft) !important; border-color: var(--ok) !important; color: var(--ok-ink); opacity: .75; }
.match-wrong { background: var(--bad-soft) !important; border-color: var(--bad) !important; }
.mem-meta { font-size: .72rem; margin-bottom: .5rem; }
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; }
.mem-card { aspect-ratio: 4/3; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--primary-deep); color: #fff; font-size: .7rem; padding: .3rem; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; transition: all .2s; }
.mem-card:hover:not(.mem-up) { transform: scale(1.03); }
.mem-up { background: var(--surface); color: var(--ink); border-color: var(--primary); }
.mem-done { background: var(--ok-soft); border-color: var(--ok); color: var(--ok-ink); opacity: .8; }
.mem-back { font-size: 1.3rem; }
.seq-slot { display: flex; align-items: center; gap: .5rem; border-radius: 10px; padding: .4rem .55rem; margin-bottom: .3rem; font-size: .8rem; }
.seq-filled { background: var(--ok-soft); border: 1px solid var(--ok); color: var(--ok-ink); }
.seq-next { background: var(--surface-2); border: 1px dashed var(--border-strong); }
.seq-num { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--primary); color: #fff; font-size: .68rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.seq-tiles { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .9rem; border-top: 1px solid var(--border); padding-top: .75rem; }
.seq-tile { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); border-radius: 10px; padding: .35rem .6rem; font-size: .78rem; }
.seq-tile:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.seq-used { display: none; } .seq-wrong { background: var(--bad-soft); border-color: var(--bad); }
.odd-wrap { text-align: center; } .odd-prompt { font-size: 1rem; font-weight: 700; color: var(--ink); } .odd-count { font-size: .7rem; margin-bottom: .8rem; }
.odd-options { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.odd-option { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); border-radius: 12px; padding: .7rem .5rem; font-size: .84rem; }
.odd-option:hover:not(.odd-locked) { border-color: var(--primary); background: var(--primary-soft); }
.odd-right { background: var(--ok-soft) !important; border-color: var(--ok) !important; font-weight: 700; }
.odd-wrong { background: var(--bad-soft) !important; border-color: var(--bad) !important; }
.basket-queue-head { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .35rem; }
.basket-items { display: flex; flex-wrap: wrap; gap: .3rem; min-height: 2rem; }
.basket-item { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .25rem .65rem; font-size: .78rem; cursor: grab; }
.basket-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.basket-held { background: var(--info-soft) !important; border-color: var(--info) !important; font-weight: 700; }
.basket-hint { font-size: .7rem; margin-top: .35rem; }
.basket-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; margin-top: .9rem; }
.basket-bin { border: 2px dashed var(--border-strong); border-radius: 12px; padding: .45rem; min-height: 5.5rem; }
.basket-over { border-color: var(--primary); background: var(--primary-soft); }
.basket-bin-head { font-size: .72rem; font-weight: 800; color: var(--ink); margin-bottom: .3rem; }
.basket-bin-body { display: flex; flex-wrap: wrap; gap: .2rem; }
.basket-chip { background: var(--ok-soft); border: 1px solid var(--ok); color: var(--ok-ink); border-radius: 999px; padding: .1rem .45rem; font-size: .68rem; }
.basket-empty { font-size: .66rem; color: var(--muted); font-style: italic; }
.label-bank { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .4rem; }
.label-chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .25rem .6rem; font-size: .76rem; cursor: grab; }
.label-chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.label-held { background: var(--info-soft) !important; border-color: var(--info) !important; font-weight: 700; }
.diagram-wrap { position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.diagram-svg { width: 100%; height: auto; display: block; }
.label-spot { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.label-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--primary); background: rgba(255,255,255,.85); }
.label-spot-over .label-dot { background: var(--accent); transform: scale(1.3); }
.label-spot-wrong .label-dot { border-color: var(--bad); background: var(--bad-soft); }
.label-spot-done .label-dot { background: var(--primary); }
.label-text { background: var(--ok-soft); border: 1px solid var(--ok); color: var(--ok-ink); border-radius: 4px; padding: 0 .3rem; font-size: .64rem; white-space: nowrap; }
.bio-table { border-collapse: separate; border-spacing: 4px; margin: 0 auto; font-variant-numeric: tabular-nums; }
.bio-table th { font-size: .66rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: .2rem .5rem; text-align: center; }
.bio-table td { background: var(--surface-2); border-radius: 10px; padding: .55rem .9rem; font-size: 1.15rem; font-weight: 800; text-align: center; min-width: 4.5rem; }
.bio-table td.tp { background: var(--ok-soft); color: var(--ok-ink); } .bio-table td.tn { background: var(--ok-soft); color: var(--ok-ink); }
.bio-table td.fp, .bio-table td.fn { background: var(--bad-soft); color: var(--bad-ink); }
.bio-ask { font-size: 1.05rem; font-weight: 800; text-align: center; margin: .9rem 0 .6rem; color: var(--ink); }
.bio-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; }
.bio-option { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); border-radius: 12px; padding: .7rem .5rem; font-size: 1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.bio-option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.spot-img { max-height: 380px; max-width: 100%; border-radius: 12px; border: 1px solid var(--border); display: block; margin: 0 auto .6rem; cursor: zoom-in; }
.spot-prompt { font-size: .92rem; text-align: center; color: var(--ink-2); margin-bottom: .6rem; }
@media (max-width: 575.98px) { .mem-grid { grid-template-columns: repeat(3, 1fr); } .match-grid, .odd-options { grid-template-columns: 1fr; } .game-bar-sub { display: none; } }

/* ---------- question selector ---------- */
.qs-presets { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-bottom: .6rem; }
.qs-label { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: .15rem; }
.qs-preset { font-size: .72rem; padding: .15rem .7rem; border-radius: 999px; }
.qs-search { font-size: .8rem; margin-bottom: .6rem; }
.qs-hint { font-size: .64rem; color: var(--muted); font-weight: 400; }
.qs-panes { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; align-items: start; }
.qs-pane { min-width: 0; }
.qs-pane-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .3rem; }
.qs-pane-body { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); max-height: 22rem; overflow-y: auto; padding: .35rem; }
.qs-drop-active { border-color: var(--primary); box-shadow: var(--shadow-glow); }
.qs-group + .qs-group { margin-top: .2rem; }
.qs-group-head { display: flex; align-items: center; gap: .35rem; width: 100%; background: var(--surface-2); color: var(--ink); border: none; border-radius: 6px; padding: .28rem .45rem; text-align: left; position: sticky; top: -0.35rem; z-index: 1; }
.qs-caret { font-size: .65rem; color: var(--muted); width: .7rem; }
.qs-group-name { font-size: .72rem; font-weight: 800; }
.qs-group-meta { margin-left: auto; font-size: .65rem; display: flex; gap: .4rem; }
.qs-selected-count { color: var(--primary-ink); font-weight: 800; }
.qs-rows { padding: .15rem 0 .25rem; }
.qs-row { display: flex; align-items: center; gap: .35rem; cursor: grab; padding: .18rem .45rem; border-radius: 6px; font-size: .76rem; border: 1px solid transparent; user-select: none; color: var(--ink); }
.qs-row:hover { background: var(--primary-soft); }
.qs-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.qs-row:active { cursor: grabbing; }
.qs-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-row-count { margin-left: auto; font-size: .65rem; color: var(--muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.qs-row-mode { width: .7rem; font-weight: 800; flex-shrink: 0; }
.qs-row-user .qs-row-name { color: var(--info); }
.qs-row-picked { font-weight: 700; }
.qs-row-any { background: var(--ok-soft); border-color: var(--ok); color: var(--ok-ink); }
.qs-row-all { background: var(--info-soft); border-color: var(--info); color: var(--info-ink); }
.qs-row-not { background: var(--bad-soft); border-color: var(--bad); color: var(--bad-ink); }
.qs-buckets { display: flex; flex-direction: column; gap: .4rem; }
.qs-bucket { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: .4rem .5rem; }
.qs-bucket-head { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; }
.qs-bucket-name { font-size: .7rem; font-weight: 800; }
.qs-b-any .qs-bucket-name { color: var(--ok); } .qs-b-all .qs-bucket-name { color: var(--info); } .qs-b-not .qs-bucket-name { color: var(--bad); }
.qs-b-any.qs-drop-active { border-color: var(--ok); background: var(--ok-soft); }
.qs-b-all.qs-drop-active { border-color: var(--info); background: var(--info-soft); }
.qs-b-not.qs-drop-active { border-color: var(--bad); background: var(--bad-soft); }
.qs-bucket-body { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; min-height: 1.6rem; }
.qs-bucket-empty { font-size: .65rem; color: var(--muted); font-style: italic; align-self: center; }
.qs-pill { display: inline-flex; align-items: center; gap: .3rem; cursor: grab; font-size: .7rem; padding: .12rem .5rem; border-radius: 999px; border: 1px solid; user-select: none; }
.qs-pill:active { cursor: grabbing; }
.qs-b-any .qs-pill { background: var(--ok-soft); border-color: var(--ok); color: var(--ok-ink); }
.qs-b-all .qs-pill { background: var(--info-soft); border-color: var(--info); color: var(--info-ink); }
.qs-b-not .qs-pill { background: var(--bad-soft); border-color: var(--bad); color: var(--bad-ink); }
.qs-pill-name { cursor: pointer; } .qs-pill-x { cursor: pointer; font-size: .85rem; line-height: 1; opacity: .6; } .qs-pill-x:hover { opacity: 1; }
.qs-clear { font-size: .68rem; padding: 0; text-transform: none; letter-spacing: 0; }
.qs-footer { display: flex; align-items: center; gap: .6rem; margin-top: .75rem; flex-wrap: wrap; }
.qs-count { font-size: .78rem; padding: .45rem .8rem; }
.qs-go { margin-left: auto; }
.qs-loading { font-size: .72rem; padding: .4rem; }
.qs-compact .qs-panes { grid-template-columns: 1fr; } .qs-compact .qs-pane-body { max-height: 13rem; }
.qs-compact .qs-go { width: 100%; margin-left: 0; } .qs-compact .qs-footer { flex-direction: column; align-items: stretch; gap: .4rem; }
.round-picker { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.round-picker button { border: none; background: transparent; color: var(--ink-2); font-weight: 800; font-size: .74rem; border-radius: 999px; padding: .2rem .7rem; }
.round-picker button.on { background: var(--primary); color: #fff; }
@media (max-width: 767.98px) { .qs-panes { grid-template-columns: 1fr; } .qs-pane-body { max-height: 15rem; } }

/* ---------- rich text ---------- */
.rich-text { white-space: pre-wrap; tab-size: 4; -moz-tab-size: 4; word-break: break-word; }
.rich-text code { background: rgba(0,0,0,.06); padding: 0 4px; border-radius: 3px; font-size: .9em; }
[data-theme="dark"] .rich-text code { background: rgba(255,255,255,.1); }
.rich-text .rich-table { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; margin: 6px 0; font-size: .88em; white-space: pre; overflow-x: auto; tab-size: 4; -moz-tab-size: 4; }
.rich-text table { border-collapse: collapse; margin: .4rem 0; } .rich-text td, .rich-text th { border: 1px solid var(--border-strong); padding: 3px 8px; }
.rich-field { display: flex; flex-direction: column; }
.rich-toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 2px; }
.rich-toolbar button { font-size: .7rem; line-height: 1; padding: 2px 6px; border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: 3px; cursor: pointer; color: var(--ink-2); }
.rich-toolbar button:hover { background: var(--surface-3); }
.rich-toolbar button[data-mark="bold"] { font-weight: 700; } .rich-toolbar button[data-mark="italic"] { font-style: italic; } .rich-toolbar button[data-mark="code"] { font-family: var(--mono); }
.rich-toolbar .rich-hint { font-size: .65rem; color: var(--muted); margin-left: auto; align-self: center; }

/* ---------- footer ---------- */
.site-footer { padding: 1.4rem 0 1.8rem; color: var(--muted); font-size: .72rem; }
.site-footer a { color: var(--muted); text-decoration: none; } .site-footer a:hover { color: var(--primary-ink); }

/* ---------- pagination ---------- */
.pagination .page-link { color: var(--primary-ink); background: var(--surface); border-color: var(--border); }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .page-item.disabled .page-link { background: var(--surface-2); color: var(--muted); }
