/* Lock It In — app.css
   Direction: Daybook (grouped lists, hairlines, one cobalt accent) with Space Grotesk headings.
   Plain CSS. Token names unchanged; only values are new. Light by default, dark via
   prefers-color-scheme, with <html data-theme="light|dark"> as the override. */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --card: #FFFFFF;
  --card-2: #F4F4F6;
  --ink: #111113;
  --muted: #66667A;
  --line: #E5E5EA;
  --accent: #2457E0;
  --accent-ink: #FFFFFF;
  --accent-soft: #E8EEFF;
  --good: #127436;
  --good-bg: #E6F6EC;
  --bad: #C9332A;
  --bad-bg: #FDECEA;
  --warn: #9A5B00;
  --warn-bg: #FFF4D6;
  --blue: #2457E0;
  --blue-bg: #E8EEFF;
  --amber: #A55300;
  --amber-bg: #FFEFD9;
  --display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, sans-serif;

  /* added helpers (not in the original token list) */
  --r-group: 12px;     /* cards, panels, lists, feedback boxes */
  --r-control: 10px;   /* buttons, inputs */
  --r-pill: 999px;     /* chips, tags, FABs, checkboxes, number dots */
  --shadow-float: 0 8px 24px rgba(17, 17, 19, .16);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0A0A0B;
    --card: #141416;
    --card-2: #1C1C1F;
    --ink: #F2F2F4;
    --muted: #9E9EAB;
    --line: #28282E;
    --accent: #7FA6FF;
    --accent-ink: #0A0A0B;
    --accent-soft: #172342;
    --good: #4ADE80;
    --good-bg: #12301F;
    --bad: #FF7A70;
    --bad-bg: #3A1816;
    --warn: #F5BE4A;
    --warn-bg: #3A2B0C;
    --blue: #7FA6FF;
    --blue-bg: #172342;
    --amber: #F8C76A;
    --amber-bg: #3A2B0C;
    --display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
    --body: 'DM Sans', system-ui, -apple-system, sans-serif;
    --shadow-float: 0 8px 24px rgba(0, 0, 0, .55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0A0B;
  --card: #141416;
  --card-2: #1C1C1F;
  --ink: #F2F2F4;
  --muted: #9E9EAB;
  --line: #28282E;
  --accent: #7FA6FF;
  --accent-ink: #0A0A0B;
  --accent-soft: #172342;
  --good: #4ADE80;
  --good-bg: #12301F;
  --bad: #FF7A70;
  --bad-bg: #3A1816;
  --warn: #F5BE4A;
  --warn-bg: #3A2B0C;
  --blue: #7FA6FF;
  --blue-bg: #172342;
  --amber: #F8C76A;
  --amber-bg: #3A2B0C;
  --display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --shadow-float: 0 8px 24px rgba(0, 0, 0, .55);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* ---------- 3. Icons (Lucide) ---------- */
.lucide { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.brand .lucide, .iconbtn .lucide { width: 20px; height: 20px; }
.btn-sm .lucide, .tag .lucide, .chip .lucide, .pill .lucide { width: 16px; height: 16px; }
.classcard .ic .lucide, .badge .bi .lucide { width: 20px; height: 20px; }

/* ---------- 4. Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 56px; padding: 0 20px; max-width: 720px; margin: 0 auto;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand .lucide { color: var(--accent); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 12px; border-radius: var(--r-pill);
  background: var(--card-2); color: var(--ink);
  font-size: 15px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.chip.pts { color: var(--amber); }
.iconbtn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink); cursor: pointer;
  transition: background .15s var(--ease), transform .12s var(--ease);
}
.iconbtn:hover { background: var(--card-2); }
.iconbtn:active { transform: scale(.94); }
.wrap { max-width: 720px; margin: 0 auto; padding: 24px 20px 140px; }
.card {
  background: var(--card-2); border: 0; border-radius: var(--r-group);
  padding: 16px; box-shadow: none;
}
.card > .todo { margin: -12px 0; }

/* ---------- 5. Headings and text ---------- */
h1 {
  font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.2;
  letter-spacing: -.02em; margin: 0 0 6px; overflow-wrap: anywhere;
}
h2 {
  font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.25;
  letter-spacing: -.01em; margin: 0;
}
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lead { font-size: 17px; color: var(--muted); margin: 0 0 8px; }
.sec { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 32px 0 10px; }
.sec-note { font-size: 15px; color: var(--muted); }
.small { font-size: 15px; }
.muted { color: var(--muted); }

/* ---------- 6. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border: 0; border-radius: var(--r-control);
  background: var(--card-2); color: var(--ink);
  font-size: 17px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background .15s var(--ease), transform .12s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover { text-decoration: none; background: color-mix(in srgb, var(--card-2) 90%, var(--ink)); }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 90%, var(--ink)); }
.btn-ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { background: var(--card-2); }
.btn-sm { min-height: 40px; padding: 6px 14px; font-size: 15px; border-radius: 9px; }
.btn-lg { min-height: 52px; font-size: 18px; }
.btn-wide { width: 100%; }
.actions-main { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- 7. Home ---------- */
.todo { display: flex; flex-direction: column; }
.todo .it {
  display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 0;
  border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; cursor: pointer;
}
.todo .it:first-child { border-top: 0; }
.todo .it:hover { text-decoration: none; }
.todo .it .box {
  position: relative; flex: none; width: 24px; height: 24px; border-radius: var(--r-pill);
  border: 1.5px solid var(--muted); background: transparent; font-size: 0; color: transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.todo .it .box > * { display: none; }               /* the check is drawn below */
.todo .it .box::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px;
  border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); opacity: 0;
}
.todo .it.done { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted); }
.todo .it.done .box { background: var(--accent); border-color: var(--accent); }
.todo .it.done .box::after { opacity: 1; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; } }

/* .classcard works with or without a wrapper around .nm/.st */
.classcard {
  position: relative;
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-auto-rows: auto;
  column-gap: 14px; align-items: center;
  min-height: 72px; padding: 12px 10px;
  border: 0; border-radius: var(--r-group);
  background: transparent; color: var(--ink); text-decoration: none; cursor: pointer;
  transition: background .15s var(--ease), transform .12s var(--ease);
}
/* straight inset divider (a border-bottom would bend around the corner radius) */
.classcard::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 1px; background: var(--line); }
.classcard:last-child::after, .classcard.hot::after { display: none; }
.classcard:hover { background: var(--card-2); text-decoration: none; }
.classcard:active { transform: scale(.99); }
.classcard > .ic { grid-column: 1; grid-row: 1 / span 2; }
.classcard > .nm { grid-column: 2; grid-row: 1; }
.classcard > .st { grid-column: 2; grid-row: 2; }
.classcard > .chev-r { grid-column: 3; grid-row: 1 / span 2; }
.classcard .ic {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-pill);
  background: var(--card-2); color: var(--ink); font-size: 0;   /* font-size 0 hides any leftover emoji */
}
.classcard .nm { display: block; font-size: 17px; font-weight: 600; line-height: 1.3; }
.classcard .st { display: block; font-size: 15px; line-height: 1.4; color: var(--muted); margin-top: 1px; }
.classcard .chev-r { color: var(--muted); }
.classcard.hot { background: var(--bad-bg); }
.classcard.hot:hover { background: color-mix(in srgb, var(--bad-bg) 88%, var(--bad)); }
.classcard.hot .ic { background: var(--bad); color: var(--card); }
.classcard.hot .st { color: var(--bad); font-weight: 600; }
.classcard.hot .chev-r { color: var(--bad); }
.classcard.quiet .ic { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.classcard.quiet .nm { color: var(--muted); font-weight: 500; }

/* ---------- 8. Class page ---------- */
.hero { padding: 12px 0 4px; }
.hero h1 { margin: 6px 0 0; }
.hero .when {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  margin-top: 8px; color: var(--muted); font-size: 15px;
}
.due-soon { display: inline-flex; align-items: center; gap: 6px; color: var(--bad); font-weight: 600; }
.due-soon::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: var(--r-pill); background: var(--bad); }

.panel {
  background: var(--card-2); border: 0; border-radius: var(--r-group);
  padding: 18px; margin-top: 16px; box-shadow: none;
}
.panel:has(.btn-primary) { background: var(--accent-soft); }   /* the "Do this next" panel */
.panel:has(.btn-primary) .eyebrow { color: var(--accent); }
.panel h2 { margin-top: 6px; }
.panel p { margin: 6px 0 0; }

.stage-list {
  display: flex; flex-direction: column; margin: 0; padding: 0 16px; list-style: none;
  background: var(--card-2); border-radius: var(--r-group);
}
/* .stage-item works with or without a wrapper around .name/.meta */
.stage-item {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; grid-auto-rows: auto;
  column-gap: 14px; align-items: center;
  min-height: 60px; padding: 10px 0; border-top: 1px solid var(--line);
  color: var(--ink); text-decoration: none; list-style: none;
}
.stage-item:first-child { border-top: 0; }
.stage-item > .num { grid-column: 1; grid-row: 1 / span 2; }
.stage-item > .name { grid-column: 2; grid-row: 1; }
.stage-item > .meta { grid-column: 2; grid-row: 2; }
.stage-item > .tag, .stage-item > .pill, .stage-item > .chev-r { grid-column: 3; grid-row: 1 / span 2; }
.stage-item .num {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-pill);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted);
  font-size: 13px; font-weight: 600;
}
.stage-item .name { display: block; font-weight: 600; line-height: 1.3; }
.stage-item .meta { display: block; font-size: 15px; line-height: 1.4; color: var(--muted); margin-top: 1px; }
.stage-item.next .num { background: var(--accent); box-shadow: none; color: var(--accent-ink); }
.stage-item.next .name { color: var(--accent); }
.stage-item.done .num { background: var(--good-bg); box-shadow: none; color: var(--good); }
.stage-item.done .name { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted); }

/* ---------- 9. Tags and pills ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0 9px;
  border-radius: var(--r-pill); background: var(--card-2); color: var(--muted);
  font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.tag-ok { background: var(--good-bg); color: var(--good); }
.tag-focus { background: var(--accent-soft); color: var(--accent); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-mute { background: var(--card-2); color: var(--muted); }
.tag-next { background: var(--blue-bg); color: var(--blue); }
.tag-bad { background: var(--bad-bg); color: var(--bad); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px;
  border-radius: var(--r-pill); background: var(--card-2); color: var(--ink);
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.pill.ok { background: var(--good-bg); color: var(--good); }
.pill.todo { background: var(--card-2); color: var(--muted); }

/* ---------- 10. Assignment step ---------- */
.progress { height: 4px; border-radius: var(--r-pill); background: var(--card-2); overflow: hidden; margin: 10px 0 20px; }
.progress i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--accent); transition: width .3s var(--ease); }

.teach { background: var(--card-2); border: 0; border-radius: var(--r-group); padding: 16px; margin: 20px 0 0; }
.teach > summary { margin: -16px; padding: 12px 16px; }
.teach[open] > summary { margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.teach h3 { margin: 0; font-family: var(--display); font-size: 18px; font-weight: 700; line-height: 1.3; }
.teach p { margin: 10px 0 0; }
.teach p:first-child { margin-top: 0; }
.teach .lucide { color: var(--accent); }
.teach .chev { color: var(--muted); }

.input, textarea.input {
  display: block; width: 100%; min-height: 140px; padding: 14px 16px;
  border: 1.5px solid var(--line); border-radius: var(--r-control);
  background: var(--card); color: var(--ink); font-size: 17px; line-height: 1.55;
  resize: vertical; outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.fb {
  border: 0; border-radius: var(--r-group); padding: 16px 18px; margin-top: 14px;
  background: var(--card-2); color: var(--ink);
  animation: fb-pop .16s var(--ease) both;
}
.fb p { margin: 0; }
.fb p + p { margin-top: 8px; }
.fb b, .fb strong, .fb h3, .fb h4 { font-size: 16px; font-weight: 700; }
.fb h3, .fb h4 { margin: 0 0 6px; font-family: var(--body); }
.fb .lucide { margin-right: 4px; }
.fb.ok { background: var(--good-bg); }
.fb.ok b, .fb.ok strong, .fb.ok h3, .fb.ok h4, .fb.ok .lucide { color: var(--good); }
.fb.part { background: var(--warn-bg); }
.fb.part b, .fb.part strong, .fb.part h3, .fb.part h4, .fb.part .lucide { color: var(--warn); }
.fb.no { background: var(--bad-bg); }
.fb.no b, .fb.no strong, .fb.no h3, .fb.no h4, .fb.no .lucide { color: var(--bad); }
@keyframes fb-pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

.ideas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.piece { background: var(--card-2); border-radius: var(--r-control); padding: 12px 14px; line-height: 1.5; }
.piece .ph { color: var(--muted); font-style: italic; border-bottom: 1.5px dashed var(--muted); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- 11. Practice ---------- */
.steps {
  list-style: none; margin: 12px 0 0; padding: 0 16px;
  display: flex; flex-direction: column; background: var(--card-2); border-radius: var(--r-group);
}
.steps li { display: flex; align-items: flex-start; gap: 12px; min-height: 52px; padding: 12px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps .n {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin-top: 1px;
  border-radius: var(--r-pill); background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.tokens { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tok {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-pill);
  background: var(--card); color: var(--ink); font-size: 16px; font-weight: 500; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease);
}
.tok:hover { background: var(--card-2); }
.tok:active { transform: scale(.97); }
.tok.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.tok.ind { border-color: transparent; background: var(--blue-bg); color: var(--blue); }
.tok.dep { border-color: transparent; background: var(--amber-bg); color: var(--amber); }

/* ---------- 12. Badges ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
@media (max-width: 359px) { .badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.badge {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 14px 10px; border-radius: var(--r-group); background: var(--card-2); color: var(--muted);
}
.badge .bi {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-pill);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font-size: 0;
}
.badge b { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; color: inherit; }
.badge .how { display: block; font-size: 13px; line-height: 1.4; color: var(--muted); }
.badge.on { background: var(--accent-soft); color: var(--ink); }
.badge.on .bi { background: var(--accent); box-shadow: none; color: var(--accent-ink); }

/* ---------- 13. Expanders ---------- */
details.map { background: var(--card-2); border: 0; border-radius: var(--r-group); margin-top: 16px; padding: 0 16px; }
details > summary {
  list-style: none; display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 10px 0; font-weight: 600; color: var(--ink); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { content: ""; }
details > summary .sec-note { margin-left: auto; }
details > summary .chev { margin-left: auto; flex: none; color: var(--muted); transition: transform .2s var(--ease); }
details > summary .sec-note + .chev { margin-left: 0; }
details[open] > summary .chev { transform: rotate(180deg); }
details.map[open] > summary { border-bottom: 1px solid var(--line); }
.map-row {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 0;
  border-top: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
details.map > summary + .map-row { border-top: 0; }

/* ---------- 14. Floating buttons, sheet, toast ---------- */
.fabs {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.fab-main {
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-float);
  transition: transform .15s var(--ease), filter .15s var(--ease);
}
.fab-main svg { width: 26px; height: 26px; transition: transform .2s var(--ease); }
.fab-main:hover { filter: brightness(1.08); }
.fab-main:active { transform: scale(.95); }
.fab-main[aria-expanded="true"] svg { transform: rotate(45deg); }
.fab-menu { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.fab-menu[hidden] { display: none; }
.fab-item {
  display: inline-flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 6px 0 16px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--card); color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-float);
  opacity: 0; transform: translateY(12px) scale(.96);
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.fab-item .ic { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--card-2); color: var(--ink); }
.fab-item .ic svg { width: 18px; height: 18px; }
.fab-item.coach .ic { background: var(--accent); color: var(--accent-ink); }
.fab-item:active { transform: scale(.97); }
.fab-menu.open .fab-item { opacity: 1; transform: none; }
.fab-menu.open .fab-item:nth-last-child(1) { transition-delay: 0s; }
.fab-menu.open .fab-item:nth-last-child(2) { transition-delay: .06s; }
.fab-menu.open .fab-item:nth-last-child(3) { transition-delay: .12s; }
#notesSheet #notesText { min-height: 180px; margin-top: 4px; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  width: auto; max-width: 720px; margin: 0 auto; max-height: min(85vh, 720px);
  flex-direction: column; overflow: hidden;
  background: var(--card); color: var(--ink); border: 0;
  border-radius: 20px 20px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .25);
  padding: 0 20px calc(16px + env(safe-area-inset-bottom));
}
.sheet[hidden] { display: none; }
.sheet::backdrop { background: rgba(0, 0, 0, .4); }
.sheet .ctop {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 12px 0 8px; border-bottom: 1px solid var(--line);
  font-family: var(--display); font-size: 18px; font-weight: 700;
}
.coach-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 0; }
.cmsg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; }
.cmsg.coach { align-self: flex-start; background: var(--card-2); color: var(--ink); border-bottom-left-radius: 6px; }
.cmsg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.coach-in { display: flex; align-items: flex-end; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.coach-in input, .coach-in textarea, input.coach-in, textarea.coach-in {
  flex: 1; min-width: 0; min-height: 44px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink);
  font-size: 17px; line-height: 1.4; outline: none; resize: none;
}
.coach-in input:focus, .coach-in textarea:focus, input.coach-in:focus, textarea.coach-in:focus { border-color: var(--accent); }
.coach-quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 4px; }
.coach-quick > * {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px;
  border: 1.5px solid var(--line); border-radius: var(--r-pill);
  background: var(--card); color: var(--ink); font-size: 15px; font-weight: 500; cursor: pointer;
}
.coach-quick > *:hover { background: var(--card-2); }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 600;
  box-shadow: var(--shadow-float);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 15. Small screens and motion ---------- */
@media (max-width: 360px) {
  .wrap, .topbar-in { padding-left: 16px; padding-right: 16px; }
  .fabs { right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fab-main:active, .btn:active, .fab-item:active, .classcard:active, .tok:active, .iconbtn:active { transform: none; }
}

/* ---------- 16. Bridge: app pieces the design file did not cover ---------- */
button.brand, button.classcard, button.stage-item, button.it { font: inherit; text-align: left; width: 100%; }
button.brand { width: auto; border: 0; background: transparent; padding: 0; cursor: pointer; }
button.stage-item { border: 0; background: transparent; cursor: pointer; }
button.it { border: 0; background: transparent; cursor: pointer; }
.todo .it .t { font-weight: 600; }
.card { background: transparent; padding: 0; border-radius: 0; }
.todo { background: var(--card-2); border-radius: var(--r-group); padding: 0 16px; }
.card > .todo { margin: 0; }
.lab-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin: 0 0 16px; }
.lab-top .btn { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-top .small:empty { display: none; }
.lab-title { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; }
.lab-title h1 { margin: 0; }
.lab-title .ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-pill); background: var(--card-2); color: var(--accent); flex: none; }
.hero.panel h2 { margin-top: 6px; }
.hero.panel .when { margin-top: 8px; }
.hero.panel .actions-main { margin-top: 14px; }
.rule { border: 0; border-left: 3px solid var(--accent); background: var(--accent-soft); color: var(--ink); padding: 12px 16px; border-radius: var(--r-control); margin: 16px 0; line-height: 1.55; }
.piece { white-space: pre-wrap; border-left: 3px solid var(--good); border-radius: 0 var(--r-control) var(--r-control) 0; margin: 10px 0; }
.piece .ph { display: block; font-style: normal; border: 0; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input.input, select.input { min-height: 48px; resize: none; }
textarea.input { min-height: 120px; }
.coach-in textarea.input { min-height: 44px; }
.sheet:not([hidden]) { display: flex; }
.chev-r { display: inline-flex; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.tight { gap: 0; }
.stack.tight > .map-row:first-child { border-top: 0; }
.map-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.sec-note { margin: -2px 0 10px; }
.teach ul { margin: 8px 0 0 18px; padding: 0; }
.teach li { margin: 4px 0; }
.chip.pts .lucide { fill: currentColor; }
.progress + h2 { margin-top: 4px; }
.btn .lucide { vertical-align: -3px; }
.classcard .ic .lucide, .badge .bi .lucide { width: 20px; height: 20px; }
.stage-item .num .lucide { width: 15px; height: 15px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.wrap { padding-bottom: 140px; }

[hidden] { display: none !important; }

/* ---------- 17. Spacing rhythm around buttons ---------- */
.hero.panel .actions-main, .panel .actions-main { margin-top: 18px; }
.panel > .row { margin-top: 16px; }
.panel .row + p { margin-top: 12px; }
p + .row, .input + .row, textarea + .row, .tokens + .row, .teach + .row, .stage-list + .row, .todo + .row, .sec + .row, details + .row, .stack + .row { margin-top: 16px; }
.fb .row { margin-top: 12px; }
.lead + .row { margin-top: 12px; }
.actions-main + p, .actions-main + details { margin-top: 20px; }
.row + .row { margin-top: 10px; }
.teach + p { margin-top: 20px; }
.teach + p + p { margin-top: 6px; }
.progress + h2 { margin-top: 8px; }
h2 + .todo, h2 + .stage-list, h2 + .panel, h2 + .teach, h2 + .row { margin-top: 12px; }
.card > p.small.muted:last-child { margin-top: 12px; }

/* ---------- 18. Room under step titles ---------- */
section.card > h2 + .todo, section.card > h2 + .stage-list, section.card > h2 + .teach, section.card > h2 + .panel, section.card > h2 + .steps, section.card > h2 + .tokens, section.card > h2 + .orig { margin-top: 16px; }
section.card > h2 + .row, section.card > h2 + textarea, section.card > h2 + .input { margin-top: 14px; }
section.card > h2 + p { margin-top: 10px; }
section.card > .todo + p, section.card > .stage-list + p { margin-top: 12px; }
.card > .todo { margin: 16px 0 0; }

.brand{white-space:nowrap}
.topbar-in{flex-wrap:nowrap}

/* ---------- 19. Reward game ---------- */
.game-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:14px}
.gcard{aspect-ratio:1;border:0;border-radius:12px;background:var(--accent);cursor:pointer;display:grid;place-items:center;color:var(--accent-ink);transition:transform .12s var(--ease),background .15s var(--ease)}
.gcard:active{transform:scale(.96)}
.gcard.up{background:var(--card-2);color:var(--ink);box-shadow:inset 0 0 0 1.5px var(--line)}
.gcard.done{background:var(--good-bg);color:var(--good);box-shadow:none;cursor:default}
.gcard .lucide{width:28px;height:28px}

/* ---------- 20. Star Hopper ---------- */
.sh-wrap{position:relative;border-radius:14px;overflow:hidden;background:#0B1026;touch-action:none;user-select:none;-webkit-user-select:none}
.sh-canvas{display:block;width:100%}
.sh-hud{position:absolute;top:10px;left:12px;right:12px;display:flex;justify-content:space-between;align-items:center;color:#fff;font-family:var(--display);font-weight:700;font-size:22px;pointer-events:none;text-shadow:0 2px 6px rgba(0,0,0,.6)}
.sh-lives{display:inline-flex;gap:4px}.sh-lives .lucide{width:20px;height:20px;color:#FF7A70;fill:#FF7A70}.sh-lives .lucide.off{fill:none;opacity:.45}.sh-mute .lucide{width:18px;height:18px;vertical-align:-4px}
.sh-mute{pointer-events:auto;border:0;background:rgba(255,255,255,.12);color:#fff;border-radius:999px;width:36px;height:36px;font-size:16px;cursor:pointer}
.sh-overlay{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none}
.sh-card{background:rgba(10,10,20,.72);color:#fff;padding:14px 18px;border-radius:14px;text-align:center;font-size:17px;line-height:1.5;max-width:80%;backdrop-filter:blur(6px)}
.sh-card .sh-sub{font-size:14px;color:#cfd6ff}

/* ---------- 21. Textbook viewer ---------- */
.book{background:var(--card-2);border-radius:var(--r-group);padding:14px 16px}
.book-top{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.book-top .input{flex:1;min-width:160px;min-height:44px;margin:0}
.book-results{display:grid;gap:6px;margin-top:10px}
.book-hit{text-align:left;border:1px solid var(--line);background:var(--card);border-radius:10px;padding:8px 12px;font:inherit;color:var(--ink);cursor:pointer;font-size:15px;line-height:1.45}
.book-hit mark{background:#FFE9A8;color:#1f1b16;border-radius:3px;padding:0 2px}
.book-nav{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:12px 0 8px}
.book-page{width:100%;height:auto;border-radius:8px;background:#fff;display:block}
.book-snippet{margin-top:8px;font-size:15px;line-height:1.5}

/* ---------- 22. Visible row dividers and status chips ---------- */
:root{--divider:#D6D6DC}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){--divider:#3B3B45} }
:root[data-theme="dark"]{--divider:#3B3B45}
.stage-item, .todo .it, .map-row, .steps li, .classcard::after { border-top-color: var(--divider); }
.classcard::after { background: var(--divider); }
.stage-item:first-child, .todo .it:first-child, .steps li:first-child { border-top: 0; }
.tag-mute { background: transparent; box-shadow: inset 0 0 0 1.5px var(--divider); color: var(--muted); }
.stage-item .meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stage-item .meta > .tag { margin-left: auto; }
.stage-item { padding: 12px 0; }

/* ---------- 23. Only the "Do this next" panel is tinted; panels with a Check button stay neutral ---------- */
.panel:has(.btn-primary) { background: var(--card-2); }
.panel:has(.btn-primary) .eyebrow { color: var(--muted); }
.panel.hero, .panel.hero:has(.btn-primary) { background: var(--accent-soft); }
.panel.hero .eyebrow { color: var(--accent); }
.book-text{margin:10px 0;font-size:15px;line-height:1.65}
.book-text .bk-sec{font-family:var(--display);font-size:18px;font-weight:700;margin:4px 0 12px;color:var(--ink)}
.book-text h4{font-family:var(--display);font-size:16px;font-weight:700;margin:18px 0 6px;color:var(--ink)}
.book-text h5{font-family:var(--display);font-size:14px;font-weight:700;margin:14px 0 4px;color:var(--accent)}
.book-text p{margin:0 0 10px}
.book-text ul,.book-text ol{margin:0 0 10px;padding-left:22px}
.book-text li{margin:0 0 6px}
.book-text .bk-box{border:1px solid var(--divider);border-radius:12px;padding:10px 12px;margin:10px 0 14px;background:var(--surface-2,transparent)}
.book-text .bk-box-title{font-family:var(--display);font-size:13px;font-weight:700;letter-spacing:.02em;text-transform:uppercase;color:var(--muted);margin:0 0 8px}
.book-text .bk-box h5{margin-top:8px}
.book-text .bk-box ul:last-child,.book-text .bk-box ol:last-child,.book-text .bk-box p:last-child{margin-bottom:0}
.book-text .bk-def{border-left:3px solid var(--accent);padding:6px 10px;margin:8px 0 12px;font-size:14px;color:var(--ink)}
.book-text .bk-def b{display:block;font-size:14px;margin-bottom:2px}
.book-text .bk-fig{font-size:13px;color:var(--muted);margin:0 0 12px}
.book-text .bk-q{font-weight:600;margin:8px 0 12px;display:flex;gap:8px;align-items:flex-start}
.book-text .bk-q svg{width:18px;height:18px;flex:none;margin-top:3px;color:var(--accent)}
.book-text .bk-note{font-size:12px;color:var(--muted);margin:0 0 10px}
.book-text .bk-table-wrap{margin:10px 0 14px;overflow-x:auto}
.book-text .bk-table{border-collapse:collapse;width:100%;font-size:13px}
.book-text .bk-table th,.book-text .bk-table td{border:1px solid var(--divider);padding:6px 8px;text-align:left;vertical-align:top}
.book-text .bk-table th{font-weight:700;background:var(--surface-2,transparent)}

/* ---------- 24. Alignment fixes (Oct 14) ---------- */
.todo .it > span:nth-of-type(2) { flex: 1; min-width: 0; }
.todo .it > .chev-r, .classcard > .chev-r { margin-left: auto; }
.stage-item > .chips { grid-column: 3; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.stage-item > .name { align-self: center; }
.panel .btn:not(.btn-primary), .fb .btn:not(.btn-primary), .teach .btn:not(.btn-primary), .book .btn:not(.btn-primary) { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.panel .btn:not(.btn-primary):hover, .fb .btn:not(.btn-primary):hover, .teach .btn:not(.btn-primary):hover { background: var(--card-2); }
.opts { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-top: 12px; }
.opts .btn { justify-content: flex-start; text-align: left; min-height: 52px; }
.pairs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; margin-top: 12px; }
.pairs-col { display: flex; flex-direction: column; gap: 8px; }
.pairs .btn { justify-content: flex-start; text-align: left; font-size: 15px; min-height: 48px; padding: 8px 12px; line-height: 1.3; }
.pairs .btn.pair-done { opacity: .45; }
@media (max-width: 480px) { .pairs { grid-template-columns: 1fr; } .pairs-col + .pairs-col { border-top: 1px solid var(--line); padding-top: 10px; } }
.opts .btn:not(.btn-primary), .pairs .btn:not(.btn-primary):not(.pair-done) { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.opts .btn:not(.btn-primary):hover { background: var(--card-2); }

/* ---------- 25. Calendar ---------- */
.cal-month { margin-top: 18px; }
.cal-month h2 { font-size: 17px; margin: 0 0 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal-cell { min-height: 44px; border-radius: 10px; background: var(--card-2); padding: 6px 4px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 14px; color: var(--ink); }
.cal-cell.empty { background: transparent; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 700; }
.cal-cell.has { cursor: pointer; }
.cal-dots { display: flex; gap: 3px; }
.cal-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.cal-dot.due { background: var(--accent); }
.cal-dot.test { background: var(--bad); }
.cal-dot.study { background: var(--blue, var(--accent)); opacity: .7; }
.cal-dot.done { opacity: .35; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
/* ---------- 26. Llama loader (ported from SALT, app colors) ---------- */
:root { --llama-outline: #B9C8F5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --llama-outline: #3F4F80; } }
:root[data-theme="dark"] { --llama-outline: #3F4F80; }
.llama-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 14px 10px; }
.llama-loader.is-inline { flex-direction: row; justify-content: flex-start; padding: 6px 0; gap: 12px; }
.llama-loader-stage { width: 64px; height: 90px; }
.llama-loader.is-compact .llama-loader-stage { width: 40px; height: 56px; }
.llama-loader.is-compact { gap: 8px; padding: 8px 6px; }
.llama-loader-label { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.llama-loader .dots { display: inline-flex; gap: 4px; }
.llama-loader .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: ll-blink 1.2s infinite ease-in-out; }
.llama-loader .dots i:nth-child(2) { animation-delay: .18s; }
.llama-loader .dots i:nth-child(3) { animation-delay: .36s; }
@keyframes ll-blink { 0%,80%,100% { opacity: .2; } 40% { opacity: 1; } }
.llama-loader .llama { width: 100%; height: 100%; overflow: visible; display: block; }
.llama-loader .llama .stroke { fill: none; stroke: var(--llama-outline); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.llama-loader .l-bounce { transform-box: view-box; transform-origin: 100px 298px; }
.llama-loader .l-neck { transform-box: view-box; transform-origin: 150px 145px; }
.llama-loader .l-tail { transform-box: view-box; transform-origin: 20px 142px; }
.llama-loader .leg { transform-box: view-box; }
.llama-loader .leg.fn { transform-origin: 155px 244px; }
.llama-loader .leg.ff { transform-origin: 128px 255px; }
.llama-loader .leg.bn { transform-origin: 62px 253px; }
.llama-loader .leg.bf { transform-origin: 26px 234px; }
.llama-loader .walk .l-bounce { animation: ll-bobWalk 1.4s ease-in-out infinite; }
.llama-loader .walk .leg.fn, .llama-loader .walk .leg.bf { animation: ll-stepA 1.4s ease-in-out infinite; }
.llama-loader .walk .leg.ff, .llama-loader .walk .leg.bn { animation: ll-stepB 1.4s ease-in-out infinite; }
.llama-loader .walk .l-neck { animation: ll-nod 1.4s ease-in-out infinite; }
.llama-loader .walk .l-tail { animation: ll-tailWag 1.4s ease-in-out infinite; }
@keyframes ll-stepA { 0%,100% { transform: rotate(9deg); } 50% { transform: rotate(-9deg); } }
@keyframes ll-stepB { 0%,100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg); } }
@keyframes ll-bobWalk { 0%,50%,100% { transform: translateY(0); } 25%,75% { transform: translateY(-3px); } }
@keyframes ll-nod { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2.5deg); } }
@keyframes ll-tailWag { 0%,100% { transform: rotate(-7deg); } 50% { transform: rotate(9deg); } }
.llama-loader .llama .accent { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100 100; animation: ll-fxDraw 3.4s ease-in-out infinite; }
@keyframes ll-fxDraw { 0% { stroke-dashoffset: 100; } 44% { stroke-dashoffset: 0; } 66% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -100; } }
@media (prefers-reduced-motion: reduce) { .llama-loader * { animation: none !important; } .llama-loader .llama .accent { stroke-dashoffset: 0; } }

/* ---------- 27. Selects, matching grid, star pop, wells ---------- */
select.input { appearance: none; -webkit-appearance: none; padding-right: 44px; background-color: var(--card); background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2366667A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; border: 1.5px solid var(--line); border-radius: var(--r-control); color: var(--ink); cursor: pointer; }
select.input:focus { outline: none; border-color: var(--accent); }
.pairs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; margin-top: 12px; align-items: stretch; }
.pairs .btn { height: 100%; }
.star-pop { position: fixed; z-index: 60; display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px; box-shadow: var(--shadow-float); pointer-events: none; animation: star-pop 1.3s var(--ease) forwards; }
.star-pop svg { width: 16px; height: 16px; }
@keyframes star-pop { 0% { opacity: 0; transform: translateY(8px) scale(.9); } 15% { opacity: 1; transform: translateY(0) scale(1.05); } 70% { opacity: 1; transform: translateY(-14px) scale(1); } 100% { opacity: 0; transform: translateY(-28px) scale(.95); } }
.well { background: var(--card-2); border-radius: var(--r-group); padding: 14px 16px; margin-top: 14px; }
.well > .well-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 6px; }
.well > .well-head h2 { margin: 0; font-size: 18px; }
.well .subwell { background: var(--card); border-radius: var(--r-group); padding: 12px 14px; margin-top: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.well .subwell .subwell-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.well .subwell .subwell-head b { font-size: 16px; }
.well .subwell .stage-list { background: transparent; padding: 0; }
.well .subwell .stage-item { min-height: 54px; }
.well .subwell .subwell-asg { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 0; color: var(--ink); background: transparent; border: 0; text-align: left; cursor: pointer; font: inherit; }
.well .subwell .subwell-asg .nm { font-weight: 700; display: block; }
.well .subwell .subwell-asg .st { font-size: 14px; color: var(--muted); display: block; }
.well .subwell .subwell-asg .chev-r { margin-left: auto; }
.subject-chip { font-size: 12px; }
/* math visuals */
.mt-steps { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 0; }
.mt-card { background: var(--card); border-radius: var(--r-group); box-shadow: inset 0 0 0 1px var(--line); padding: 12px 14px; }
.mt-card .mt-k { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; color: var(--accent); margin: 0 0 6px; }
.mt-card p { margin: 4px 0 0; }
.mt-eq { font-family: var(--display); font-size: 20px; line-height: 1.5; display: flex; flex-direction: column; gap: 2px; margin: 6px 0; }
.mt-eq span { display: block; }
.mt-eq .mark { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 0 6px; }
.mt-table { border-collapse: collapse; margin: 8px 0 2px; font-size: 16px; }
.mt-table th, .mt-table td { border: 1px solid var(--line); padding: 6px 14px; text-align: center; }
.mt-table .hl td { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.mt-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.mt-compare .mt-card h4 { margin: 0 0 4px; font-family: var(--display); font-size: 17px; }
.mt-compare ul { margin: 6px 0 0; padding-left: 18px; }
.mt-compare svg { width: 100%; height: 56px; display: block; margin-top: 8px; }
.mt-formula { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; font-family: var(--display); font-size: 22px; margin: 8px 0 4px; }
.mt-formula .part { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mt-formula .part small { font-family: var(--body); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.mt-formula .a { color: var(--good); } .mt-formula .b { color: var(--accent); } .mt-formula .x { color: var(--amber); }
.mt-chain { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-family: var(--display); font-size: 17px; margin-top: 6px; }
.mt-chain .arrow { color: var(--muted); }
@media (max-width: 420px) { .mt-compare { grid-template-columns: 1fr; } }
.stage-item { align-content: center; grid-template-rows: auto auto; }
.stage-item > .num, .stage-item > .chips, .stage-item > .chev-r { align-self: center; }

/* ---------- 28. Drag cards, order list, flip cards ---------- */
.buckets { display: grid; gap: 10px; margin-top: 12px; }
.bucket { background: var(--card); border-radius: var(--r-group); box-shadow: inset 0 0 0 1.5px var(--line); padding: 10px; min-height: 96px; display: flex; flex-direction: column; gap: 8px; transition: box-shadow .12s var(--ease), background .12s; }
.bucket.over { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.bucket-h { font-family: var(--display); font-weight: 700; font-size: 15px; text-align: center; }
.bucket-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 10px 0; border: 1.5px dashed var(--line); border-radius: 8px; }
.dcards { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.dcard { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-control); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; line-height: 1.35; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.dcard.placed { background: var(--card-2); font-size: 14px; }
.dcard.picked { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.dcard.dragging { opacity: .35; }
.dcard .grip { flex: none; width: 18px; height: 18px; color: var(--muted); cursor: grab; touch-action: none; }
.dcard.ghost { position: fixed; z-index: 70; pointer-events: none; box-shadow: var(--shadow-float); background: var(--card); opacity: .95; transform: rotate(-1.5deg); }
.olist { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ocard { cursor: default; }
.ocard.over { box-shadow: inset 0 0 0 2px var(--accent); }
.ocard .on { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); font-size: 12px; font-weight: 700; color: var(--muted); }
.ocard .otext { flex: 1; min-width: 0; }
.ocard .oarrows { display: flex; flex-direction: column; gap: 2px; margin-left: auto; }
.ocard .oarrows .iconbtn { width: 30px; height: 26px; min-height: 0; }
.ocard .oarrows .iconbtn:disabled { opacity: .3; }
.flips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.flip { position: relative; min-height: 120px; border: 0; background: transparent; padding: 0; cursor: pointer; perspective: 800px; font: inherit; color: inherit; text-align: left; }
.flip .face { position: absolute; inset: 0; border-radius: var(--r-group); padding: 12px; display: flex; flex-direction: column; justify-content: center; gap: 4px; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .45s var(--ease); }
.flip .front { background: var(--accent); color: var(--accent-ink); align-items: center; text-align: center; }
.flip .front svg { width: 22px; height: 22px; }
.flip .front small { font-size: 12px; opacity: .8; }
.flip .back { background: var(--card); box-shadow: inset 0 0 0 1.5px var(--accent); transform: rotateY(180deg); font-size: 14px; line-height: 1.4; }
.flip.on .front { transform: rotateY(180deg); }
.flip.on .back { transform: rotateY(0); }
@media (prefers-reduced-motion: reduce) { .flip .face { transition: none; } }
.stage-item > .name { position: relative; top: 2px; }
.well .subwell .subwell-head { align-items: center; padding-bottom: 8px; margin-bottom: 6px; border-bottom: 1px solid var(--divider); }
.well .subwell .subwell-head b { font-family: var(--body); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.well .subwell .subwell-head .small { font-size: 12px; }
.well > .well-head { padding-bottom: 4px; }
.well > .well-head h2 { font-size: 20px; }
.mt-eq span { display: inline; }
.mt-eq > span { display: block; }
.mt-eq .mark { display: inline-block; line-height: 1.2; }

/* ---------- 29. Carousel, audio bar, limits ---------- */
.row > .btn { align-self: stretch; }
.flips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .flips { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 340px) { .flips { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .buckets { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
.caro { margin-top: 6px; }
.caro-viewport { overflow: hidden; border-radius: var(--r-group); }
.caro-track { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; transition: transform .3s var(--ease); }
.caro-page { min-width: 0; padding: 2px; display: flex; flex-direction: column; }
.caro-page .mt-steps, .caro-page .mt-compare { margin: 0; display: block; flex: 1; }
.caro-page .mt-card { height: 100%; box-sizing: border-box; }
.caro-nav { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.caro-nav .small { margin-left: auto; }
.caro-dots { display: flex; gap: 6px; }
.caro-dots .dot { width: 10px; height: 10px; border-radius: 50%; border: 0; padding: 0; background: var(--line); cursor: pointer; }
.caro-dots .dot.seen { background: var(--muted); }
.caro-dots .dot.on { background: var(--accent); transform: scale(1.2); }
.audio { position: relative; display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 8px 10px; border-radius: var(--r-control); background: var(--card-2); }
.teach .audio, .panel .audio, .caro-page .audio { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.audio .aplay { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; }
.audio .aplay:disabled { opacity: .5; }
.audio .aplay svg { width: 18px; height: 18px; }
.audio .abody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.audio .abar { height: 6px; border-radius: 3px; background: var(--line); cursor: pointer; overflow: hidden; }
.audio .afill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .2s linear; }
.audio .atime { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio .atime .llama-loader { padding: 0; }
.audio .atime .llama-loader-stage { width: 26px; height: 36px; }
.audio .amore { flex: none; width: 36px; height: 36px; }
.audio .amenu { position: absolute; right: 8px; top: calc(100% + 4px); z-index: 20; background: var(--card); border-radius: var(--r-group); box-shadow: var(--shadow-float), inset 0 0 0 1px var(--line); padding: 6px; display: flex; flex-direction: column; min-width: 170px; }
.audio .amenu[hidden] { display: none; }
.amenu-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; border-radius: 8px; cursor: pointer; text-align: left; }
.amenu-item:hover { background: var(--card-2); }
.amenu-item.on { color: var(--accent); font-weight: 600; }
.amenu-item svg { width: 16px; height: 16px; }

.audio .abody { flex-direction: row; align-items: center; gap: 10px; }
.audio .abar { flex: 1; min-width: 60px; }
.audio .atime:empty { display: none; }
.audio .atime { flex: none; max-width: 46%; }
.lr-wrap{box-shadow:inset 0 0 0 1px var(--line)}
.lr-hud{font-size:16px;color:var(--muted);text-shadow:none;letter-spacing:.08em}
.lr-hud .lr-score{color:var(--ink)}
.lr-wrap .sh-mute{background:var(--card);color:var(--ink);box-shadow:inset 0 0 0 1px var(--line)}

/* ---------- 30. Scoreboard ---------- */
.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.score-card { background: var(--card); border-radius: var(--r-group); box-shadow: inset 0 0 0 1px var(--line); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.panel.hero .score-card { box-shadow: none; }
.score-top { display: flex; align-items: center; gap: 8px; }
.score-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.score-ic svg { width: 16px; height: 16px; }
.score-name { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.score-val { font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1; color: var(--ink); }
.score-val small { font-size: 16px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.score-sub { font-size: 13px; color: var(--muted); }
.score-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.score-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.score-next { font-size: 12px; color: var(--muted); }
@media (max-width: 380px) { .scoreboard { grid-template-columns: 1fr; } }
.audio .aplay svg, .audio .aplay .lucide { color: var(--accent-ink); stroke: var(--accent-ink); }
.caro-page .mt-card { display: flex; flex-direction: column; justify-content: flex-start; }
.teach .btn .lucide, .teach .btn-primary .lucide, .teach .aplay .lucide { color: inherit; }
.teach .btn-primary .lucide { color: var(--accent-ink); }
/* secondary buttons beside a primary: solid tinted fill, no inset border (the border made them look smaller) */
.panel .btn:not(.btn-primary), .fb .btn:not(.btn-primary), .teach .btn:not(.btn-primary), .book .btn:not(.btn-primary), .opts .btn:not(.btn-primary), .pairs .btn:not(.btn-primary):not(.pair-done) { background: color-mix(in srgb, var(--ink) 9%, var(--card-2)); box-shadow: none; }
.panel .btn:not(.btn-primary):hover, .fb .btn:not(.btn-primary):hover, .teach .btn:not(.btn-primary):hover, .opts .btn:not(.btn-primary):hover { background: color-mix(in srgb, var(--ink) 15%, var(--card-2)); }
.panel .btn-ghost, .teach .btn-ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.mt-card .mt-compare { gap: 8px; }
.mt-card .mt-compare .mt-table { width: 100%; font-size: 14px; }
.mt-card .mt-compare .mt-table th, .mt-card .mt-compare .mt-table td { padding: 4px 6px; }
.mt-card.anchor { background: var(--accent-soft); box-shadow: none; }
.mt-card.anchor .mt-k { color: var(--accent); }

/* ---------- 31. Lesson stepper ---------- */
.lesson { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.lstep { border-radius: var(--r-group); background: var(--card-2); padding: 12px 14px; }
.lstep.open { background: var(--card); box-shadow: inset 0 0 0 1.5px var(--accent); }
.lstep.locked { opacity: .55; }
.lstep-head { display: flex; align-items: center; gap: 12px; }
.lstep-head .num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 700; color: var(--muted); flex: none; }
.lstep.open .lstep-head .num { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.lstep.done .lstep-head .num { background: var(--good-bg); color: var(--good); box-shadow: none; }
.lstep-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lstep-title b { font-size: 16px; }
.lstep.done .lstep-title b { font-weight: 600; color: var(--muted); }
.lstep-head .lock { width: 16px; height: 16px; color: var(--muted); }
.lstep-body { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); line-height: 1.6; }
.lstep-body.peek { font-size: 15px; }
.lstep-body p { margin: 0 0 10px; }
.lstep-body ul { margin: 0 0 10px; }
.lstep-body .opts { margin-top: 10px; }
.lstep-body .mt-table { margin: 6px 0 2px; }
.lcheck { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.worked { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.wline { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--r-control); background: var(--card-2); }
.lstep.open .wline { background: var(--card-2); }
.wline.new { box-shadow: inset 0 0 0 1.5px var(--accent); }
.wline.done { background: var(--good-bg); }
.wline .weq { font-family: var(--display); font-size: 18px; line-height: 1.4; }
.wline .weq .mark { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 0 5px; }
.wline .wwhy { font-size: 14px; color: var(--muted); }
@media (max-width: 480px) { .wline { grid-template-columns: 1fr; gap: 4px; } }
.diag { width: 100%; height: auto; display: block; margin: 8px 0 4px; color: var(--ink); }

.work-parts { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.wpart { padding: 10px 12px; border-radius: var(--r-control); background: var(--card-2); }
.wpart.done { background: var(--good-bg); }
.wpart label { display: block; margin-bottom: 6px; color: var(--muted); }
.wpart .wans { font-family: var(--display); font-size: 17px; }
.narrate { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.npart label { display: block; margin-bottom: 4px; color: var(--muted); }
.npart textarea { min-height: 56px; }
details.map.pin { margin: 12px 0 0; }
details.map.pin summary { font-weight: 700; }
details.map.pin .mt-table { margin-top: 4px; }
.pyramid { margin: 0; padding-left: 0; list-style: none; counter-reset: p; }
.pyramid li { counter-increment: p; padding: 8px 12px; margin: 0 auto 4px; border-radius: 8px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; }
.pyramid li:nth-child(1){width:55%}.pyramid li:nth-child(2){width:65%}.pyramid li:nth-child(3){width:75%}.pyramid li:nth-child(4){width:85%}.pyramid li:nth-child(5){width:95%}.pyramid li:nth-child(6){width:100%}
@media (max-width:480px){ .pyramid li { width: 100% !important; } }
.truths { margin: 0; padding-left: 20px; }
.truths li { margin: 4px 0; }

.refcard { margin-top: 12px; padding: 12px 14px; border-radius: var(--r-group); background: var(--card-2); }
.refcard-h { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.refcard-h svg { width: 14px; height: 14px; }
.refcard .mt-table { width: 100%; }
.refcard .mt-table th, .refcard .mt-table td { text-align: left; padding: 6px 10px; }
.refcard .mt-compare .mt-card { background: var(--card); }
.lstep.done .lstep-head { cursor: pointer; }
.lstep.done .lstep-head:hover .lstep-title b { color: var(--ink); }
.guess-back { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--accent); margin-bottom: 8px; }
.guess-back svg { width: 16px; height: 16px; }
.lstep-body .audio { margin-top: 10px; }
.spectrum .band { height: 26px; border-radius: 6px; background: linear-gradient(90deg,#7b2ff7 0%,#2457E0 18%,#15b39a 36%,#7ad13a 52%,#ffd166 68%,#ff8a3d 84%,#c9332a 100%); position: relative; overflow: hidden; }
.spectrum .band::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(0,0,0,.85) 22px 24px, transparent 24px 61px, rgba(0,0,0,.85) 61px 63px, transparent 63px 97px, rgba(0,0,0,.85) 97px 99px); }
.mt-compare.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.mt-compare.three svg { height: 64px; }
@media (max-width: 520px) { .mt-compare.three { grid-template-columns: 1fr; } }

blockquote.rq { margin: 8px 0 14px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--card-2); border-radius: 0 var(--r-control) var(--r-control) 0; font-size: 17px; line-height: 1.55; }
.flip.big { width: 100%; min-height: 150px; display: block; }
.flip.big .front b { font-size: 22px; }
.flip.big .back { align-items: flex-start; text-align: left; }
/* lesson: one step at a time */
.lnav { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.lnav .ldots { display: flex; gap: 5px; flex-wrap: wrap; }
.lnav .ldots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: inline-block; }
.lnav .ldots i.done { background: var(--good); }
.lnav .ldots i.on { background: var(--accent); transform: scale(1.3); }
.lnav .small { margin-left: auto; }
.lstep.viewing { box-shadow: inset 0 0 0 1.5px var(--line); }

.flashwrap { max-width: 440px; margin: 14px auto 0; }
.flip.big { min-height: 190px; }
.flip.big .face { transition: transform .55s cubic-bezier(.4,.2,.2,1); padding: 18px; gap: 8px; }
.flip.big .front b { font-size: 24px; }
.flip.big .back { align-items: center; text-align: center; justify-content: center; }
.flip.big .back small { color: var(--muted); font-size: 12px; }
.flip.big .back .fdef { font-size: 17px; line-height: 1.45; }
.flip:active .face { transform: scale(.985); }
.flip.on:active .front { transform: rotateY(180deg) scale(.985); }
.lnav.bottom { position: sticky; bottom: 0; z-index: 5; margin-top: 16px; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); justify-content: space-between; }
.lnav.bottom .lcount { font-size: 14px; color: var(--muted); text-align: center; flex: 1; }
.lnav.bottom .lcount .plus { color: var(--warn); }
.lnav.bottom .btn { min-width: 112px; }
.linkbtn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 4px 0; margin-left: 4px; }
.linkbtn svg { width: 15px; height: 15px; }
.rnav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.rnav .rcount { font-size: 14px; color: var(--muted); text-align: center; flex: 1; }
.rnav .rcount .plus { color: var(--warn); }
.rnav .btn { min-width: 112px; }
/* mission rows: both chips on the right, wrap under the title on narrow screens */
.stage-item > .chips { flex-wrap: nowrap; }
.stage-item .subject-chip { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
@media (max-width: 560px) { .stage-item > .chips { grid-column: 2; grid-row: 2; justify-content: flex-start; flex-wrap: wrap; margin-top: 6px; } .stage-item > .num { grid-row: 1 / span 2; } }
.btn.btn-ok { background: var(--good-bg); color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.rcount .plus { color: var(--warn); }
.btn.wrong { background: var(--bad-bg, rgba(255,80,80,.12)); color: var(--bad, #e5484d); box-shadow: inset 0 0 0 1px currentColor; }
.fb + textarea.input, .fb + .input, .fb + .lcheck, blockquote.rq + .fb { margin-top: 12px; }
.fb + .fb { margin-top: 8px; }
.row > #exWait:empty { display: none; }
.row .llama-loader.is-inline { padding: 0; }
#flashRate { text-align: center; }
#flashRate .row.rate { justify-content: center; gap: 12px; }
#flashRate .row.rate .btn { flex: 0 0 160px; width: 160px; justify-content: center; }
/* classes grid: uniform cards, even gaps, aligned rows */
.grid { gap: 10px; align-items: stretch; }
@media (min-width: 640px) { .grid { column-gap: 14px; row-gap: 10px; } }
.grid > .classcard { background: var(--card-2); min-height: 84px; padding: 14px 14px; height: 100%; }
.grid > .classcard::after { display: none; }
.grid > .classcard:hover { background: color-mix(in srgb, var(--card-2) 80%, var(--ink) 6%); }
.grid > .classcard.hot { background: var(--bad-bg); }
.grid > .classcard.quiet { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.grid > .classcard .st { margin-top: 3px; }
.sec + .grid { margin-top: 12px; }
.grid + .row { margin-top: 18px; }
/* shared matcher: equal-height rows, tap or drag, joined pairs */
.pairs.drag { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); grid-auto-rows: 1fr; column-gap: 10px; row-gap: 8px; align-items: stretch; }
.pairs .pcard { height: 100%; min-height: 52px; display: flex; align-items: center; justify-content: flex-start; text-align: left; font-size: 15px; line-height: 1.3; padding: 10px 12px; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y; position: relative; transition: box-shadow .12s var(--ease), background .12s var(--ease); }
.pairs .pcard.sel, .pairs .pcard.drop-target { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); color: var(--ink); }
.pairs .pcard.dragging { opacity: .35; }
.pairs .pcard.done { opacity: 1; background: var(--accent-soft); color: var(--ink); cursor: default; box-shadow: inset 0 0 0 1px var(--accent); }
.pairs .pcard.done.l { border-radius: var(--r-control) 0 0 var(--r-control); margin-right: -5px; border-right: 3px solid var(--accent); }
.pairs .pcard.done.r { border-radius: 0 var(--r-control) var(--r-control) 0; margin-left: -5px; }
.pair-ghost { position: fixed; z-index: 60; pointer-events: none; opacity: .95; box-shadow: 0 12px 32px rgba(0,0,0,.35); background: var(--card); color: var(--ink); border-radius: var(--r-control); }
.row > .btn[data-o], .row > .btn[data-exo] { justify-content: flex-start; text-align: left; }
.pairs .pcard.done { cursor: pointer; }
.pairs .pcard.done:hover { filter: brightness(1.08); }
.pairs .pcard.done.locked { background: var(--good-bg); color: var(--good); box-shadow: inset 0 0 0 1px var(--good); cursor: default; }
.pairs .pcard.done.locked.l { border-right-color: var(--good); }
.pairs .pcard.done.locked .lucide { width: 16px; height: 16px; margin-right: 6px; flex: 0 0 auto; }
.pairs .pcard.done.locked:hover { filter: none; }
/* refcard lists and the script / FANBOYS demos */
.refcard ul.tight, .refcard ol.tight { margin: 6px 0 0 18px; padding: 0; }
.refcard ul.tight li, .refcard ol.tight li { margin: 4px 0; line-height: 1.4; }
.refcard ol.olist.tight { list-style: decimal; }
.script-demo { font-family: "Courier New", Courier, monospace; font-size: 14px; line-height: 1.5; background: var(--card); border-radius: var(--r-control); padding: 14px 16px; margin-top: 8px; color: var(--ink); }
.script-demo .sh { text-transform: uppercase; font-weight: 700; }
.script-demo .ac { margin-top: 10px; }
.script-demo .ch { text-align: center; text-transform: uppercase; margin-top: 10px; }
.script-demo .dl { text-align: center; padding: 0 18%; }
.fanboys { font-size: 18px; letter-spacing: .3px; margin: 4px 0 0; }
.fanboys b { color: var(--accent); }
/* math typesetting */
.math { white-space: nowrap; font-variant-numeric: lining-nums; }
.math var, var { font-style: italic; font-family: inherit; font-weight: inherit; }
.math sup, .math sub { font-size: .72em; line-height: 0; position: relative; vertical-align: baseline; }
.math sup { top: -.55em; }
.math sub { bottom: -.25em; }
.math sup var, .math sub var { font-style: italic; }
h1 .math, h2 .math { font-weight: inherit; }
/* home list: subject as a subtitle, dividers between rows */
.stage-list.later .stage-item { padding: 14px 0; }
.stage-list.later .stage-item + .stage-item { border-top: 1px solid var(--divider); }
.stage-list.later .stage-item > .meta { display: flex; align-items: center; justify-content: flex-start; gap: 6px; color: var(--muted); font-size: 14px; margin-top: 3px; }
.stage-list.later .stage-item > .meta .lucide { width: 14px; height: 14px; }
.stage-list.later .stage-item > .chips { grid-row: 1 / span 2; }
@media (max-width: 560px) { .stage-list.later .stage-item > .chips { grid-column: 2; grid-row: 3; margin-top: 6px; } .stage-list.later .stage-item > .num { grid-row: 1 / span 3; } }
/* math: keep italics off the parentheses and exponents */
.math var { margin-right: .05em; }
.math var.fn { margin-right: .14em; }
.math var + sup { margin-left: .06em; }
.math sup { margin-left: .02em; }
/* review fixes: phone layout, hidden reference, self-check label, extras */
body:has(.lnav.bottom) #fabs, body:has(.rnav) #fabs { bottom: calc(84px + env(safe-area-inset-bottom)); }
h2.purpose.clamp { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
h2.purpose.clamp::after { content: ""; }
.refcard .diagwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 560px) { .refcard .diagwrap svg.diag { min-width: 620px; height: auto; } .refcard .diagwrap::after { content: "Swipe sideways to see the whole diagram"; display: block; font-size: 12px; color: var(--muted); margin-top: 4px; } }
.refcard.hidden { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.refcard.hidden p { margin: 6px 0 0; }
.selfcheck { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--muted); background: var(--card-2); border-radius: var(--r-control); padding: 10px 12px; margin: 0 0 10px; }
.selfcheck .lucide { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; }
.extra-wrap { margin-top: 12px; }
.extra-wrap .stage-list { margin-top: 10px; }
.narrate .small .ok { color: var(--good); } .narrate .small .part { color: var(--warn); }
.mt-table.plan13 td:last-child { white-space: nowrap; color: var(--muted); }
/* first-run tour */
.tour { position: fixed; inset: 0; z-index: 80; }
.tour .tour-back { position: absolute; inset: 0; }
.tour .tour-spot { position: absolute; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(0,0,0,.66), 0 0 0 3px var(--accent); transition: left .25s var(--ease), top .25s var(--ease), width .25s var(--ease), height .25s var(--ease); pointer-events: none; }
.tour .tour-card { position: absolute; background: var(--card); color: var(--ink); border-radius: var(--r-group); padding: 16px 16px 14px; box-shadow: 0 18px 50px rgba(0,0,0,.45), inset 0 0 0 1px var(--line); max-width: 380px; }
.tour .tour-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tour .tour-head h3 { margin: 0; font-size: 18px; }
.tour .tour-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); flex: 0 0 auto; }
.tour .tour-ic .lucide { width: 18px; height: 18px; }
.tour .tour-card p { margin: 0; font-size: 15px; line-height: 1.5; }
.tour .tour-demo { margin-top: 12px; padding: 10px; border-radius: var(--r-control); background: var(--card-2); }
.tour .tour-demo .lnav.bottom.demo { position: static; margin: 0; padding: 0; border: 0; background: transparent; }
.tour .tour-demo .lnav.bottom.demo .btn { min-width: 0; pointer-events: none; }
.tour .tour-demo .audio.demo { pointer-events: none; margin: 0; }
.tour .tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.tour .tour-dots { display: inline-flex; gap: 5px; }
.tour .tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); display: block; }
.tour .tour-dots i.done { background: var(--muted); }
.tour .tour-dots i.on { background: var(--accent); width: 16px; border-radius: 3px; }
@media (max-width: 560px) { .tour .tour-card { left: 12px !important; right: 12px; top: auto !important; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: none; width: auto !important; } }
body.touring { overflow: hidden; }
.tour .tour-foot .row { flex-wrap: nowrap; }
.tour .tour-foot .btn { white-space: nowrap; }
@media (max-width: 560px) { .tour .tour-foot { flex-wrap: wrap; } .tour .tour-dots { width: 100%; justify-content: center; margin-bottom: 4px; } .tour .tour-foot .row { width: 100%; justify-content: flex-end; } }
.fresh-tag { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--accent); background: var(--accent-soft); border-radius: var(--r-control); padding: 8px 12px; margin: 0 0 10px; }
.fresh-tag .lucide { width: 16px; height: 16px; flex: 0 0 auto; }
.sec #covCopy { margin-left: auto; }
/* who is this */
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.who { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 12px; border: 0; border-radius: var(--r-group); background: var(--card-2); color: var(--ink); font: inherit; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); }
.who:hover { background: color-mix(in srgb, var(--card-2) 80%, var(--ink) 6%); }
.who.on { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.who .who-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); }
.who .who-ic .lucide { width: 22px; height: 22px; }
.who .who-nm { font-weight: 700; font-size: 17px; }
/* Asia map practice */
.amap { margin-top: 12px; border-radius: var(--r-group); background: var(--card-2); padding: 6px; overflow: hidden; }
.amap svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.amap.zoom { overflow: auto; -webkit-overflow-scrolling: touch; }
.amap.zoom svg { min-width: 1000px; }
.amap .ctx { fill: var(--card); stroke: var(--line); stroke-width: .8; }
.amap .tgt { fill: color-mix(in srgb, var(--card-2) 60%, var(--ink) 10%); stroke: var(--muted); stroke-width: 1; cursor: pointer; transition: fill .15s var(--ease); }
.amap .tgt.known { fill: var(--card-2); }
.amap .tgt:hover { fill: var(--accent-soft); }
.amap .tgt.hi { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.4; }
.amap .tgt.ok { fill: var(--good-bg); stroke: var(--good); stroke-width: 2; }
.amap .tgt.bad { fill: var(--bad-bg); stroke: var(--bad); stroke-width: 2; }
.amap .tgt.reveal { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 3; animation: mpulse 1s ease-in-out 3; }
.amap .mark { stroke-width: 2; }
.amap .lbl { font: 700 18px/1 inherit; font-family: inherit; fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-width: 5px; pointer-events: none; }
@keyframes mpulse { 0%, 100% { stroke-width: 3; } 50% { stroke-width: 7; } }
.amap svg { touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; }
.amap .tgt, .amap .ctx { vector-effect: non-scaling-stroke; }
.amap.zoom svg { min-width: 0; }
.seg { display: inline-flex; gap: 4px; padding: 4px; margin-top: 10px; border-radius: var(--r-pill); background: var(--card-2); }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; padding: 6px 14px; border-radius: var(--r-pill); cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.amap .tgt.extra { fill: color-mix(in srgb, var(--card-2) 85%, var(--ink) 4%); stroke-dasharray: 4 3; }
.amap .lbl.all { font-size: 13px; font-weight: 600; }
.lnav.bottom button.lcount { border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 6px 8px; border-radius: var(--r-pill); min-width: 0; }
.lnav.bottom button.lcount:hover { background: var(--card-2); }
.lnav.bottom button.lcount .lucide { width: 14px; height: 14px; }
.lpick { margin-top: 14px; }

/* ---------- Nov 3 2026: flow extensions ---------- */
.fx-verify{display:flex;gap:10px;align-items:flex-start;margin-top:12px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--card-2);font-size:.95rem;line-height:1.35}
.fx-verify input{width:22px;height:22px;flex:none;margin-top:1px}
.fx-photo input{display:none}
.fx-thumbs{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.fx-thumb{position:relative;margin:0;width:96px;height:96px;border-radius:10px;overflow:hidden;border:1px solid var(--line);background:#eee}
.fx-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.fx-del{position:absolute;top:4px;right:4px;width:30px;height:30px;background:rgba(255,255,255,.9)}
.fx-ws{margin-top:12px}
.fx-cols{display:grid;gap:10px;margin-top:10px}
@media(min-width:720px){.fx-cols{grid-template-columns:1fr 1fr}}
.fx-col{padding:10px 12px;border-radius:12px;border:1px solid var(--line);background:var(--card-2)}
.fx-col .eyebrow{display:flex;gap:6px;align-items:center}
.fx-col p{margin:6px 0 0;white-space:pre-wrap;line-height:1.45}
mark.fx-new{background:#d9f3e4;color:inherit;border-radius:4px;padding:0 2px;outline:1px dashed #0a8f5b}
.fx-versions{margin-top:10px;display:grid;gap:6px}
.fx-ver{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:6px 0;border-top:1px solid var(--line)}
.fx-rows{display:grid;gap:8px;margin-top:8px}
.fx-row{display:flex;justify-content:space-between;gap:8px;align-items:flex-start;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--card)}
.fx-row.incomplete{border-style:dashed}
.fx-row-main{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:.95rem;line-height:1.35}
.fx-row-acts{display:flex;gap:6px;flex:none}
.fx-form{display:grid;gap:10px;margin-top:12px;padding:12px;border:1px solid var(--line);border-radius:12px;background:var(--card-2)}
.fx-form label{display:grid;gap:4px}
.fx-form .input{margin:0}
.fx-stats{display:grid;gap:6px;margin-top:10px}
.fx-stat{display:grid;grid-template-columns:120px 1fr;gap:8px;align-items:center;padding:6px 0;border-top:1px solid var(--line)}
.fx-tools{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}
.fx-sketch svg{display:block;cursor:crosshair}
.fx-sketch svg:focus{outline:2px solid var(--accent);outline-offset:2px}
.fx-it{cursor:grab}
.fx-bundle section{margin-top:12px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--card)}
.fx-bundle h3{margin:0 0 6px;font-size:1rem}
.fx-bundle p{margin:0;white-space:pre-wrap}
.fx-bundle table{font-size:.85rem}
.map-row.pstat{align-items:flex-start}
#hrSvg:focus{outline:2px solid var(--accent);outline-offset:2px}
.tag-warn{background:var(--warn-bg,#fff3df);color:var(--warn,#9a5b00)}

/* ---------- Nov 20 2026: inequality number line, rock layers ---------- */
.nl-q{font-size:1.25rem;font-weight:700;margin:6px 0 4px;letter-spacing:.01em}
.nl-shapes{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 4px}
.nl-end{margin-top:8px;display:grid;gap:4px}
.nl-end .iconbtn{width:44px;height:44px}
.nl-end .btn{min-height:44px}

/* ---------- Nov 23 2026: help row, session picker ---------- */
.helprow{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.helprow .btn{min-height:44px}
.row.seg{display:flex;align-items:center;gap:8px;flex-wrap:wrap;background:transparent;padding:0;border-radius:0}
/* a two-choice toggle made of ordinary buttons: the chosen one must look chosen (the older .seg button rule made both look the same) */
.row.seg .btn{background:var(--card-2);color:var(--ink,inherit);border:1px solid var(--divider);border-radius:9px;font-size:15px;padding:6px 14px}
.row.seg .btn.btn-primary{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.row.seg .btn{min-height:44px}

/* ---------- coverage fixes (Nov 23 2026): worksheet map, coverage list, source pages ---------- */
.fx-group, .fx-led { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; background: var(--card); }
.fx-ghead { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; justify-content: space-between; }
.fx-boxes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fx-box { display: flex; flex-direction: column; align-items: flex-start; min-width: 96px; min-height: 48px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); font: inherit; cursor: pointer; text-align: left; }
.fx-box .n { font-weight: 700; font-size: 16px; line-height: 1.2; }
.fx-box .w { font-size: 13px; line-height: 1.25; }
.fx-box:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.fx-sheet { margin: 12px 0 0; }
.fx-sheet figcaption { margin-bottom: 6px; }
.sheetq { border-left: 4px solid var(--accent); border-radius: 4px; }
.fx-bundle .ans, #boxText { white-space: pre-wrap; }
.fx-bundle h3 .tag { font-weight: 500; margin-left: 6px; }
.fx-para { margin: 10px 0 0; line-height: 1.6; }
.fx-doc { margin-top: 6px; }
/* phone fit and tap targets (Nov 23 2026 fixes) */
.fb .tag, .ideas .tag, .fx-led .tag, .fx-ghead .tag { white-space: normal; line-height: 1.3; padding: 4px 9px; max-width: 100%; }
.audio .iconbtn.amore { min-width: 44px; min-height: 44px; }
.linkbtn { min-height: 44px; }
.ocard .oarrows .iconbtn { width: 44px; height: 40px; }
.fx-verify { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; }
