/* ThinkLab core styles — shared by the hub and every lab.
   Layout: bright classroom canvas · sticky top bar · step rail · one stage card, teacher notes beside it on wide screens.
   A deliberately single, bright theme (requested: no dark aesthetics); every colour is set explicitly. */
:root {
  --canvas: #F4F6FB;
  --surface: #FFFFFF;
  --surface-2: #EDF1F8;
  --ink: #141B36;
  --ink-2: #48526F;
  --ink-3: #6E7894;
  --line: #DCE3EF;
  --line-2: #C6D0E2;

  --brand: #D81F73;          /* LibNext magenta */
  --brand-press: #A9135A;
  --brand-soft: #FCE6F0;
  --machine: #2C64D8;        /* anything the machine does */
  --machine-press: #1C49A8;
  --machine-soft: #E4ECFC;
  --teach: #5B3FD0;          /* teacher view */
  --teach-soft: #F1EDFE;

  --good: #1C8A4D;  --good-soft: #DDF4E6;
  --bad: #D2382F;   --bad-soft: #FDE6E3;
  --warn: #9A6400;  --warn-soft: #FFF3D6;

  --f-display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --f-body: "Lexend", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --r-sm: 10px; --r-md: 16px; --r-lg: 24px;
  --shadow: 0 1px 2px rgba(20, 27, 54, .05), 0 10px 30px -12px rgba(20, 27, 54, .14);
  --shadow-lg: 0 2px 4px rgba(20, 27, 54, .06), 0 24px 60px -20px rgba(20, 27, 54, .28);
  color-scheme: light;
}

/* Fluid root size: phones ~15px, laptops ~17px, 4K smartboards up to 22px */
html { font-size: clamp(15px, 0.35vw + 12.5px, 22px); -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font-family: var(--f-body); font-size: 1rem; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
html.has-overlay { overflow: hidden; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.08; margin: 0; text-wrap: balance; letter-spacing: -0.005em; color: var(--ink); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }
strong { font-weight: 600; }
:focus-visible { outline: 3px solid var(--machine); outline-offset: 2px; border-radius: 6px; }

.wrap {
  width: 100%; max-width: 1360px; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.ic { display: inline-flex; width: 1.15em; height: 1.15em; flex: none; }
.ic svg { width: 100%; height: 100%; }
.eyebrow { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.small { font-size: .86rem; }
.muted { color: var(--ink-3); }
.strong { font-weight: 600; }
.mono { font-family: var(--f-mono); font-size: .85em; }
.warn-text { color: var(--warn); display: flex; gap: .4rem; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 2.85rem; padding: .55rem 1.2rem; border-radius: 999px; border: 2px solid transparent;
  font-weight: 600; font-size: .98rem; line-height: 1.2; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, background-color .15s ease, box-shadow .12s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn-sm { min-height: 2.4rem; padding: .35rem .9rem; font-size: .88rem; }
.btn-lg { min-height: 3.3rem; padding: .7rem 1.6rem; font-size: 1.06rem; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 0 var(--brand-press); }
.btn-primary:hover { background: #C71A69; }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brand-press); }
.btn-machine { background: var(--machine); color: #fff; box-shadow: 0 4px 0 var(--machine-press); }
.btn-machine:hover { background: #2457C2; }
.btn-machine:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--machine-press); }
.btn-outline { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink-3); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.is-armed { background: var(--bad-soft); color: var(--bad); }
.btn.is-armed .hide-sm { display: inline; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: .6rem; min-height: 3.9rem; padding-block: .4rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); flex: none; }
.brand-mark { width: 2.25rem; height: 2.25rem; display: inline-flex; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; font-family: var(--f-display); font-weight: 800; font-size: 1.12rem; line-height: 1.05; }
.brand-text small { font-family: var(--f-mono); font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); font-weight: 600; }
.topbar-lab { font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; color: var(--ink-2); padding-left: .8rem; margin-left: .2rem; border-left: 1px solid var(--line); white-space: nowrap; }
.topbar-spacer { flex: 1; }
.score-chip {
  position: relative; display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .8rem;
  border-radius: 999px; background: var(--warn-soft); color: var(--ink); font-family: var(--f-mono); font-size: .86rem; white-space: nowrap;
}
.score-chip .ic { color: #C98200; }
.score-chip strong { font-size: 1rem; }
.sc-max { color: var(--ink-3); }
.score-chip.bump { animation: bump .5s ease; }
.score-pop { position: absolute; right: .3rem; top: -.2rem; font-weight: 700; color: var(--good); animation: pop-up 1.1s ease forwards; pointer-events: none; }
@keyframes bump { 40% { transform: scale(1.12); } }
@keyframes pop-up { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-1.6rem); } }

.teacher-switch {
  display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .4rem .3rem .75rem; min-height: 2.5rem;
  border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 500; font-size: .88rem; white-space: nowrap;
}
.teacher-switch.is-on { border-color: var(--teach); background: var(--teach-soft); color: var(--teach); }
.switch { position: relative; display: inline-block; width: 2.6rem; height: 1.5rem; border-radius: 999px; background: var(--line-2); border: 0; padding: 0; flex: none; cursor: pointer; transition: background .2s; }
.switch-knob { position: absolute; top: .18rem; left: .18rem; width: 1.14rem; height: 1.14rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.teacher-switch.is-on .switch { background: var(--teach); }
.teacher-switch.is-on .switch-knob, .switch[aria-checked="true"] .switch-knob { transform: translateX(1.1rem); }
.switch[aria-checked="true"] { background: var(--machine); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 2rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; padding-block: 1.1rem; font-size: .8rem; color: var(--ink-3); }

/* ---------- hub ---------- */
.hub { padding-bottom: 1rem; }
.hub-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: center; padding-block: clamp(1.8rem, 5vw, 4.5rem) clamp(1.5rem, 3vw, 2.5rem); }
.hub-copy { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.hub-kicker { font-family: var(--f-mono); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); font-weight: 600; }
.hub-title { font-size: clamp(3rem, 8.2vw, 7.4rem); font-weight: 800; line-height: .86; text-transform: uppercase; letter-spacing: -0.02em; }
.hub-ai { display: inline-block; color: var(--brand); position: relative; }
.hub-ai::after { content: ""; position: absolute; left: .04em; right: .04em; bottom: .02em; height: .11em; border-radius: 99px; background: linear-gradient(90deg, #3F8F2A, #8DB531 40%, #F2C12E 70%, #F28C1C); z-index: -1; }
.hub-sub { font-size: clamp(1.05rem, 1.4vw, 1.3rem); color: var(--ink-2); max-width: 34ch; }
.hub-facts { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; color: var(--ink-2); font-size: .9rem; }
.hub-facts li { display: flex; align-items: center; gap: .45rem; }
.hub-facts .ic { color: var(--brand); }

.feature-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: clamp(1rem, 2vw, 1.6rem); display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
.feature-top { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; }
.feature-title { font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 800; }
.feature-tag { color: var(--ink-2); }
.feature-preview { display: flex; flex-direction: column; gap: .5rem; background: var(--surface-2); border-radius: var(--r-md); padding: .5rem; min-height: 12rem; }
.preview-chip { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .86rem; color: var(--ink-2); padding: 0 .4rem .3rem; }
.feature-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.probe { transition: transform .9s cubic-bezier(.5, 0, .2, 1); }
.probe-ring { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 4 4; }
.probe-dot { stroke: var(--ink); stroke-width: 2.5; fill: #fff; transition: fill .4s; }

.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill-ready { background: var(--good-soft); color: var(--good); }
.pill-soon { background: var(--surface-2); color: var(--ink-3); }
.pill-quiet { background: var(--surface-2); color: var(--ink-2); font-weight: 500; }

.section-head { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1.25rem; max-width: 60ch; }
.section-title { font-size: clamp(1.6rem, 2.6vw, 2.3rem); font-weight: 800; }
.section-sub { color: var(--ink-2); }
.hub-cycle, .hub-labs { padding-block: clamp(1.5rem, 3vw, 2.5rem); }
.cycle-list { list-style: none; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .5rem; counter-reset: c; }
.cycle-item { position: relative; display: flex; flex-direction: column; gap: .3rem; padding: .9rem .85rem 1rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.cycle-n { font-family: var(--f-mono); font-size: .75rem; font-weight: 600; width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 50%; background: var(--cy, var(--surface-2)); color: var(--cy-ink, var(--ink)); }
.cycle-name { font-family: var(--f-display); font-weight: 700; font-size: 1.12rem; line-height: 1.1; }
.cycle-desc { font-size: .82rem; color: var(--ink-3); }
@media (max-width: 1180px) { .cycle-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cycle-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* cycle colours: one hue family per phase so the rail, pills and hub agree */
.cycle-observe { --cy: #E4ECFC; --cy-ink: #1C49A8; }
.cycle-patterns { --cy: #EFEBFD; --cy-ink: #4A31B5; }
.cycle-train { --cy: #DFF3E6; --cy-ink: #1D6B3B; }
.cycle-predict { --cy: #FFF1D2; --cy-ink: #8A5600; }
.cycle-mistakes { --cy: #FDE6E3; --cy-ink: #A72C24; }
.cycle-investigate { --cy: #E1F2F7; --cy-ink: #10637A; }
.cycle-improve { --cy: #FCE6F0; --cy-ink: #A9135A; }
.cycle-reflect { --cy: #EEF1F6; --cy-ink: #343D5C; }

.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr)); gap: 1rem; }
.lab-card { display: flex; flex-direction: column; gap: .55rem; padding: 1.15rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.lab-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.lab-art { width: 3.4rem; height: 3.4rem; display: inline-flex; }
.lab-art svg { width: 100%; height: 100%; }
.lab-card-title { font-size: 1.3rem; font-weight: 700; }
.lab-card-tag { font-size: .9rem; color: var(--ink-2); flex: 1; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { font-size: .74rem; padding: .18rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }

@media (max-width: 900px) { .hub-hero { grid-template-columns: minmax(0, 1fr); } }

/* ---------- lab layout ---------- */
.lab-main { padding-block: .25rem 0; }
.rail { display: flex; gap: .4rem; overflow-x: auto; padding-block: .8rem; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.rail-step {
  flex: 1 0 auto; display: flex; align-items: center; gap: .5rem; padding: .32rem .85rem .32rem .32rem;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-size: .86rem; font-weight: 500;
  color: var(--ink-2); cursor: pointer; white-space: nowrap; min-height: 2.6rem;
}
.rail-step:hover:not([disabled]) { border-color: var(--ink-3); }
.rail-n { width: 1.85rem; height: 1.85rem; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-family: var(--f-mono); font-size: .76rem; font-weight: 600; flex: none; }
.rail-n .ic { width: .95rem; height: .95rem; }
.rail-step.is-done .rail-n { background: var(--good); color: #fff; }
.rail-step.is-current { border-color: var(--brand); color: var(--ink); background: var(--brand-soft); font-weight: 600; }
.rail-step.is-current .rail-n { background: var(--brand); color: #fff; }
.rail-step[disabled] { cursor: default; opacity: .5; }

.lab-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (min-width: 1180px) { .lab-layout.has-teacher { grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem); } }
.stage {
  scroll-margin-top: 5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: clamp(1rem, 2.4vw, 2.2rem); display: flex; flex-direction: column; gap: 1.5rem; min-width: 0;
}
.stage-head { display: flex; flex-direction: column; gap: .55rem; max-width: 70ch; }
.stage-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.cycle-pill { padding: .22rem .7rem; border-radius: 999px; background: var(--cy); color: var(--cy-ink); font-weight: 600; font-size: .8rem; }
.stage-count { font-family: var(--f-mono); font-size: .76rem; color: var(--ink-3); letter-spacing: .04em; }
.stage-title { font-size: clamp(1.9rem, 3.2vw, 2.9rem); font-weight: 800; outline: none; }
.stage-lead { color: var(--ink-2); font-size: 1.06rem; }
.activity { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.stage-nav { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.nav-right { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.nav-hint { font-size: .84rem; color: var(--ink-3); }
.nav-hint.is-teacher { color: var(--teach); }

/* ---------- teacher panel ---------- */
.teacher-panel {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 4.6rem);
  background: var(--teach-soft); border: 1.5px solid #D9D0FB; border-radius: var(--r-lg); padding: 1.1rem 1.15rem 1.2rem;
  display: flex; flex-direction: column; gap: 1rem; font-size: .9rem; color: var(--ink); min-width: 0;
  max-height: calc(100vh - 6rem); overflow-y: auto;
}
@media (max-width: 1179px) { .teacher-panel { position: static; max-height: none; } }
.tp-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.tp-badge { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--teach); font-family: var(--f-display); font-size: 1.15rem; }
.tp-time { display: inline-flex; gap: .3rem; align-items: center; font-family: var(--f-mono); font-size: .8rem; background: var(--surface); padding: .2rem .6rem; border-radius: 999px; }
.tp-h { display: flex; align-items: center; gap: .35rem; font-family: var(--f-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--teach); margin-bottom: .3rem; font-weight: 600; }
.tp-pause { background: var(--surface); border-radius: var(--r-md); padding: .8rem .9rem; border: 1.5px dashed #BDAEF7; }
.tp-list { padding-left: 1.2rem; display: flex; flex-direction: column; gap: .4rem; }
.tp-mis { display: flex; flex-direction: column; gap: .4rem; }
.mis-wrong strong { color: var(--bad); }
.mis-right strong { color: var(--good); }
.tp-plan { align-self: flex-start; }

/* ---------- lesson plan sheet ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(20, 27, 54, .45); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: calc(env(safe-area-inset-top, 0px) + 2rem) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 2rem) max(16px, env(safe-area-inset-left, 0px)); }
.sheet { width: 100%; max-width: 62rem; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: clamp(1.1rem, 3vw, 2.2rem); display: flex; flex-direction: column; gap: 1.4rem; animation: rise .25s ease; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.sheet-title { font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 800; }
.plan-meta { display: flex; flex-wrap: wrap; gap: .4rem; }
.plan-lead { font-size: 1.04rem; color: var(--ink-2); max-width: 70ch; }
.plan-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1.5rem; }
.plan-h { font-size: 1.25rem; font-weight: 700; margin-bottom: .55rem; }
.plan-list { padding-left: 1.2rem; display: flex; flex-direction: column; gap: .4rem; margin-top: .35rem; }
.plan-dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; margin: 0; font-size: .92rem; }
.plan-dl dt { font-weight: 600; }
.plan-dl dd { margin: 0; color: var(--ink-2); }
.table-scroll { overflow-x: auto; max-width: 100%; }
.plan-table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 38rem; }
.plan-table th, .plan-table td { text-align: left; vertical-align: top; padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
.plan-table th { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.plan-table .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.mis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: .75rem; }
.mis-card { background: var(--surface-2); border-radius: var(--r-md); padding: .85rem 1rem; display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; }

/* ---------- feedback, toast ---------- */
.feedback { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1.05rem; border-radius: var(--r-md); background: var(--machine-soft); animation: rise .25s ease; }
.fb-icon { flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--machine); }
.fb-icon .ic { width: 1.05rem; height: 1.05rem; }
.fb-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.fb-title { font-weight: 600; }
.fb-text { color: var(--ink-2); }
.fb-good { background: var(--good-soft); } .fb-good .fb-icon { background: var(--good); }
.fb-bad { background: var(--bad-soft); } .fb-bad .fb-icon { background: var(--bad); }
.fb-warn { background: var(--warn-soft); } .fb-warn .fb-icon { background: #D99100; }
.feedback .btn-row { margin-top: .5rem; }
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 1.2rem); transform: translate(-50%, 1rem);
  background: var(--ink); color: #fff; padding: .6rem 1.1rem; border-radius: 999px; font-size: .9rem; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100% - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: rise .45s ease; }

/* ---------- panels, blocks, callouts ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 920px) { .split, .split-even { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface-2); border-radius: var(--r-md); padding: clamp(.9rem, 2vw, 1.3rem); display: flex; flex-direction: column; gap: .9rem; min-width: 0; }
.panel-title { font-size: 1.3rem; font-weight: 700; }
.panel-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.block { display: flex; flex-direction: column; gap: 1rem; }
.block-q { padding-top: 1.3rem; border-top: 1px dashed var(--line-2); }
.block-head { display: flex; flex-direction: column; gap: .2rem; }
.block-title { font-size: 1.5rem; font-weight: 800; }
.block-sub { color: var(--ink-3); font-size: .92rem; }
.callout { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink-2); }
.callout > .ic { color: var(--machine); margin-top: .15rem; }
.insight { display: flex; gap: 1rem; align-items: flex-start; padding: 1.15rem 1.25rem; border-radius: var(--r-md); background: var(--ink); color: #E9ECF6; animation: rise .35s ease; }
.insight-icon { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: #fff; }
.insight-title { font-family: var(--f-display); font-weight: 800; font-size: 1.35rem; color: #fff; margin-bottom: .2rem; }

/* ---------- questions ---------- */
.q { display: flex; flex-direction: column; gap: .8rem; }
.q-text { font-weight: 600; font-size: 1.12rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; }
.q-num { font-family: var(--f-mono); font-size: .8rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center; flex: none; transform: translateY(-.1rem); }
.q-tag { font-family: var(--f-mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; padding: .18rem .5rem; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-weight: 600; margin-right: .4rem; }
.q-hint { color: var(--ink-3); font-size: .9rem; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: .6rem; }
.option {
  display: flex; gap: .75rem; align-items: center; text-align: left; padding: .8rem 1rem; min-height: 3.3rem;
  border: 2px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; font-weight: 500;
  transition: border-color .15s, background-color .15s, transform .1s;
}
.option:hover:not([disabled]) { border-color: var(--machine); }
.option:active:not([disabled]) { transform: scale(.99); }
.opt-key { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-family: var(--f-mono); font-size: .8rem; font-weight: 600; }
.option.is-picked { border-color: var(--machine); background: var(--machine-soft); }
.option.is-picked .opt-key { background: var(--machine); color: #fff; }
.option.is-right { border-color: var(--good); background: var(--good-soft); opacity: 1; }
.option.is-right .opt-key { background: var(--good); color: #fff; }
.option.is-wrong { border-color: #F2B6B1; background: var(--bad-soft); }
.option.is-wrong .opt-key { background: var(--bad); color: #fff; }
.option[disabled] { cursor: default; }
.option[disabled]:not(.is-right):not(.is-wrong) { opacity: .55; }
.quiz-item { padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.quiz-item:last-child { border-bottom: 0; padding-bottom: 0; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: .45rem; }
.field-label { font-weight: 600; }
.textarea { font: inherit; width: 100%; padding: .75rem .9rem; border-radius: var(--r-md); border: 2px solid var(--line); background: var(--surface); color: var(--ink); resize: vertical; min-height: 5.5rem; }
.textarea:focus { border-color: var(--machine); outline: none; }
.range { width: 100%; height: 2.4rem; accent-color: var(--brand); cursor: pointer; margin: 0; }
.range-ends { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: .75rem; color: var(--ink-3); margin-top: -.6rem; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 999px; padding: .2rem; gap: .15rem; }
.seg-btn { display: inline-flex; align-items: center; gap: .35rem; border: 0; background: transparent; border-radius: 999px; padding: .35rem .85rem; min-height: 2.2rem; cursor: pointer; font-weight: 500; font-size: .9rem; color: var(--ink-2); }
.seg-btn.is-on { background: var(--ink); color: #fff; }
.toggle-row { display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; border-radius: var(--r-md); background: var(--surface); border: 1.5px solid var(--line); }
.toggle-row.is-on { border-color: #B9CDF5; }
.toggle-row.is-disabled { opacity: .85; }
.toggle-icon { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.toggle-row.is-on .toggle-icon { background: var(--machine-soft); color: var(--machine); }
.toggle-text { flex: 1; display: flex; flex-direction: column; min-width: 0; cursor: pointer; }
.toggle-label { font-weight: 600; }
.toggle-desc { font-size: .8rem; color: var(--ink-3); }

/* ---------- ring ---------- */
.ring { flex: none; }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 12; }
.ring-arc { fill: none; stroke: var(--machine); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.ring.is-good .ring-arc { stroke: var(--good); }
.ring.is-mid .ring-arc { stroke: #E0A400; }
.ring.is-low .ring-arc { stroke: var(--bad); }
.ring-value { font-family: var(--f-display); font-weight: 800; font-size: 28px; fill: var(--ink); }

/* ---------- feature map ---------- */
.map-frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: .8rem; display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.map { width: 100%; height: auto; display: block; max-width: 100%; user-select: none; -webkit-user-select: none; }
.map.is-draggable { touch-action: none; }
.map.drag-x { cursor: ew-resize; } .map.drag-y { cursor: ns-resize; }
.map-bg { fill: #FAFBFE; stroke: var(--line); }
.map .grid { stroke: #E3E8F2; stroke-width: 1; }
.map .tick { font-family: var(--f-mono); font-size: 12px; fill: var(--ink-3); }
.map .axis-label { font-family: var(--f-body); font-size: 14px; font-weight: 600; fill: var(--ink); }
.map .axis-end { font-family: var(--f-body); font-size: 12px; fill: var(--ink-3); }
.map .is-hidden { fill: var(--ink-3); }
.map .hidden-note { font-weight: 500; fill: var(--bad); }
.map .strip.is-hidden { opacity: .35; }
.map .vline { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 6 5; }
.map .vline-label { font-family: var(--f-mono); font-size: 12px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.map .link { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 3 4; opacity: .7; }
.pt-shape { stroke: #fff; stroke-width: 2.5; }
.pt-test .pt-shape { stroke: var(--ink); stroke-width: 2.2; }
.pt.is-ghost .pt-shape { opacity: .5; stroke-width: 1.5; }
.pt-ring { fill: none; stroke: var(--bad); stroke-width: 3; opacity: 0; }
.pt.is-wrong .pt-ring { opacity: 1; }
.pt-sel { fill: none; stroke: var(--brand); stroke-width: 3.5; opacity: 0; }
.pt.is-selected .pt-sel { opacity: 1; }
.pt.is-clickable { cursor: pointer; }
.pt.is-clickable:hover .pt-shape { stroke: var(--brand); }
.pt.is-clickable:focus { outline: none; }
.pt.is-clickable:focus-visible .pt-sel { opacity: 1; stroke: var(--machine); }
.rule-line { stroke: var(--ink); stroke-width: 3; }
.rule-handle circle { fill: var(--ink); stroke: #fff; stroke-width: 3; }
.rule-handle path { fill: #fff; }
.rule-tag { font-family: var(--f-mono); font-size: 13px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.map-note { text-align: center; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .8rem; color: var(--ink-2); justify-content: center; }
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
.lg { display: inline-block; flex: none; }
.lg-dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--ink-3); }
.lg-dot.lg-small { width: .55rem; height: .55rem; opacity: .6; }
.lg-diamond { width: .7rem; height: .7rem; transform: rotate(45deg); border: 2px solid var(--ink); border-radius: 2px; background: var(--surface); }
.lg-ring { width: .95rem; height: .95rem; border-radius: 50%; border: 2.5px solid var(--bad); }
.lg-zone { width: 1rem; height: .8rem; border-radius: 3px; border: 1px solid var(--line-2); }

/* ---------- certificate ---------- */
.certificate { display: flex; gap: 1.25rem; align-items: center; padding: clamp(1.1rem, 3vw, 1.8rem); border-radius: var(--r-lg); background: linear-gradient(135deg, #FFF6DD, #FCE6F0); border: 1.5px solid #F5CFA0; animation: rise .4s ease; flex-wrap: wrap; }
.cert-seal { flex: none; width: 4.8rem; height: 4.8rem; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; box-shadow: 0 0 0 6px #fff, 0 0 0 8px #F5CFA0; }
.cert-seal .ic { width: 2.3rem; height: 2.3rem; }
.cert-body { display: flex; flex-direction: column; gap: .4rem; flex: 1; min-width: min(100%, 16rem); }
.cert-title { font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 800; }
.cert-text { color: var(--ink-2); }
.cert-stats { display: flex; flex-wrap: wrap; gap: .75rem 2rem; margin-top: .4rem; }
.stat { display: flex; flex-direction: column; }
.stat-value { font-family: var(--f-display); font-weight: 800; font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--ink-3); }
.concept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr)); gap: .75rem; }
.concept { padding: .95rem 1rem; border-radius: var(--r-md); background: var(--surface-2); display: flex; flex-direction: column; gap: .3rem; }
.concept-did { font-size: .84rem; color: var(--ink-3); }
.concept-term { font-family: var(--f-display); font-weight: 800; font-size: 1.3rem; color: var(--brand); line-height: 1.1; }
.concept-meaning { font-size: .9rem; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .hide-sm, .topbar-lab, .ts-label, .sc-label { display: none; }
  .brand-text { font-size: 1rem; }
  .teacher-switch { padding-left: .5rem; }
  .stage { border-radius: var(--r-md); }
  .stage-nav .btn { flex: 1; }
  .nav-right { width: 100%; }
  .nav-hint { width: 100%; text-align: right; }
}
@media (max-width: 420px) { .brand-text { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
