/* ============================================================
   GTR Math Garage
   Dark-first motorsport workspace.
   Accent is theme-owned: brushed silver on dark, sky blue on light.
   Every accent tint derives from --acc / --acc-rgb, so swapping the
   two theme blocks below re-skins the whole workspace.
   ============================================================ */

:root {
  --paper:    #0b0f17;
  --paper-2:  #0d1322;
  --card:     #121a28;
  --card-2:   #172234;

  --ink:      #e6edf7;
  --ink-2:    #9fb0c8;
  --ink-soft: #647089;

  --line:      rgba(230, 237, 247, 0.10);
  --line-soft: rgba(230, 237, 247, 0.05);
  --fill:      rgba(230, 237, 247, 0.04);
  --fill-2:    rgba(230, 237, 247, 0.08);

  --ok:    #34d399;  --ok-bg:  rgba(52, 211, 153, 0.13);
  --err:   #fb7185;  --err-bg: rgba(251, 113, 133, 0.12);
  --warn:  #fb923c;  --warn-bg: rgba(251, 146, 60, 0.13);

  /* Brushed silver */
  --acc:      #c8d2de;
  --acc-2:    #eef3f9;
  --acc-deep: #7d8b9c;
  --acc-rgb:  200, 210, 222;
  --acc-glow: rgba(200, 210, 222, 0.13);
  --acc-sel:  rgba(200, 210, 222, 0.20);
  --acc-ink:  #0b1017;

  /* Accent for the always-dark garage bay */
  --bay-acc: #c8d2de; --bay-acc-rgb: 200, 210, 222;

  --sh-1: 0 1px 2px rgba(0,0,0,.3), 0 2px 10px rgba(0,0,0,.28);
  --sh-2: 0 2px 8px rgba(0,0,0,.36), 0 14px 34px rgba(0,0,0,.4);
  --sh-3: 0 10px 30px rgba(0,0,0,.5), 0 30px 70px rgba(0,0,0,.55);
  --sh-acc: 0 8px 26px rgba(200,210,222,.20);

  --r-sm: 12px; --r: 16px; --r-lg: 24px; --r-xl: 30px;

  --g-ink: 230,237,247; --g-mut: 159,176,200; --g-halo: 11,15,23;
  --g-label: #e6edf7; --g-shadow: 0,0,0;

  --ease: cubic-bezier(.32, .72, 0, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);

  /* Long fallback chains so a blocked Google Fonts CDN degrades to a
     comparable local face instead of a default serif. */
  --display: 'Space Grotesk', 'Segoe UI Variable Display', 'Segoe UI',
             system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --sans: 'Inter', 'Segoe UI Variable Text', 'Segoe UI',
          system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', 'Cascadia Code',
          Consolas, 'Liberation Mono', Menlo, monospace;

  /* Exercise reading scale. Options and prompts hang off a single indent
     so the number badge, question, and answers share one left edge. */
  --ex-indent: 42px;

  /* Knowledge-graph cluster ramp, read by graph.js. One accent family in
     eleven steps so the unified graph reads as clusters without new hues. */
  --gx-num-fill:  #d0d9e3; --gx-num-ring:  #f1f5fa;
  --gx-frac-fill: #c2ccd9; --gx-frac-ring: #e6ecf4;
  --gx-expr-fill: #b4bfce; --gx-expr-ring: #dbe3ec;
  --gx-eq-fill:   #a6b2c3; --gx-eq-ring:   #d0dae6;
  --gx-pow-fill:  #98a5b8; --gx-pow-ring:  #c6d0dc;
  --gx-fun-fill:  #8a98ad; --gx-fun-ring:  #bac5d3;
  --gx-geo-fill:  #7c8ba2; --gx-geo-ring:  #aeb9c8;
  --gx-men-fill:  #6f7e96; --gx-men-ring:  #a2aec0;
  --gx-data-fill: #62718b; --gx-data-ring: #96a3b7;
  --gx-adv-fill:  #556480; --gx-adv-ring:  #8a98ad;
  --gx-shop-fill: #4a5975; --gx-shop-ring: #7d8b9c;
  --gx-core-fill: #d0d9e3; --gx-core-ring: #f1f5fa;
}

/* -------------------------------- LIGHT ---------------------------------- */
/* Softened: no pure-white cards, no near-black ink, gentler shadows. */
html[data-theme="light"] {
  --paper:   #eef1f7;
  --paper-2: #e5eaf3;
  --card:    #f9fbfe;
  --card-2:  #f1f5fa;

  --ink:      #1c2634;
  --ink-2:    #4d5a6e;
  --ink-soft: #6e7c8f;

  --line:      rgba(28, 38, 52, 0.12);
  --line-soft: rgba(28, 38, 52, 0.07);
  --fill:      rgba(28, 38, 52, 0.035);
  --fill-2:    rgba(28, 38, 52, 0.065);

  --ok: #0f8f5b; --ok-bg: rgba(15, 143, 91, 0.10);
  --err: #ce2f4b; --err-bg: rgba(206, 47, 75, 0.09);
  --warn: #c2410c; --warn-bg: rgba(194, 65, 12, 0.10);

  /* Sky blue, deepened until it clears 4.5:1 both as text on every light
     surface (>=4.65:1) and as a fill under white ink (5.61:1). Plain
     sky-600 (#0284c7) fails both at 3.95 and 4.10 and is not usable here. */
  --acc:      #026da6;
  --acc-2:    #075985;
  --acc-deep: #024e78;
  --acc-rgb:  2, 109, 166;
  --acc-glow: rgba(2, 109, 166, 0.09);
  --acc-sel:  rgba(2, 109, 166, 0.15);
  --acc-ink:  #ffffff;

  /* The garage bay stays dark in both themes, so it needs a bright sky */
  --bay-acc: #38bdf8; --bay-acc-rgb: 56, 189, 248;

  --sh-1: 0 1px 2px rgba(30,50,80,.05), 0 2px 8px rgba(30,50,80,.05);
  --sh-2: 0 2px 6px rgba(30,50,80,.06), 0 10px 24px rgba(30,50,80,.08);
  --sh-3: 0 8px 24px rgba(30,50,80,.10), 0 24px 56px rgba(30,50,80,.11);
  --sh-acc: 0 8px 24px rgba(2,109,166,.16);

  --g-ink: 28,38,52; --g-mut: 77,90,110; --g-halo: 238,241,247;
  --g-label: #1c2634; --g-shadow: 40,60,90;

  /* Sky ramp, darkened so nodes hold their edges against light paper. */
  --gx-num-fill:  #026da6; --gx-num-ring:  #075985;
  --gx-frac-fill: #0369a1; --gx-frac-ring: #0c4a6e;
  --gx-expr-fill: #0e7490; --gx-expr-ring: #164e63;
  --gx-eq-fill:   #11687f; --gx-eq-ring:   #12475c;
  --gx-pow-fill:  #155e75; --gx-pow-ring:  #0e3f52;
  --gx-fun-fill:  #175468; --gx-fun-ring:  #0d3a4c;
  --gx-geo-fill:  #1e4b6b; --gx-geo-ring:  #12303f;
  --gx-men-fill:  #1f455f; --gx-men-ring:  #112c3d;
  --gx-data-fill: #203f56; --gx-data-ring: #102636;
  --gx-adv-fill:  #22394d; --gx-adv-ring:  #0e2030;
  --gx-shop-fill: #233247; --gx-shop-ring: #0c1b2a;
  --gx-core-fill: #026da6; --gx-core-ring: #075985;
}

/* ------------------------------ ACCENTS ---------------------------------- */
/* Track accent hooks. Every track now follows the theme accent, so these
   classes intentionally override nothing; keep them as the seam for
   reintroducing per-track hues later. */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--paper);
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; font-optical-sizing: auto;
  text-rendering: optimizeLegibility; overflow: hidden;
}
/* Digits line up in columns and never vary in width — matters when a learner
   compares numeric answers stacked on top of each other. */
body { font-variant-numeric: tabular-nums lining-nums; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1100px 720px at 84% -12%, rgba(var(--acc-rgb),.10), transparent 56%),
    radial-gradient(900px 640px at -8% 108%, rgba(var(--acc-rgb),.05), transparent 55%),
    linear-gradient(165deg, var(--paper) 0%, var(--paper-2) 100%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: .5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}
/* Light paper needs far less grain — at .3 the noise reads as dirty glare. */
html[data-theme="light"] body::after { mix-blend-mode: multiply; opacity: .14; }

/* --acc-glow is too faint to register as a selection; --acc-sel is the
   stronger tint, and --acc-2 is theme-correct ink on top of it. */
::selection { background: var(--acc-sel); color: var(--acc-2); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
.main::-webkit-scrollbar { width: 10px; }
.main::-webkit-scrollbar-thumb { background: rgba(160,176,200,.2); border-radius: 20px;
  border: 3px solid transparent; background-clip: padding-box; }

/* ------------------------------- LAYOUT ---------------------------------- */
.app { display: grid; grid-template-columns: 262px 1fr; height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 8px; padding: 22px 16px; height: 100vh;
  background: linear-gradient(180deg, rgba(18,26,40,.7), rgba(11,15,23,.4));
  border-right: 1px solid var(--line); backdrop-filter: blur(10px); }
html[data-theme="light"] .sidebar { background: linear-gradient(180deg, rgba(255,255,255,.7), rgba(244,246,251,.5)); }

.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 20px; }
.brand-mark { width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--acc-ink);
  background: linear-gradient(150deg, var(--acc-2) 0%, var(--acc-deep) 100%);
  border-radius: 13px; box-shadow: var(--sh-2), inset 0 1px 0 rgba(255,255,255,.3); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 21px; letter-spacing: .3px; color: var(--ink); }
.brand-sub { font-size: 11px; color: var(--ink-soft); letter-spacing: .4px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-group { font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink-soft);
  padding: 14px 12px 6px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px;
  color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all .2s var(--ease); position: relative; border: 1px solid transparent; text-decoration: none; }
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav-item:hover { background: var(--fill); color: var(--ink); transform: translateX(3px); }
.nav-item.active { background: var(--fill-2); color: var(--ink); border-color: var(--line);
  box-shadow: var(--sh-1); }
.nav-item.active svg { opacity: 1; color: var(--acc); }
.nav-item.active::before { content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 4px 4px 0; background: var(--acc); }
.nav-acc { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; background: var(--acc); opacity: .8; }
.nav-badge-dot { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 20px;
  background: var(--acc); color: var(--acc-ink); font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; }

.btn.disabled { opacity: .55; pointer-events: none; }
.track-card.track-locked { opacity: .58; filter: saturate(.35); }
.lesson-row.locked { cursor: not-allowed; opacity: .52; }
.lesson-row.locked:hover { transform: none; border-color: var(--line); }

.sidebar-foot { padding: 6px; }
.mini-progress { background: linear-gradient(145deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: 15px; padding: 13px 15px; box-shadow: var(--sh-1); }
.mp-top { display: flex; justify-content: space-between; align-items: baseline; }
.mp-level { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--ink); }
.mp-xp { font-size: 11px; color: var(--ink-soft); font-family: var(--mono); }
.mp-bar { height: 6px; border-radius: 6px; background: var(--fill-2); margin-top: 9px; overflow: hidden; }
.mp-bar > i { display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--acc), var(--acc-2)); transition: width 1s var(--ease); }
.mp-foot { font-size: 11px; color: var(--ink-soft); margin-top: 9px; display: flex; gap: 10px; }
.mp-foot svg { width: 12px; height: 12px; vertical-align: -1px; }

.main { overflow-y: auto; height: 100vh; scroll-behavior: smooth; }
.view { max-width: 1160px; margin: 0 auto; padding: 38px 42px 90px; animation: fadeUp .5s var(--ease); }

.page-head { margin-bottom: 28px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 600;
  letter-spacing: 1.6px; text-transform: uppercase; color: var(--acc); margin-bottom: 11px;
  font-family: var(--mono); }
.eyebrow::before { content: ""; width: 22px; height: 1.5px; background: var(--acc); opacity: .6; }
.eyebrow svg { width: 15px; height: 15px; }
.page-title { font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1.08;
  letter-spacing: -.6px; color: var(--ink); }
.page-title .accent { color: var(--acc); }
.page-sub { color: var(--ink-2); font-size: 15.5px; margin-top: 10px; max-width: 66ch; }

/* ------------------------------- BENTO ----------------------------------- */
.bento { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--sh-1); position: relative; overflow: hidden;
  transition: transform .38s var(--ease), box-shadow .38s var(--ease), border-color .3s; }
.tile.hoverable { cursor: pointer; }
.tile.hoverable:hover { transform: translateY(-4px); box-shadow: var(--sh-3); border-color: var(--acc); }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

.hero { grid-column: span 8; color: var(--ink); padding: 34px 38px;
  background: radial-gradient(150% 130% at 90% -25%, var(--acc-glow), transparent 52%),
    linear-gradient(150deg, var(--card-2) 0%, var(--card) 90%);
  border-color: var(--line); box-shadow: var(--sh-2); }
.hero::after { content: "◆"; position: absolute; right: 20px; bottom: -30px; font-size: 200px;
  font-family: var(--display); color: var(--acc); opacity: .05; line-height: 1; pointer-events: none; }
.hero .eyebrow { color: var(--acc); }
.hero h1 { font-family: var(--display); font-weight: 600; font-size: clamp(23px, 3vw, 34px);
  line-height: 1.15; letter-spacing: -.4px; max-width: 22ch; position: relative; z-index: 1; }
.hero h1 b { font-weight: 700; color: var(--acc); }
.hero p { margin-top: 12px; color: var(--ink-2); max-width: 52ch; font-size: 15px; position: relative; z-index: 1; }
.hero-actions { margin-top: 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-goal { display: inline-flex; align-items: center; gap: 9px; background: var(--fill-2);
  border: 1px solid var(--line); padding: 8px 15px; border-radius: 30px; font-size: 13px; color: var(--ink-2); }
.hero-goal svg { width: 17px; height: 17px; color: var(--acc); }
.hero-proverb { margin-top: 16px; padding: 9px 15px; border-left: 3px solid var(--acc);
  background: var(--fill); border-radius: 4px 10px 10px 4px; font-style: italic; font-size: 13px;
  color: var(--ink-2); position: relative; z-index: 1; max-width: 58ch; }
.hero-stats { display: flex; gap: 20px; margin-top: 18px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.hero-stats b { color: var(--ink); font-family: var(--mono); }
.hero-stats svg { width: 15px; height: 15px; vertical-align: -2px; color: var(--acc); }

.stat { display: flex; flex-direction: column; justify-content: space-between; min-height: 130px; }
.stat.stat-h { flex-direction: row; align-items: center; gap: 13px; min-height: 0; padding: 17px 19px; }
.stat.stat-h .stat-num { font-size: 26px; }
.stat .ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--acc-glow); color: var(--acc); flex: none; }
.stat .ico svg { width: 21px; height: 21px; }
.stat-num { font-family: var(--display); font-size: 36px; font-weight: 700; color: var(--ink);
  line-height: 1; letter-spacing: -1px; }
.stat-num small { font-size: 15px; color: var(--ink-soft); font-family: var(--sans); font-weight: 500; }
.stat-label { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }

.tile-eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.tile-eyebrow h3 { font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--ink); }
.tile-eyebrow .link { margin-left: auto; font-size: 13px; color: var(--acc); font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; transition: gap .2s; }
.tile-eyebrow .link:hover { gap: 8px; }
.tile-eyebrow .link svg { width: 15px; height: 15px; }
.tile-eyebrow svg.lead { width: 19px; height: 19px; color: var(--acc); }

/* today / board tiles */
.today-tile.has-due { border-color: var(--acc); box-shadow: var(--sh-2), 0 0 0 2px var(--acc-glow); }
.today-streak { font-size: 15px; color: var(--ink); margin-bottom: 5px; }
.today-streak b { font-family: var(--display); font-size: 22px; color: var(--acc); }
.today-streak svg { width: 18px; height: 18px; vertical-align: -3px; color: var(--acc); }
.today-due { font-size: 13.5px; color: var(--ink-2); }
.board-tile.has-unread { border-color: var(--acc); box-shadow: var(--sh-2), 0 0 0 2px var(--acc-glow); }

/* continue card */
.continue-card { display: flex; align-items: center; gap: 16px; padding: 18px 22px;
  background: linear-gradient(120deg, var(--acc-glow), transparent 55%), var(--card); border-color: var(--acc); }
.cc-ico { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--acc), var(--acc-deep)); color: var(--acc-ink); box-shadow: var(--sh-2); }
.cc-ico svg { width: 20px; height: 20px; margin-left: 2px; }
.cc-main { flex: 1; min-width: 0; }
.cc-lab { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--acc); font-family: var(--mono); }
.cc-title { font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.cc-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ------------------------------ TRACK CARDS ------------------------------ */
.track-card { display: flex; flex-direction: column; gap: 16px; min-height: 176px; }
.track-glyph { position: absolute; right: 16px; top: 6px; font-family: var(--display); font-size: 92px;
  font-weight: 700; line-height: 1; opacity: .09; color: var(--acc); pointer-events: none; }
.track-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600;
  letter-spacing: .8px; text-transform: uppercase; color: var(--acc); padding: 5px 11px;
  background: var(--acc-glow); border-radius: 30px; font-family: var(--mono); }
.track-tag svg { width: 14px; height: 14px; }
.track-name { font-family: var(--display); font-size: 24px; font-weight: 600; color: var(--ink);
  margin-top: 13px; letter-spacing: -.3px; }
.track-desc { color: var(--ink-2); font-size: 13.5px; margin-top: 6px; max-width: 40ch; }
.track-foot { display: flex; align-items: center; gap: 14px; margin-top: auto; }
.track-prog { flex: 1; }
.track-prog .bar { height: 7px; background: var(--fill-2); border-radius: 8px; overflow: hidden; }
.track-prog .bar > i { display: block; height: 100%; border-radius: 8px;
  background: linear-gradient(90deg, var(--acc), var(--acc-2)); transition: width .9s var(--ease); }
.track-prog .lab { font-size: 12px; color: var(--ink-soft); margin-top: 6px; font-family: var(--mono); }

/* ------------------------------- BUTTONS --------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--sans);
  font-size: 13.5px; font-weight: 600; padding: 10px 18px; border-radius: 30px; border: 1px solid transparent;
  cursor: pointer; transition: all .28s var(--spring); white-space: nowrap; text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--acc), var(--acc-deep)); color: var(--acc-ink); box-shadow: var(--sh-acc); }
.btn-primary:hover { transform: translateY(-2px) scale(1.02); }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink); box-shadow: var(--sh-1); }
.btn-ghost:hover { background: var(--card-2); border-color: var(--acc); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none; }
.back-link { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500;
  color: var(--ink-2); cursor: pointer; margin-bottom: 16px; transition: all .2s; text-decoration: none; }
.back-link:hover { color: var(--acc); gap: 10px; }
.back-link svg { width: 16px; height: 16px; }

/* -------------------------------- PILLS ---------------------------------- */
/* Difficulty ramp stays three visibly distinct steps: accent, violet, pink.
   --lv2 / --lv3 are theme-tuned so the pills read on light paper too. */
:root { --lv2: #a5b4fc; --lv3: #f472b6; }
html[data-theme="light"] { --lv2: #4f46e5; --lv3: #be1e69; }
.level-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; letter-spacing: .2px; }
.level-pill svg { width: 12px; height: 12px; }
.lv1 { background: var(--acc-glow); color: var(--acc); }
.lv2 { background: color-mix(in srgb, var(--lv2) 14%, transparent); color: var(--lv2); }
.lv3 { background: color-mix(in srgb, var(--lv3) 14%, transparent); color: var(--lv3); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500;
  padding: 4px 10px; border-radius: 20px; background: var(--fill); color: var(--ink-2); }
.pill svg { width: 13px; height: 13px; }
.lens-tag { background: var(--acc-glow); color: var(--acc); font-weight: 600; }
.srs-tag { background: rgba(52,211,153,.13); color: var(--ok); font-weight: 600; }
.lock-tag { background: var(--fill-2); color: var(--ink-soft); }
/* Board Room pack marker — kept off the accent so it stays distinct from the
   lens and new-lesson pills it sits beside. */
.gold-pill { background: color-mix(in srgb, var(--lv2) 14%, transparent); color: var(--lv2); margin-right: 6px; }
.ok-pill { background: var(--ok-bg); color: var(--ok); }
.new-pill { background: var(--acc-glow); color: var(--acc); }
.dot-done { width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ok-bg); color: var(--ok); flex: none; }
.dot-done svg { width: 12px; height: 12px; }

/* ---------------------------- SECTION / LESSON LIST ---------------------- */
.section-head { display: flex; align-items: center; gap: 12px; margin: 30px 0 14px; }
.section-head .flag { font-size: 15px; width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--sh-1);
  font-weight: 700; color: var(--acc); }
.section-head .flag svg { width: 17px; height: 17px; }
.section-head h3 { font-family: var(--display); font-size: 20px; font-weight: 600; color: var(--ink); }
.section-head .note { font-size: 12px; color: var(--ink-soft); }
.section-head .line { flex: 1; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--acc-glow), transparent); }

.lesson-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); cursor: pointer;
  transition: all .28s var(--ease); margin-bottom: 10px; }
.lesson-row:hover { transform: translateX(5px); box-shadow: var(--sh-2); border-color: var(--acc); }
.lesson-idx { font-family: var(--display); font-size: 22px; font-weight: 600; color: var(--acc);
  width: 28px; text-align: center; flex: none; }
.lesson-main { flex: 1; min-width: 0; }
.lesson-main .tt { font-weight: 600; font-size: 15.5px; color: var(--ink); display: flex; align-items: center;
  gap: 9px; flex-wrap: wrap; }
.lesson-main .ss { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.lesson-lens { font-size: 12px; color: var(--ink-soft); margin-top: 7px; display: flex; gap: 7px; align-items: flex-start; }
.lesson-lens svg { width: 14px; height: 14px; color: var(--acc); flex: none; margin-top: 2px; }
.lesson-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.lesson-meta .row { display: flex; gap: 7px; align-items: center; }
.mini-stat { font-size: 11.5px; color: var(--ink-soft); display: inline-flex; gap: 4px; align-items: center; font-family: var(--mono); }
.mini-stat svg { width: 12px; height: 12px; }

.exam-cta { display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--acc-glow), transparent); border-color: var(--acc); }
.exam-ico { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center;
  background: var(--acc-glow); color: var(--acc); flex: none; }
.exam-ico svg { width: 24px; height: 24px; }
.exam-cta h3 { font-family: var(--display); font-size: 19px; font-weight: 600; color: var(--ink); }
.exam-cta p { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; }

/* ---------------------------- LESSON DETAIL ------------------------------ */
.lesson-hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 28px 32px; box-shadow: var(--sh-1); margin-bottom: 20px; position: relative; overflow: hidden; }
.lesson-hero .hero-glyph { position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
  font-family: var(--display); font-size: 110px; font-weight: 700; color: var(--acc); opacity: .07;
  line-height: 1; pointer-events: none; }
.lesson-hero h1 { font-family: var(--display); font-size: 29px; font-weight: 700; color: var(--ink);
  letter-spacing: -.4px; margin: 12px 0 6px; max-width: 26ch; }
.lesson-hero .sub { font-size: 16px; color: var(--ink-2); }
.lesson-hero .meta { display: flex; gap: 9px; margin-top: 16px; flex-wrap: wrap; }

.lens-card { background: linear-gradient(135deg, var(--acc-glow), transparent); border: 1px solid var(--acc);
  border-radius: var(--r); padding: 20px 24px; margin-bottom: 20px; }
.lens-card .lab { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--acc); margin-bottom: 11px; font-family: var(--mono); }
.lens-card .lab svg { width: 16px; height: 16px; }
.lens-card .q { font-family: var(--display); font-size: 18px; font-style: italic; line-height: 1.5; color: var(--ink); }
.lens-card .ways { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.lens-card .ways .pill { background: var(--card); border: 1px solid var(--line); }

.canon-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 20px;
  padding: 12px 16px; background: var(--fill); border-radius: var(--r); border: 1px solid var(--line-soft); }
.canon-lab { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--ink-soft); font-family: var(--mono); display: inline-flex; align-items: center; gap: 6px; }
.canon-lab svg { width: 14px; height: 14px; }
.canon-item { font-size: 12.5px; color: var(--ink-2); padding: 4px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.canon-item.primary { border-color: var(--acc); color: var(--ink); }
.canon-item a { color: inherit; text-decoration: none; }
.canon-item a:hover { color: var(--acc); }

/* content blocks */
.block { margin-bottom: 18px; }
.block-text { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px 24px; box-shadow: var(--sh-1); font-size: 15px; color: var(--ink); line-height: 1.7; }
.block-text b { color: var(--acc); font-weight: 600; }
.block code, .block-text code { font-family: var(--mono); font-size: .88em; background: var(--fill-2);
  padding: 1px 6px; border-radius: 6px; color: var(--acc-2); }
.block-key { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--acc);
  border-radius: var(--r); padding: 18px 22px; box-shadow: var(--sh-1); }
.block-key h4 { font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 11px; }
.block-key ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.block-key li { display: flex; gap: 11px; font-size: 14px; color: var(--ink); line-height: 1.5; }
.block-key li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--acc);
  margin-top: 8px; flex: none; }

.block-paper { background: linear-gradient(135deg, var(--acc-glow), transparent); border: 1px solid var(--line);
  border-left: 3px solid var(--acc); border-radius: var(--r); padding: 18px 22px; }
.block-paper .cite { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600;
  color: var(--acc); margin-bottom: 9px; font-family: var(--mono); }
.block-paper .cite svg { width: 15px; height: 15px; }
.block-paper .cite a { color: var(--acc); }
.block-paper p { font-size: 14px; color: var(--ink); line-height: 1.65; }

.block-case { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 22px; box-shadow: var(--sh-1); }
.block-case h4 { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-size: 16px;
  font-weight: 600; color: var(--ink); margin-bottom: 9px; }
.block-case h4 svg { width: 18px; height: 18px; color: var(--acc); }
.block-case p { font-size: 14px; color: var(--ink-2); line-height: 1.65; }

.block-fun { display: flex; gap: 14px; background: linear-gradient(135deg, rgba(52,211,153,.08), transparent);
  border: 1px solid rgba(52,211,153,.22); border-radius: var(--r); padding: 16px 20px; }
.block-fun .spark { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--ok-bg); color: var(--ok); }
.block-fun .spark svg { width: 17px; height: 17px; }
.block-fun p { font-size: 13.5px; color: var(--ink); line-height: 1.6; }
.block-fun .flab { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--ok); display: block; margin-bottom: 3px; font-family: var(--mono); }

.block-compare { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 22px; box-shadow: var(--sh-1); }
.block-compare > h4 { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-size: 16px;
  font-weight: 600; color: var(--ink); margin-bottom: 15px; }
.block-compare > h4 svg { width: 18px; height: 18px; flex: none; color: var(--acc); }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.compare-col { border-radius: 13px; padding: 15px 17px; border: 1px solid var(--line); }
.compare-col.left { background: var(--acc-glow); border-color: var(--acc); }
.compare-col.right { background: var(--fill-2); }
.compare-lab { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  margin-bottom: 8px; line-height: 1.35; font-family: var(--mono); }
.compare-col.left .compare-lab { color: var(--acc); }
.compare-col.right .compare-lab { color: var(--ink-2); }
.compare-body { font-size: 13.5px; color: var(--ink); line-height: 1.6; }
@media (max-width: 720px) { .compare-grid { grid-template-columns: 1fr; } }

.block-code { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 20px; box-shadow: var(--sh-1); }
.code-lab { font-size: 11.5px; font-weight: 600; color: var(--acc); margin-bottom: 10px; font-family: var(--mono);
  display: inline-flex; align-items: center; gap: 6px; }
.code-lab svg { width: 15px; height: 15px; }
.block-code pre { overflow-x: auto; background: var(--paper-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 14px 16px; }
.block-code code { font-family: var(--mono); font-size: 13px; color: var(--ink); line-height: 1.6; }
.code-note { font-size: 13px; color: var(--ink-2); margin-top: 10px; line-height: 1.55; }

.block-math { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 20px; box-shadow: var(--sh-1); text-align: center; }
.math-expr { font-family: var(--mono); font-size: 15px; color: var(--acc-2); line-height: 1.7;
  white-space: pre-wrap; padding: 8px 0; }
.math-note { font-size: 13px; color: var(--ink-2); margin-top: 8px; line-height: 1.55; text-align: left; }

.block-source { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 22px; box-shadow: var(--sh-1); }
.block-source h4 { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-size: 15px;
  font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.block-source h4 svg { width: 16px; height: 16px; color: var(--acc); }
.block-source ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.block-source li { font-size: 13.5px; color: var(--ink-2); padding-left: 16px; position: relative; }
.block-source li::before { content: "›"; position: absolute; left: 2px; color: var(--acc); }
.block-source a { color: var(--acc); text-decoration: none; }
.block-source a svg { width: 12px; height: 12px; vertical-align: -1px; }

/* interactive concept labs */
.block-lab { position: relative; overflow: hidden; padding: 22px; border: 1px solid var(--line);
  border-top: 3px solid var(--acc); border-radius: var(--r-lg); background:
  radial-gradient(100% 120% at 100% 0, var(--acc-glow), transparent 52%), var(--card); box-shadow: var(--sh-2); }
.lab-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.lab-head h4 { font-family: var(--display); font-size: 19px; color: var(--ink); margin-top: 4px; }
.lab-head p { color: var(--ink-2); font-size: 13.5px; margin-top: 5px; max-width: 72ch; }
.lab-kicker { display: inline-flex; align-items: center; gap: 6px; color: var(--acc); font: 700 10.5px var(--mono);
  letter-spacing: 1.1px; text-transform: uppercase; }
.lab-kicker svg { width: 14px; height: 14px; }
.lab-toolbar { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.lab-toolbar label { display: flex; flex-direction: column; gap: 5px; color: var(--ink-soft); font: 600 11px var(--mono); }
.lab-toolbar select, .lab-toolbar input[type="number"] { min-width: 145px; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px; background: var(--card-2); color: var(--ink); font: 13px var(--sans); outline: none; }
.lab-toolbar select:focus, .lab-toolbar input:focus { border-color: var(--acc); }
.lab-agents { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.lab-agent { background: var(--fill); border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.lab-agent > b { display: block; font-family: var(--display); color: var(--ink); margin-bottom: 9px; }
.lab-agent label { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: 11px; color: var(--ink-2); margin-top: 7px; }
.lab-agent input { grid-column: span 2; width: 100%; accent-color: var(--acc); }
.lab-agent [data-out] { color: var(--acc); font: 700 12px var(--mono); }
.lab-result { margin-top: 14px; min-height: 42px; border-radius: 10px; padding: 11px 14px; background: var(--fill);
  border: 1px solid var(--line-soft); color: var(--ink-2); font-size: 13px; line-height: 1.55; }
.lab-result b { color: var(--ink); }.lab-result .good { color: var(--ok); }.lab-result .bad { color: var(--err); }
.mono-result { font-family: var(--mono); white-space: normal; max-height: 260px; overflow: auto; }
.mono-result hr { border: none; border-top: 1px solid var(--line); margin: 8px 0; }
.number-inputs input { width: 110px; min-width: 110px !important; }
.graph-lab-stage { display: grid; grid-template-columns: minmax(0, 2fr) minmax(190px, 1fr); gap: 12px; align-items: stretch; }
.graph-lab-stage svg { width: 100%; min-height: 280px; background: var(--fill); border: 1px solid var(--line-soft); border-radius: 13px; }
.lab-edge { stroke: var(--line); stroke-width: 2; }.lab-weight { fill: var(--ink-soft); font: 11px var(--mono); }
.lab-node circle { fill: var(--card-2); stroke: var(--ink-soft); stroke-width: 2; transition: all .25s; }
.lab-node text { fill: var(--ink); font: 700 13px var(--mono); text-anchor: middle; pointer-events: none; }
.lab-node.visited circle { fill: var(--acc-glow); stroke: var(--acc); }.lab-node.current circle { fill: var(--acc); stroke: var(--acc-2); }
.lab-node.current text { fill: #07131d; }
.context-meter { display: grid; grid-template-columns: auto minmax(120px, 1fr) auto; gap: 12px; align-items: center;
  color: var(--ink-2); font: 12px var(--mono); margin-bottom: 12px; }
.context-meter b { color: var(--acc); }.context-bar { height: 9px; background: var(--fill-2); border-radius: 9px; overflow: hidden; }
.context-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--acc); transition: width .25s; }
.context-bar i.over { background: var(--err); }
.context-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.context-item { display: flex; gap: 10px; align-items: center; background: var(--fill); border: 1px solid var(--line);
  border-radius: 11px; padding: 11px 12px; cursor: pointer; }
.context-item:has(input:checked) { border-color: var(--acc); background: var(--acc-glow); }
.context-item input { accent-color: var(--acc); }.context-item span { display: flex; flex-direction: column; min-width: 0; }
.context-item b { color: var(--ink); font-size: 13px; }.context-item small { color: var(--ink-soft); font: 10.5px var(--mono); }
.reason-bars { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.reason-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(120px, 3fr) 42px; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-2); }
.reason-row > div { height: 10px; border-radius: 10px; overflow: hidden; background: var(--fill-2); }
.reason-row i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc-deep), var(--acc)); border-radius: inherit; transition: width .4s; }
.reason-row b { color: var(--acc); font: 700 11px var(--mono); text-align: right; }
.evidence-deck { display: flex; flex-wrap: wrap; gap: 8px; }
.evidence-card { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card-2); color: var(--ink); padding: 9px 12px; cursor: pointer; font: 12px var(--sans); transition: all .2s; }
.evidence-card:hover { border-color: var(--acc); transform: translateY(-1px); }.evidence-card:disabled { opacity: .4; cursor: default; transform: none; }
.evidence-card svg { width: 14px; height: 14px; color: var(--acc); }

@media (max-width: 720px) {
  .block-lab { padding: 16px; }.graph-lab-stage { grid-template-columns: 1fr; }.graph-lab-stage svg { min-height: 240px; }
  .context-meter { grid-template-columns: 1fr auto; }.context-bar { grid-column: span 2; order: 3; }
  .reason-row { grid-template-columns: 100px 1fr 36px; }.lab-toolbar .btn { flex: 1; }
}

/* ------------------------------ EXERCISES -------------------------------- */
/* Reading rules for this block:
   - Question prompt is the largest text on the card (18px) — it is the thing
     being reasoned about, so nothing competes with it.
   - Every answer control is >=16.5px and >=48px tall, so a tap target and a
     glanceable word share the same box.
   - Prompt, options, and feedback all hang off --ex-indent for one left edge.
   - State is never carried by colour alone: selected/correct/wrong each change
     border weight and the mark glyph as well as the tint. */
.ex-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 30px 34px; box-shadow: var(--sh-2); margin-top: 24px; }
.ex-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.ex-head h2 { font-family: var(--display); font-size: 25px; font-weight: 600; color: var(--ink);
  letter-spacing: -.2px; }
.ex-head svg.lead { width: 22px; height: 22px; color: var(--acc); }
.ex-sub { color: var(--ink-2); font-size: 15px; line-height: 1.6; margin-bottom: 24px; max-width: 72ch; }
.ex-item { padding: 26px 0; border-top: 1px solid var(--line-soft); }
.ex-item:first-of-type { border-top: none; padding-top: 4px; }
.ex-item:last-of-type { padding-bottom: 4px; }
.ex-q { display: flex; gap: 12px; margin-bottom: 18px; }
.ex-q .n { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--acc-ink);
  background: var(--acc); width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  flex: none; font-variant-numeric: tabular-nums; }
/* 'zero' slashes the zero so 0 and O cannot be confused in a numeric answer —
   the single highest-value legibility feature in a maths context. */
.ex-q .txt, .opt, .tf-btn, .match-item, .open-input, .open-model p, .ex-explain, .srs-front, .srs-back {
  font-feature-settings: 'zero' 1, 'tnum' 1;
}
.ex-q .txt { font-size: 18px; color: var(--ink); font-weight: 500; line-height: 1.65;
  padding-top: 3px; max-width: 68ch; }
/* Inline math must not shrink below the prose it sits inside. */
.ex-q .txt code { font-family: var(--mono); font-size: .94em; background: var(--fill-2);
  padding: 2px 6px; border-radius: 6px; color: var(--acc-2); font-weight: 600; }

.opts { display: flex; flex-direction: column; gap: 11px; padding-left: var(--ex-indent); }
.opt { display: flex; align-items: flex-start; gap: 13px; padding: 14px 18px; border: 1.5px solid var(--line);
  border-radius: 13px; cursor: pointer; transition: border-color .18s var(--ease), background-color .18s var(--ease);
  background: var(--card); font-size: 16.5px; line-height: 1.5; color: var(--ink); min-height: 50px; }
.opt .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none;
  transition: all .2s; display: grid; place-items: center; margin-top: 2px; }
.opt .mark svg { width: 12px; height: 12px; opacity: 0; color: var(--acc-ink); }
.opt:hover { border-color: var(--acc); background: var(--fill); }
.opt:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.opt.sel { border-color: var(--acc); border-width: 2px; padding: 13.5px 17.5px; background: var(--acc-sel); }
.opt.sel .mark { background: var(--acc); border-color: var(--acc); }
.opt.sel .mark svg { opacity: 1; }
.opt.correct { border-color: var(--ok); border-width: 2px; padding: 13.5px 17.5px; background: var(--ok-bg); }
.opt.correct .mark { background: var(--ok); border-color: var(--ok); }
.opt.correct .mark svg { opacity: 1; }
.opt.wrong { border-color: var(--err); border-width: 2px; padding: 13.5px 17.5px; background: var(--err-bg); }
.opt.wrong .mark { background: var(--err); border-color: var(--err); position: relative; }
/* The markup only ships a check glyph, so a wrong answer used to render as a
   blank red dot — the one state with no symbol at all. Draw the cross here so
   every state is legible without relying on colour. */
.opt.wrong .mark svg { opacity: 0; }
.opt.wrong .mark::before, .opt.wrong .mark::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 11px; height: 2px;
  margin: -1px 0 0 -5.5px; background: var(--acc-ink); border-radius: 2px;
}
.opt.wrong .mark::before { transform: rotate(45deg); }
.opt.wrong .mark::after  { transform: rotate(-45deg); }
.opt.locked { pointer-events: none; }

.tf-row { display: flex; gap: 12px; padding-left: var(--ex-indent); }
.tf-btn { flex: 1; padding: 15px; border: 1.5px solid var(--line); border-radius: 13px; cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 16.5px; text-align: center;
  transition: border-color .18s var(--ease), background-color .18s var(--ease); background: var(--card);
  display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--ink); min-height: 52px; }
.tf-btn svg { width: 19px; height: 19px; }
.tf-btn:hover { border-color: var(--acc); background: var(--fill); }
.tf-btn:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
/* --acc-2 keeps this readable on the tint in both themes; plain --acc on
   --acc-glow was too low-contrast to trust. */
.tf-btn.sel { border-color: var(--acc); border-width: 2px; background: var(--acc-sel); color: var(--acc-2); }
.tf-btn.correct { border-color: var(--ok); border-width: 2px; background: var(--ok-bg); color: var(--ok); }
.tf-btn.wrong { border-color: var(--err); border-width: 2px; background: var(--err-bg); color: var(--err); }

.match-grid { display: grid; grid-template-columns: 1fr; gap: 10px; padding-left: var(--ex-indent); }
.match-col-lab { font-size: 12px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 6px; font-family: var(--mono); }
.match-left { display: flex; flex-direction: column; gap: 10px; }
.match-item { padding: 13px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  font-size: 16px; line-height: 1.5; display: flex; align-items: center; justify-content: space-between;
  gap: 14px; color: var(--ink); min-height: 52px; }
/* The prompt half must never be squeezed to a truncated sliver by the select. */
.match-item > span:first-child { flex: 1 1 auto; min-width: 0; }
.match-item select { border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 11px;
  font-family: var(--sans); font-size: 15px; color: var(--ink); background: var(--card-2); cursor: pointer;
  flex: 0 1 auto; max-width: 48%; }
.match-item select:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.match-item.correct { border-color: var(--ok); border-width: 2px; background: var(--ok-bg); }
.match-item.wrong { border-color: var(--err); border-width: 2px; background: var(--err-bg); }

/* open (free-response) */
.open-wrap { padding-left: var(--ex-indent); }
.open-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700;
  letter-spacing: .9px; text-transform: uppercase; color: var(--acc); margin-bottom: 10px; font-family: var(--mono); }
.open-tag svg { width: 15px; height: 15px; }
/* Written reasoning is the longest thing a learner types here, so it gets
   book-like line height and a comfortable minimum height. */
.open-input { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 16px;
  font-family: var(--sans); font-size: 16.5px; color: var(--ink); background: var(--card-2); resize: vertical;
  line-height: 1.7; outline: none; transition: border-color .2s; min-height: 116px; }
.open-input::placeholder { color: var(--ink-soft); }
.open-input:focus { border-color: var(--acc); border-width: 2px; padding: 13.5px 15.5px; }
.open-input:disabled { opacity: .8; }
.open-reveal { display: none; margin-top: 14px; }
.open-reveal.show { display: block; animation: fadeUp .4s var(--ease); }
.open-grade { font-size: 15px; line-height: 1.6; padding: 12px 16px; border-radius: 10px; margin-bottom: 12px;
  font-weight: 500; background: var(--acc-glow); color: var(--ink); border: 1px solid var(--acc); }
.open-grade svg { width: 15px; height: 15px; vertical-align: -2px; color: var(--acc); }
.open-grade b { color: var(--acc-2); font-family: var(--mono); }
.open-grade.self { background: var(--fill); border-color: var(--line); }
.open-grade.self b { color: var(--ink); }
.open-grade.miss { background: var(--err-bg); border-color: var(--err); }
.open-grade.miss b { color: var(--err); }
.open-model { background: var(--fill); border: 1px solid var(--line); border-left: 3px solid var(--ok);
  border-radius: 10px; padding: 15px 18px; }
.open-rubric { background: var(--fill); border: 1px solid var(--line); border-radius: 10px;
  padding: 15px 18px; margin-top: 10px; }
.om-lab { font-size: 12px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; color: var(--ok);
  margin-bottom: 9px; font-family: var(--mono); }
.open-rubric .om-lab { color: var(--acc); }
.open-model p { font-size: 15.5px; color: var(--ink); line-height: 1.7; max-width: 70ch; }
.open-rubric ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.open-rubric li { font-size: 15px; color: var(--ink-2); padding-left: 22px; position: relative;
  line-height: 1.6; max-width: 70ch; }
.open-rubric li::before { content: "✓"; position: absolute; left: 2px; top: 0; color: var(--acc); font-weight: 700; }

.ex-explain { margin: 14px 0 0 var(--ex-indent); padding: 13px 16px; border-radius: 11px; font-size: 15px;
  background: var(--fill); color: var(--ink-2); display: none; line-height: 1.65;
  border-left: 3px solid var(--acc); max-width: 70ch; }
.ex-explain.show { display: block; animation: fadeUp .4s var(--ease); }
.ex-explain b { color: var(--ink); font-weight: 600; }
.ex-foot { display: flex; align-items: center; gap: 16px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.ex-foot .spacer { flex: 1; }

.result-banner { display: flex; align-items: center; gap: 20px; padding: 20px 24px; border-radius: var(--r);
  margin-bottom: 20px; animation: fadeUp .5s var(--ease); }
.result-banner.pass { background: linear-gradient(135deg, rgba(52,211,153,.13), transparent); border: 1px solid rgba(52,211,153,.32); }
.result-banner.fail { background: linear-gradient(135deg, rgba(251,113,133,.11), transparent); border: 1px solid rgba(251,113,133,.3); }
.result-ring { width: 66px; height: 66px; flex: none; }
.result-banner h3 { font-family: var(--display); font-size: 21px; font-weight: 600; color: var(--ink); }
.result-banner p { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; }
.result-banner .cheer-line { font-size: 14.5px; font-weight: 600; color: var(--ink); margin-top: 5px; }

/* -------------------------------- SRS ------------------------------------ */
.srs-progress { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 14px; font-family: var(--mono); }
.srs-bar { height: 5px; border-radius: 5px; background: var(--fill-2); margin-top: 8px; overflow: hidden; max-width: 500px; }
.srs-bar > i { display: block; height: 100%; background: var(--acc); border-radius: 5px; transition: width .4s var(--ease); }
.srs-card { max-width: 640px; margin: 0 auto; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 40px 36px; box-shadow: var(--sh-2); text-align: center; }
.srs-track { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600;
  color: var(--acc); text-transform: uppercase; letter-spacing: .8px; font-family: var(--mono); margin-bottom: 18px; }
.srs-track svg { width: 15px; height: 15px; }
.srs-front { font-family: var(--display); font-size: 22px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.srs-back { margin-top: 6px; font-size: 15.5px; color: var(--ink-2); line-height: 1.65; }
.srs-div { height: 1px; background: var(--line); margin: 22px 0; }
.srs-actions { display: flex; gap: 10px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.grade { padding: 13px 24px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card);
  font-family: var(--sans); font-size: 15.5px; font-weight: 600; cursor: pointer;
  transition: all .2s var(--spring); color: var(--ink); min-height: 50px; }
.grade:hover { transform: translateY(-2px); }
.grade.again { border-color: var(--err); color: var(--err); }
.grade.hard { border-color: var(--warn); color: var(--warn); }
.grade.good { border-color: var(--acc); color: var(--acc); }
.grade.easy { border-color: var(--ok); color: var(--ok); }

/* ---------------------------- GT-R GARAGE ------------------------------- */
.garage-hero { grid-column: span 12; display: grid; grid-template-columns: minmax(320px,.9fr) minmax(420px,1.1fr);
  gap: 24px; align-items: stretch; overflow: hidden; padding: 0; min-height: 360px; }
.garage-hero-copy { padding: 34px 0 30px 34px; display: flex; flex-direction: column; justify-content: center; z-index: 1; }
.garage-hero-copy h1 { max-width: 560px; }
.garage-hero-visual { position: relative; min-height: 330px; overflow: hidden; background: #090b0f; border-left: 1px solid rgba(var(--bay-acc-rgb),.15); }
.garage-hero-visual::after { content:"PROCEDURAL BAY"; position:absolute; top:18px; right:20px; color:rgba(var(--bay-acc-rgb),.55);
  font:600 9px var(--mono); letter-spacing:1.6px; }
.garage-hero-visual canvas { width: 100%; height: 100%; display: block; }
.garage-preview-stat { position: absolute; left: 18px; bottom: 18px; display:flex; align-items:baseline; gap:8px;
  border:1px solid rgba(var(--bay-acc-rgb),.22); background:rgba(9,11,15,.82); backdrop-filter:blur(8px); padding:8px 12px; border-radius:10px; }
.garage-preview-stat b { color:var(--bay-acc); font:700 19px var(--mono); }
.garage-preview-stat span { color:#aeb8c2; font-size:11px; text-transform:uppercase; letter-spacing:.8px; }

.garage-head { max-width: 780px; }
.garage-stage { border:1px solid rgba(var(--bay-acc-rgb),.22); border-radius:var(--r-lg); background:#090b0f; overflow:hidden;
  box-shadow:0 24px 70px rgba(0,0,0,.42); }
.garage-stage-top, .garage-stage-foot { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:16px 20px;
  color:#dfe5eb; background:rgba(18,21,26,.9); }
.garage-stage-top { border-bottom:1px solid rgba(var(--bay-acc-rgb),.12); }
.garage-stage-foot { border-top:1px solid rgba(var(--bay-acc-rgb),.12); }
.garage-stage-top > div { display:flex; flex-direction:column; }
.garage-stage-label { color:#838e98; font:600 10px var(--mono); text-transform:uppercase; letter-spacing:1.2px; }
.garage-stage-top b { font-size:14px; }
.garage-stage-top strong { color:var(--bay-acc); font:700 27px var(--mono); }
.garage-stage-foot > span { display:flex; align-items:center; gap:8px; font-size:13px; }
.garage-stage-foot svg { width:17px; color:var(--bay-acc); }
.garage-canvas-wrap { position:relative; min-height:460px; overflow:hidden; background:#090b0f; }
#garageCanvas { width:100%; height:460px; display:block; touch-action:none; }
.garage-model-loading { position:absolute; inset:0; display:grid; place-content:center; justify-items:center; gap:13px;
  color:#d8dee5; background:radial-gradient(circle at 50% 50%,rgba(var(--bay-acc-rgb),.08),transparent 36%),#090b0f;
  font:600 11px var(--mono); letter-spacing:.8px; transition:opacity .35s var(--ease); pointer-events:none; }
.garage-loader-line { width:132px; height:2px; overflow:hidden; background:rgba(var(--bay-acc-rgb),.12); }
.garage-loader-line::after { content:""; display:block; width:44%; height:100%; background:var(--bay-acc); transform-origin:left;
  animation:garage-load 1.2s var(--ease) infinite alternate; }
@keyframes garage-load { from { transform:translateX(-75%) scaleX(.45); } to { transform:translateX(165%) scaleX(1); } }
.garage-canvas-wrap[data-viewer="three"] .garage-model-loading,
.garage-canvas-wrap[data-viewer="blueprint"] .garage-model-loading { opacity:0; visibility:hidden; }
.garage-orbit-hint { position:absolute; right:14px; bottom:13px; padding:7px 10px; border:1px solid rgba(var(--bay-acc-rgb),.2);
  border-radius:8px; color:#aeb8c2; background:rgba(9,11,15,.78); backdrop-filter:blur(8px);
  font:500 10px var(--mono); letter-spacing:.35px; opacity:0; transform:translateY(5px); transition:.3s var(--ease); pointer-events:none; }
.garage-canvas-wrap[data-viewer="three"] .garage-orbit-hint { opacity:1; transform:none; }
.model-status { display:flex; align-items:flex-start; gap:13px; margin:16px 0 28px; padding:14px 16px; border:1px solid var(--line);
  border-radius:var(--r-sm); background:var(--card); color:var(--ink-2); }
.model-status > svg { width:20px; flex:none; color:var(--acc); margin-top:2px; }
.model-status div { display:flex; flex-direction:column; gap:2px; font-size:12.5px; }
.model-status b { color:var(--ink); }
.model-status code { font-family:var(--mono); color:var(--acc); font-size:11.5px; }
.model-status.ready { border-color:rgba(var(--bay-acc-rgb),.35); }
.model-status.ready > svg { color:var(--acc); }
.model-credit { color:var(--ink-soft); font-size:11px; }
.model-credit a { color:var(--acc); text-decoration:none; }
.model-credit a:hover { text-decoration:underline; }

.assembly-roadmap { display:flex; flex-direction:column; gap:12px; }
.assembly-card { display:grid; grid-template-columns:64px minmax(0,1fr) auto; gap:18px; align-items:start; padding:22px 24px;
  border:1px solid var(--line); border-radius:var(--r); background:var(--card); box-shadow:var(--sh-1); }
.assembly-card.locked { opacity:.52; }
.assembly-card.complete { border-color:rgba(var(--bay-acc-rgb),.34); background:linear-gradient(100deg,rgba(var(--bay-acc-rgb),.06),var(--card) 42%); }
.assembly-order { font:700 24px var(--mono); color:var(--ink-soft); padding-top:3px; }
.assembly-card.complete .assembly-order { color:var(--acc); }
.assembly-kicker { color:var(--acc); font:600 10px var(--mono); text-transform:uppercase; letter-spacing:1.1px; }
.assembly-main h2 { font:700 24px var(--display); margin:3px 0 2px; }
.assembly-main p { color:var(--ink-2); font-size:13px; max-width:70ch; }
.assembly-meter { height:5px; margin:14px 0 12px; border-radius:6px; background:var(--fill-2); overflow:hidden; }
.assembly-meter i { display:block; width:0; height:100%; background:var(--acc); border-radius:6px; transition:width .8s var(--ease); }
.part-list { display:flex; flex-wrap:wrap; gap:7px; }
.part-chip { display:inline-flex; align-items:center; gap:5px; padding:5px 8px; border:1px solid var(--line); border-radius:8px;
  color:var(--ink-soft); font-size:11px; }
.part-chip svg { width:12px; height:12px; }
.part-chip.installed { border-color:rgba(var(--bay-acc-rgb),.28); color:var(--ink); background:var(--acc-glow); }
.part-chip.installed svg { color:var(--acc); }
.assembly-state { display:flex; align-items:center; gap:6px; color:var(--ink-soft); font:600 11px var(--mono); white-space:nowrap; padding-top:5px; }
.assembly-state svg { width:14px; }
.assembly-card.complete .assembly-state { color:var(--acc); }

/* ------------------------ MATH INTERACTIVE LABS ------------------------- */
.numberline-readout { display:flex; gap:20px; flex-wrap:wrap; margin:16px 0 12px; font-size:12px; color:var(--ink-2); }
.numberline-readout b { color:var(--acc); font-family:var(--mono); }
.numberline-track { height:52px; position:relative; margin:8px 12px 18px; border-bottom:2px solid var(--line); }
.numberline-track::before { content:""; position:absolute; left:0; right:0; bottom:-6px; height:10px;
  background:repeating-linear-gradient(90deg,var(--line) 0 1px,transparent 1px 5%); }
.numberline-track i { position:absolute; bottom:-8px; width:1px; height:17px; background:var(--ink-soft); }
.numberline-track span { position:absolute; bottom:-10px; width:5px; height:22px; border-radius:4px; background:var(--ok); transform:translateX(-50%); }
.numberline-track b { position:absolute; bottom:-15px; width:30px; height:30px; border:5px solid var(--acc); background:var(--card);
  border-radius:50%; transform:translateX(-50%); transition:left .35s var(--spring); box-shadow:0 0 20px var(--acc-glow); }
.lab-toolbar-label { font-size:11px; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.8px; }
.balance-stage { max-width:560px; margin:20px auto 12px; padding:28px 24px 8px; }
.balance-beam { height:8px; border-radius:6px; background:var(--acc); position:relative; transform-origin:center; transition:transform .25s var(--ease); }
.balance-beam::after { content:""; position:absolute; left:50%; top:8px; transform:translateX(-50%); border-left:18px solid transparent;
  border-right:18px solid transparent; border-bottom:48px solid var(--line); }
.balance-pans { display:flex; justify-content:space-between; padding:10px 20px 0; color:var(--ink); font:600 13px var(--mono); }
.lab-slider { display:flex; align-items:center; gap:10px; color:var(--ink-2); font-size:13px; margin:18px 0; }
.lab-slider input { flex:1; accent-color:var(--acc); }
.lab-slider b { color:var(--acc); font-family:var(--mono); }
.geometry-stage { display:grid; grid-template-columns:minmax(0,1fr) 170px; gap:18px; align-items:center; margin-top:12px; }
.geometry-stage canvas { width:100%; height:240px; border:1px solid var(--line-soft); border-radius:var(--r-sm); background:var(--fill); }
.geometry-metrics { display:flex; flex-direction:column; gap:10px; }
.geometry-metrics span { display:flex; flex-direction:column; padding:10px; border-left:2px solid var(--acc); color:var(--ink-soft); font-size:11px; }
.geometry-metrics b { color:var(--ink); font:600 18px var(--mono); }
.counting-categories { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:10px; margin:16px 0; }
.counting-category { display:flex; flex-direction:column; gap:7px; padding:13px; border:1px solid var(--line); border-radius:var(--r-sm); background:var(--fill); }
.counting-category > b { color:var(--acc); font-size:12px; }
.counting-category label { font-size:12px; color:var(--ink-2); cursor:pointer; }
.counting-category input { accent-color:var(--acc); }
.counting-total { display:flex; align-items:baseline; justify-content:flex-end; gap:14px; border-top:1px solid var(--line); padding-top:12px; }
.counting-total span { font:500 13px var(--mono); color:var(--ink-soft); }
.counting-total b { font:700 22px var(--mono); color:var(--acc); }

/* ------------------------------- GRAPH ----------------------------------- */
.graph-shell { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-2); overflow: hidden; position: relative; }
.graph-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft);
  background: var(--fill); flex-wrap: wrap; }
.seg { display: flex; gap: 4px; background: var(--fill-2); padding: 4px; border-radius: 11px; }
.seg.scroll { overflow-x: auto; max-width: 100%; }
.seg button { border: none; background: transparent; font-family: var(--sans); font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); padding: 7px 13px; border-radius: 8px; cursor: pointer; transition: all .2s; white-space: nowrap; }
.seg button.active { background: var(--card); color: var(--acc); box-shadow: var(--sh-1); }
.graph-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 20px; border-bottom: 1px solid var(--line-soft); }
.graph-legend span { font-size: 11.5px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.graph-legend i { width: 10px; height: 10px; border-radius: 50%; }
.graph-canvas { width: 100%; height: 580px; display: block; cursor: grab; touch-action: none; }
.graph-canvas:active { cursor: grabbing; }
.graph-hint { position: absolute; bottom: 14px; left: 20px; font-size: 11.5px; color: var(--ink-soft);
  background: var(--card); padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line-soft); }
.node-info { position: absolute; top: 120px; right: 20px; width: 240px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh-3); opacity: 0; transform: translateY(8px);
  pointer-events: none; transition: all .3s var(--ease); }
.node-info.show { opacity: 1; transform: none; }
.node-info .k { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--acc); font-family: var(--mono); }
.node-info h4 { font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--ink); margin: 6px 0 8px; }
.node-info .links { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.node-info .links b { color: var(--acc); }

/* ---------------------------- FILES & NOTES ------------------------------ */
.drop { border: 2px dashed var(--line); border-radius: var(--r-lg); padding: 40px; text-align: center;
  background: var(--card); transition: all .3s var(--ease); cursor: pointer; margin-bottom: 24px; }
.drop.over { border-color: var(--acc); background: var(--acc-glow); }
.drop .ic { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center;
  background: var(--acc-glow); color: var(--acc); }
.drop .ic svg { width: 26px; height: 26px; }
.drop h3 { font-family: var(--display); font-size: 19px; font-weight: 600; color: var(--ink); }
.drop p { font-size: 13px; color: var(--ink-soft); margin-top: 5px; }
.file-row { display: flex; align-items: center; gap: 15px; padding: 14px 18px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); margin-bottom: 9px; transition: all .25s var(--ease); }
.file-row:hover { box-shadow: var(--sh-2); }
.file-ic { width: 40px; height: 40px; flex: none; border-radius: 11px; display: grid; place-items: center;
  background: var(--acc-glow); color: var(--acc); font-size: 10.5px; font-weight: 700; font-family: var(--mono); }
.file-ic svg { width: 19px; height: 19px; }
.file-main { flex: 1; min-width: 0; }
.file-main .n { font-weight: 600; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-main .m { font-size: 12px; color: var(--ink-soft); margin-top: 2px; font-family: var(--mono); }
.file-act { display: flex; gap: 8px; }
.icon-btn { width: 35px; height: 35px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; cursor: pointer; transition: all .2s; color: var(--ink-2); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--fill); color: var(--acc); border-color: var(--acc); }
.icon-btn.danger:hover { color: var(--err); border-color: var(--err); background: var(--err-bg); }
.note-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--sh-1); }
.note-card textarea, .note-card input { width: 100%; border: none; font-family: var(--sans); color: var(--ink);
  background: transparent; resize: none; outline: none; }
.note-card input { font-family: var(--display); font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.note-card textarea { font-size: 14px; line-height: 1.6; min-height: 84px; }
.note-card textarea::placeholder, .note-card input::placeholder { color: var(--ink-soft); }
.note-title-t { font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink); }
.note-body-t { font-size: 13.5px; color: var(--ink-2); margin-top: 5px; white-space: pre-wrap; }
.note-date-t { font-size: 11px; color: var(--ink-soft); margin-top: 8px; font-family: var(--mono); }

/* ------------------------------ PROGRESS --------------------------------- */
.radar-tile { display: flex; flex-direction: column; }
.radar { width: 100%; max-width: 260px; margin: 0 auto; }
.heatmap { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; max-width: 640px; }
.heatmap .hm { aspect-ratio: 1; border-radius: 3px; background: var(--fill-2); }
.heatmap .hm0 { background: var(--fill-2); }
.heatmap .hm1 { background: var(--acc-glow); }
.heatmap .hm2 { background: rgba(34,211,238,.35); }
.heatmap .hm3 { background: rgba(34,211,238,.6); }
.heatmap .hm4 { background: var(--acc); }

/* ------------------------------ BOARD ROOM ------------------------------- */
.compose-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px 24px; box-shadow: var(--sh-2); margin-bottom: 26px; }
.type-seg { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.type-seg button { flex: 1; min-width: 100px; padding: 10px 12px; border-radius: 11px; border: 1.5px solid var(--line);
  background: var(--card); font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; transition: all .2s; }
.type-seg button svg { width: 15px; height: 15px; }
.type-seg button.active { border-color: var(--acc); background: var(--acc-glow); color: var(--acc); }
.compose-fields { display: flex; flex-direction: column; gap: 11px; }
.compose-fields select, .compose-fields input, .compose-fields textarea { width: 100%; border: 1.5px solid var(--line);
  border-radius: 11px; padding: 11px 14px; font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: var(--card-2); outline: none; transition: border-color .2s; }
.compose-fields input:focus, .compose-fields textarea:focus, .compose-fields select:focus { border-color: var(--acc); }
.compose-fields textarea { min-height: 76px; resize: vertical; }
.compose-fields .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.compose-fields .row2.hidden { display: none; }
.compose-foot { display: flex; justify-content: flex-end; margin-top: 6px; }

.memo-card { display: flex; gap: 15px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 17px 20px; box-shadow: var(--sh-1); margin-bottom: 11px; transition: all .25s var(--ease); position: relative; }
.memo-card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.memo-card.unread { border-color: var(--acc); box-shadow: var(--sh-2); }
.memo-card.unread::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px;
  border-radius: 3px; background: var(--acc); }
.memo-ic { width: 40px; height: 40px; flex: none; border-radius: 11px; display: grid; place-items: center;
  background: var(--acc-glow); color: var(--acc); }
.memo-ic svg { width: 19px; height: 19px; }
.memo-main { flex: 1; min-width: 0; }
.memo-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.memo-head .tt { font-weight: 600; font-size: 15px; color: var(--ink); font-family: var(--display); }
.memo-tag { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 3px 8px;
  border-radius: 20px; background: var(--fill-2); color: var(--ink-2); font-family: var(--mono); }
.memo-body { font-size: 13.5px; color: var(--ink-2); margin-top: 7px; line-height: 1.6; white-space: pre-wrap; }
.memo-meta { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.memo-meta a { color: var(--acc); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
.memo-meta a svg { width: 13px; height: 13px; }
.memo-due { font-size: 11.5px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); }
.memo-due svg { width: 13px; height: 13px; }
.memo-due.high { color: var(--err); font-weight: 600; }
.memo-date { font-size: 11px; color: var(--ink-soft); font-family: var(--mono); }
.memo-check { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; cursor: pointer;
  padding: 5px 12px; border-radius: 20px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink-2); transition: all .2s; }
.memo-check svg { width: 14px; height: 14px; }
.memo-check.done { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.memo-act { display: flex; flex-direction: column; gap: 6px; flex: none; }

.pack-catalog { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.pack-card { display: flex; gap: 15px; align-items: flex-start; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 17px 19px; box-shadow: var(--sh-1); transition: all .25s var(--ease); }
.pack-card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--acc); }
.pack-card.done { border-color: rgba(52,211,153,.35); }
.pk-ico { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--acc-glow); color: var(--acc); }
.pk-ico svg { width: 20px; height: 20px; }
.pk-main { flex: 1; min-width: 0; }
.pk-title { font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.pk-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.pk-meta { display: flex; gap: 9px; margin-top: 9px; flex-wrap: wrap; align-items: center; }
.pk-act { display: flex; flex-direction: column; gap: 8px; flex: none; }

/* --------------------------------- BADGES -------------------------------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 13px; }
.badge-card { text-align: center; padding: 20px 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-1); transition: all .3s var(--ease); }
.badge-card.locked { opacity: .45; filter: grayscale(.6); }
.badge-card.earned:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: var(--sh-2); }
.badge-ic { width: 52px; height: 52px; margin: 0 auto 11px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--acc-2), var(--acc-deep)); color: var(--acc-ink); box-shadow: var(--sh-acc); }
.badge-card.locked .badge-ic { background: var(--fill-2); color: var(--ink-soft); box-shadow: none; }
.badge-ic svg { width: 25px; height: 25px; }
.badge-card .bn { font-family: var(--display); font-size: 14.5px; font-weight: 600; color: var(--ink); }
.badge-card .bd { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; line-height: 1.4; }

/* ----------------------- TOASTS · CONFETTI · ANIM ------------------------ */
.toast-wrap { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { display: flex; align-items: center; gap: 12px; background: var(--card-2); color: var(--ink);
  padding: 12px 19px; border-radius: 30px; box-shadow: var(--sh-3); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 500; animation: toastIn .5s var(--spring); }
.toast svg { width: 17px; height: 17px; color: var(--acc); }
.toast.out { animation: toastOut .4s var(--ease) forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(22px) scale(.88); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(22px) scale(.88); } }
.stagger > * { opacity: 0; animation: fadeUp .55s var(--ease) forwards; }
.stagger > *:nth-child(1) { animation-delay: .04s; } .stagger > *:nth-child(2) { animation-delay: .09s; }
.stagger > *:nth-child(3) { animation-delay: .14s; } .stagger > *:nth-child(4) { animation-delay: .19s; }
.stagger > *:nth-child(5) { animation-delay: .24s; } .stagger > *:nth-child(6) { animation-delay: .29s; }
.stagger > *:nth-child(7) { animation-delay: .34s; } .stagger > *:nth-child(8) { animation-delay: .39s; }
.stagger > *:nth-child(9) { animation-delay: .44s; } .stagger > *:nth-child(10) { animation-delay: .49s; }
.confetti { position: fixed; width: 10px; height: 14px; pointer-events: none; z-index: 200; top: -20px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .2; } }

/* -------------------------------- LOGIN ---------------------------------- */
body.locked .app { filter: blur(7px) saturate(.8); pointer-events: none; user-select: none; }
.login-screen { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 600px at 80% -10%, rgba(34,211,238,.14), transparent 55%),
    radial-gradient(700px 500px at -5% 105%, rgba(167,139,250,.12), transparent 55%),
    linear-gradient(160deg, rgba(11,15,23,.85), rgba(13,19,34,.92));
  backdrop-filter: blur(4px); animation: fadeUp .4s var(--ease); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 32px 30px; box-shadow: var(--sh-3); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.login-title { font-family: var(--display); font-size: 25px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.login-sub { font-size: 12px; color: var(--ink-soft); }
.login-hint { font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.login-personas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.persona { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 16px 10px;
  border: 1.5px solid var(--line); border-radius: 15px; background: var(--card-2); cursor: pointer;
  transition: all .22s var(--ease); font-family: var(--sans); }
.persona:hover { transform: translateY(-2px); border-color: var(--acc); }
.persona.active { border-color: var(--acc); background: var(--acc-glow); box-shadow: 0 0 0 3px var(--acc-glow); }
.persona .p-glyph { width: 40px; height: 40px; display: grid; place-items: center; color: var(--acc-ink);
  background: linear-gradient(135deg, var(--acc-2), var(--acc-deep)); border-radius: 12px; }
.persona .p-glyph svg { width: 19px; height: 19px; }
.persona .p-name { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--ink); }
.persona .p-role { font-size: 11px; color: var(--ink-soft); }
.login-card input { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 15px;
  font-family: var(--sans); font-size: 14px; color: var(--ink); background: var(--card-2); margin-bottom: 12px; outline: none; }
.login-card input:focus { border-color: var(--acc); }
.login-foot { margin-top: 14px; font-size: 11px; color: var(--ink-soft); text-align: center; line-height: 1.5; }

/* ------------------------------ SIDE TOOLS ------------------------------- */
.side-tools { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 0 2px; }
.user-chip { flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; }
.u-ava { width: 32px; height: 32px; flex: none; display: grid; place-items: center; color: var(--acc-ink);
  background: linear-gradient(135deg, var(--acc-2), var(--acc-deep)); border-radius: 10px; }
.u-ava svg { width: 16px; height: 16px; }
.u-name { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.15; display: flex; flex-direction: column; overflow: hidden; }
.u-name small { font-size: 10px; font-weight: 500; color: var(--ink-soft); }
.tool-btn { width: 34px; height: 34px; flex: none; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: all .2s var(--ease); }
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn:hover { color: var(--acc); border-color: var(--acc); transform: translateY(-1px); }

/* ------------------------------ MISC · RESPONSIVE ------------------------ */
.hidden { display: none !important; }
.empty { text-align: center; padding: 50px 20px; color: var(--ink-soft); }
.empty svg { width: 62px; height: 62px; opacity: .5; margin-bottom: 14px; padding: 17px; background: var(--fill);
  border-radius: 50%; color: var(--acc); }
.empty p { font-size: 14px; margin-bottom: 14px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--acc);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mt-lg { margin-top: 32px; }

@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; width: 262px; transform: translateX(-100%);
    transition: transform .3s var(--ease); box-shadow: var(--sh-3); }
  .sidebar.open { transform: none; }
  .hero, .col-8, .col-7, .col-6, .col-5, .col-4, .col-3 { grid-column: span 12; }
  .col-3.stat-h { grid-column: span 6; }
  .view { padding: 28px 22px 70px; }
  .garage-hero { grid-template-columns:1fr; }
  .garage-hero-copy { padding:30px; }
  .garage-hero-visual { min-height:320px; border-left:0; border-top:1px solid rgba(var(--bay-acc-rgb),.15); }
}
@media (max-width: 720px) {
  .bento { gap: 12px; }
  .page-title { font-size: 30px; }
  /* Reclaim the hanging indent — on a phone it costs a fifth of the line and
     forces answer text to wrap mid-phrase. */
  :root { --ex-indent: 0px; }
  .ex-wrap { padding: 22px 18px; }
  .ex-q .txt { font-size: 17px; }
  .tf-row { flex-direction: column; }
  .grid-2 { grid-template-columns: 1fr; }
  .graph-canvas { height: 440px; }
  .pack-catalog { grid-template-columns: 1fr; }
  .login-personas { grid-template-columns: 1fr; }
  .match-item { flex-direction: column; align-items: stretch; gap: 8px; }
  .match-item select { max-width: 100%; }
  .compose-fields .row2 { grid-template-columns: 1fr; }
  .heatmap { grid-template-columns: repeat(12, 1fr); }
  .garage-canvas-wrap { min-height:300px; }
  #garageCanvas { height:300px; }
  .garage-stage-top, .garage-stage-foot { align-items:flex-start; }
  .garage-stage-foot { flex-direction:column; }
  .assembly-card { grid-template-columns:42px 1fr; padding:18px 16px; gap:10px; }
  .assembly-state { grid-column:2; }
  .geometry-stage { grid-template-columns:1fr; }
  .geometry-metrics { display:grid; grid-template-columns:repeat(2,1fr); }
}
.menu-btn { display: none; position: fixed; top: 16px; left: 16px; z-index: 60; width: 44px; height: 44px;
  border-radius: 13px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--sh-2);
  place-items: center; cursor: pointer; color: var(--acc); }
.menu-btn svg { width: 22px; height: 22px; }
@media (max-width: 1080px) { .menu-btn { display: grid; } .view { padding-top: 72px; } }

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