/* Tamil Bridge — styles.
   Dark by default, light available. Indic fonts fall back to the ones that ship
   with Windows (Nirmala UI, Latha) so the app reads correctly with no network. */

:root {
  /* Warm paper rather than a screen. The page should look like something
     you could write on, because half of what happens here is writing. */
  --bg:        #fbf7f0;
  --bg-soft:   #f3ede3;
  --panel:     #ffffff;
  --panel-2:   #f6f1e9;
  --line:      #e0d6c7;
  --line-soft: #ece4d8;
  --text:      #22303f;   /* 16.1:1 on --bg */
  --text-dim:  #5a6b7d;   /* 6.6:1  */
  --text-mute: #7e8ea0;   /* 4.6:1  */

  --accent:    #e05d00;
  --accent-2:  #b34700;
  --accent-dim:#ffe7d2;

  --teal:      #0f766e;
  --blue:      #1d4ed8;
  --green:     #15803d;
  --red:       #be123c;
  --amber:     #a16207;
  --purple:    #6d28d9;
  --pink:      #be185d;

  /* One colour per section, so a place is recognised rather than read. */
  --c-home:      #e05d00;
  --c-lessons:   #1d4ed8;
  --c-phrases:   #0f766e;
  --c-practice:  #be185d;
  --c-translate: #1d4ed8;
  --c-meaning:   #6d28d9;
  --c-numbers:   #a16207;
  --c-maths:     #15803d;
  --c-tutor:     #be123c;
  --c-conjugate: #0f766e;
  --c-photo:     #7c3aed;
  --c-speak:     #db2777;
  --c-write:     #0369a1;
  --c-alphabet:  #ca8a04;
  --c-phonics:   #0891b2;
  --c-vocab:     #16a34a;

  --radius:    16px;
  --radius-sm: 11px;
  --shadow:    0 2px 4px rgba(40,30,15,.05), 0 10px 26px rgba(40,30,15,.08);
  --tamil: 'Noto Sans Tamil', 'Nirmala UI', 'Latha', 'Tamil Sangam MN', sans-serif;
  --deva:  'Noto Sans Devanagari', 'Nirmala UI', 'Mangal', 'Kohinoor Devanagari', sans-serif;
  --ui:    'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

:root[data-theme="dark"] {
  /* Warmer than the old near-black, so an evening session is still gentle
     without the page feeling like a terminal. */
  --bg:        #15181f;
  --bg-soft:   #1c2029;
  --panel:     #212733;
  --panel-2:   #2a313f;
  --line:      #39414f;
  --line-soft: #2c333f;
  --text:      #f0eee9;   /* 15.2:1 on --bg */
  --text-dim:  #b3bcc9;
  --text-mute: #8996a6;

  --accent:    #ff9f45;
  --accent-2:  #ffc078;
  --accent-dim:#4a2f14;

  --teal:      #2dd4bf;
  --blue:      #7aa9ff;
  --green:     #4ade80;
  --red:       #fb7185;
  --amber:     #fbbf24;
  --purple:    #c4a6ff;
  --pink:      #f9a8d4;

  --c-home:      #ff9f45;
  --c-lessons:   #7aa9ff;
  --c-phrases:   #2dd4bf;
  --c-practice:  #f9a8d4;
  --c-translate: #7aa9ff;
  --c-meaning:   #c4a6ff;
  --c-numbers:   #fbbf24;
  --c-maths:     #4ade80;
  --c-tutor:     #fb7185;
  --c-conjugate: #2dd4bf;
  --c-photo:     #c4a6ff;
  --c-speak:     #f9a8d4;
  --c-write:     #67c5ff;
  --c-alphabet:  #fbbf24;
  --c-phonics:   #5fd8ee;
  --c-vocab:     #4ade80;

  --shadow:    0 2px 4px rgba(0,0,0,.25), 0 12px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--ui); font-size: calc(16px * var(--fs, 1)); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.ta, [lang="ta"] { font-family: var(--tamil); }
.hi, [lang="hi"] { font-family: var(--deva); }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }

/* ----------------------------------------------------------- auth screen */
/* Hidden until something asks for it. It used to be the other way round:
   the card was in the markup plainly visible, and the app only hid it once
   every script had loaded and boot() ran — so every refresh showed the
   sign-in page for about a second first. */
#auth { display: none; }
#auth.on, :root.authfirst #auth {
  position: fixed; inset: 0; z-index: 50;
  display: block; padding: 28px 16px 40px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(240,136,62,.16), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(45,212,191,.12), transparent 60%),
    var(--bg);
  overflow-y: auto;
}

/* One narrow column: the brand alone at the top, then one card doing one
   job, then the other choice below a divider rather than beside it. */
.auth-wrap { width: 100%; max-width: 384px; margin: 0 auto; }

.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 18px; text-decoration: none; color: var(--text);
}
.auth-brand-text { font-size: calc(23px * var(--fs, 1)); font-weight: 700; letter-spacing: -.3px; }

.auth-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px 20px 22px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.auth-card h1 {
  margin: 0 0 14px; font-size: calc(27px * var(--fs, 1)); font-weight: 500; letter-spacing: -.4px;
}
.auth-card[hidden] { display: none; }

.auth-remember {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 14px; font-size: calc(13px * var(--fs, 1)); color: var(--text-dim); cursor: pointer;
}
.auth-remember input { width: auto; margin: 2px 0 0; flex: none; }

/* "Forgot your password?" sits on the label line, as a link rather than a
   button, because it is a way out and not a thing to do. */
.link-btn {
  float: right; padding: 0; border: 0; background: none;
  font: inherit; font-size: calc(12.5px * var(--fs, 1)); font-weight: 500;
  color: var(--blue); cursor: pointer; text-decoration: none;
}
.link-btn:hover { text-decoration: underline; }

.auth-swap { margin-top: 20px; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px; font-size: calc(12.5px * var(--fs, 1)); color: var(--text-dim);
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
.auth-foot {
  margin-top: 18px; text-align: center;
  font-size: calc(12px * var(--fs, 1)); color: var(--text-dim);
}
.btn-tall { min-height: 44px; font-size: calc(15px * var(--fs, 1)); }

@media (max-width: 420px) {
  #auth { padding: 20px 12px 32px; }
  .auth-card { padding: 17px 16px 19px; }
  .auth-card h1 { font-size: calc(23px * var(--fs, 1)); }
}
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.brand-mark {
  width: 40px; height: 40px; flex: none; border-radius: 11px;
  display: grid; place-items: center; font-size: calc(21px * var(--fs, 1)); font-weight: 700;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #1a1004; font-family: var(--tamil);
}
.brand h1 { margin: 0; font-size: calc(20px * var(--fs, 1)); letter-spacing: -.2px; }
.brand span { display: block; font-size: calc(12px * var(--fs, 1)); color: var(--text-dim); font-weight: 400; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: calc(12.5px * var(--fs, 1)); color: var(--text-dim); margin-bottom: 5px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240,136,62,.15);
}
.field .hint { font-size: calc(11.5px * var(--fs, 1)); color: var(--text-mute); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-weight: 600;
  transition: background .15s, border-color .15s, transform .06s;
}
.btn:hover { background: var(--line-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #1a1004;
}
.btn-primary:hover { filter: brightness(1.07); background: linear-gradient(140deg, var(--accent), var(--accent-2)); }
.btn-wide { width: 100%; padding: 12px; }
.btn-sm { padding: 6px 11px; font-size: calc(13px * var(--fs, 1)); border-radius: 7px; }
.btn-icon { padding: 7px 9px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }

.msg { padding: 10px 12px; border-radius: var(--radius-sm); font-size: calc(13.5px * var(--fs, 1)); margin-bottom: 12px; }
.msg-err { background: rgba(248,81,73,.12); border: 1px solid rgba(248,81,73,.35); color: var(--red); }
.msg-ok  { background: rgba(63,185,80,.12); border: 1px solid rgba(63,185,80,.35); color: var(--green); }
.msg-info{ background: rgba(88,166,255,.10); border: 1px solid rgba(88,166,255,.3); color: var(--blue); }
.msg-warn{ background: rgba(210,153,34,.12); border: 1px solid rgba(210,153,34,.35); color: var(--amber); }

.privacy-note {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft);
  font-size: calc(11.5px * var(--fs, 1)); color: var(--text-mute); line-height: 1.6;
}

/* ------------------------------------------------------------- app shell */
#app { display: grid; min-height: 100vh; grid-template-columns: 232px 1fr; }
:root.authfirst #app { display: none; }
#app.off { display: none; }
/* Kept so a stylesheet cached from an older build still shows the app. */
#app.on { display: grid; }

.side {
  background: var(--bg-soft); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line-soft); }
.nav { flex: 1; overflow-y: auto; padding: 10px 9px; }
.nav-group { font-size: calc(10.5px * var(--fs, 1)); text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-mute); padding: 12px 9px 5px; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 2px;
  border-radius: 8px; color: var(--text-dim); text-decoration: none; font-size: calc(14px * var(--fs, 1));
  font-weight: 500; transition: background .12s, color .12s;
}
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.on { background: var(--accent-dim); color: var(--accent-2); font-weight: 600; }
:root[data-theme="light"] .nav a.on { color: var(--accent); }
.nav .ic { width: 18px; text-align: center; flex: none; font-size: calc(15px * var(--fs, 1)); }
.nav .badge {
  margin-left: auto; background: var(--accent); color: #1a1004; border-radius: 9px;
  padding: 1px 7px; font-size: calc(11px * var(--fs, 1)); font-weight: 700;
}

.side-foot { padding: 11px; border-top: 1px solid var(--line-soft); }
.who { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 9px; }
.who:hover { background: var(--panel); }
.avatar {
  width: 31px; height: 31px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), var(--accent-2)); color: #1a1004;
  font-weight: 700; font-size: calc(13px * var(--fs, 1));
}
.who-name { font-size: calc(13px * var(--fs, 1)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-sub { font-size: calc(11px * var(--fs, 1)); color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 13px 22px;
  border-bottom: 1px solid var(--line); background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
.topbar h2 { margin: 0; font-size: calc(17px * var(--fs, 1)); font-weight: 650; letter-spacing: -.2px; }
.topbar .sub { font-size: calc(12px * var(--fs, 1)); color: var(--text-dim); }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }

.view { padding: 22px; max-width: 1080px; width: 100%; }
.view.wide { max-width: 1320px; }

/* --------------------------------------------------------------- pieces */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 17px; margin-bottom: 15px;
}
.card h3 { margin: 0 0 4px; font-size: calc(15px * var(--fs, 1)); font-weight: 650; }
.card .card-sub { font-size: calc(12.5px * var(--fs, 1)); color: var(--text-dim); margin-bottom: 13px; }
.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: 13px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.gauto { grid-template-columns: repeat(auto-fill, minmax(178px,1fr)); }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; }
.stat .n { font-size: calc(27px * var(--fs, 1)); font-weight: 700; line-height: 1.15; letter-spacing: -.5px; }
.stat .l { font-size: calc(12px * var(--fs, 1)); color: var(--text-dim); margin-top: 2px; }
.stat.accent .n { color: var(--accent); }
.stat.green .n { color: var(--green); }
.stat.blue .n { color: var(--blue); }
.stat.purple .n { color: var(--purple); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  font-size: calc(11.5px * var(--fs, 1)); font-weight: 600; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--text-dim);
}
.chip.accent { background: var(--accent-dim); border-color: transparent; color: var(--accent-2); }
:root[data-theme="light"] .chip.accent { color: var(--accent); }
.chip.green { background: rgba(63,185,80,.14); border-color: rgba(63,185,80,.3); color: var(--green); }
.chip.red   { background: rgba(248,81,73,.13); border-color: rgba(248,81,73,.3); color: var(--red); }
.chip.blue  { background: rgba(88,166,255,.13); border-color: rgba(88,166,255,.3); color: var(--blue); }
.chip.amber { background: rgba(210,153,34,.14); border-color: rgba(210,153,34,.3); color: var(--amber); }

.row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--text-dim); }
.small { font-size: calc(12.5px * var(--fs, 1)); }
.tiny  { font-size: calc(11.5px * var(--fs, 1)); }
.mono  { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; }
.center{ text-align: center; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }

/* ------------------------------------------------------------ translate */
.tr-wrap { display: grid; grid-template-columns: 1fr auto 1fr; gap: 11px; align-items: stretch; }
.tr-pane {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 240px; overflow: hidden;
}
.tr-pane.out { background: var(--panel-2); }
.tr-bar {
  display: flex; align-items: center; gap: 7px; padding: 9px 11px;
  border-bottom: 1px solid var(--line-soft); min-height: 44px;
  flex-wrap: wrap;
}
.tr-bar select {
  border: 0; background: transparent; font-weight: 650; font-size: calc(13.5px * var(--fs, 1));
  outline: none; max-width: 190px; padding: 3px 4px; border-radius: 6px;
  min-width: 0; flex: 1 1 110px;
}
.tr-bar select:hover { background: var(--panel-2); }
.tr-body { flex: 1; display: flex; flex-direction: column; }
.tr-body textarea {
  flex: 1; border: 0; background: transparent; resize: none; outline: none;
  padding: 13px 14px; font-size: calc(19px * var(--fs, 1)); line-height: 1.5; min-height: 130px;
}
.tr-out {
  flex: 1; padding: 13px 14px; font-size: calc(19px * var(--fs, 1)); line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; min-height: 130px;
}
.tr-roman { padding: 0 14px 8px; font-size: calc(13px * var(--fs, 1)); color: var(--text-dim); font-style: italic; }
.tr-foot {
  display: flex; align-items: center; gap: 6px; padding: 8px 11px;
  border-top: 1px solid var(--line-soft); min-height: 42px;
  flex-wrap: wrap;
}
.tr-foot .spacer { flex: 1; }
.swap-col { display: flex; align-items: center; }
.swap {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); display: grid; place-items: center; font-size: calc(16px * var(--fs, 1));
}
.swap:hover { background: var(--panel-2); color: var(--accent); }

.word-tap { cursor: pointer; border-bottom: 1px dashed transparent; border-radius: 3px; padding: 0 1px; }
.word-tap:hover { background: var(--accent-dim); border-bottom-color: var(--accent); }

/* ------------------------------------------------------------ word cards */
.wcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; transition: border-color .15s, transform .1s;
}
.wcard:hover { border-color: var(--accent); transform: translateY(-1px); }
.wcard .w-ta { font-family: var(--tamil); font-size: calc(19px * var(--fs, 1)); font-weight: 600; }
.wcard .w-en { font-size: calc(16px * var(--fs, 1)); font-weight: 600; margin-top: 3px; }
.wcard .w-hi { font-family: var(--deva); font-size: calc(16px * var(--fs, 1)); margin-top: 2px; }
.wcard .w-r  { font-size: calc(11.5px * var(--fs, 1)); color: var(--text-mute); font-style: italic; }
.wcard .w-ipa{ font-size: calc(11.5px * var(--fs, 1)); color: var(--teal); font-family: ui-monospace, monospace; }

/* ----------------------------------------------------------- alphabet */
.alpha-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px,1fr)); gap: 7px; }
.alpha-cell {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 5px; text-align: center; transition: border-color .12s, background .12s;
}
.alpha-cell:hover { border-color: var(--accent); background: var(--panel-2); }
.alpha-cell .ch { font-size: calc(23px * var(--fs, 1)); line-height: 1.25; }
.alpha-cell .r  { font-size: calc(10.5px * var(--fs, 1)); color: var(--text-mute); }
.alpha-cell.hard { border-color: rgba(248,81,73,.4); }
.alpha-cell.asp  { border-color: rgba(210,153,34,.4); }

.matrix { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.matrix table { border-collapse: collapse; width: 100%; font-size: calc(14px * var(--fs, 1)); }
.matrix th, .matrix td {
  border: 1px solid var(--line-soft); padding: 7px 5px; text-align: center; white-space: nowrap;
}
.matrix th { background: var(--panel-2); font-size: calc(11.5px * var(--fs, 1)); color: var(--text-dim); font-weight: 600; position: sticky; top: 0; }
.matrix td { cursor: pointer; font-size: calc(17px * var(--fs, 1)); }
.matrix td:hover { background: var(--accent-dim); }
.matrix td .r { display: block; font-size: calc(9.5px * var(--fs, 1)); color: var(--text-mute); }
.matrix .rowhead { background: var(--panel-2); font-weight: 700; }

/* ------------------------------------------------------------- analysis */
.tok-line { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.tok {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 10px; min-width: 62px; text-align: center; cursor: pointer;
  transition: border-color .12s, transform .1s;
}
.tok:hover { border-color: var(--accent); transform: translateY(-1px); }
.tok .t-w { font-weight: 650; font-size: calc(15px * var(--fs, 1)); }
.tok .t-m { font-size: calc(12px * var(--fs, 1)); color: var(--accent-2); margin-top: 2px; font-family: var(--tamil); }
:root[data-theme="light"] .tok .t-m { color: var(--accent); }
.tok .t-p { font-size: calc(10px * var(--fs, 1)); color: var(--text-mute); margin-top: 1px; }
.tok.pos-verb { border-left: 3px solid var(--green); }
.tok.pos-noun { border-left: 3px solid var(--blue); }
.tok.pos-aux  { border-left: 3px solid var(--purple); }
.tok.pos-pron { border-left: 3px solid var(--teal); }
.tok.pos-adj  { border-left: 3px solid var(--amber); }
.tok.pos-prep, .tok.pos-det { border-left: 3px solid var(--text-mute); }

.svo { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.svo-part { padding: 8px 13px; border-radius: 9px; font-size: calc(14px * var(--fs, 1)); border: 1px dashed; }
.svo-s { border-color: var(--teal); color: var(--teal); }
.svo-v { border-color: var(--green); color: var(--green); }
.svo-o { border-color: var(--blue); color: var(--blue); }
.svo-q { border-color: var(--purple); color: var(--purple); }

.explain { background: var(--panel-2); border-left: 3px solid var(--accent); border-radius: 0 9px 9px 0;
  padding: 11px 13px; margin: 10px 0; font-family: var(--tamil); font-size: calc(14px * var(--fs, 1)); line-height: 1.7; }
.explain.tip { border-left-color: var(--amber); }
.explain.warn { border-left-color: var(--red); }

.diffbox { padding: 11px 13px; border-radius: 9px; background: var(--panel-2); font-size: calc(16px * var(--fs, 1)); line-height: 1.7; }
.del { color: var(--red); text-decoration: line-through; opacity: .75; }
.ins { color: var(--green); font-weight: 650; }

/* ------------------------------------------------------------- practice */
.flash {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 34px 26px; text-align: center; min-height: 250px;
  display: flex; flex-direction: column; justify-content: center; gap: 9px;
}
.flash .prompt { font-size: calc(34px * var(--fs, 1)); font-weight: 700; letter-spacing: -.5px; }
.flash .answer { font-size: calc(25px * var(--fs, 1)); color: var(--accent); font-weight: 650; }
.rate-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-top: 14px; }

.bar { height: 7px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 4px; transition: width .3s; }

.mic-btn {
  width: 66px; height: 66px; border-radius: 50%; border: 2px solid var(--line);
  background: var(--panel); font-size: calc(25px * var(--fs, 1)); display: grid; place-items: center; margin: 0 auto;
}
.mic-btn.live { border-color: var(--red); background: rgba(248,81,73,.13); animation: pulse 1.3s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(248,81,73,.42); } 50% { box-shadow: 0 0 0 14px rgba(248,81,73,0); } }

.score-ring { font-size: calc(40px * var(--fs, 1)); font-weight: 800; letter-spacing: -1px; }
.score-great { color: var(--green); } .score-good { color: var(--teal); }
.score-ok { color: var(--amber); } .score-retry { color: var(--red); }
.w-ok { color: var(--green); } .w-bad { color: var(--red); text-decoration: underline wavy; }

/* -------------------------------------------------------------- history */
.hist {
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px;
  margin-bottom: 8px; background: var(--panel);
}
.hist:hover { border-color: var(--accent); }
.hist .h-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.hist .h-time { font-size: calc(11px * var(--fs, 1)); color: var(--text-mute); margin-left: auto; }
.hist .h-src { font-size: calc(14px * var(--fs, 1)); }
.hist .h-out { font-size: calc(14px * var(--fs, 1)); color: var(--accent-2); margin-top: 2px; }
:root[data-theme="light"] .hist .h-out { color: var(--accent); }

/* ---------------------------------------------------------------- modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.62); z-index: 100;
  display: grid; place-items: center; padding: 18px; overflow-y: auto;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; max-width: 520px; width: 100%; box-shadow: var(--shadow);
  max-height: 88vh; overflow-y: auto;
}

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px 18px;
  text-align: center; transition: border-color .15s, background .15s; cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-dim); }

.toast-wrap { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); font-size: calc(13.5px * var(--fs, 1));
  max-width: 330px; animation: slidein .2s ease;
}
.toast.err { border-left-color: var(--red); }
.toast.ok  { border-left-color: var(--green); }
@keyframes slidein { from { opacity: 0; transform: translateX(14px); } }

.spin {
  width: 15px; height: 15px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%;
  display: inline-block; animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.speak-btn { background: transparent; border: 0; color: var(--text-dim); padding: 3px 5px; border-radius: 6px; font-size: calc(15px * var(--fs, 1)); }
.speak-btn:hover { color: var(--accent); background: var(--panel-2); }
.speak-btn.playing { color: var(--accent); }

.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 5px 11px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--panel); font-size: calc(12.5px * var(--fs, 1)); font-weight: 600; color: var(--text-dim);
}
.pill.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-2); }
:root[data-theme="light"] .pill.on { color: var(--accent); }

.empty { text-align: center; padding: 40px 18px; color: var(--text-mute); }
.empty .big { font-size: calc(34px * var(--fs, 1)); margin-bottom: 8px; opacity: .6; }

/* --------------------------------------------------------------- mobile */
@media (max-width: 900px) {
  .tr-wrap { grid-template-columns: 1fr; }
  .swap-col { justify-content: center; }
  .swap { transform: rotate(90deg); }
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 244px; z-index: 40;
    transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow);
  }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .view { padding: 15px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .rate-row { grid-template-columns: repeat(2,1fr); }
  .flash .prompt { font-size: calc(27px * var(--fs, 1)); }
  .topbar { padding: 11px 14px; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 39; }
}

@media print { .side, .topbar { display: none; } }

/* Tamil reading aid: small, sitting under the English/Hindi it supports. */
.w-gloss {
  font-family: var(--tamil);
  font-size: calc(13px * var(--fs, 1));
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.5;
}
.w-gloss .w-r { font-size: calc(11px * var(--fs, 1)); color: var(--text-mute); font-style: italic; }
.card-sub.ta { font-family: var(--tamil); font-size: calc(12px * var(--fs, 1)); }

/* ---------------------------------------------------- writing practice */
.trace-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: center; }
.trace-model {
  font-size: calc(150px * var(--fs, 1)); line-height: 1.1; text-align: center; font-weight: 600;
  background: var(--panel-2); border-radius: var(--radius); padding: 18px 8px;
}
.trace-pad { position: relative; width: 100%; aspect-ratio: 1; max-width: 440px; margin: 0 auto; }
.trace-ghost {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: calc(260px * var(--fs, 1)); line-height: 1; color: var(--line); pointer-events: none;
  user-select: none; opacity: .75;
}
.trace-pad canvas {
  position: relative; width: 100%; height: 100%;
  border: 2px dashed var(--line); border-radius: var(--radius);
  background: transparent; touch-action: none; cursor: crosshair;
}
.spell-in {
  width: 100%; max-width: 380px; margin: 14px auto 0; display: block;
  padding: 13px 16px; font-size: calc(26px * var(--fs, 1)); text-align: center;
  border-radius: var(--radius-sm); border: 2px solid var(--line);
  background: var(--bg-soft); color: var(--text); outline: none;
}
.spell-in:focus { border-color: var(--accent); }

/* ------------------------------------------------------ read-aloud player */
.reader-line {
  padding: 7px 11px; border-radius: 8px; margin-bottom: 3px;
  transition: background .15s, color .15s; cursor: pointer; line-height: 1.7;
}
.reader-line:hover { background: var(--panel-2); }
.reader-line.now {
  background: var(--accent-dim); color: var(--accent-2);
  font-weight: 600; box-shadow: inset 3px 0 0 var(--accent);
}
:root[data-theme="light"] .reader-line.now { color: var(--accent); }

/* A line the engine was unsure of. Marked rather than hidden: it is usually
   still readable, and hiding it would lose part of the page. */
.reader-line.weak { opacity: .62; border-left: 2px dashed var(--line); }
.reader-line.weak::after {
  content: '?'; margin-left: 8px; font-size: calc(11px * var(--fs, 1)); color: var(--muted);
  vertical-align: super;
}

/* Original line above its translation, so a verse keeps its shape. */
.tr-pair {
  padding: 8px 11px; border-radius: 8px; margin-bottom: 4px;
  border-left: 2px solid var(--line-soft); line-height: 1.6;
}
.tr-pair:hover { background: var(--panel-2); }

@media (max-width: 760px) {
  .trace-wrap { grid-template-columns: 1fr; }
  .trace-model { font-size: calc(96px * var(--fs, 1)); }
  .trace-ghost { font-size: calc(180px * var(--fs, 1)); }
}

.tok .t-r { font-size: calc(10px * var(--fs, 1)); color: var(--teal); font-style: italic; margin-top: 1px; }
.tok .t-p.ta { font-family: var(--tamil); color: var(--text-mute); font-size: calc(11px * var(--fs, 1)); margin-top: 2px; }
.tok .t-m.hi { font-family: var(--deva); color: var(--text); font-size: calc(13px * var(--fs, 1)); }
.tok .t-w { font-size: calc(15px * var(--fs, 1)); font-weight: 650; }

/* password field with a show/hide eye */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px !important; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; font-size: calc(16px * var(--fs, 1)); line-height: 1;
  padding: 6px 8px; border-radius: 7px; opacity: .65;
}
.pw-eye:hover { opacity: 1; background: var(--panel-2); }

/* Hindi reading aid: roman letters, then Tamil letters */
.hi-read { font-size: calc(12px * var(--fs, 1)); margin-top: 2px; line-height: 1.5; }
.hi-rom { color: var(--teal); font-style: italic; }
.hi-tam { font-family: var(--tamil); color: var(--text-dim); }

/* phrasebook */
.phrase { padding: 12px 0; border-top: 1px solid var(--line-soft); transition: background .15s; }
.phrase:first-of-type { border-top: 0; }
.phrase.now { background: var(--accent-dim); border-radius: 9px; padding-left: 10px; padding-right: 10px; }
.ph-en { font-size: calc(16px * var(--fs, 1)); font-weight: 650; }
.ph-hi { font-size: calc(19px * var(--fs, 1)); margin-top: 3px; }
.ph-actions { display: flex; gap: 2px; flex: none; }

/* ------------------------------------------------------- conjugation */
.conj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 9px; }
.conj-cell {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px;
}
.conj-en { font-size: calc(11px * var(--fs, 1)); color: var(--text-mute); }
.conj-hi { font-size: calc(17px * var(--fs, 1)); font-weight: 600; margin-top: 2px; }
.conj-line { font-size: calc(16px * var(--fs, 1)); padding: 3px 0; }
.conj-line.neg { color: var(--text-dim); }
.conj-line.q   { color: var(--blue); }

/* ----------------------------------------------------------------- maths */
.msetup { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mnum {
  flex: 1; min-width: 120px; padding: 13px 15px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
  font-size: calc(26px * var(--fs, 1)); font-weight: 650; letter-spacing: 1px; text-align: right;
}
.mnum:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240,136,62,.15); }
#mOps .pill { font-size: calc(21px * var(--fs, 1)); padding: 6px 15px; line-height: 1.2; }

.manswer {
  font-size: calc(40px * var(--fs, 1)); font-weight: 750; letter-spacing: 1px; color: var(--accent-2);
  word-break: break-all; line-height: 1.2; margin-bottom: 6px;
}
:root[data-theme="light"] .manswer { color: var(--accent); }
.mwords { display: grid; gap: 10px; }
.mword { padding-top: 9px; border-top: 1px solid var(--line-soft); }

/* the sum written out in columns, as on paper */
.msum {
  display: inline-block; padding: 14px 18px; border-radius: 10px;
  background: var(--bg-soft); font-variant-numeric: tabular-nums;
  overflow-x: auto; max-width: 100%;
}
.mrow { display: flex; justify-content: flex-end; }
.mcell {
  width: 30px; height: 40px; display: grid; place-items: center;
  font-size: calc(27px * var(--fs, 1)); font-weight: 650; font-family: ui-monospace, 'Consolas', monospace;
}
.mcell.mop { color: var(--text-dim); }
.mcell.mans { color: var(--accent-2); }
:root[data-theme="light"] .mcell.mans { color: var(--accent); }
.mcell.mmark { height: 20px; font-size: calc(14px * var(--fs, 1)); color: var(--teal); font-weight: 700; }
.mline { height: 2px; background: var(--line); margin: 5px 0; }

/* counting dots, for anyone who cannot read the words yet */
.mcount { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: calc(22px * var(--fs, 1)); }
.mdots { display: inline-flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }
.mdot { width: 15px; height: 15px; border-radius: 50%; display: inline-block; background: var(--accent); }
.mdot.b { background: var(--teal); }
.mplus { font-size: calc(24px * var(--fs, 1)); color: var(--text-dim); font-weight: 700; }
.mgroup { padding: 6px; border: 1px dashed var(--line); border-radius: 9px; }
.mgroup.mleft { border-style: dotted; opacity: .75; }

/* the steps */
.mstep {
  display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start;
  padding: 9px 11px; border-radius: 9px; margin-bottom: 4px; cursor: pointer;
  line-height: 1.6; transition: background .15s;
}
.mstep:hover { background: var(--panel-2); }
.mstep.now { background: var(--accent-dim); box-shadow: inset 3px 0 0 var(--accent); }
.mstepn {
  width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel-2); color: var(--text-dim); font-size: calc(12px * var(--fs, 1)); font-weight: 700;
}
.mstep.now .mstepn { background: var(--accent); color: #1a1004; }
.mcheck {
  margin-top: 11px; padding: 11px; border-radius: 9px;
  background: rgba(45,212,191,.09); border: 1px solid rgba(45,212,191,.28); line-height: 1.6;
}

.mtable { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.mtrow {
  display: flex; align-items: center; gap: 8px; padding: 7px 11px;
  background: var(--bg-soft); border-radius: 8px; font-variant-numeric: tabular-nums;
}
.mtrow b { margin-left: auto; color: var(--accent-2); }
:root[data-theme="light"] .mtrow b { color: var(--accent); }

@media (max-width: 560px) {
  .mcell { width: 23px; height: 33px; font-size: calc(21px * var(--fs, 1)); }
  .manswer { font-size: calc(31px * var(--fs, 1)); }
  .mnum { font-size: calc(21px * var(--fs, 1)); }
}

/* ------------------------------------------------------- the writing pad */
:root { --model-ink: rgba(70,95,125,.24); }
:root[data-theme="dark"] { --model-ink: rgba(170,190,210,.26); }

.write-pad {
  position: relative; width: 100%; margin-top: 14px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px;
  touch-action: none; overflow: hidden;
}
.write-pad.rows-1 { height: 190px; }
.write-pad.rows-4 { height: 430px; }
.write-model, .write-ink { position: absolute; inset: 0; display: block; }
.write-ink { cursor: crosshair; }

.trace-big {
  font-size: calc(46px * var(--fs, 1)); font-weight: 700; line-height: 1;
  display: flex; align-items: center; gap: 8px;
}
.trace-big.ta { font-family: var(--tamil); }
.trace-big.hi { font-family: var(--deva); }

@media (max-width: 560px) {
  .write-pad.rows-1 { height: 150px; }
  .write-pad.rows-4 { height: 330px; }
  .trace-big { font-size: calc(36px * var(--fs, 1)); }
}

/* a printed practice sheet is black on white with none of the app around it */
@media print {
  .side, .head, .nav, #auth, #auth.on, .pill-row, .btn, .card-sub, .tiny { display: none !important; }
  body, .card, .write-pad { background: #fff !important; color: #000 !important; border: none !important; }
  .write-pad.rows-4 { height: 620px; }
}

/* ----------------------------------------------------------------- maths */
.msetup { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mnum {
  flex: 1; min-width: 120px; padding: 13px 15px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
  font-size: calc(26px * var(--fs, 1)); font-weight: 650; letter-spacing: 1px; text-align: right;
}
.mnum:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240,136,62,.15); }
#mOps .pill { font-size: calc(21px * var(--fs, 1)); padding: 6px 15px; line-height: 1.2; }

.manswer {
  font-size: calc(40px * var(--fs, 1)); font-weight: 750; letter-spacing: 1px; color: var(--accent-2);
  word-break: break-all; line-height: 1.2; margin-bottom: 6px;
}
:root[data-theme="light"] .manswer { color: var(--accent); }
.mwords { display: grid; gap: 10px; }
.mword { padding-top: 9px; border-top: 1px solid var(--line-soft); }

/* the sum written out in columns, as on paper */
.msum {
  display: inline-block; padding: 14px 18px; border-radius: 10px;
  background: var(--bg-soft); font-variant-numeric: tabular-nums;
  overflow-x: auto; max-width: 100%;
}
.mrow { display: flex; justify-content: flex-end; }
.mcell {
  width: 30px; height: 40px; display: grid; place-items: center;
  font-size: calc(27px * var(--fs, 1)); font-weight: 650; font-family: ui-monospace, 'Consolas', monospace;
}
.mcell.mop { color: var(--text-dim); }
.mcell.mans { color: var(--accent-2); }
:root[data-theme="light"] .mcell.mans { color: var(--accent); }
.mcell.mmark { height: 20px; font-size: calc(14px * var(--fs, 1)); color: var(--teal); font-weight: 700; }
.mline { height: 2px; background: var(--line); margin: 5px 0; }

/* counting dots, for anyone who cannot read the words yet */
.mcount { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: calc(22px * var(--fs, 1)); }
.mdots { display: inline-flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }
.mdot { width: 15px; height: 15px; border-radius: 50%; display: inline-block; background: var(--accent); }
.mdot.b { background: var(--teal); }
.mplus { font-size: calc(24px * var(--fs, 1)); color: var(--text-dim); font-weight: 700; }
.mgroup { padding: 6px; border: 1px dashed var(--line); border-radius: 9px; }
.mgroup.mleft { border-style: dotted; opacity: .75; }

/* the steps */
.mstep {
  display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start;
  padding: 9px 11px; border-radius: 9px; margin-bottom: 4px; cursor: pointer;
  line-height: 1.6; transition: background .15s;
}
.mstep:hover { background: var(--panel-2); }
.mstep.now { background: var(--accent-dim); box-shadow: inset 3px 0 0 var(--accent); }
.mstepn {
  width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel-2); color: var(--text-dim); font-size: calc(12px * var(--fs, 1)); font-weight: 700;
}
.mstep.now .mstepn { background: var(--accent); color: #1a1004; }
.mcheck {
  margin-top: 11px; padding: 11px; border-radius: 9px;
  background: rgba(45,212,191,.09); border: 1px solid rgba(45,212,191,.28); line-height: 1.6;
}

.mtable { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.mtrow {
  display: flex; align-items: center; gap: 8px; padding: 7px 11px;
  background: var(--bg-soft); border-radius: 8px; font-variant-numeric: tabular-nums;
}
.mtrow b { margin-left: auto; color: var(--accent-2); }
:root[data-theme="light"] .mtrow b { color: var(--accent); }

@media (max-width: 560px) {
  .mcell { width: 23px; height: 33px; font-size: calc(21px * var(--fs, 1)); }
  .manswer { font-size: calc(31px * var(--fs, 1)); }
  .mnum { font-size: calc(21px * var(--fs, 1)); }
}

/* ------------------------------------------------- sections have colours */
/* A sidebar of fifteen identical grey rows is a list to be read. Give each
   one its own colour and it becomes a place you recognise. */
.nav a .ic { color: var(--row-colour, var(--text-mute)); }
.nav a[data-v="home"]      { --row-colour: var(--c-home); }
.nav a[data-v="learn"]     { --row-colour: var(--c-lessons); }
.nav a[data-v="phrases"]   { --row-colour: var(--c-phrases); }
.nav a[data-v="practice"]  { --row-colour: var(--c-practice); }
.nav a[data-v="translate"] { --row-colour: var(--c-translate); }
.nav a[data-v="meaning"]   { --row-colour: var(--c-meaning); }
.nav a[data-v="numbers"]   { --row-colour: var(--c-numbers); }
.nav a[data-v="maths"]     { --row-colour: var(--c-maths); }
.nav a[data-v="tutor"]     { --row-colour: var(--c-tutor); }
.nav a[data-v="conjugate"] { --row-colour: var(--c-conjugate); }
.nav a[data-v="photo"]     { --row-colour: var(--c-photo); }
.nav a[data-v="speak"]     { --row-colour: var(--c-speak); }
.nav a[data-v="write"]     { --row-colour: var(--c-write); }
.nav a[data-v="alphabet"]  { --row-colour: var(--c-alphabet); }
.nav a[data-v="phonics"]   { --row-colour: var(--c-phonics); }
.nav a[data-v="vocab"]     { --row-colour: var(--c-vocab); }

.nav a {
  padding: 11px 12px; font-size: calc(15px * var(--fs, 1)); border-radius: 11px;
}
.nav a .ic { font-size: calc(18px * var(--fs, 1)); width: 22px; }
.nav a.on {
  background: color-mix(in srgb, var(--row-colour, var(--accent)) 14%, transparent);
  color: var(--row-colour, var(--accent));
  font-weight: 700;
}
.nav a.on .ic { color: var(--row-colour, var(--accent)); }

/* the page header picks up the colour of the section you are in */
.head { border-bottom: 3px solid var(--head-colour, var(--line)); }
.head h2 { color: var(--head-colour, var(--text)); }

/* ------------------------------------------------- friendlier furniture */
.btn { padding: 11px 18px; font-size: calc(15px * var(--fs, 1)); border-radius: 12px; }
.btn-sm { padding: 8px 14px; font-size: calc(14px * var(--fs, 1)); border-radius: 10px; }
.btn-primary { box-shadow: 0 2px 0 var(--accent-2); }
.btn-primary:active { box-shadow: none; transform: translateY(2px); }
.pill { padding: 8px 15px; font-size: calc(14px * var(--fs, 1)); border-radius: 999px; }
.card { border-radius: var(--radius); }
.card h3 { font-size: calc(17px * var(--fs, 1)); }
.field label { font-size: calc(13.5px * var(--fs, 1)); }
.tiny { font-size: calc(12.5px * var(--fs, 1)); }
.small { font-size: calc(14px * var(--fs, 1)); }

/* a child taps with a whole finger */
@media (max-width: 760px) {
  .btn, .pill { min-height: 44px; }
  .nav a { min-height: 46px; }
}

/* ------------------------------------- grammar, word pairs, conversation */
.lang-line { margin-bottom: 5px; line-height: 1.55; }
.gram-rule {
  padding: 11px 13px; border-radius: 11px; background: var(--bg-soft);
  border-left: 3px solid var(--c-lessons); margin-bottom: 10px;
}
.gram-ex {
  padding: 9px 12px; border-radius: 10px; margin-bottom: 6px;
  background: var(--panel-2);
}
.gram-mistake {
  margin-top: 12px; padding: 12px; border-radius: 11px;
  background: rgba(190,18,60,.07); border: 1px solid rgba(190,18,60,.22);
}
.gram-wrong { color: var(--red); text-decoration: line-through; margin: 5px 0 2px; }
.gram-right { color: var(--green); font-weight: 650; }

.pair-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.pair-gloss { font-size: calc(13px * var(--fs, 1)); color: var(--text-dim); margin: 3px 0 9px; }
.pair-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.pair-tag {
  font-size: calc(11px * var(--fs, 1)); font-weight: 700; padding: 3px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .4px;
}
.pair-tag.same { background: rgba(21,128,61,.14); color: var(--green); }
.pair-tag.opp  { background: rgba(190,18,60,.13); color: var(--red); }
.pill-sm { padding: 5px 11px; font-size: calc(13px * var(--fs, 1)); }
.pair-ex { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }

.sent { padding: 13px 15px; }
.chip-present { background: rgba(29,78,216,.14); color: var(--blue); }
.chip-past    { background: rgba(109,40,217,.14); color: var(--purple); }
.chip-future  { background: rgba(21,128,61,.14); color: var(--green); }

.chart-scroll { overflow-x: auto; }
table.chart { border-collapse: collapse; width: 100%; min-width: 620px; }
table.chart th {
  text-align: left; font-size: calc(12px * var(--fs, 1)); text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-mute); padding: 7px 10px; border-bottom: 2px solid var(--line);
}
table.chart td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; line-height: 1.5; }
.chart-who { font-weight: 650; white-space: nowrap; }

.talk {
  display: grid; grid-template-columns: 26px 1fr; gap: 9px; align-items: start;
  padding: 9px 11px; border-radius: 11px; margin-bottom: 5px; cursor: pointer;
}
.talk:hover { background: var(--panel-2); }
.talk-who {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: calc(12px * var(--fs, 1)); font-weight: 700; background: var(--panel-2); color: var(--text-dim);
}
.talk-A { background: rgba(29,78,216,.06); }
.talk-A .talk-who { background: var(--blue); color: #fff; }
.talk-B .talk-who { background: var(--c-phrases); color: #fff; }

@media (max-width: 560px) {
  .pair-grid { grid-template-columns: 1fr; }
}

/* The whole practice set as one tappable index: a hundred numbers or two
   hundred Tamil letters are not reachable by a Next button alone. */
.jump-strip {
  display: flex; flex-wrap: wrap; gap: 5px;
  max-height: 124px; overflow-y: auto;
  padding: 8px; margin: 10px 0 2px;
  background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: 12px;
}
.jump {
  min-width: 34px; min-height: 34px; padding: 3px 7px;
  font: inherit; font-size: calc(14px * var(--fs, 1)); line-height: 1.2;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; transition: background .12s, border-color .12s, transform .12s;
}
.jump:hover { border-color: var(--accent); }
.jump.on {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 700; transform: scale(1.06);
}
.jump.ta, .jump.hi { font-size: calc(16px * var(--fs, 1)); }

/* A select that matches the pills beside it, at every text size. */
.sel {
  font: inherit; padding: 8px 11px; margin-top: 3px;
  color: var(--text); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 10px;
  max-width: 100%; min-height: 40px;
}
.sel:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

@media (max-width: 640px) {
  .jump-strip { max-height: 160px; }
  .jump { min-width: 38px; min-height: 38px; }
}

/* ------------------------------------------------------------------ search
   One box across the top of every page. It has to be wide enough to read a
   Tamil phrase in, and it has to stay put when the page under it changes. */
.search {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
  max-width: 620px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 10px 0 12px;
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search:focus-within {
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.search-ic { font-size: calc(15px * var(--fs, 1)); opacity: .65; flex: none; }
.search input {
  flex: 1; min-width: 0;
  font: inherit; font-size: calc(15px * var(--fs, 1));
  color: var(--text); background: none;
  border: 0; outline: none; padding: 0;
}
.search input::placeholder { color: var(--text-dim); opacity: .9; }
.search-clear {
  flex: none; width: 24px; height: 24px; padding: 0;
  font: inherit; font-size: calc(13px * var(--fs, 1)); line-height: 1;
  color: var(--text-dim); background: var(--line-soft);
  border: 0; border-radius: 50%; cursor: pointer;
}
.search-clear:hover { color: var(--text); background: var(--line); }
.search-key {
  flex: none;
  font: inherit; font-size: calc(11px * var(--fs, 1)); font-weight: 600;
  color: var(--text-dim); background: var(--bg);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 6px;
}
.search:focus-within .search-key { display: none; }

/* the dropdown */
.search-out {
  position: absolute; z-index: 60;
  top: calc(100% + 7px); left: 0; right: 0;
  max-height: min(66vh, 520px);
  overflow-y: auto;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 44px -12px rgba(0, 0, 0, .3), 0 3px 10px rgba(0, 0, 0, .08);
  animation: searchIn .14s ease-out;
}
@keyframes searchIn { from { opacity: 0; transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .search-out { animation: none; } }

.search-group {
  padding: 9px 10px 4px;
  font-size: calc(11px * var(--fs, 1)); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-dim);
}
.search-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; margin: 1px 0;
  font: inherit; text-align: left; text-decoration: none;
  color: var(--text); background: none;
  border: 0; border-radius: 10px; cursor: pointer;
}
.search-row.on, .search-row:hover { background: var(--bg-soft); }
.search-row.on { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* A past search, with the way to take it off the list beside it. */
.search-group-row { display: flex; align-items: baseline; justify-content: space-between; }
.search-forget-all {
  font: inherit; font-size: calc(11px * var(--fs, 1)); font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  background: none; border: 0; padding: 0 2px; cursor: pointer;
  color: var(--text-dim); border-radius: 6px;
}
.search-forget-all:hover { color: var(--red); text-decoration: underline; }
.search-recent { display: flex; align-items: center; }
.search-recent .search-row { flex: 1; min-width: 0; }
.search-forget {
  flex: none; width: 30px; height: 30px; margin-right: 6px;
  display: flex; align-items: center; justify-content: center;
  font: inherit; line-height: 1; background: none; border: 0;
  border-radius: 8px; cursor: pointer; color: var(--text-dim);
}
.search-forget:hover { background: var(--bg-soft); color: var(--red); }
.search-forget:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-row-ic { flex: none; width: 22px; font-size: calc(16px * var(--fs, 1)); text-align: center; }
.search-row-main { min-width: 0; flex: 1; display: block; }
.search-row-t { display: block; font-weight: 600; overflow-wrap: anywhere; }
.search-row-t b { color: var(--accent); }
.search-row-s {
  display: block; margin-top: 1px;
  font-size: calc(12.5px * var(--fs, 1)); color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-row-go { flex: none; opacity: 0; color: var(--accent); font-weight: 700; }
.search-row.on .search-row-go { opacity: 1; }
.search-empty { padding: 18px 12px; text-align: center; color: var(--text); }
.search-foot {
  padding: 9px 11px 5px; margin-top: 3px;
  border-top: 1px solid var(--line-soft);
  font-size: calc(12px * var(--fs, 1)); color: var(--text-dim);
}

/* Squeezed between a title and four chips there is no room to read a
   placeholder until the window is really wide, so below that the search
   takes a line of its own rather than shrinking into uselessness. */
@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .search { order: 10; flex-basis: 100%; max-width: none; }
  .search-key { display: none; }
  .search-out { max-height: 64vh; }
}
@media (min-width: 1101px) {
  .search { margin: 0 14px; }
}

/* The header on a narrow screen: the title gives way rather than pushing the
   buttons onto rows of their own — the theme button stranded on a line by
   itself looked like a mistake, because it was one. */
@media (max-width: 760px) {
  .topbar { gap: 7px; }
  .topbar > div:first-of-type { flex: 1 1 60px; min-width: 0; }
  .topbar h2 {
    font-size: calc(17px * var(--fs, 1)); line-height: 1.25;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .topbar .sub {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .topbar .chip { font-size: calc(11px * var(--fs, 1)); padding: 3px 7px; }
  .topbar .btn-sm, .topbar .btn-icon { padding: 6px 9px; min-width: 0; }
}
@media (max-width: 400px) {
  .topbar .sub { display: none; }   /* at this width the subtitle is a luxury */
}

/* ------------------------------------------------- growing up now
   A page a parent may read aloud to a child, so it is quiet: plenty of
   room between the three languages, and the warning is marked without
   shouting. */
.mod { border-left: 3px solid var(--accent); }
.mod-block { margin: 12px 0; }
.mod-label {
  font-size: calc(11px * var(--fs, 1)); font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 5px;
}
.mod-words {
  margin: 14px 0 4px; padding: 11px 12px;
  background: var(--bg-soft); border-radius: 11px;
}
.mod-word {
  display: inline-flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  padding: 5px 10px; margin: 0 5px 5px 0;
  background: var(--bg); border: 1px solid var(--line-soft); border-radius: 9px;
  font-size: calc(14px * var(--fs, 1));
}
.mod-word .ta { color: var(--teal); }
.mod-word .hi { color: var(--purple); }
/* A child has to be able to hit this. It was 20x12, which nobody can tap
   reliably and a small hand cannot tap at all. */
.mod-word .mini {
  display: inline-grid; place-items: center;
  min-width: 34px; min-height: 34px; padding: 0;
  font-size: calc(15px * var(--fs, 1)); line-height: 1;
  background: none; border: 0; border-radius: 50%;
  cursor: pointer; opacity: .65;
}
.mod-word .mini:hover { opacity: 1; background: var(--line-soft); }
@media (max-width: 640px) {
  .mod-word .mini { min-width: 40px; min-height: 40px; font-size: calc(17px * var(--fs, 1)); }
}
.mod-try, .mod-careful {
  margin-top: 12px; padding: 11px 13px; border-radius: 11px;
}
.mod-try { background: rgba(21, 128, 61, .08); }
.mod-careful { background: rgba(190, 18, 60, .07); }
.mod-try .mod-label { color: var(--green); }
.mod-careful .mod-label { color: var(--red); }
@media (max-width: 640px) {
  .mod-word { width: 100%; }
}

/* ------------------------------------------------------------------- home
   One thing to do, then your progress, then every section there is. The
   drawer is a shortcut to this page, not the only way to find things. */
.hero {
  display: block; position: relative; overflow: hidden;
  padding: 22px 24px; margin-bottom: 14px;
  text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: var(--radius);
  background:
    radial-gradient(520px 220px at 92% -30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--panel);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.hero:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .35);
}
.hero-kicker {
  font-size: calc(11px * var(--fs, 1)); font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent);
}
.hero-title {
  margin: 5px 0 4px; font-size: calc(25px * var(--fs, 1)); font-weight: 700;
  letter-spacing: -.4px; line-height: 1.22;
}
.hero-sub { font-size: calc(14px * var(--fs, 1)); color: var(--text-dim); max-width: 60ch; }
.hero-cta { margin-top: 14px; pointer-events: none; }

.dept { margin-bottom: 14px; }
.dept-grid {
  display: grid; gap: 9px; margin-top: 11px;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
}
.dept-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; text-decoration: none; color: inherit;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft); border-radius: 12px;
  transition: transform .13s ease, border-color .13s ease, background .13s ease;
}
.dept-item:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--panel);
}
.dept-ic { font-size: calc(21px * var(--fs, 1)); flex: none; line-height: 1; }
.dept-text { min-width: 0; display: block; line-height: 1.32; }
.dept-text b { display: block; font-size: calc(14.5px * var(--fs, 1)); font-weight: 650; }
.dept-text span {
  display: block; font-size: calc(12px * var(--fs, 1)); color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --------------------------------------------------------------- polish
   One focus ring for the whole app. A person moving by keyboard, or a
   child using a switch, has to be able to see where they are. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.card, .dept-item, .hero, .btn { -webkit-tap-highlight-color: transparent; }

/* Nothing should move for somebody who has asked for less movement. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 640px) {
  .hero { padding: 18px 17px; }
  .hero-title { font-size: calc(21px * var(--fs, 1)); }
  .dept-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ abacus
   A soroban: one bead above the bar worth five, four below worth one. Drawn
   rather than photographed so it works offline and scales to any screen. */
.abacus {
  background: linear-gradient(180deg, #8b5e34, #6f4522);
  border: 6px solid #5a3718; border-radius: 12px;
  padding: 14px 10px 10px; overflow-x: auto;
}
.ab-rods { display: flex; gap: 4px; justify-content: center; min-width: min-content; }
.ab-rod {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 0 3px;
}
/* the rod itself, behind the beads */
.ab-rod::before {
  content: ''; position: absolute; top: 4px; bottom: 34px; width: 3px;
  background: #c9a227; border-radius: 2px;
}
.ab-heaven { position: relative; height: 62px; display: flex; align-items: flex-start; }
.ab-earth { position: relative; height: 150px; display: flex; flex-direction: column; }
.ab-bar { width: 100%; min-width: 34px; height: 7px; background: #3d2411; border-radius: 2px; margin: 3px 0; }

.ab-bead {
  display: block; width: 34px; height: 22px; padding: 0; margin: 2px 0;
  border: 0; cursor: pointer;
  border-radius: 50% / 45%;
  background: radial-gradient(circle at 34% 32%, #ffe08a, #d9a441 45%, #9a6b16);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  transition: transform .12s ease;
}
.ab-bead.heaven { transform: translateY(0); }
.ab-bead.heaven.on { transform: translateY(32px); }
.ab-bead.earth { transform: translateY(26px); }
.ab-bead.earth.on { transform: translateY(0); }
.ab-bead:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.ab-digit {
  margin-top: 6px; font-size: calc(17px * var(--fs, 1)); font-weight: 700; color: #ffe9b0;
  min-width: 34px; text-align: center;
}
.ab-place { font-size: calc(9px * var(--fs, 1)); color: rgba(255, 233, 176, .7); text-align: center; line-height: 1.1; }

.ab-value { font-size: calc(40px * var(--fs, 1)); font-weight: 700; letter-spacing: -1px; margin-bottom: 8px; }
.ab-ask { font-size: calc(14px * var(--fs, 1)); color: var(--text-dim); }
.ab-target { font-size: calc(44px * var(--fs, 1)); font-weight: 700; color: var(--accent); letter-spacing: -1px; }
.ab-step {
  padding: 9px 12px; margin-top: 7px;
  background: var(--bg-soft); border-radius: 10px; font-size: calc(14.5px * var(--fs, 1));
}
.ab-step.carry { background: rgba(240, 136, 62, .12); border-left: 3px solid var(--accent); }

@media (max-width: 640px) {
  .ab-bead { width: 28px; height: 19px; }
  .ab-bar { min-width: 28px; }
  .ab-earth { height: 128px; }
  .ab-heaven { height: 54px; }
  .ab-bead.heaven.on { transform: translateY(27px); }
  .ab-bead.earth { transform: translateY(22px); }
  .ab-value, .ab-target { font-size: calc(32px * var(--fs, 1)); }
}

/* ------------------------------------------------- vertically & crosswise
   The pattern is the lesson: a straight line where one pair meets, a cross
   where two or more do. */
.xw-grid {
  display: flex; gap: 8px; margin: 14px 0 4px;
  overflow-x: auto; padding-bottom: 6px; justify-content: flex-start;
}
.xw-col {
  flex: none; min-width: 96px; text-align: center;
  padding: 10px 8px; border-radius: 11px;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
}
.xw-col.cross { background: rgba(240, 136, 62, .10); border-color: var(--accent); }
.xw-mark { font-size: calc(20px * var(--fs, 1)); color: var(--accent); line-height: 1; }
.xw-col:not(.cross) .xw-mark { color: var(--text-dim); }
.xw-pairs { margin: 6px 0 4px; font-size: calc(13px * var(--fs, 1)); }
.xw-pair { white-space: nowrap; }
.xw-plus { color: var(--text-dim); margin: 0 3px; }
.xw-sum { font-size: calc(19px * var(--fs, 1)); font-weight: 700; }
.xw-carry { font-size: calc(11px * var(--fs, 1)); color: var(--accent); }
.xw-digit {
  margin-top: 6px; font-size: calc(25px * var(--fs, 1)); font-weight: 700; color: var(--green);
  border-top: 2px solid var(--line); padding-top: 4px;
}
.xw-place { font-size: calc(10px * var(--fs, 1)); color: var(--text-dim); }

/* ------------------------------------------------------------- practice */
.q-sum { font-size: calc(38px * var(--fs, 1)); font-weight: 700; letter-spacing: -1px; margin: 12px 0; }
.q-score { font-size: calc(52px * var(--fs, 1)); font-weight: 700; color: var(--accent); }
.link-inline { color: inherit; text-decoration: underline; }

/* ---------------------------------------------------------- number chart */
.num-chart {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
}
.num-chart.roomy { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.num-cell {
  display: flex; flex-direction: column; gap: 1px;
  padding: 10px 9px; text-align: left; font: inherit; cursor: pointer;
  color: var(--text); background: var(--bg-soft);
  border: 1px solid var(--line-soft); border-radius: 11px;
  transition: border-color .12s, transform .12s, background .12s;
}
.num-cell:hover { border-color: var(--accent); transform: translateY(-1px); }
.num-cell.on { border-color: var(--accent); background: var(--panel); box-shadow: inset 0 0 0 1px var(--accent); }
.num-fig { font-size: calc(21px * var(--fs, 1)); font-weight: 700; letter-spacing: -.5px; }
.num-en { font-size: calc(12px * var(--fs, 1)); color: var(--text-dim); }
.num-ta { font-size: calc(12.5px * var(--fs, 1)); color: var(--teal); }
.num-hi { font-size: calc(12.5px * var(--fs, 1)); color: var(--purple); }

@media (max-width: 640px) {
  .num-chart, .num-chart.roomy { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .q-sum { font-size: calc(30px * var(--fs, 1)); }
  .xw-col { min-width: 88px; }
}

/* ==========================================================================
   DEPTH
   --------------------------------------------------------------------------
   A screen is flat, so depth has to be drawn. Three things do all of it:

     light   — a page-wide glow above and behind everything, so surfaces
               have something to catch;
     rim     — a one-pixel highlight along the top edge of a surface, which
               is what a real edge does under a light from above;
     shadow  — two of them, always. A tight dark one for contact and a wide
               soft one for the distance to the page. One shadow looks
               printed; two look lifted.

   The scale below is the whole vocabulary. Nothing in this stylesheet
   should invent a shadow of its own.                                       */
:root {
  --sh-1: 0 1px 2px rgba(48, 34, 16, .05),  0 3px 8px -2px rgba(48, 34, 16, .07);
  --sh-2: 0 2px 4px rgba(48, 34, 16, .05),  0 12px 28px -8px rgba(48, 34, 16, .16);
  --sh-3: 0 4px 10px rgba(48, 34, 16, .07), 0 26px 52px -16px rgba(48, 34, 16, .26);
  --sh-4: 0 8px 18px rgba(48, 34, 16, .09), 0 46px 88px -24px rgba(48, 34, 16, .34);
  --rim:  inset 0 1px 0 rgba(255, 255, 255, .85);
  --sheen: rgba(255, 255, 255, .62);
  --glow: 0 0 0 1px color-mix(in srgb, var(--accent) 34%, transparent),
          0 16px 44px -16px color-mix(in srgb, var(--accent) 52%, transparent);
  --lift: -3px;
}
:root[data-theme="dark"] {
  /* In the dark a shadow cannot be seen, so depth is carried by the rim
     and by the surface getting lighter as it comes towards you. */
  --sh-1: 0 1px 2px rgba(0, 0, 0, .35),  0 3px 10px -2px rgba(0, 0, 0, .40);
  --sh-2: 0 2px 6px rgba(0, 0, 0, .40),  0 14px 34px -10px rgba(0, 0, 0, .55);
  --sh-3: 0 4px 12px rgba(0, 0, 0, .45), 0 30px 62px -18px rgba(0, 0, 0, .68);
  --sh-4: 0 8px 20px rgba(0, 0, 0, .50), 0 52px 96px -26px rgba(0, 0, 0, .78);
  --rim:  inset 0 1px 0 rgba(255, 255, 255, .07);
  --sheen: rgba(255, 255, 255, .16);
}

/* Type, at the size a 4K panel actually shows it. Without this the strokes
   of த and ह are snapped to whole pixels and the letters go lumpy. */
html, body { text-rendering: optimizeLegibility; -moz-osx-font-smoothing: grayscale; }

/* ------------------------------------------------------------- the light
   One wash of colour behind the whole page, fixed so it does not scroll
   with the cards — the cards move past the light rather than carrying it.
   Drifting very slowly, which is the difference between a backdrop and a
   wallpaper. Three gradients, one compositor layer, no repaint. */
.main { position: relative; isolation: isolate; }
.main::before {
  content: ''; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38vmax 34vmax at 12% 2%,  color-mix(in srgb, var(--accent) 17%, transparent), transparent 66%),
    radial-gradient(34vmax 32vmax at 92% 12%, color-mix(in srgb, var(--blue)   13%, transparent), transparent 64%),
    radial-gradient(42vmax 38vmax at 56% 96%, color-mix(in srgb, var(--teal)   12%, transparent), transparent 68%);
  will-change: transform;
}
html.depth .main::before { animation: sky 54s ease-in-out infinite alternate; }
@keyframes sky {
  from { transform: translate3d(0, 0, 0)            scale(1);    }
  to   { transform: translate3d(2.5vmax, -2vmax, 0) scale(1.09); }
}

/* Glass over the light, so the header belongs to the page it floats on. */
.topbar {
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  backdrop-filter: saturate(1.5) blur(16px);
  border-bottom-color: color-mix(in srgb, var(--line) 80%, transparent);
}
.side {
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
}
@supports not (backdrop-filter: blur(4px)) {
  .topbar { background: var(--bg); }
  .side   { background: var(--bg-soft); }
}

/* ----------------------------------------------------------- the surfaces */
.card {
  box-shadow: var(--sh-1), var(--rim);
  background: linear-gradient(176deg, color-mix(in srgb, var(--panel) 96%, var(--text)), var(--panel) 42%);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.stat {
  position: relative;
  background: linear-gradient(168deg, var(--panel), var(--panel-2));
  box-shadow: var(--sh-1), var(--rim);
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat:hover { transform: translateY(var(--lift)); box-shadow: var(--sh-3), var(--rim); }
.stat .n { font-variant-numeric: tabular-nums; }

.btn { box-shadow: var(--sh-1), var(--rim); transition: transform .12s ease, box-shadow .16s ease, background .16s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--sh-2), var(--rim); }
.btn:active { transform: translateY(1px); box-shadow: var(--sh-1); }
.btn-ghost { box-shadow: none; }
.btn-ghost:hover { box-shadow: var(--sh-1); }
.btn-primary {
  box-shadow: 0 2px 0 var(--accent-2), var(--sh-2), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn-primary:hover { box-shadow: 0 2px 0 var(--accent-2), var(--sh-3), inset 0 1px 0 rgba(255, 255, 255, .34); }
.btn-primary:active { transform: translateY(2px); box-shadow: var(--sh-1); }

/* ---------------------------------------------------------------- the hero
   The one cinematic thing on the page, and the only place where the type is
   allowed to be this big. A light sweeps across it when the pointer
   arrives — once, on the way past, the way light moves over a real card
   being picked up. */
.hero {
  padding: 30px 30px 26px;
  box-shadow: var(--sh-2), var(--rim);
  background:
    radial-gradient(760px 320px at 88% -45%, color-mix(in srgb, var(--accent) 27%, transparent), transparent 70%),
    radial-gradient(560px 280px at 4% 130%,  color-mix(in srgb, var(--blue)   17%, transparent), transparent 70%),
    linear-gradient(162deg, color-mix(in srgb, var(--panel) 90%, var(--accent)), var(--panel) 52%);
  transition: transform .2s ease, box-shadow .25s ease, border-color .2s ease;
}
.hero::before {
  content: ''; position: absolute; inset: -60% -20%; pointer-events: none;
  background: linear-gradient(104deg, transparent 40%, var(--sheen) 50%, transparent 60%);
  transform: translate3d(-130%, 0, 0);
}
html.depth .hero:hover::before { transition: transform 1.1s cubic-bezier(.22, .68, .28, 1); transform: translate3d(130%, 0, 0); }
.hero:hover { transform: translateY(-4px); box-shadow: var(--sh-4), var(--rim); border-color: var(--accent); }
.hero > * { position: relative; }
.hero-title { font-size: calc(clamp(26px, 3.3vw, 42px) * var(--fs, 1)); letter-spacing: -.8px; }
/* Ink that fades towards the section colour. Guarded, because a browser
   that clips a background to text but cannot paint it leaves no text. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero-title {
    background: linear-gradient(172deg, var(--text) 30%, color-mix(in srgb, var(--text) 52%, var(--accent)));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
  }
}
.hero-cta { box-shadow: 0 2px 0 var(--accent-2), var(--sh-2); }

/* ------------------------------------------------------------ the tiles
   The tiles on the home page are the one place a child is choosing rather
   than reading, so they are the one place worth making solid. They turn
   towards the pointer, the icon lifts off the face, and a highlight tracks
   across. On a touch screen none of that happens and nothing is lost.     */
.dept-grid { perspective: 1000px; }
.dept-item {
  position: relative;
  background: linear-gradient(168deg, var(--bg-soft), color-mix(in srgb, var(--bg-soft) 82%, var(--panel)));
  box-shadow: var(--sh-1);
}
.dept-item > * { position: relative; z-index: 1; }
html.depth-tilt .dept-item {
  transform-style: preserve-3d;
  transform: rotateX(calc(var(--rx, 0) * 1deg)) rotateY(calc(var(--ry, 0) * 1deg)) translateZ(0);
  transition: transform .22s cubic-bezier(.2, .7, .3, 1), box-shadow .22s ease, border-color .18s ease;
}
html.depth-tilt .dept-item:hover { box-shadow: var(--sh-3); transform: rotateX(calc(var(--rx, 0) * 1deg)) rotateY(calc(var(--ry, 0) * 1deg)) translateZ(10px); }
html.depth-tilt .dept-item .dept-ic { transition: transform .22s cubic-bezier(.2, .7, .3, 1); }
html.depth-tilt .dept-item:hover .dept-ic { transform: translateZ(26px) scale(1.14); }
/* the highlight the pointer drags across the face */
.dept-item::after {
  content: ''; position: absolute; inset: 0; z-index: 0; border-radius: inherit;
  background: radial-gradient(170px 130px at var(--mx, 50%) var(--my, 50%), var(--sheen), transparent 72%);
  opacity: 0; transition: opacity .22s ease; pointer-events: none;
}
html.depth-tilt .dept-item:hover::after { opacity: 1; }

/* --------------------------------------------------------------- arriving
   A card fades up the first time it is scrolled to. The class that hides
   it is put on by depth.js, so a browser that cannot put it back has never
   taken it away. */
html.depth .rv {
  opacity: 0; transform: translate3d(0, 16px, 0);
  transition: opacity .5s ease, transform .55s cubic-bezier(.2, .7, .3, 1);
  transition-delay: var(--rv-delay, 0ms);
}
html.depth .rv.in { opacity: 1; transform: none; }

/* The logo is a way home, so it has to look like one. */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit;
  padding: 4px 6px; margin: -4px -6px; border-radius: 11px;
  transition: background .15s ease, transform .15s ease; }
.brand:hover { background: var(--panel); transform: translateX(1px); }
.brand:hover .brand-mark { transform: rotate(-4deg) scale(1.05); box-shadow: var(--sh-2); }
.brand-mark { transition: transform .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s ease; }
.brand h1, .brand span { transition: color .15s ease; }
.brand:hover h1 { color: var(--accent); }

/* ==========================================================================
   FOLDS
   --------------------------------------------------------------------------
   Sixteen grammar rules, seventeen topics and nineteen conversations, all
   open at once, is a wall — and a child scrolls straight past the thing
   they came for. Shut, a page is a list of what is there and you open the
   one you want.

   Built on <details>, so opening, closing, the keyboard and find-in-page all
   work already and none of it has to be written twice.                     */
.fold { padding: 0; }
.fold > *:not(summary) { padding-left: 17px; padding-right: 17px; }
.fold > *:last-child { padding-bottom: 16px; }
.fold-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 17px; cursor: pointer; list-style: none;
  border-radius: var(--radius);
  transition: background .14s ease;
}
.fold-head::-webkit-details-marker { display: none; }   /* Safari's own arrow */
.fold-head:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.fold-head h3 { margin: 0; }
.fold-head .spacer { flex: 1; }
/* the arrow, which turns as it opens */
.fold-head::after {
  content: '\203A'; margin-left: 4px; flex: none;
  font-size: calc(23px * var(--fs, 1)); line-height: 1; color: var(--text-mute);
  transform: rotate(90deg); transform-origin: 50% 45%;
  transition: transform .2s cubic-bezier(.2, .7, .3, 1), color .14s ease;
}
.fold[open] > .fold-head::after { transform: rotate(-90deg); color: var(--accent); }
.fold[open] { box-shadow: var(--sh-2), var(--rim); }
.fold[open] > .fold-head {
  border-bottom: 1px solid var(--line-soft);
  border-radius: var(--radius) var(--radius) 0 0;
}
.fold-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* The body unfolds rather than appearing. */
html.depth .fold[open] > *:not(summary) { animation: unfold .28s cubic-bezier(.2, .7, .3, 1); }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }

/* ==========================================================================
   COUNTING ON A SLATE
   --------------------------------------------------------------------------
   Four strokes and a line across them. The oldest counting there is, and
   still the first a child meets, because it needs nothing but a surface and
   it reads at a glance: you do not count fourteen marks, you see two fives
   and four.

   Drawn as a slate in a wooden frame, because that is where it is learnt,
   and as line segments rather than letters, because the mark is not a
   character in any font and the fifth stroke has to be seen going across
   the other four.                                                          */
.tally {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px;
  padding: 26px 20px; margin: 4px 0 14px;
  min-height: 108px;
  border: 10px solid #7a4e24;
  border-radius: 14px;
  background:
    radial-gradient(120% 150% at 28% -10%, rgba(255, 255, 255, .07), transparent 62%),
    linear-gradient(168deg, #33413b, #1d2723);
  box-shadow:
    var(--sh-3),
    inset 0 0 0 1px rgba(255, 255, 255, .05),
    inset 0 10px 30px rgba(0, 0, 0, .5);
}
.tally-group { width: 60px; height: 52px; flex: none; overflow: visible; }
.tally-group line {
  stroke: #f2efe3; stroke-width: 3.6; stroke-linecap: round;
  opacity: .94;
}
/* the fifth, drawn across the other four */
.tally-group line.fifth { stroke: #ffb066; stroke-width: 4; opacity: 1; }
/* Only the newest stroke is drawn. The slate is rebuilt from scratch on
   every press, so animating them all blanked the whole board for a fifth
   of a second each time a child added one mark. */
html.depth .tally-group:last-of-type line:last-of-type { animation: chalk .2s ease-out; }
@keyframes chalk { from { opacity: 0; transform: scaleY(.3); transform-origin: 50% 100%; } }
.tally-empty { color: rgba(242, 239, 227, .52); font-size: calc(14.5px * var(--fs, 1)); padding: 16px 4px; }

/* ----------------------------------------------------------- the abacus
   The beads were flat discs. A bead is a thing you push, so it is lit from
   above, it is darker underneath, and it sits on the frame rather than in
   it. */
.abacus {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .13), transparent 20%),
    repeating-linear-gradient(94deg, rgba(0, 0, 0, .045) 0 2px, transparent 2px 11px),
    linear-gradient(180deg, #8b5e34, #6f4522);
  box-shadow: var(--sh-3), inset 0 2px 7px rgba(0, 0, 0, .38);
}
.ab-bead {
  background:
    radial-gradient(circle at 31% 25%, rgba(255, 255, 255, .92), rgba(255, 255, 255, 0) 40%),
    radial-gradient(circle at 38% 34%, #ffe08a, #d9a441 46%, #8a5d10);
  box-shadow:
    0 2px 3px rgba(0, 0, 0, .5),
    inset 0 -2px 4px rgba(0, 0, 0, .34),
    inset 0 2px 3px rgba(255, 255, 255, .3);
  transition: transform .14s cubic-bezier(.3, 1.5, .6, 1);   /* beads snap */
}

/* ------------------------------------------------------------ small screens */
@media (max-width: 640px) {
  .fold-head { padding: 13px 14px; }
  .fold > *:not(summary) { padding-left: 14px; padding-right: 14px; }
  .hero { padding: 22px 18px 20px; }
  .tally { gap: 13px 16px; padding: 20px 14px; border-width: 8px; }
  .tally-group { width: 50px; height: 44px; }
  /* A finger is not a pointer: no tilt, and nothing left leaning behind it. */
  html.depth-tilt .dept-item { transform: none; }
}

/* A 4K panel shows every soft edge, so the light is allowed to be wider
   and the shadows are allowed to be deeper. */
@media (min-width: 1800px) {
  .view { max-width: 1240px; }
  .view.wide { max-width: 1560px; }
  .hero { padding: 40px 40px 34px; }
}

/* --------------------------------------------------------- how big
   One number, set by the button in the corner, that every size in this
   file is multiplied by. A child learning to read and a grandparent
   learning a new script want very different things from the same page. */
:root { --fs: 1; }
:root[data-size="large"]   { --fs: 1.16; }
:root[data-size="largest"] { --fs: 1.34; }
/* Bigger type wants more room to breathe, and a bigger thing to press. */
:root[data-size="large"]   .view { padding: 26px; }
:root[data-size="largest"] .view { padding: 30px; }
:root[data-size="large"]   .btn,
:root[data-size="largest"] .btn { min-height: 44px; }
:root[data-size="largest"] .speak-btn,
:root[data-size="largest"] .mini { min-width: 38px; min-height: 38px; }

/* A sound, then a word that has it in. The word is the lesson; the symbol
   above it is only the label. */
.ph-ex {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line-soft);
  font-size: calc(15px * var(--fs, 1));
}
.ph-ex .ph-ex-r { color: var(--text-dim); font-size: calc(12.5px * var(--fs, 1)); }
.ph-ex .ph-ex-en { color: var(--teal); font-size: calc(12.5px * var(--fs, 1)); }
.ph-ex .ph-ex-en::before { content: '\2014\00a0'; color: var(--text-mute); }

/* A folded group says how many are inside, so you know whether it is worth
   opening before you open it. */
.fold-head .chip { margin-left: auto; }
.fold-head > div { min-width: 0; }
.fold-head .card-sub { margin-bottom: 0; }

/* The line being read aloud, while it is being read. Hearing three
   languages in a row is only a lesson if you can see which one you are
   listening to. */
.lang-line.saying {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  box-shadow: -3px 0 0 var(--accent);
  border-radius: 0 7px 7px 0;
  padding: 2px 8px 2px 9px; margin-left: -9px;
}
@media (prefers-reduced-motion: no-preference) {
  .lang-line { transition: background .18s ease, padding .18s ease; }
}

/* A message that describes a dead end carries the button out of it. */
.msg-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.msg-acts .btn { flex: 1 1 auto; min-width: 140px; justify-content: center; }
@media (max-width: 420px) { .msg-acts .btn { flex: 1 1 100%; } }

/* The Tamil reading of a Hindi word, on the same line as the word, where
   there is no room for the full two-part aid. */
.hi-tam-inline {
  display: block;
  font-family: var(--tamil);
  font-size: calc(11.5px * var(--fs, 1));
  color: var(--text-mute);
  line-height: 1.45;
  margin-top: 1px;
}
.card-sub .hi-tam-inline { display: inline; margin-left: 5px; }
.card-sub .hi-tam-inline::before { content: '['; }
.card-sub .hi-tam-inline::after { content: ']'; }

/* A worked step, now three languages deep: a number down the side so the
   order is still obvious once each step is three lines tall. */
.ab-step { display: flex; gap: 11px; align-items: flex-start; }
.ab-step-n {
  flex: none; width: 23px; height: 23px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line);
  font-size: calc(12px * var(--fs, 1)); font-weight: 700; color: var(--text-dim);
  margin-top: 2px;
}
.ab-step.carry .ab-step-n { background: var(--accent); border-color: var(--accent); color: #fff; }
/* trio() returns three sibling lines, so they need a column of their own —
   dropped straight into the flex row they became three narrow columns with
   one word on each line. */
.ab-step-body { flex: 1 1 auto; min-width: 0; }
.ab-step-body .lang-line { min-width: 0; }

/* The rod label says its place in English and in Tamil. */
.ab-place .ta { display: block; font-size: calc(8.5px * var(--fs, 1)); opacity: .85; }

/* The number that was asked for by name, so the eye lands on it in a page
   of five hundred. */
.num-cell.found {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent), var(--sh-2);
}

/* How to say the letter: the thing a learner came for, so it is the thing
   they see. The scholarly transliteration keeps its place underneath. */
.alpha-say {
  font-size: calc(17px * var(--fs, 1));
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .2px;
  margin: 2px 0 1px;
}
.alpha-en {
  font-size: calc(11px * var(--fs, 1));
  color: var(--text-dim);
  line-height: 1.4;
  margin-top: 3px;
}
/* The word that carries the sound. Tappable in its own right. */
.alpha-ex {
  margin-top: 7px; padding-top: 6px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer; border-radius: 0 0 8px 8px;
  font-size: calc(13.5px * var(--fs, 1));
}
.alpha-ex:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.alpha-ex span { display: block; }
.alpha-ex .alpha-ex-r { font-size: calc(11px * var(--fs, 1)); color: var(--text-mute); font-style: italic; }
.alpha-ex .alpha-ex-en { font-size: calc(11px * var(--fs, 1)); color: var(--teal); }
.alpha-cell { text-align: center; min-width: 0; }
/* Nothing in a letter card may hang off the side of it. */
.alpha-cell > *, .alpha-ex, .alpha-en, .alpha-two { max-width: 100%; min-width: 0; }
.alpha-ex span, .alpha-en { overflow-wrap: anywhere; }
.alpha-two { flex-wrap: wrap; }

/* A button that cannot be pressed has to look like one. Without this, a
   device with a single voice showed three choices and answered two. */
.pill[disabled] {
  opacity: .42;
  cursor: not-allowed;
  filter: grayscale(1);
}
.pill[disabled]:hover { background: var(--panel); }

/* The picture for a letter's word. Emoji, so it costs nothing, needs no
   internet and scales to any size. */
.alpha-pic {
  font-size: calc(30px * var(--fs, 1));
  line-height: 1.1;
  margin-top: 4px;
}
/* The two readings of a mei letter: its name, and the sound it makes. */
.alpha-two { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 3px 0 1px; }
.alpha-two b {
  font-size: calc(15px * var(--fs, 1)); font-weight: 700;
  padding: 1px 8px; border-radius: 7px;
}
.alpha-two .as-name { color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); }
.alpha-two .as-sound { color: var(--accent); background: var(--accent-dim); }
.alpha-two small { display: block; font-size: calc(9px * var(--fs, 1)); font-weight: 600;
  opacity: .8; letter-spacing: .3px; text-transform: uppercase; }
/* The letter being read, while the whole set is read through. */
.alpha-cell.saying {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* க — the same letter with its vowel back. A different letter, a different
   reading, and so a different thing to press. */
.alpha-with {
  /* It was inline-flex with no wrapping, in a grid cell narrower than its
     own content, so "WITH அ" hung off the side of the card. */
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: center; gap: 4px 5px;
  max-width: 100%; margin: 3px auto 0; padding: 3px 8px;
  border: 1px dashed var(--line); border-radius: 9px;
  background: transparent; color: var(--accent);
  font-size: calc(13px * var(--fs, 1)); font-weight: 700; cursor: pointer;
}
.alpha-with:hover { background: var(--accent-dim); border-style: solid; }
.alpha-with small {
  font-size: calc(8.5px * var(--fs, 1)); font-weight: 600;
  color: var(--text-mute); text-transform: uppercase; letter-spacing: .3px;
}
.alpha-with .ta { font-size: calc(17px * var(--fs, 1)); color: var(--text); }

/* While the whole set is read, Stop has to be reachable from anywhere: the
   reading scrolls the page, and the button was at the top of it. */
.reading #aStop {
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  box-shadow: var(--sh-3); padding: 11px 18px;
}

/* The meaning of the example word in the other two languages. */
.alpha-ex .alpha-ex-m {
  font-size: calc(11.5px * var(--fs, 1));
  color: var(--text-dim);
  line-height: 1.5;
}

/* A bead is 34×21 because that is what a bead looks like. What a finger
   has to hit is a different measurement, and 21 is under any of the floors
   for it — on a page built for children. The bead keeps its size; the area
   that answers a tap grows past it. */
.ab-bead { position: relative; }
.ab-bead::after {
  content: ''; position: absolute;
  left: 0; right: 0; top: 50%;
  height: 30px; transform: translateY(-50%);
}

/* What the table cannot show on its own: which of the lookalikes is which. */
.grid-legend {
  margin: 10px 0 12px; padding: 10px 13px;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  border-radius: 10px;
  font-size: calc(12px * var(--fs, 1)); line-height: 1.8; color: var(--text-dim);
}
.grid-legend b { color: var(--text); }
.grid-legend i { color: var(--text-mute); font-style: normal; font-size: calc(11px * var(--fs, 1)); }

/* The reading a learner acts on, over the scholarly form that tells the
   lookalikes apart. */
.matrix td .say {
  display: block; font-family: var(--ui);
  font-size: calc(10.5px * var(--fs, 1)); font-weight: 700;
  color: var(--accent); line-height: 1.2; margin-top: 2px;
}
.matrix th .r, .matrix .rowhead .r {
  display: block; font-family: var(--ui);
  font-size: calc(9.5px * var(--fs, 1)); color: var(--text-mute); font-weight: 600;
}

/* ங is never met on its own, so its row gives a word instead of a bare
   syllable — which is also the only thing a voice can actually say. */
.matrix td.withword { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.matrix td.nonword { opacity: .5; }
/* The cluster this cell is really about: ங்கி, not ஙி. */
.matrix td .cluster {
  display: block; font-family: var(--tamil);
  font-size: calc(11px * var(--fs, 1)); font-weight: 700;
  color: var(--blue); line-height: 1.3; margin-top: 2px;
}
.matrix td .wpic { display: block; font-size: calc(15px * var(--fs, 1)); line-height: 1.2; }
.matrix td .inword {
  display: block; font-family: var(--tamil);
  font-size: calc(12px * var(--fs, 1)); font-weight: 600;
  color: var(--text); line-height: 1.35; margin-top: 2px;
}
.matrix td { position: relative; }

/* A letter no voice can say on its own, written in the form that it can:
   the letter with a vowel in front and its own vowel killed. */
.alpha-alone {
  display: inline-flex; align-items: baseline; gap: 5px; flex-wrap: wrap;
  justify-content: center; max-width: 100%;
  margin: 2px auto 0; padding: 1px 8px;
  border: 1px dashed var(--line); border-radius: 9px;
  font-size: calc(12.5px * var(--fs, 1)); font-weight: 700; color: var(--blue);
}
.alpha-alone .hi { font-size: calc(15px * var(--fs, 1)); color: var(--text); }
.alpha-alone small {
  font-size: calc(8.5px * var(--fs, 1)); font-weight: 600; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: .3px;
}

/* The traditional spelling, for a letter that modern writing replaces with
   the anusvara — the only place the letter itself can be seen. */
.alpha-old {
  display: block; margin-top: 4px; padding-top: 4px;
  border-top: 1px dashed var(--line-soft);
  font-size: calc(12.5px * var(--fs, 1)); color: var(--text-dim);
}
.alpha-old small {
  display: block; font-size: calc(8.5px * var(--fs, 1)); font-weight: 600;
  color: var(--text-mute); text-transform: uppercase; letter-spacing: .3px;
}

/* Silent on purpose: no Tamil word, and no voice here that says it right. */
.matrix td.mute { cursor: default; }
.matrix td.mute:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }

/* The letter a reading would pick up from, marked so it can be seen. */
.alpha-cell.from-here {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sec-read { gap: 8px; flex-wrap: wrap; }

/* What a verb means, under the verb itself. */
.conj-meaning {
  margin-top: 4px;
  font-size: calc(15px * var(--fs, 1));
  display: flex;
  gap: 6px 14px;
  align-items: baseline;
  flex-wrap: wrap;
}
/* Each meaning keeps its label next to it when the line wraps, so the
   language and the word it names never come apart. */
.conj-mean-bit { display: inline-flex; gap: 5px; align-items: baseline; white-space: nowrap; }

/* What one cell of a tense table actually means. Sits under the form and
   its pronunciation, quieter than either, because it is the answer to a
   question the reader has already asked by looking at the cell. */
.conj-rowmean {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px dashed var(--line-soft);
  font-size: calc(13.5px * var(--fs, 1)); line-height: 1.45;
}
.crm-en { color: var(--text-dim); }
.crm-ta { color: var(--text); }

/* Stop should be findable at a glance while a reading is running. */
.btn-stop {
  border-color: var(--red);
  color: var(--red);
  font-weight: 600;
}

/* ------------------------------------------------------- talk & learn */
.tk-scene { text-align: left; cursor: pointer; font: inherit; color: inherit; width: 100%; }
.tk-scene:hover { border-color: var(--accent); }
.tk-scene h3 { margin: 4px 0 2px; }
.tk-chat { display: flex; flex-direction: column; gap: 10px; }
.tk-chat:empty { display: none; }
.tk-bubble {
  max-width: 88%; padding: 10px 13px; border-radius: 14px;
  border: 1px solid var(--line-soft); background: var(--bg-soft);
}
.tk-bubble.tk-A { align-self: flex-start; border-top-left-radius: 4px; }
.tk-bubble.tk-B { align-self: flex-end; border-top-right-radius: 4px;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-soft)); }
.tk-who { font-size: calc(11px * var(--fs, 1)); font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 2px; }
.tk-line { font-size: calc(19px * var(--fs, 1)); font-weight: 650; line-height: 1.45; }
.tk-mean { font-size: calc(14px * var(--fs, 1)); margin-top: 3px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.tk-your { border-color: var(--accent); }
.tk-target { margin: 6px 0 2px; font-size: calc(22px * var(--fs, 1)); }
.tk-hidden { filter: blur(7px); cursor: pointer; user-select: none; }
.tk-actions { gap: 8px; flex-wrap: wrap; }
.tk-result { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-soft); }
.tk-result.tk-great, .tk-result.tk-good { border-color: var(--green); }
.tk-result.tk-ok { border-color: var(--amber, #d4a017); }
.tk-result.tk-retry { border-color: var(--red); }
.tk-word { display: inline-block; padding: 1px 6px; border-radius: 6px; margin: 2px 1px; }
.tk-word.ok { background: color-mix(in srgb, var(--green) 18%, transparent); }
.tk-word.miss { background: color-mix(in srgb, var(--red) 18%, transparent); text-decoration: underline wavy var(--red); }
.tk-fix { padding: 6px 0; }
.tk-weak { padding: 6px 0; border-top: 1px dashed var(--line-soft); }
.tk-hide { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
@media (max-width: 560px) { .tk-bubble { max-width: 100%; } }

/* the tutor speaking, a thing to learn, and what to say next */
.tk-say { font-size: calc(15.5px * var(--fs, 1)); line-height: 1.55; }
.tk-say2 { font-size: calc(15px * var(--fs, 1)); color: var(--text-dim); margin-top: 2px; }
.tk-item { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-soft); }
.tk-chips { gap: 6px; }
.tk-chip { font-size: calc(13px * var(--fs, 1)); }

/* Hindi readings added by captions.js where a page had none. */
.cap-more { margin-top: 2px; font-size: calc(12px * var(--fs, 1)); }
.cap-more > summary { cursor: pointer; color: var(--teal); width: fit-content; }
.cap-more > .hi-read { margin-top: 2px; }
