:root {
  /* Redesign step 1 (2026-10-17; design record content/design/ui-redesign-2026-10/): ONE token set per theme. Dark is the
     default; light = "C Mist" with its own cobalt accent. The tenant's colours come from the server as --brand-* (logo, series
     cover, book covers) and, in the dark theme only, as the accent (server.py _theme_css). The old names below (--paper,
     --ink, --muted …) point at the tokens, so every older screen follows the theme. */
  --serif: "Tiro Devanagari Hindi", "Noto Serif Kannada", "Noto Serif Telugu", "Noto Serif Gurmukhi", "Noto Serif Oriya", "Noto Serif Devanagari", Georgia, serif;
  --sans: Mukta, "Noto Sans Devanagari", "Noto Sans Kannada", "Noto Sans Telugu", "Noto Sans Gurmukhi", "Noto Sans Oriya", system-ui, -apple-system, "Segoe UI", sans-serif;
  --chalk-font: Kalam, "Noto Sans Kannada", "Noto Sans Telugu", "Noto Sans Gurmukhi", "Noto Sans Oriya", Mukta, cursive;
  --radius: 16px;
  --brand-ink: #1B3A6B; --brand-ink-dark: #11233F; --brand-accent: #E8590C; --brand-gold: #F2A93B;
  --gold: #F2A93B; --chalk: #F3F0E8; --chalk-yel: #F4D27A;
  /* old names → tokens */
  --paper: var(--bg); --ink: var(--text); --ink-2: var(--text2); --muted: var(--text3);
  --shadow: 0 18px 40px -18px var(--drop);
}
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A1019; --desk: #0A1019; --glow: rgba(255,236,200,.07); --card: #151E2C; --page: #1C1D1E; --field: #101824;
  --line: rgba(255,255,255,.12); --line-soft: rgba(255,255,255,.07);
  --text: #EDE7DC; --text2: #BDB6A9; --text3: #958E82; --faint: #7F796F; --reading: #E4DDD0;
  --sec-bg: rgba(255,255,255,.08); --gutter: rgba(0,0,0,.5); --drop: rgba(0,0,0,.65);
  --edge1: #25221C; --edge2: #1E1B16; --edge3: #171511; --strong-bg: #EDE7DC; --strong-text: #14171C;
  --ok: #7FD69B; --ok-soft: rgba(127,214,155,.14); --on-ok: #0B2414; --bad: #FF8E7E; --bad-soft: rgba(255,142,126,.14); --on-bad: #2A0B06;
  --tip: rgba(242,169,59,.10); --tip-line: rgba(242,169,59,.38);
  --wood: #7A5A3A; --wood-edge: #3E2E1D; --board: #182128;
  --stone: #262C34; --stone-edge: #15191E; --stone-icon: #8E887D; --pill: rgba(255,255,255,.12); --active: #F3EEE4;
  --accent: #E8590C; --on-accent: #FFFFFF; --accent-soft: rgba(232,89,12,.22); --accent-text: #F19B6D; --accent-deep: #A74009;
  --accent-light: #F09361; --accent-glow: rgba(232,89,12,.4); --scrim: rgba(0,0,0,.74);
}
:root[data-theme="light"] {   /* C · Mist: blue-grey stone, white cards and pages, navy text, slate board frame, own cobalt */
  color-scheme: light;
  --bg: #E9EDF2; --desk: #DFE5EC; --glow: rgba(255,255,255,.65); --card: #FFFFFF; --page: #FFFFFF; --field: #F7F9FB;
  --line: #D5DCE4; --line-soft: #E4E9EF;
  --text: #142C50; --text2: #44536A; --text3: #5A677B; --faint: #7D8899; --reading: #1A2433;
  --sec-bg: #DCE3EB; --gutter: rgba(20,40,70,.08); --drop: rgba(20,40,70,.22);
  --edge1: #EEF2F6; --edge2: #E3E9EF; --edge3: #D8DFE7; --strong-bg: #142C50; --strong-text: #FFFFFF;
  --ok: #1E7A45; --ok-soft: #E3F2E8; --on-ok: #FFFFFF; --bad: #B42318; --bad-soft: #FBE7E4; --on-bad: #FFFFFF;
  --tip: #FFF4E5; --tip-line: #F5CFA0;
  --wood: #4A5868; --wood-edge: #36414E; --board: #182128;
  --stone: #FFFFFF; --stone-edge: #C9D2DC; --stone-icon: #8593A6; --pill: #E3EAFD; --active: #142C50;
  --accent: #1F4FE0; --on-accent: #FFFFFF; --accent-soft: #E3EAFD; --accent-text: #1A44C4; --accent-deep: #163AA6;
  --accent-light: #6F8FEC; --accent-glow: rgba(31,79,224,.3); --scrim: rgba(20,30,50,.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; font-size: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent-text); }
img { max-width: 100%; }
.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.hidden { display: none !important; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
}
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.mark {
  width: 40px; height: 40px; border-radius: 11px; background: var(--ink); color: var(--paper);
  display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 700; font-size: 20px;
}
.brand-name { font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.1; }
.brand-sub { font-size: 11.5px; color: var(--muted); letter-spacing: .2px; }
.brand-sub b { color: var(--ink); }

/* ---------- home ---------- */
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--gold); }
.continue { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.continue small { display: block; font-size: 12px; opacity: .7; }
.continue strong { font-size: 15px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 26px 20px 12px; }
.section-head h2 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 600; }
.section-head span { font-size: 13px; color: var(--muted); }
.mlist { display: flex; flex-direction: column; gap: 10px; padding: 0 20px; }
.mcard {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink);
}
.mcard:active { transform: scale(.99); }
.mnum {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; background: var(--sec-bg); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 20px; font-weight: 600;
}
.mcard.started .mnum { background: var(--ink); color: var(--paper); }
.mbody { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.mtitle { font-size: 15px; font-weight: 700; line-height: 1.25; }
.mmeta { font-size: 12px; color: var(--muted); line-height: 1.3; }
.bar { height: 4px; border-radius: 2px; background: var(--line-soft); overflow: hidden; }
.bar > i { display: block; height: 4px; border-radius: 2px; background: var(--accent); width: 0; transition: width .4s; }
.powered { text-align: center; font-size: 12px; color: var(--faint); padding: 26px 0 8px; }
.powered b { color: var(--muted); }

/* ---------- bottom nav: Home · Book · tutor · Progress, full width, icon over label ---------- */
.nav-space { height: 100px; flex-shrink: 0; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 4px 6px env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line);
}
.bottomnav a {
  position: relative; flex: 1; max-width: 132px; min-width: 0; height: 58px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; color: var(--muted); font-weight: 800; font-size: 11px; line-height: 1.1; text-decoration: none; white-space: nowrap;
}
.bottomnav a.on { color: var(--accent-text); }
.bottomnav svg { width: 22px; height: 22px; }
.bottomnav a.nav-meera img { width: 24px; height: 24px; border-radius: 12px; border: 1.5px solid var(--gold); object-fit: cover; }
.bottomnav a.nav-meera.on img { border: 2px solid var(--accent); }

/* ---------- milestone reader ---------- */
.readbar {
  position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.readbar-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.readbar .t { flex-grow: 1; min-width: 0; }
.readbar .t small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-text); }
.readbar .t div { font-family: var(--serif); font-weight: 400; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readbar .bar { border-radius: 0; height: 3px; }
.reader { padding: 8px 20px 0; }
.m-intro { padding: 18px 0 6px; }
.m-intro .eyebrow { color: var(--accent-text); }
.m-intro h1 { font-family: var(--serif); font-size: 30px; line-height: 1.12; margin: 6px 0 0; font-weight: 600; }

.row { margin: 18px 0; scroll-margin-top: 80px; }
.md { overflow-wrap: anywhere; }
.md p { margin: .55em 0; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--serif); font-weight: 400; line-height: 1.2; margin: 1.1em 0 .4em; }
.md h1 { font-size: 26px; } .md h2 { font-size: 23px; } .md h3 { font-size: 20px; } .md h4 { font-size: 17px; }
.md ul, .md ol { padding-left: 1.3em; margin: .5em 0; }
.md blockquote { margin: .8em 0; padding: 0 0 0 14px; color: var(--muted); font-style: italic; border-left: 2px solid var(--line); }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; margin: .6em 0; }
.md .katex { font-size: 1.06em; }
.table-wrap { overflow-x: auto; margin: .6em 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.md table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.md th, .md td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); text-align: center; white-space: nowrap; }
.md th { background: var(--sec-bg); font-weight: 700; }
.md tr:last-child td { border-bottom: 0; }
.md table.prose th, .md table.prose td { white-space: normal; text-align: left; vertical-align: top; min-width: 6em; }
@media (max-width: 599px) {   /* sentence-long tables: one card per row on phones */
  .md table.prose, .md table.prose tbody, .md table.prose tr, .md table.prose td { display: block; width: 100%; min-width: 0; }
  .md table.prose thead { display: none; }
  .md table.prose tr { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
  .md table.prose tr:last-child { border-bottom: 0; }
  .md table.prose td { padding: 3px 0; border: 0; }
  .md table.prose td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 800;
    color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .md table.prose td:empty { display: none; }
}

.theory { padding: 2px 0; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 16px 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .3px;
  padding: 4px 10px; border-radius: 999px; background: var(--sec-bg); color: var(--ink);
}
.chip.dark { background: var(--ink); color: var(--paper); }
.chip.warn { background: var(--accent-soft); color: var(--accent-text); }
.set-head { margin: 34px 0 10px; padding: 18px; border-radius: 18px; background: var(--ink); color: var(--paper); }
.set-head .eyebrow { color: var(--gold); }
.set-head h2 { margin: 4px 0 2px; font-family: var(--serif); font-weight: 400; font-size: 24px; }
.set-head p { margin: 0; opacity: .8; font-size: 14px; }
.tipbox { background: var(--tip); border: 1px solid var(--tip-line); border-radius: 16px; padding: 14px 16px; }
.tipbox .tip-t { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-text); }
.tipbox .tip-t svg { width: 16px; height: 16px; }
.figure {
  display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; padding: 10px 12px; border-radius: 12px;
  background: var(--sec-bg); font-size: 13.5px; color: var(--ink-2); line-height: 1.45;
}
.figure svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--accent-text); }
.figure button { border: 0; background: none; color: var(--accent-text); font-weight: 700; padding: 0; font-size: 13.5px; text-decoration: underline; }

/* options */
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 8px 12px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--field); transition: border-color .15s, background .15s;
}
.opt .k {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 15px; border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--muted);
}
.opt .v { flex-grow: 1; min-width: 0; overflow-x: auto; }
.opt.picked { border-color: var(--ink); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .k { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .k { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
.opt:disabled { cursor: default; }
.verdict { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-weight: 700; font-size: 14px; }
.verdict.ok { color: var(--ok); } .verdict.no { color: var(--bad); }
.verdict svg { width: 18px; height: 18px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ghost {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--paper); font-weight: 700; font-size: 13.5px; color: var(--ink);
}
.ghost svg { width: 16px; height: 16px; }
.ghost.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.reveal { margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--sec-bg); border: 1px dashed var(--line); }
.reveal .lbl { font-size: 11.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-text); margin-bottom: 4px; }
.review-note { margin-top: 10px; font-size: 13px; color: var(--accent-text); display: flex; gap: 6px; align-items: flex-start; }
.review-note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.fb-link { border: 0; background: none; padding: 6px 0 0; font-size: 12.5px; color: var(--faint); font-weight: 600; display: inline-flex; gap: 5px; align-items: center; }
.fb-link svg { width: 14px; height: 14px; }
.row-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* sheet */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; opacity: 0; transition: opacity .2s; }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; left: 50%; bottom: 0; width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh;
  transform: translate(-50%, 100%); transition: transform .25s cubic-bezier(.2,.8,.2,1), visibility 0s linear .25s;
  background: var(--paper); border-radius: 24px 24px 0 0; z-index: 41; display: flex; flex-direction: column;
  box-shadow: 0 -10px 40px rgba(27,34,51,.2); visibility: hidden;
}
/* closed = hidden, not only moved below the screen: a closed sheet just under the bottom edge peeked out on phones
   (a taller viewport, the toolbar sliding away, overscroll, a full-page screenshot) on every screen, e.g. Progress */
.sheet.open { transform: translate(-50%, 0); visibility: visible; transition: transform .25s cubic-bezier(.2,.8,.2,1); }
body:not([data-view="reader"]) .sheet:not(.open) { display: none; }   /* the help sheet belongs to the reader only */
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px 10px; gap: 10px; }
.sheet-head h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 20px; }
.sheet-head small { display: block; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-text); }
.sheet-body { overflow-y: auto; padding: 0 20px calc(24px + env(safe-area-inset-bottom)); }
.help-list { display: flex; flex-direction: column; gap: 8px; }
.help-item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; border-radius: 16px; text-align: left;
  background: var(--card); border: 1px solid var(--line);
}
.help-item .hi {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; background: var(--sec-bg); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
}
.help-item .hi svg { width: 20px; height: 20px; }
.help-item b { display: block; font-size: 15px; }
.help-item span { font-size: 12.5px; color: var(--muted); line-height: 1.35; display: block; }
.help-item:disabled { opacity: .45; }
.panel { margin-top: 12px; }
.hint { padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); margin-bottom: 8px; }
.hint .lbl { font-size: 11.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-text); }
.back-link { border: 0; background: none; padding: 4px 0 10px; font-weight: 700; color: var(--accent-text); display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.back-link svg { width: 16px; height: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.tag {
  min-height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--line); background: var(--card);
  font-weight: 600; font-size: 13.5px;
}
.tag.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
textarea, input[type=text] {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px; background: var(--field); padding: 12px 14px;
  font-family: inherit; font-size: 16px; color: var(--ink); outline: none;
}
textarea { min-height: 110px; resize: vertical; }
textarea:focus, input[type=text]:focus { border-color: var(--ink); }
.primary {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 50px; border-radius: 25px;
  border: 0; background: var(--ink); color: var(--paper); font-weight: 800; font-size: 15px; margin-top: 12px;
}
.primary:disabled { opacity: .5; }

/* page viewer */
.viewer { position: fixed; inset: 0; z-index: 60; background: #11151F; display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; color: #EEF1F7; gap: 10px; }
.viewer-bar .icon-btn { background: #1E2638; border-color: #2B3550; color: #EEF1F7; }
.viewer-scroll { flex-grow: 1; overflow: auto; padding: 0 8px 24px; -webkit-overflow-scrolling: touch; }
.viewer-scroll img { display: block; width: 100%; max-width: 900px; margin: 0 auto 10px; border-radius: 6px; background: #fff; }
.viewer-scroll.zoom img { width: 200%; max-width: none; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: 22px; font-weight: 700; font-size: 14px; z-index: 80; box-shadow: var(--shadow);
}

/* simple pages */
.page-pad { padding: 8px 20px 0; }
.page-title { font-family: var(--serif); font-size: 28px; font-weight: 600; margin: 10px 0 4px; line-height: 1.15; }
.soon {
  margin: 20px; padding: 26px 22px; border-radius: 20px; background: var(--ink); color: var(--paper);
}
.soon h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 6px 0 8px; line-height: 1.15; }
.soon p { opacity: .8; margin: 0 0 10px; }
.soon ul { margin: 0; padding-left: 1.2em; opacity: .9; }
.list-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 10px 0; }
.list-card .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.list-card p { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.list-card a { font-weight: 700; font-size: 14px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); text-decoration: none; color: var(--ink); font-weight: 700; margin-bottom: 8px; text-align: left;
}
.menu-item svg { width: 20px; height: 20px; color: var(--accent-text); }
.loading { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------- languages ---------- */
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-weight: 800; font-size: 14px;
}
.lang-btn svg { width: 18px; height: 18px; color: var(--accent-text); }
.seg { display: flex; padding: 3px; border-radius: 20px; background: var(--line-soft); flex-shrink: 0; }
.seg button { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 0; background: transparent; color: var(--muted); font-weight: 800; font-size: 13px; }
.seg button.on { background: var(--ink); color: var(--paper); }
.seg.dark { background: var(--ink-2); align-self: flex-start; display: inline-flex; }
.seg.dark button { color: var(--paper); opacity: .8; padding: 0 16px; }
.seg.dark button.on { background: var(--paper); color: var(--ink); }
.ai-banner {
  display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 9px 12px; border-radius: 12px;
  background: var(--tip); border: 1px solid var(--tip-line); font-size: 12.5px; color: var(--text); line-height: 1.45;
}
.ai-banner svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.fb-link.lang-link { color: var(--accent-text); font-weight: 700; }
.lang-list { display: flex; flex-direction: column; gap: 10px; }
.lang-item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 16px; text-align: left;
  background: var(--card); border: 1px solid var(--line);
}
.lang-item.on { border: 2px solid var(--ink); }
.lang-item.is-soon { opacity: .6; }
.lang-glyph {
  width: 44px; height: 44px; border-radius: 12px; background: var(--sec-bg); color: var(--ink); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
}
.lang-item.on .lang-glyph { background: var(--ink); color: var(--paper); }
.lang-body { flex-grow: 1; display: flex; flex-direction: column; gap: 3px; }
.lang-body b { font-size: 16px; }
.lang-body span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.lang-tick { width: 26px; height: 26px; border-radius: 13px; background: var(--ink); color: var(--paper); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lang-tick svg { width: 15px; height: 15px; }

/* ---------- Ask: chat ---------- */
.chat-head {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: color-mix(in srgb, var(--paper) 95%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.chat-head .av-lg { width: 44px; height: 44px; border-radius: 22px; border: 2px solid var(--gold); object-fit: cover; flex-shrink: 0; }
.chat-head .who { flex-grow: 1; min-width: 0; }
.chat-head .name { font-family: var(--serif); font-weight: 400; font-size: 17px; line-height: 1.2; }
.chat-head .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .seg button { min-height: 34px; padding: 0 11px; }
.chat-list { display: flex; flex-direction: column; gap: 14px; padding: 16px 16px 206px; }
.msg.user {
  align-self: flex-end; max-width: 82%; padding: 11px 14px; border-radius: 18px 18px 4px 18px;
  background: var(--ink); color: var(--paper); font-size: 15px; line-height: 1.45; overflow-wrap: anywhere;
}
.msg.didi { display: flex; gap: 10px; align-items: flex-start; }
.msg.didi .av { width: 30px; height: 30px; border-radius: 15px; object-fit: cover; flex-shrink: 0; }
.msg.didi .bubble {
  flex-grow: 1; min-width: 0; padding: 12px 14px; border-radius: 4px 18px 18px 18px; background: var(--card);
  border: 1px solid var(--line); font-size: 15px; line-height: 1.6;
}
.msg.didi .bubble .md p:first-child { margin-top: 0; }
.msg.didi .bubble .md p:last-child { margin-bottom: 0; }
.from-book { margin: 10px 0 6px; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-text); }
.link-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.link-chips a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 18px;
  background: var(--sec-bg); color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none;
}
.link-chips a.first { background: var(--ink); color: var(--paper); }
.try { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.sugg { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.sugg button {
  min-height: 40px; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card);
  font-weight: 600; font-size: 14px; text-align: left; color: var(--ink);
}
.chat-bar {
  flex-wrap: wrap; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(66px + env(safe-area-inset-bottom));
  width: 100%; max-width: 560px; display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: linear-gradient(to top, var(--paper) 75%, transparent); z-index: 15; box-sizing: border-box;
}
.usage-line { flex-basis: 100%; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.usage-line:empty { display: none; }
.t-usage { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(3px + env(safe-area-inset-bottom)); flex-basis: auto;
  white-space: nowrap; padding: 1px 10px; border-radius: 10px; background: color-mix(in srgb, var(--card) 88%, transparent); }
.usage-box { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.usage-title { font-size: 12.5px; font-weight: 800; color: var(--muted); margin-bottom: 8px; }
.usage-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: 14px; margin-bottom: 10px; }
.usage-row:last-child { margin-bottom: 0; }
.usage-row i { flex-basis: 100%; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.usage-row u { display: block; height: 100%; background: var(--accent); }
.chat-bar input {
  flex: 1 1 0; width: auto; min-width: 0;   /* not the global width: 100% — that pushed the box onto its own row */ height: 46px; border-radius: 23px; border: 1.5px solid var(--line); background: var(--field);
  padding: 0 16px; font-family: inherit; font-size: 16px; color: var(--ink); outline: none;
}
.chat-bar input:focus { border-color: var(--ink); }
.chat-bar .send {
  width: 46px; height: 46px; border-radius: 23px; border: 0; background: var(--accent); color: var(--on-accent); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.chat-bar .send svg { width: 20px; height: 20px; }
.typing { display: inline-flex; gap: 4px; margin-right: 8px; vertical-align: middle; }
.typing i { width: 7px; height: 7px; border-radius: 4px; background: var(--accent); opacity: .35; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .7; } }

/* ---------- Tutor: talking with Meera Didi ---------- */
.tutor { position: fixed; inset: 0; z-index: 30; overflow: hidden; background: var(--paper); }
@media (min-width: 600px) { .tutor { left: 50%; right: auto; width: 560px; transform: translateX(-50%); } }
.t-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(1.5px); transform: scale(1.03); }
.t-shade { position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 40%, color-mix(in srgb, var(--paper) 93%, transparent) 58%, var(--paper) 68%); }
.tutor.has-board .t-shade { background: linear-gradient(to bottom, transparent 24%, color-mix(in srgb, var(--paper) 95%, transparent) 36%, var(--paper) 44%); }
.t-meera {
  position: absolute; left: 50%; top: 64px; width: min(78vw, 340px); aspect-ratio: 560 / 627; transform: translateX(-50%);
  transition: width .45s ease, top .45s ease; animation: breathe 6s ease-in-out infinite;
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent 100%); mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
}
.tutor.has-board .t-meera { width: min(46vw, 210px); top: 58px; }
.t-faces, .t-faces img, .t-think { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom; }
.t-faces img { opacity: 0; transition: opacity .07s linear; }
.t-faces { transform-origin: 50% 85%; will-change: transform; }
.t-faces img.brows { transition: opacity .16s ease; }
.t-faces img.brows.up { opacity: 1; }
.t-faces img.blink { transition: none; }
@media (prefers-reduced-motion: reduce) { .t-faces { transform: none !important; } }
.t-faces img.on { opacity: 1; }
.t-faces img.mf:first-child { opacity: 1; }   /* base face always solid: cross-fading two frames let the background show through (flicker) */
.t-think { opacity: 0; transition: opacity .3s; }
.t-think.on { opacity: 1; }
.tutor[data-state="thinking"] .t-faces { opacity: 0; transition: opacity .3s; }
@keyframes breathe { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-1.5px); } }
@media (prefers-reduced-motion: reduce) { .t-meera { animation: none; } }
.t-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; }
.t-top .icon-btn, .t-top .lang-btn { background: color-mix(in srgb, var(--card) 92%, transparent); border-color: transparent; color: var(--ink); }
.t-name { display: flex; flex-direction: column; align-items: center; padding: 5px 14px; border-radius: 16px; background: color-mix(in srgb, var(--card) 92%, transparent); }
.t-name b { font-family: var(--serif); font-weight: 400; font-size: 16px; }
.t-name span { font-size: 11.5px; font-weight: 800; color: var(--ok); }
.tutor[data-state="thinking"] .t-name span { color: var(--muted); }
.tutor[data-state="speaking"] .t-name span, .tutor[data-state="recording"] .t-name span { color: var(--accent-text); }
.t-caption {
  position: absolute; left: 18px; right: 18px; top: calc(64px + min(78vw, 340px) * 1.12 - 60px); padding: 9px 13px; border-radius: 14px;
  background: rgba(8,11,16,.86); color: var(--chalk); font-size: 14.5px; line-height: 1.45; text-align: center; min-height: 22px;
  max-height: calc(1.45em * 3 + 18px); overflow-y: auto; z-index: 2;   /* subtitles: the sentence being spoken, max 3 lines */
}
.tutor.has-board .t-caption { top: calc(58px + min(46vw, 210px) * 1.12 - 16px); }
.t-panel {
  position: absolute; left: 16px; right: 16px; top: calc(64px + min(78vw, 340px) * 1.12 + 6px); bottom: 150px;
  overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px;
}
.tutor.has-board .t-panel { top: calc(58px + min(46vw, 210px) * 1.12 + 78px); }   /* below a 3-line caption */
.t-you { align-self: flex-end; max-width: 85%; padding: 10px 13px; border-radius: 16px 16px 4px 16px; background: var(--ink); color: var(--paper); font-size: 14.5px; line-height: 1.45; }
.t-you small { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold); }
.t-hello { font-family: var(--serif); font-size: 18px; font-weight: 600; text-align: center; padding: 4px 8px; }
.t-or { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.t-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.t-chips button { min-height: 38px; padding: 6px 14px; border-radius: 19px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13.5px; text-align: left; }
.t-type { display: flex; gap: 8px; }
.t-type input { flex: 1 1 0; width: auto; min-width: 0; height: 46px; border-radius: 23px; border: 1.5px solid var(--line); padding: 0 16px; font-family: inherit; font-size: 16px; background: var(--field); color: var(--ink); }
.t-type button { width: 46px; height: 46px; border-radius: 23px; border: 0; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; padding: 0; }
.t-type button svg { width: 20px; height: 20px; }
.t-board { padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(27,34,51,.08); display: flex; flex-direction: column; gap: 8px; }
.t-board-h { font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--accent-text); }
.t-step { display: flex; gap: 10px; align-items: baseline; opacity: .18; transition: opacity .4s; overflow-x: auto; }
.t-step.shown { opacity: 1; }
.t-step.last { background: var(--ok-soft); border-radius: 10px; padding: 6px 8px; margin: 0 -8px; }
.t-step .n { width: 22px; height: 22px; border-radius: 11px; background: var(--sec-bg); font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.t-step.last .n { background: var(--ok); color: var(--on-ok); }
.t-step .md { font-size: 17px; }
.t-links { display: flex; gap: 8px; }
.t-links a { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 13.5px; }
.t-links a.first { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.t-links small { font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-text); }
.t-links a.first small { color: var(--gold); }
.t-controls { position: absolute; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; padding: 0 30px; }
.t-side { width: 52px; height: 52px; border-radius: 26px; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: flex; align-items: center; justify-content: center; padding: 0; }
.t-side svg { width: 22px; height: 22px; }
.t-side.end { color: var(--bad); }
.t-micwrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.t-mic { width: 84px; height: 84px; border-radius: 42px; border: 0; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; padding: 0;
  box-shadow: 0 0 0 10px var(--accent-soft), 0 12px 30px var(--drop); transition: background .2s; }
.t-mic svg { width: 34px; height: 34px; }
.t-mic .i-stop { display: none; width: 30px; height: 30px; }
.tutor[data-state="speaking"] .t-mic { background: var(--strong-bg); color: var(--strong-text); }
.tutor[data-state="speaking"] .t-mic .i-mic { display: none; }
.tutor[data-state="speaking"] .t-mic .i-stop { display: block; }
/* a recorded answer: the big button pauses / continues it, a small ■ in the keyboard's place stops it */
.t-mic .i-pause, .t-mic .i-play, .t-stop { display: none; }
.tutor[data-rec="on"] .t-mic .i-stop, .tutor[data-rec="paused"] .t-mic .i-stop { display: none; }
.tutor[data-rec="on"] .t-mic .i-pause, .tutor[data-rec="paused"] .t-mic .i-play { display: block; }
.tutor[data-rec="paused"] .t-mic { background: var(--accent); color: var(--on-accent); }
.tutor[data-rec="on"] #tKeys, .tutor[data-rec="paused"] #tKeys { display: none; }
.tutor[data-rec="on"] .t-stop, .tutor[data-rec="paused"] .t-stop { display: flex; }
.tutor[data-state="recording"] .t-mic { animation: pulse 1.2s ease-in-out infinite; }
.tutor[data-state="thinking"] .t-mic { opacity: .5; }
@keyframes pulse { 50% { box-shadow: 0 0 0 18px var(--accent-soft), 0 12px 30px var(--drop); } }
@media (prefers-reduced-motion: reduce) { .tutor[data-state="recording"] .t-mic { animation: none; } }
.t-miclabel { font-size: 13px; font-weight: 800; }

/* ---------- books + Meera up front (design canvas row "Books + finding Meera") ---------- */
.brand-link { color: var(--ink); text-decoration: none; min-height: 44px; min-width: 0; }
.brand-link > div { min-width: 0; }
.brand-link .brand-name { font-size: 17px; }
.brand-link .brand-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.help-item.meera-item { background: var(--ink); color: var(--paper); border: 0; align-items: center; }
.help-item.meera-item img { width: 46px; height: 46px; border-radius: 23px; border: 2px solid var(--gold); object-fit: cover; flex-shrink: 0; }
.help-item.meera-item > span { flex: 1; color: var(--paper); }
.help-item.meera-item b { font-weight: 800; font-size: 15.5px; }
.help-item.meera-item span span { color: inherit; opacity: .75; }
.help-item.meera-item > svg { width: 22px; height: 22px; color: var(--gold); flex-shrink: 0; }

/* chapters not yet translated into the chosen language */
.tr-soon {
  display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  background: var(--tip); color: var(--ink); font-size: 13.5px; line-height: 1.45;
}
.tr-soon svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--accent-text); }
.tr-chip { display: inline-block; margin-top: 5px; padding: 2px 8px; border-radius: 10px; background: var(--tip); color: var(--accent-text); font-size: 11.5px; font-weight: 700; }
.t-step.head { font-weight: 800; color: var(--accent-text); margin-top: 4px; }
.t-step.head .md { font-size: 14px; letter-spacing: .3px; }

/* The board as a small classroom blackboard (mock-up claude.ai/artifact/SK7eUz5BLbPpjG7rXWFMPa, owner OK 2026-10-14): the
   same board lines, chalked in one by one as she says them; the current line glows, the last one is underlined in yellow.
   Kalam has Latin + Devanagari; Kannada/Telugu/Gurmukhi fall back to the app's fonts in chalk colour. */
.t-board.chalk { --chalk: #F3F1E7; --chalk-yel: #F2D675; --chalk-grn: #9FDC9A; position: relative; gap: 4px; color: var(--chalk);
  padding: 14px 18px 24px; border: 9px solid var(--wood); border-radius: 14px;
  background: radial-gradient(110% 70% at 30% -10%, rgba(255,236,200,.14), rgba(255,236,200,0) 62%), var(--board);
  box-shadow: inset 0 0 30px rgba(0,0,0,.45), 0 10px 24px rgba(20,24,30,.22);
  font-family: "Kalam", "Noto Sans Kannada", "Noto Sans Telugu", "Noto Sans Gurmukhi", "Noto Sans Oriya", Mukta, sans-serif; }
.t-board.chalk::after { content: ""; position: absolute; right: 22px; bottom: 7px; width: 26px; height: 6px; border-radius: 2px; background: #EDE8DA; opacity: .85; }   /* a stick of chalk on the ledge */
.t-board.chalk .t-board-h { color: rgba(243,241,231,.55); font-family: var(--sans); letter-spacing: 1.6px; margin-bottom: 4px; }
.t-board.chalk .t-step { opacity: 1; clip-path: inset(0 100% 0 0); transition: clip-path 1s steps(18, end); text-shadow: 0 0 1px rgba(243,241,231,.6); padding: 2px 0; }
.t-board.chalk .t-step.shown { clip-path: inset(0 0 0 0); }
.t-board.chalk .t-step.now { text-shadow: 0 0 10px rgba(242,214,117,.35); }
.t-board.chalk .t-step .md { line-height: 1.4; }
.t-board.chalk .t-step .md :is(strong, b) { color: var(--chalk-yel); font-weight: 700; }
.t-board.chalk .t-step .n { background: none; border: 2px solid rgba(243,241,231,.7); color: var(--chalk); font-weight: 700; transform: rotate(-4deg); font-size: 13px; }
.t-board.chalk .t-step.head { color: var(--chalk-yel); font-weight: 700; }
.t-board.chalk .t-step.last { background: none; padding: 2px 0; margin: 0; color: var(--chalk-grn); }
.t-board.chalk .t-step.last .n { background: none; border-color: var(--chalk-grn); color: var(--chalk-grn); }
.t-board.chalk .t-step.last .md { background: linear-gradient(var(--chalk-yel), var(--chalk-yel)) 0 100% / 100% 3px no-repeat; padding-bottom: 3px; }
@media (prefers-reduced-motion: reduce) { .t-board.chalk .t-step { transition: none; } }

/* ---------- Home: greeting + status chips, Your next step (big, + the mini path), Continue + Ask tiles
   (mockups 9FnG1XvxMWGAfZn8FxJESb, DBVwk6SXn3jEuAjArYpVTM) ---------- */
.hm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.hm-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 15px; background: var(--card);
  border: 1px solid var(--line); color: var(--ink); font-weight: 800; font-size: 12.5px; text-decoration: none; white-space: nowrap;
}
.hm-chip .pg-ic { width: 17px; height: 17px; }
.hm-sub { display: none; }
.hm-tile {
  position: relative; overflow: hidden; min-height: 156px; display: flex; flex-direction: column; gap: 4px; padding: 14px;
  border-radius: 20px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.hm-tile b { font-family: var(--serif); font-size: 17px; font-weight: 600; line-height: 1.2; }
.hm-tile small { font-size: 12px; line-height: 1.35; color: var(--muted); }
.hm-mic {
  position: relative; z-index: 1; margin-top: auto; width: 42px; height: 42px; border-radius: 21px; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; flex-shrink: 0;
}
.hm-mic svg { width: 19px; height: 19px; }
.hm-tile:active { transform: scale(.99); }
html:not([lang|="en"]):not([lang="hi-Latn"]) .mc-tag { letter-spacing: 0; }   /* spaced-out Indic script breaks apart */

/* ---------- Book tab ---------- */
.mc-tag { align-self: flex-start; font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--accent-text); background: var(--accent-soft); padding: 1px 8px; border-radius: 8px; }
.mcard.now { border-color: var(--accent); }

/* ---------- white label: logo image instead of the letter mark ---------- */
.mark-img { width: 42px; height: 42px; object-fit: contain; flex-shrink: 0; }
.deskbar, .desk-only { display: none; }

/* ---------- website layout: 1024 px and wider (design canvas row "Jai Kisan · website on desktop + phone") ---------- */
@media (min-width: 1024px) {
  .desk-only { display: revert; }
  .shell { max-width: 1320px; padding: 0 40px; }
  .topbar, .bottomnav, .scrim { display: none !important; }
  .nav-space { height: 40px; }

  /* top bar */
  .deskbar {
    display: flex; align-items: center; gap: 28px; position: sticky; top: 0; z-index: 20; height: 76px;
    padding: 0 max(40px, calc(50vw - 620px)); background: var(--card); border-bottom: 1px solid var(--line);
  }
  .db-brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; min-width: 0; }
  .db-brand .mark-img { width: 46px; height: 46px; }
  .db-brand .brand-name { font-size: 21px; font-weight: 700; }
  .db-brand .brand-sub { font-size: 12.5px; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .db-nav { display: flex; gap: 6px; margin-left: 24px; }
  .db-nav a { height: 42px; padding: 0 16px; border-radius: 21px; display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; font-size: 14.5px; text-decoration: none; }
  .db-nav a:hover { background: var(--line-soft); }
  .db-nav a.on { background: var(--ink); color: var(--paper); font-weight: 700; }
  .db-nav img { width: 28px; height: 28px; border-radius: 14px; border: 2px solid var(--gold); object-fit: cover; }
  .db-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
  body[data-view="tutor"] .deskbar { display: none; }

  /* Book tab: chapters as a grid */
  .section-head { padding: 30px 0 14px; }
  .section-head h2 { font-size: 26px; }
  .mlist { padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .mcard { flex-direction: column; align-items: stretch; gap: 10px; padding: 16px 18px; border-radius: 20px; min-height: 150px; }
  .mcard > svg { display: none; }
  .mcard:hover { border-color: var(--ink); }
  .mnum { width: 38px; height: 38px; font-size: 18px; }
  .mbody { flex-grow: 1; }
  .mbody .bar { margin-top: auto; }

  /* book picker */
  .page-pad { padding: 28px 0 0; }

  /* reader: contents (left) · text (middle) · Help panel (right, the help sheet becomes a side panel) */
  .readbar { top: 76px; }
  .reader-wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr) 360px; gap: 36px; align-items: start; }
  .reader { padding: 8px 0 0; max-width: 760px; font-size: 17px; }
  .r-toc { position: sticky; top: 150px; max-height: calc(100vh - 170px); overflow-y: auto; padding: 18px 0; display: flex !important; flex-direction: column; gap: 2px; }
  .r-toc a { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 12px; color: var(--ink); text-decoration: none; font-size: 14px; line-height: 1.35; }
  .r-toc a span { font-size: 12px; opacity: .7; flex-shrink: 0; min-width: 18px; }
  .r-toc a:hover { background: var(--line-soft); }
  .r-toc a.on { background: var(--ink); color: var(--paper); font-weight: 700; }
  .r-toc a.toc-exercise_set { font-weight: 700; }
  .sheet {
    left: auto; right: max(40px, calc(50vw - 620px)); top: 168px; bottom: 24px; width: 360px; max-width: none; max-height: none;
    transform: none; border-radius: 22px; border: 1px solid var(--line); box-shadow: none; background: var(--paper);
    display: none; transition: none;
  }
  .sheet.open { display: flex; transform: none; }
  .sheet-grip { display: none; }
  body:not([data-view="reader"]) .sheet { display: none; }
  .opts { display: grid; grid-template-columns: 1fr 1fr; }

  /* chat: centred column */
  .chat-head, .chat-list { max-width: 880px; margin: 0 auto; width: 100%; }
  .chat-head { top: 76px; }
  .chat-bar { bottom: 20px; max-width: 880px; }
  .chat-list { padding-bottom: 136px; }

  /* Meera: full screen, Meera on the left, board on the right */
  .tutor { left: 0; right: 0; width: auto; transform: none; }
  .t-shade, .tutor.has-board .t-shade { background: linear-gradient(to right, transparent 20%, color-mix(in srgb, var(--paper) 55%, transparent) 60%); }
  .t-meera, .tutor.has-board .t-meera {
    left: 4%; top: auto; bottom: 150px; transform: none; animation: breathe-d 6s ease-in-out infinite;
    width: min(36vw, 560px, calc((100vh - 250px) * 0.893));   /* fit the screen height too (image is 560 × 627) */
  }
  .t-caption, .tutor.has-board .t-caption {
    left: 4%; right: auto; width: min(36vw, 560px); top: auto; bottom: 160px; font-size: 19px; text-align: center;
  }
  .t-panel, .tutor.has-board .t-panel {
    left: calc(4% + min(36vw, 560px) + 4%); right: 4%; top: 100px; bottom: 150px;
    background: var(--card); border-radius: 28px; padding: 28px 32px; box-shadow: 0 20px 50px rgba(0,0,0,.18);
  }
  .t-board { box-shadow: none; border: 0; padding: 0; }
  .t-step .md { font-size: 22px; }
  .t-you { font-size: 17px; }
  .t-top { padding: 18px 4%; }
  .t-right { display: flex; gap: 10px; }
  .t-proj[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
  .t-controls { justify-content: center; gap: 48px; bottom: 26px; }
  .t-mic { width: 96px; height: 96px; border-radius: 48px; }
  /* projector mode: everything bigger, for a hall */
  .tutor.big .t-step .md { font-size: 30px; }
  .tutor.big .t-step .n { width: 30px; height: 30px; font-size: 15px; }
  .tutor.big .t-step.head .md { font-size: 18px; }
  .tutor.big .t-caption { font-size: 25px; }
  .tutor.big .t-you { font-size: 21px; }
  .tutor.big .t-hello { font-size: 28px; }
  .tutor.big .t-chips button { font-size: 18px; min-height: 48px; }
  .tutor.big .t-dym-list button { font-size: 19px; min-height: 58px; }
  .tutor.big .t-links a { font-size: 17px; }
}
@media (min-width: 1024px) {
  .t-right .t-proj { display: inline-flex; }
}
@keyframes breathe-d { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@media (min-width: 1024px) and (prefers-reduced-motion: reduce) { .t-meera, .tutor.has-board .t-meera { animation: none; } }

/* ---------- admin screen (#/admin) ---------- */
.ad-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 16px; padding-bottom: 2px; }
.ad-tabs a { flex-shrink: 0; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 13.5px; }
.ad-tabs a.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ad-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ad-stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); display: flex; flex-direction: column; gap: 6px; }
.ad-stat.wide { grid-column: 1 / -1; }
.ad-stat small { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.ad-stat b { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.1; }
.ad-stat b span { font-size: 16px; color: var(--muted); }
.ad-stat em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.ad-stat em.hot, .ad-warn { color: var(--bad); font-weight: 700; }
.ad-warn { margin: 0; font-size: 13.5px; }
.ad-bar.hot > i { background: var(--bad); }
.ad-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 10px; }
.ad-tools input[type=text] { flex: 1 1 220px; }
.ad-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.ad-form { display: flex; flex-direction: column; gap: 12px; max-width: 460px; }
.ad-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.ad-err { color: var(--bad); font-weight: 700; font-size: 14px; margin: 6px 0 0; min-height: 0; }
.ad-err:empty { display: none; }
.ad-code { margin-top: 18px; padding: 16px; border: 1.5px dashed var(--accent); border-radius: 16px; background: var(--accent-soft); max-width: 460px; }
.ad-code p { margin: 0 0 6px; }
.ad-code b { display: block; font-family: ui-monospace, Consolas, monospace; font-size: 28px; letter-spacing: 2px; margin-bottom: 10px; }
.ad-code .menu-item { margin: 0; justify-content: center; }
.ad-wrap { margin: 6px 0 14px; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ad-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 800; padding: 8px 10px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.ad-table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.ad-table td.nm small { display: block; font-size: 11.5px; color: var(--faint); font-family: ui-monospace, Consolas, monospace; }
.ad-table td.nm a { font-weight: 700; color: var(--ink); }
.ad-table td.nm .ad-su { margin-top: 3px; font-size: 12px; color: var(--muted); font-weight: 500; }
.ad-table tr.off { opacity: .6; }
.ad-table tr.bad td { background: var(--bad-soft); }
.ad-table td.er { color: var(--bad); font-weight: 700; }
.ad-table .act { white-space: nowrap; text-align: right; }
.ad-table .act button { min-height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 12.5px; margin-left: 4px; }
.ad-table .act button.danger { color: var(--bad); border-color: var(--bad-soft); }
@media (max-width: 1023px) {          /* phones: each row becomes a card with labelled values */
  .ad-table, .ad-table tbody { display: block; }
  .ad-table thead { display: none; }
  .ad-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
  .ad-table td { display: block; padding: 2px 0; border: 0; font-size: 13.5px; }
  .ad-table td.nm { grid-column: 1 / -1; font-size: 15px; }
  .ad-table td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12px; }
  .ad-table td.er, .ad-table td.act { grid-column: 1 / -1; text-align: left; }
  .ad-table td.act { padding-top: 8px; }
  .ad-table td.act button { margin: 0 8px 0 0; }
  .ad-table tr.bad { background: var(--bad-soft); }
}
@media (min-width: 1024px) {
  .ad-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ad-stat.wide { grid-column: span 3; }
  .ad .primary { max-width: 360px; }
}

/* ---------- login PIN: one-time prompt on home, set / change page ---------- */
.pp-later { border: 0; background: none; padding: 6px 2px; color: var(--muted); font-weight: 700; font-size: 13.5px; }
.pin-page form { max-width: 360px; }
.pin-label { display: block; margin: 18px 0 8px; font-weight: 700; font-size: 13.5px; color: var(--ink); }
.pinf { position: relative; height: 60px; max-width: 272px; }
.pinf input[type=text] {               /* the real input: invisible, on top of the boxes */
  position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; color: transparent; caret-color: transparent; -webkit-text-fill-color: transparent; outline: none; font-size: 16px;
}
.pinf-cells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; height: 100%; }
.pinf-cells span {
  display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--line); border-radius: 13px; background: var(--field);
  font-weight: 800; font-size: 30px; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
.pinf-cells span.fill { border-color: var(--ink-2); }
.pinf.focus .pinf-cells span.cur { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.pinf.shake .pinf-cells { animation: pinShake .4s ease; }
.pinf.shake .pinf-cells span { border-color: var(--bad); }
@keyframes pinShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.pin-page .ad-err { margin-top: 14px; }
.pin-page .primary { margin-top: 22px; }
.pin-hint { margin-top: 16px; font-size: 13.5px; line-height: 1.5; }

/* ---------- ready answers + the Live switch (2026-10-05) ---------- */
.live-sw { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 14px; border-radius: 20px; flex-shrink: 0;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2); font-weight: 800; font-size: 13px; white-space: nowrap; }
.live-sw i { position: relative; width: 34px; height: 20px; border-radius: 10px; background: var(--line); transition: background .15s; }
.live-sw i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.live-sw.on { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.live-sw.on i { background: var(--ok); }
.live-sw.on i::after { left: 16px; }
.live-sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.t-top .live-sw { background: color-mix(in srgb, var(--card) 92%, transparent); border-color: transparent; height: 44px; }
.t-top .live-sw.on { background: var(--ok-soft); }
.chat-head .live-sw { margin-left: auto; }

.live-modal { position: fixed; inset: 0; z-index: 90; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; }
.live-card { width: 100%; max-width: 560px; background: var(--card); border-radius: 22px 22px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
@media (min-width: 700px) { .live-modal { align-items: center; } .live-card { border-radius: 22px; } }
.live-card h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 21px; }
.live-card p { margin: 0; color: var(--ink-2); font-size: 15px; }
.live-left { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 10px 14px; border-radius: 12px; background: var(--paper); font-size: 14px; font-variant-numeric: tabular-nums; }
.live-left b { text-align: right; }
.live-card .primary { background: var(--ok); border-color: var(--ok); }
.live-card .ghost { justify-content: center; min-height: 46px; }

.ready-list { display: flex; flex-direction: column; gap: 8px; }
.ready-rows { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.ready-rows.muted { padding: 12px 14px; color: var(--faint); }
.ready-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 0; border-top: 1px solid var(--line-soft);
  background: transparent; text-align: left; font-size: 15px; font-weight: 600; color: var(--ink); }
.ready-row:first-child { border-top: 0; }
.ready-row small { color: var(--faint); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ready-row:active { background: var(--paper); }
.help-item.meera-item svg { width: 22px; height: 22px; color: var(--gold); flex-shrink: 0; }

.listen { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 12px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--paper); color: var(--accent-text); font-weight: 800; font-size: 13px; }
.listen svg { width: 14px; height: 14px; }
.listen.on { background: var(--accent-soft); border-color: var(--accent); }
.ready-line { margin: 0 0 8px; }
.sugg.in-bubble { margin: 4px 0 10px; }
.live-ask { margin-top: 6px; background: var(--ok); border-color: var(--ok); }
.t-panel .live-ask { width: 100%; }
/* not found: "Did you mean…" (up to 3 questions; a tap plays that recorded answer) + "Ask this in Live" */
.t-dym { display: flex; flex-direction: column; gap: 8px; }
.t-dym .t-or { margin: 2px 2px 0; }
.t-dym-list { display: flex; flex-direction: column; gap: 8px; }
.t-dym-list button { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 44px; padding: 7px 14px 7px 9px;
  border-radius: 16px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-family: inherit;
  font-weight: 650; font-size: 14.5px; line-height: 1.35; text-align: left; box-shadow: 0 2px 8px rgba(27,34,51,.05); cursor: pointer; }
.t-dym-list button:hover, .t-dym-list button:focus-visible { border-color: var(--accent); }
.t-dym-list svg { width: 28px; height: 28px; flex-shrink: 0; padding: 8px 7px 8px 9px; border-radius: 14px; box-sizing: border-box;
  background: var(--accent-soft); color: var(--accent-text); }
.t-dym-list span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.t-dym .live-ask { margin-top: 2px; }
.t-dym .t-nf { display: none; margin: 0 4px; font-size: 13px; line-height: 1.4; color: var(--ink-2); text-align: center; }
.msg .t-or { margin: 6px 0 2px; }
.t-board.t-said .md { font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.t-board.t-said .md + .md { margin-top: 10px; }

/* ---------- the tutor beside the book (2026-10-06): started from a topic, the chapter stays open ----------
   Same #tutor as the tutor screen, in #dock with .docked; body.dock = the page makes room, body.dock-full = ⤢ (the
   normal full-screen tutor, the book waits underneath). Desktop: a panel where the Help panel is. Phone: the top 40%. */
:root { --dock-h: 40vh; --dock-h: 40dvh; --dock-w: 460px; }
.tutor:not(.docked) .t-dock, .t-proj2, .toc-btn, .dock-help-btn { display: none; }
.t-top .t-close { color: var(--bad); }

/* the row being explained: gold edge, soft background, a small chip with the tutor */
.row.dock-on { background: color-mix(in srgb, var(--gold) 13%, var(--card)); box-shadow: inset 4px 0 0 var(--gold); }
.row.dock-on:not(.card):not(.tipbox) { margin-left: -14px; margin-right: -6px; padding: 10px 10px 10px 14px; border-radius: 0 14px 14px 0; }
.row.card.dock-on, .row.tipbox.dock-on { border-color: var(--tip-line); padding-left: 18px; }
.dock-chip { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; font-size: 11px; font-weight: 800; letter-spacing: 1px; line-height: 1.3;
  text-transform: uppercase; color: var(--accent-text); }
.dock-chip img { width: 22px; height: 22px; border-radius: 11px; border: 1.5px solid var(--gold); object-fit: cover; flex-shrink: 0; }
.dock-chip .eq { display: none; width: 12px; height: 10px; flex-shrink: 0;   /* three bars while the tutor speaks */
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 2px 60% no-repeat, linear-gradient(var(--accent), var(--accent)) 5px 100% / 2px 100% no-repeat,
    linear-gradient(var(--accent), var(--accent)) 10px 100% / 2px 40% no-repeat; }
.dock-busy .dock-chip .eq { display: inline-block; animation: dock-eq .9s ease-in-out infinite; }
@keyframes dock-eq { 50% { background-size: 2px 100%, 2px 45%, 2px 85%; } }
@media (prefers-reduced-motion: reduce) { .dock-busy .dock-chip .eq { animation: none; } }
.dock-chip .dc-short { display: none; }
@media (max-width: 599px) { .dock-chip .dc-long { display: none; } .dock-chip .dc-short { display: inline; } }

/* phone (and tablet): the tutor on top, the book scrolls underneath, mic + keyboard float at the bottom */
@media (max-width: 1023px) {
  body.dock .shell { padding-top: var(--dock-h); }
  body.dock .readbar { top: var(--dock-h); }
  body.dock .row { scroll-margin-top: calc(var(--dock-h) + 80px); }
  .tutor.docked { top: 0; bottom: auto; left: 0; right: 0; width: auto; max-width: 560px; margin: 0 auto; height: var(--dock-h); transform: none;
    border-bottom: 1px solid var(--line); }
  .tutor.docked .t-shade, .tutor.docked .t-back, .tutor.docked .t-right, .tutor.docked .t-usage, .tutor.docked .t-miclabel { display: none; }
  .tutor.docked .t-meera, .tutor.docked.has-board .t-meera { top: auto; bottom: 0; height: 86%; width: auto; }
  .tutor.docked .t-top { padding: calc(10px + env(safe-area-inset-top)) 12px 0; }
  .tutor.docked .t-top .icon-btn { width: 40px; height: 40px; }
  .tutor.docked .t-caption, .tutor.docked.has-board .t-caption { top: auto; bottom: 10px; left: 12px; right: 12px; font-size: 13.5px; }
  /* no board here (only in full screen); when the answer ends, the follow-up chips take the caption's place */
  .tutor.docked .t-panel, .tutor.docked.has-board .t-panel { top: auto; bottom: 10px; left: 12px; right: 12px; max-height: 48%; padding: 0; }
  .tutor.docked .t-panel > :not(.t-chips):not(.t-type):not(.t-dym):not(.t-sugg) { display: none; }
  .tutor.docked .t-sugg .t-or { display: none; }
  .tutor.docked:not([data-state="idle"]) .t-panel :is(.t-chips, .t-dym) { display: none; }
  .tutor.docked[data-state="idle"]:has(.t-panel :is(.t-sugg:not(.hidden) .t-chips, .t-dym)) .t-caption { display: none; }
  .tutor.docked[data-state="idle"] .t-panel:has(.t-dym) { max-height: calc(100% - 66px - env(safe-area-inset-top)); }
  .tutor.docked .t-dym { gap: 5px; padding: 8px; border-radius: 16px; background: color-mix(in srgb, var(--paper) 92%, transparent);
    box-shadow: 0 6px 20px rgba(27,34,51,.12); }
  .tutor.docked .t-dym .t-or { font-size: 11.5px; }
  .tutor.docked .t-dym-list { gap: 5px; }
  .tutor.docked .t-dym-list button { min-height: 36px; padding: 4px 10px 4px 6px; gap: 8px; border-radius: 12px; font-size: 13px; line-height: 1.25; box-shadow: none; }
  .tutor.docked .t-dym-list svg { width: 22px; height: 22px; padding: 6px 5px 6px 7px; border-radius: 11px; }
  .tutor.docked .t-dym .live-ask { height: 36px; margin-top: 1px; font-size: 13px; }
  .tutor.docked .t-dym .t-nf { display: block; }   /* not found: the caption gives way, its line stays on the card */
  .tutor.docked .t-chips { justify-content: center; gap: 6px; }
  .tutor.docked .t-chips button { min-height: 34px; padding: 4px 12px; font-size: 12.5px; font-weight: 700; }
  .tutor.docked .t-type { position: fixed; left: 12px; right: 12px; max-width: 536px; margin: 0 auto; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 3; }
  .tutor.docked .t-controls { position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom)); justify-content: center; gap: 26px;
    padding: 0; z-index: 2; pointer-events: none; }
  .tutor.docked .t-controls > * { pointer-events: auto; }
  .tutor.docked .t-controls::before { content: ""; position: absolute; left: 0; right: 0; bottom: calc(-16px - env(safe-area-inset-bottom)); height: 110px;
    background: linear-gradient(to bottom, transparent, var(--paper) 55%); z-index: -1; pointer-events: none; }
  .tutor.docked .t-side { width: 46px; height: 46px; }
  .tutor.docked .t-side.end { visibility: hidden; }   /* ✕ is on top; this keeps the mic centred */
  .tutor.docked .t-mic { width: 60px; height: 60px; border-radius: 30px; box-shadow: 0 8px 20px rgba(27,34,51,.25); }
  .tutor.docked .t-mic svg { width: 26px; height: 26px; }
}

/* desktop: a panel where the Help panel is; the contents list folds into a button so the text keeps its width */
@media (min-width: 1024px) {
  :root { --dock-w: clamp(400px, 36vw, 470px); }
  body.dock .reader-wrap { grid-template-columns: minmax(0, 1fr) var(--dock-w); }
  .row.dock-on:not(.card):not(.tipbox) { margin-left: 0; margin-right: 0; padding-left: 18px; }   /* stays under the reading bar's edge */
  body.dock .r-toc { display: none !important; }
  body.dock.toc-open .r-toc { display: flex !important; position: fixed; z-index: 16; top: 150px; left: max(40px, calc(50vw - 620px)); width: 300px;
    max-height: calc(100vh - 180px); padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
  body.dock .toc-btn, body.dock .dock-help-btn { display: inline-flex; flex-shrink: 0; }
  body.dock .toc-btn[aria-expanded="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  body.dock .sheet { display: none; }
  body.dock.dock-help .sheet.open { display: flex; z-index: 41; width: var(--dock-w); box-shadow: var(--shadow); }   /* Help, over the tutor */
  .tutor.docked { --stage: min(300px, 44%); top: 168px; bottom: 24px; left: auto; right: max(40px, calc(50vw - 620px)); width: var(--dock-w); z-index: 15;
    border-radius: 26px; border: 1px solid var(--line); background: var(--card); box-shadow: 0 18px 44px rgba(27,34,51,.14); }
  .tutor.docked .t-bg { inset: 0 0 auto; height: var(--stage); }
  .tutor.docked .t-shade, .tutor.docked.has-board .t-shade { inset: 0 0 auto; height: var(--stage); background: linear-gradient(to bottom, transparent 62%, var(--card)); }
  .tutor.docked .t-meera, .tutor.docked.has-board .t-meera { left: 50%; top: auto; bottom: calc(100% - var(--stage)); height: calc(var(--stage) - 24px); width: auto;
    transform: translateX(-50%); animation: breathe 6s ease-in-out infinite; }
  .tutor.docked .t-top { padding: 12px; gap: 8px; justify-content: flex-start; }
  .tutor.docked .t-name { margin-right: auto; align-items: flex-start; }
  .tutor.docked .t-right { order: 1; }
  .tutor.docked .t-dock { order: 2; width: 40px; height: 40px; }
  .tutor.docked .t-close { order: 3; }
  .tutor.docked .t-back, .tutor.docked .t-right .lang-btn, .tutor.docked .t-right .t-proj, .tutor.docked .t-side.end { display: none; }
  .tutor.docked .t-caption, .tutor.docked.has-board .t-caption { left: 16px; right: 16px; width: auto; top: calc(var(--stage) - 10px); bottom: auto;
    transform: translateY(-100%); font-size: 14.5px; }
  .tutor.docked .t-panel, .tutor.docked.has-board .t-panel { left: 0; right: 0; top: var(--stage); bottom: 118px; padding: 12px 22px 8px;
    background: none; border-radius: 0; box-shadow: none; }
  .tutor.docked .t-step .md { font-size: 16.5px; }
  .tutor.docked .t-dym { gap: 6px; }
  .tutor.docked .t-dym-list { gap: 6px; }
  .tutor.docked .t-dym-list button { min-height: 40px; padding: 5px 12px 5px 7px; font-size: 14px; line-height: 1.3; }
  .tutor.docked .t-dym-list svg { width: 24px; height: 24px; padding: 7px 6px 7px 8px; border-radius: 12px; }
  .tutor.docked .t-dym .live-ask { height: 42px; font-size: 14px; }
  .tutor.docked.big .t-dym-list button { font-size: 16px; min-height: 46px; }
  .tutor.docked .t-you { font-size: 14px; }
  .tutor.docked .t-hello { font-size: 17px; }
  .tutor.docked .t-controls { bottom: 22px; gap: 34px; }
  .tutor.docked .t-side { width: 46px; height: 46px; }
  .tutor.docked .t-proj2 { display: flex; }
  .tutor.docked .t-proj2[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); }
  .tutor.docked .t-mic { width: 64px; height: 64px; border-radius: 32px; box-shadow: 0 0 0 8px rgba(160,74,18,.12), 0 8px 20px rgba(27,34,51,.22); }
  .tutor.docked .t-mic svg { width: 26px; height: 26px; }
  .tutor.docked .t-miclabel { font-size: 12px; }
  .tutor.docked .t-usage { bottom: 3px; font-size: 11px; }
  /* projector mode in the panel: bigger board text that still fits beside the book */
  .tutor.docked.big .t-step .md { font-size: 21px; }
  .tutor.docked.big .t-step .n { width: 26px; height: 26px; font-size: 14px; }
  .tutor.docked.big .t-step.head .md { font-size: 15px; }
  .tutor.docked.big .t-caption { font-size: 18px; }
  .tutor.docked.big .t-you { font-size: 16px; }
  .tutor.docked.big .t-hello { font-size: 20px; }
  .tutor.docked.big .t-chips button { font-size: 15.5px; min-height: 42px; }
  .tutor.docked.big .t-links a { font-size: 15px; }
  .tutor.docked.big .t-board.t-said .md { font-size: 19px; }
}
@media (min-width: 1024px) and (prefers-reduced-motion: reduce) { .tutor.docked .t-meera, .tutor.docked.has-board .t-meera { animation: none; } }

/* top bar: one line from 1024 px up (four links, two pills, language, profile); below 1280 it tightens and the book line goes */
@media (min-width: 1024px) {
  .deskbar a, .deskbar .brand-name { white-space: nowrap; }
  .db-brand > div { min-width: 0; }
  .db-brand .brand-name { overflow: hidden; text-overflow: ellipsis; }
  .db-nav, .db-right { flex-shrink: 0; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .deskbar { gap: 16px; padding: 0 24px; }
  .db-nav { margin-left: 0; gap: 2px; }
  .db-nav a { padding: 0 12px; }
  .db-brand .brand-sub { display: none; }
}

/* Home on the website: greeting row (the chapter + stickers on the right; streak and points are in the top bar),
   the big card left (your next step + its mini path, else Continue), the other tiles stacked right */
@media (min-width: 1024px) {
  .hm-chips { display: none; }
  .hm-sub { display: block; color: var(--muted); font-weight: 700; font-size: 14.5px; text-align: right; text-decoration: none; padding-bottom: 4px; max-width: 62%; }
  .hm-sub:hover { color: var(--ink); }   /* room above the button, which sits at the bottom */
  .hm-tile { grid-column: 2; min-height: 180px; padding: 22px 24px; border-radius: 24px; }
  .hm-tile b { font-size: 22px; }
  .hm-tile small { font-size: 13.5px; }
}

/* ---------- Books-first Home, book page, tutor under each row, pictures in the text, chapter quiz (2026-10-12;
   mockup claude.ai/artifact/Qy5999YT1npc1vqnGbfaRa) ---------- */
.hm-quiz { background: var(--tip); border-color: var(--tip-line); }

.sheet.modal .soon-box { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.sheet.modal .soon-box p { margin: 0; color: var(--ink-2); font-size: 14.5px; }

/* book page */
.mgroup { display: flex; flex-direction: column; }
.mgroup .mcard:has(+ .mc-quiz) { border-radius: var(--radius) var(--radius) 0 0; }
.mgroup.now .mcard, .mgroup.now .mc-quiz { border-color: var(--accent); }
.mc-quiz { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px 8px 16px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: var(--paper); }
.mc-quiz .chip { font-size: 12px; }
.mc-quiz-go { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 13px; text-decoration: none; white-space: nowrap; }

/* reader: the tutor under each row, Feedback on the right */
.row-foot { margin-top: 10px; }
.rf-right { display: inline-flex; align-items: center; gap: 14px; margin-left: auto; }
.rf-right .fb-link { padding: 0; }
.ask-tutor { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border: 0; border-radius: 999px; background: var(--ink); color: var(--paper); font-weight: 800; font-size: 13px; line-height: 1.15; text-align: left; }
.ask-tutor img { width: 32px; height: 32px; border-radius: 16px; border: 2px solid var(--gold); object-fit: cover; flex-shrink: 0; }
.ask-tutor small { display: block; font-weight: 600; font-size: 11px; opacity: .75; }
.ask-tutor:active { transform: scale(.97); }

/* pictures cut out of the page, inside the text and the options */
.fig-in { margin: 10px 0; padding: 10px; border-radius: 12px; background: #fff; border: 1px solid var(--line-soft); display: flex; justify-content: center; }
.fig-in img { display: block; max-width: 100%; max-height: 240px; height: auto; }
.opts.pics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opts.pics .opt { flex-direction: column; align-items: center; gap: 6px; padding: 8px; }
.opts.pics .opt .v { display: flex; flex-direction: column; align-items: center; gap: 4px; overflow: visible; }
.opts.pics .opt img { display: block; max-width: 100%; max-height: 120px; height: auto; }

/* the chapter quiz: a bar under the reader's title, the trophy card at the end */
.rq-bar { display: flex; align-items: center; gap: 10px; padding: 6px 16px 8px; font-size: 11.5px; font-weight: 800; color: var(--muted); }
.rq-bar b { color: var(--ink); font-variant-numeric: tabular-nums; }
.rq-dots { flex: 1; display: flex; gap: 3px; min-width: 0; }
.rq-dots i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.rq-dots i.d { background: var(--ok); }
.rq-dots.flat { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.rq-dots.flat i { flex: none; height: 100%; }
.cq-card { display: flex; flex-direction: column; gap: 12px; margin: 14px 0 6px; padding: 16px; border-radius: 20px; background: var(--card); border: 1.5px solid var(--gold); }
.cq-top { display: flex; gap: 12px; align-items: center; }
.cq-top h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 18px; line-height: 1.2; }
.cq-top p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.4; }
.cq-trophy { width: 48px; height: 48px; border-radius: 14px; background: var(--tip); display: grid; place-items: center; font-size: 26px; flex-shrink: 0; }
.cq-go { text-align: center; text-decoration: none; }

/* help sheet opened from the tutor: her line on top */
.tutor-line { display: flex; gap: 10px; align-items: center; margin: 2px 0 12px; }
.tutor-line img { width: 48px; height: 48px; border-radius: 24px; border: 2px solid var(--gold); object-fit: cover; flex-shrink: 0; }
.tutor-line div { flex: 1; padding: 8px 12px; border-radius: 4px 14px 14px 14px; background: var(--card); border: 1px solid var(--line-soft); font-weight: 600; font-size: 14.5px; }
.tutor-line small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; }

@media (min-width: 1024px) {
  body:not(.help-open):not(.dock) .reader-wrap { grid-template-columns: 260px minmax(0, 1fr); }   /* docked: body.dock .reader-wrap */
  body:not(.help-open) .r-help-space { display: none !important; }
  .opts.pics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sheet.modal.open { display: flex; left: 50%; right: auto; top: 50%; bottom: auto; width: 440px; transform: translate(-50%, -50%); box-shadow: var(--shadow); }
  body:not([data-view="reader"]) .sheet.modal.open { display: flex; }
}
