/* ═══════════════════════════════════════════════════════════════════════════════
   Aṣṭādhyāyī study edition — design system

   Colour is functional, never decorative. Five hues, one per kind of grammatical
   statement, drawn from manuscript-tradition pigments. NOTHING ELSE on this site is
   coloured, so hue always means rule-type. That is the single most useful thing a
   beginner internalises here, so it is load-bearing — do not spend these hues on
   anything else, and do not add a sixth.

   Type: Tiro Devanagari Sanskrit for Devanāgarī (drawn for Sanskrit, carries Vedic
   accent marks), Spectral for Latin body, IBM Plex Mono for sūtra addresses —
   because addresses are coordinates, not prose. No fourth family.

   Restraint: one bold element (the sthāna strip), everything else quiet. No
   gradients, no shadows, no decorative animation.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── self-hosted fonts: the site must work offline ──────────────────────────── */
@font-face { font-family: 'Tiro Devanagari Sanskrit'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('../fonts/tiro-devanagari-400-normal.woff2') format('woff2');
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FF; }
@font-face { font-family: 'Tiro Devanagari Sanskrit'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('../fonts/tiro-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Spectral'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('../fonts/spectral-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Spectral'; font-style: italic; font-weight: 400;
  font-display: swap; src: url('../fonts/spectral-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Spectral'; font-style: normal; font-weight: 600;
  font-display: swap; src: url('../fonts/spectral-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Noto Serif Bengali'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('../fonts/notoserifbengali-400.woff2') format('woff2');
  unicode-range: U+0964-0965, U+0980-09FE, U+1CD0, U+200C-200D, U+20B9, U+25CC, U+A8F1; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('../fonts/plex-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500;
  font-display: swap; src: url('../fonts/plex-latin-500-normal.woff2') format('woff2'); }

/* ── tokens ─────────────────────────────────────────────────────────────────── */
:root {
  /* the five rule-type pigments */
  --t-S:  #39479B;   /* संज्ञा    indigo    — a definition            190 */
  --t-P:  #96233A;   /* परिभाषा   lac red   — a meta-rule              24 */
  --t-V:  #3A3F3C;   /* विधि     ink       — an operational rule    3,629 */
  --t-AT: #0E7361;   /* अतिदेश    verdigris — an extension             67 */
  --t-AD: #A9660D;   /* अधिकार    orpiment  — a governing domain        73 */

  --t-S-wash:  #eceef7;
  --t-P-wash:  #f7eaed;
  --t-V-wash:  #eceeed;
  --t-AT-wash: #e5f2ef;
  --t-AD-wash: #f7eee1;

  /* surfaces — warm paper, not blue-white */
  --bg:        #faf7f0;
  --panel:     #f4efe4;
  --card:      #fffdf8;
  --ink:       #23201c;
  --ink-soft:  #5d574e;
  --ink-faint: #8d857a;
  --line:      #e0d8c8;
  --line-soft: #ece5d7;

  --focus:     #1a4fd6;

  --font-dev: 'Tiro Devanagari Sanskrit', 'Noto Serif Devanagari', serif;
  --font-ui:  'Spectral', Georgia, serif;
  --font-mono:'IBM Plex Mono', ui-monospace, monospace;
  --font-ben: 'Noto Serif Bengali', 'Tiro Devanagari Sanskrit', serif;

  --maxw: 1400px;
  --rad: 3px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* all five hues lift; the *relationships* between them must survive */
    --t-S:  #8f9cdf;
    --t-P:  #e2899a;
    --t-V:  #b9c0bb;
    --t-AT: #5cc0ac;
    --t-AD: #e0a552;

    --t-S-wash:  #23273c;
    --t-P-wash:  #3a2429;
    --t-V-wash:  #26282a;
    --t-AT-wash: #17322d;
    --t-AD-wash: #382a17;

    --bg:        #16151a;
    --panel:     #1e1d23;
    --card:      #232228;
    --ink:       #ece8e1;
    --ink-soft:  #b0a99f;
    --ink-faint: #7e766c;
    --line:      #34323a;
    --line-soft: #2a282f;
    --focus:     #7da2ff;
  }
}

:root[data-theme="dark"] {
  --t-S:  #8f9cdf;  --t-P:  #e2899a;  --t-V:  #b9c0bb;
  --t-AT: #5cc0ac;  --t-AD: #e0a552;
  --t-S-wash:  #23273c; --t-P-wash: #3a2429; --t-V-wash: #26282a;
  --t-AT-wash: #17322d; --t-AD-wash: #382a17;
  --bg: #16151a; --panel: #1e1d23; --card: #232228;
  --ink: #ece8e1; --ink-soft: #b0a99f; --ink-faint: #7e766c;
  --line: #34323a; --line-soft: #2a282f; --focus: #7da2ff;
}

/* ── base ───────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.65 var(--font-ui);
  font-variant-numeric: oldstyle-nums;
}
.deva, [lang="sa"] { font-family: var(--font-dev); line-height: 1.75; }
/* Bengali needs its own face: Tiro Devanagari has no Bengali coverage, so a bn run would
   otherwise fall through to a system font and look nothing like the rest of the page. */
[lang="bn"] { font-family: var(--font-ben); line-height: 1.8; }
.mono, .addr { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ── masthead ───────────────────────────────────────────────────────────────── */
header.site {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
header.site .wrap { display: flex; align-items: baseline; gap: 18px; padding: 14px 24px; flex-wrap: wrap; }
header.site h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
header.site h1 .dv { font-family: var(--font-dev); font-weight: 400; }
header.site nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
header.site nav a {
  padding: 5px 10px; font-size: 14px; color: var(--ink-soft);
  text-decoration: none; border-radius: var(--rad);
}
header.site nav a:hover { background: var(--card); color: var(--ink); }
header.site nav a[aria-current="page"] { color: var(--ink); background: var(--card); border: 1px solid var(--line); }

.themebtn {
  font: inherit; font-size: 13px; padding: 4px 9px; cursor: pointer;
  background: var(--card); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--rad);
}

/* ── the databanner: fetch() dies on file://, say so usefully ───────────────── */
.databanner {
  margin: 24px auto; max-width: 760px; padding: 16px 20px;
  border: 1px solid var(--t-P); background: var(--t-P-wash);
  border-radius: var(--rad);
}
.databanner h2 { margin: 0 0 8px; font-size: 17px; }
.databanner code { font-family: var(--font-mono); font-size: 13px; }
.databanner pre {
  margin: 10px 0 0; padding: 10px 12px; overflow-x: auto;
  background: var(--card); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5;
}

/* ── rule-type chips ────────────────────────────────────────────────────────── */
.rt {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 2px 9px; border-radius: 11px; font-size: 13px;
  border: 1px solid currentColor;
}
.rt .dv { font-family: var(--font-dev); }
.rt-S  { color: var(--t-S);  background: var(--t-S-wash); }
.rt-P  { color: var(--t-P);  background: var(--t-P-wash); }
.rt-V  { color: var(--t-V);  background: var(--t-V-wash); }
.rt-AT { color: var(--t-AT); background: var(--t-AT-wash); }
.rt-AD { color: var(--t-AD); background: var(--t-AD-wash); }

/* ── cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--rad); padding: 20px 22px; margin: 0 0 18px;
}
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }

.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: 14px; }

/* ── editorial vs corpus: the honesty mechanism ─────────────────────────────
   Everything the site itself says wears .ed. Corpus text never does. A reader must
   always be able to tell which half a human wrote — so .ed is typographically
   distinct and uses NEUTRAL ink, never one of the five hues (those mean rule-type).
   Every .ed element carries data-src; the DOM lint in tools/cdp_grammar.py fails the
   build if unattributed Devanāgarī appears outside a corpus container.            */
.ed {
  font-style: italic; font-size: .93em; color: var(--ink-soft);
  border-left: 2px solid var(--line); padding-left: 10px;
}
.ed[data-src]::after {
  content: '※'; font-style: normal; font-size: .8em;
  color: var(--ink-faint); margin-left: 5px; cursor: help;
}

/* ── corpus inline markup. Mirrors adbuild/markup.py — one source of truth. ─── */
.xq { color: var(--ink); background: var(--line-soft); padding: 0 3px; border-radius: 2px; }
.xw { font-weight: 600; }
.xhl { background: var(--line-soft); padding: 0 3px; }
.xhlb { display: inline-block; margin-top: .5em; font-weight: 600; }
.xt { margin: 1.1em 0 .35em; font-size: 1em; font-weight: 600; }
.xkarika { margin: .7em 0; padding-left: 14px; border-left: 2px solid var(--line); white-space: pre-line; }
.xlight { color: var(--ink-faint); font-size: .9em; }
.xsource { color: var(--ink-soft); }
.xnote { color: var(--ink-soft); }
.xinline { font-style: italic; }
.xbg { font-style: italic; }
.xbig { font-size: 1.12em; }
.xpr { display: block; height: .7em; }
.xspacer { display: block; height: 1em; }
.xli { display: block; text-indent: -.9em; padding-left: .9em; }
.xli::before { content: '· '; color: var(--ink-faint); }
.xlist, .xlistsp { display: block; height: .4em; }
.xpv, .xprd, .xc, .xgana { display: inline; }
.xunk { border-bottom: 1px dotted var(--t-P); }

/* udāharaṇa vs pratyudāharaṇa. Distinguished WITHOUT hue, because hue is
   reserved — an example and a counter-example must never be confusable. */
.xex, .xnex { font-family: var(--font-dev); }
.xex  { border-bottom: 1px solid var(--ink-faint); }
.xnex { border-bottom: 1px dashed var(--ink-faint); }
.xex::before  { content: '✓\2009'; font-family: var(--font-ui); color: var(--ink-faint); font-size: .85em; }
.xnex::before { content: '✗\2009'; font-family: var(--font-ui); color: var(--ink-faint); font-size: .85em; }
.xnex::after  { content: '\2009(प्रत्युदाहरणम्)'; font-family: var(--font-dev);
                color: var(--ink-faint); font-size: .78em; }

.xtable { border-collapse: collapse; margin: .8em 0; font-size: .95em; }
.xtable td, .xtable th { border: 1px solid var(--line); padding: 3px 8px; text-align: left; }

/* cross-reference links resolved from [[७.२.१]] */
.xref { font-family: var(--font-mono); font-size: .88em; white-space: nowrap;
        text-decoration: none; border-bottom: 1px solid var(--line); }
.xref:hover { border-bottom-color: currentColor; }

/* ── the sthāna strip: the signature element ────────────────────────────────── */
.strip { display: block; width: 100%; height: auto; }
.strip .cell { stroke: none; }
.strip .pada-line { stroke: var(--line); stroke-width: .5; fill: none; }
.strip .pada-label { font-family: var(--font-mono); font-size: 7px; fill: var(--ink-faint); }
.strip .lane { opacity: .85; }
.strip .abhiya { fill: var(--t-AD); opacity: .1; }
.strip .tripadi { stroke: var(--t-P); stroke-width: 1.5; }
.strip .here { stroke: var(--ink); stroke-width: 1.5; }
.strip .hit { cursor: pointer; }
/* Only the domain bars and the page's own hit area answer clicks; the per-sūtra cells,
   the ābhīya wash and the rules behind them must let a click through to whatever is
   underneath, or a click on the strip lands on a 0.25 px rectangle. */
.strip .cell, .strip .abhiya, .strip .pada-line, .strip .tripadi,
.strip .here, .strip .pada-label { pointer-events: none; }
.strip .striphit { cursor: pointer; }

/* ── loading / empty states ─────────────────────────────────────────────────── */
.loading { padding: 40px 0; color: var(--ink-faint); text-align: center; }
.empty {
  padding: 14px 16px; border: 1px dashed var(--line);
  border-radius: var(--rad); color: var(--ink-soft); font-size: 14.5px;
}

footer.site {
  margin-top: 48px; border-top: 1px solid var(--line);
  padding: 20px 0 40px; color: var(--ink-faint); font-size: 13.5px;
}

/* ── the evidence block: what this rule actually does ───────────────────────── */
.ev { border-top: 1px solid var(--line-soft); padding: 12px 0 2px; }
.ev:first-of-type { border-top: 0; padding-top: 2px; }
.ev h4 { margin: 0 0 7px; font-size: 14.5px; font-weight: 600; font-family: var(--font-dev); }
.ev h4 .muted { font-family: var(--font-ui); font-size: 12.5px; font-weight: 400; }
/* example vs counter-example: distinguished by mark and weight, never by hue —
   hue is reserved for rule-type across the whole site. */
.chip.ok .w::before { content: '✓\2009'; font-family: var(--font-ui); font-size: .72em; color: var(--ink-faint); }
.chip.no { border-style: dashed; }
.chip.no .w { text-decoration: underline dashed var(--ink-faint) 1px; text-underline-offset: 3px; }
.chip.no .w::before { content: '✗\2009'; font-family: var(--font-ui); font-size: .72em; color: var(--ink-faint); }
.ev-card .prayoga { margin: 0 0 9px; }

.exlines { list-style: none; margin: 0; padding: 0; }
.exlines li { font-family: var(--font-dev); font-size: 17px; line-height: 1.7;
  padding: 4px 0 4px 20px; text-indent: -20px; }
.exlines.ok li::before { content: '✓\2009'; font-family: var(--font-ui); font-size: .74em;
  color: var(--ink-faint); }
.exlines.no li::before { content: '✗\2009'; font-family: var(--font-ui); font-size: .74em;
  color: var(--ink-faint); }
.exlines.no li { text-decoration: underline dashed var(--line) 1px; text-underline-offset: 4px; }

/* ── pratyāhāra lookup overlay ──────────────────────────────────────────────── */
.pra-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.32);
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; z-index: 50; }
.pra-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--rad);
  width: min(720px, 100%); max-height: 76vh; display: flex; flex-direction: column; }
.pra-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); }
.pra-head b { font-family: var(--font-dev); font-size: 19px; font-weight: 400; }
.pra-head input { flex: 1; font: inherit; font-family: var(--font-dev); font-size: 16px;
  padding: 5px 9px; border: 1px solid var(--line); border-radius: var(--rad);
  background: var(--bg); color: var(--ink); }
.pra-x { font: inherit; font-size: 11px; font-family: var(--font-mono); cursor: pointer;
  background: var(--bg); color: var(--ink-faint); border: 1px solid var(--line);
  border-radius: var(--rad); padding: 4px 7px; }
.pra-list { overflow-y: auto; padding: 6px 14px 12px; }
.pra-row { display: grid; grid-template-columns: 62px 1fr auto auto;
  gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.pra-n { font-family: var(--font-dev); font-size: 18px; }
.pra-m { font-family: var(--font-dev); font-size: 16px; word-spacing: .28em; color: var(--ink-soft); }
.pra-c { font-size: 11px; color: var(--ink-faint); }
.pra-s { font-size: 11.5px; }
.pra-tag { grid-column: 2 / -1; font-size: 11px; color: var(--ink-faint); font-style: italic; }
@media (max-width: 620px) {
  .pra-row { grid-template-columns: 54px 1fr auto; }
  .pra-s { display: none; }
}

/* ── find-a-sūtra overlay ("/" anywhere) and search.html ────────────────────── */
.sr-box { width: min(780px, 100%); }
.sr-head-b { font-family: var(--font-mono) !important; font-size: 12px !important;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.sr-overlay .pra-head input { font-family: var(--font-dev); }
/* the keyboard toggles ride in the overlay's head row, next to the field */
.pra-head .kbhost { flex: none; }
.pra-head .kbbtn { min-width: 32px; padding: 4px 6px; font-size: 15px; }
@media (max-width: 480px) {
  .pra-head { flex-wrap: wrap; }
  .pra-head input { min-width: 0; }
}
.sr-list { padding: 4px 8px 8px; }
.sr-row { display: grid; grid-template-columns: 62px 1fr auto auto; gap: 10px;
  align-items: baseline; padding: 7px 6px; border-bottom: 1px solid var(--line-soft);
  text-decoration: none; color: inherit; border-radius: var(--rad); }
.sr-row:hover { background: var(--panel); }
.sr-row.on { background: var(--panel); outline: 1px solid var(--line); }
.sr-ref { font-size: 12.5px; color: var(--ink-soft); }
.sr-s { font-family: var(--font-dev); font-size: 17px; }
.sr-t { font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }
.sr-k { font-size: 10.5px; color: var(--ink-faint); }
.sr-hint { font-size: 13.5px; color: var(--ink-soft); padding: 10px 6px; margin: 0; }
.sr-hint b { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; }
.sr-foot { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap;
  padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px;
  color: var(--ink-faint); }
.sr-foot a { margin-left: auto; }
@media (max-width: 620px) {
  .sr-row { grid-template-columns: 56px 1fr auto; }
  .sr-k { display: none; }
  /* the corpus's ASCII slug is long and is a matching aid, not the answer — the
     Devanāgarī and the address both stay. */
  .sr-page-list .sr-row { grid-template-columns: 62px 1fr auto; }
  .sr-slug { display: none; }
}

/* the home-page and search-page boxes share the field styling */
.findbox { display: flex; gap: 8px; align-items: stretch; margin: 14px 0 6px; }
.findbox input { flex: 1; min-width: 0; font: inherit; font-family: var(--font-dev); font-size: 17px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--rad);
  background: var(--card); color: var(--ink); }
.findbox button { font: inherit; font-family: var(--font-mono); font-size: 12px;
  padding: 0 16px; cursor: pointer; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--rad); }
.findbox button:hover { border-color: var(--ink-faint); }
.findhint { font-size: 12.5px; color: var(--ink-faint); margin: 0 0 4px; }
.findhint b { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.sr-page-list { margin: 18px 0 0; }
.sr-page-list .sr-row { grid-template-columns: 70px 1fr auto auto auto; padding: 9px 6px; }
.sr-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; }
.sr-filters button { font: inherit; font-family: var(--font-mono); font-size: 11.5px;
  padding: 4px 10px; cursor: pointer; background: var(--bg); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 999px; }
.sr-filters button[aria-pressed="true"] { background: var(--panel); color: var(--ink);
  border-color: var(--ink-faint); }

/* ── varṇasamāmnāya: the traditional grid ───────────────────────────────────── */
.viewhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.viewhead h3 { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--rad);
  overflow: hidden; margin-left: auto; }
.seg button { font: inherit; font-size: 12.5px; padding: 4px 10px; cursor: pointer;
  background: var(--card); color: var(--ink-soft); border: 0; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* both arrangements sit side by side, so the grid has to stay compact */
.gsec { margin: 0 0 14px; }
.gsec h4 { margin: 0 0 6px; font-family: var(--font-dev); font-size: 16px; font-weight: 400; }
.gsec h4 .muted { font-family: var(--font-ui); font-size: 12.5px; }
.gtab { border-collapse: separate; border-spacing: 3px; }
.gtab td { padding: 0; vertical-align: middle; }
.gtab th.rh { text-align: right; padding-right: 8px; white-space: nowrap; font-weight: 400; }
.gtab th.rh .vname { font-family: var(--font-dev); font-size: 14px; display: block; }
.gtab th.rh .sthana { font-family: var(--font-dev); font-size: 11px; color: var(--ink-faint);
  display: block; text-align: right; font-weight: 400; }
.gtab td.sthana { font-family: var(--font-dev); font-size: 11px; color: var(--ink-faint);
  text-align: center; font-weight: 400; padding-top: 2px; }
.grid5 thead th { font-weight: 400; padding-bottom: 4px; }
.grid5 .colnum { font-family: var(--font-dev); font-size: 12px; color: var(--ink-faint); display: block; }
.grid5 .collab { font-family: var(--font-dev); font-size: 10px; color: var(--ink-faint);
  display: block; line-height: 1.25; }
.gv { display: inline-block; }

/* ── rules in motion ────────────────────────────────────────────────────────── */
.rulepick { font: inherit; font-size: 13.5px; padding: 5px 8px; width: 100%;
  border: 1px solid var(--line); border-radius: var(--rad);
  background: var(--card); color: var(--ink); }
.rule { font-size: 21px; margin: 12px 0 10px; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px; margin: 0 0 14px; }
.role { border: 1px solid var(--line); border-radius: var(--rad); padding: 8px 10px;
  background: var(--card); transition: border-color .25s, background .25s; }
.role.live { border-color: var(--t-S); background: var(--t-S-wash); }
.rlab { font-size: 11.5px; }
.rlab .dv { font-size: 13px; }
.rword { font-size: 19px; margin: 2px 0 1px; }
.rmem { font-size: 14px; color: var(--ink-soft); word-spacing: .25em; }
.stage { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.ex { font-size: 28px; line-height: 1.5; min-height: 1.5em; }
.ex .hot { font-family: var(--font-dev); padding: 0 2px; border-radius: 2px;
  transition: background .3s, color .3s; }
.ex .hot { background: var(--line-soft); color: var(--ink-soft); }
.ex .hot.lit.a { background: var(--t-P-wash); color: var(--t-P); }
.ex .hot.lit.b { background: var(--t-AT-wash); color: var(--t-AT); }
.exarrow { font-size: 18px; color: var(--ink-faint); line-height: 1; margin: 2px 0; }
.exmeta { margin-top: 4px; }

/* side-by-side varṇa panels: the grid is the wider of the two */
@media (min-width: 981px) {
  .cols2 { grid-template-columns: .92fr 1.08fr; }
}
.gtab { border-spacing: 2px; }
.grid5 .collab { font-size: 9px; }

/* ── रूपाणि: the derivation pages ────────────────────────────────────────────
   Shared by prakriya / dhaturupa / shabdarupa / krdanta. Colour still means
   rule-type only: the paradigm tables use weight and rule, not hue, and the one
   coloured thing is .chg (the part a rule changed), which is the संज्ञा indigo
   already used for "this is the thing being defined".                          */

/* the searchable picker (AD.picker) */
.dhfind { margin: 0 0 14px; }
.dhfind > label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-faint); display: block; margin-bottom: 3px; }
.dqrow { display: flex; gap: 6px; align-items: stretch; }
.dqrow input { flex: 1 1 auto; font: inherit; font-size: 16px; padding: 6px 10px;
  font-family: var(--font-dev); border: 1px solid var(--line);
  border-radius: var(--rad); background: var(--card); color: var(--ink); }
.kbhost { display: flex; gap: 4px; }
.kbbtn { font-family: var(--font-dev); font-size: 16px; line-height: 1; min-width: 38px;
  padding: 4px 8px; cursor: pointer; background: var(--card); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--rad); }
.kbbtn[aria-pressed="true"] { background: var(--t-S-wash); color: var(--t-S);
  border-color: var(--t-S); }
.kbbtn[disabled] { opacity: .4; cursor: default; }
.dlist { width: 100%; margin-top: 6px; font: inherit; font-size: 15px;
  font-family: var(--font-dev); padding: 3px; border: 1px solid var(--line);
  border-radius: var(--rad); background: var(--card); color: var(--ink); }
.dhcount { margin: 4px 0 0; }

/* option rows and buttons */
.picker2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; align-items: end; margin: 0 0 12px; }
.picker2 label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-faint); display: block; margin-bottom: 3px; }
.picker2 select, .picker2 input { font: inherit; font-size: 14px; padding: 5px 8px;
  width: 100%; border: 1px solid var(--line); border-radius: var(--rad);
  background: var(--card); color: var(--ink); }
.picker2 .dv, .dsel { font-family: var(--font-dev); }
.go { font: inherit; font-size: 14px; padding: 6px 16px; cursor: pointer;
  background: var(--ink); color: var(--bg); border: 0; border-radius: var(--rad); }
.go[disabled] { opacity: .45; cursor: default; }

/* a derivation */
.result { font-family: var(--font-dev); font-size: 40px; line-height: 1.4; margin: 6px 0 2px; }
.result .alt { font-size: 26px; color: var(--ink-soft); margin-left: 12px; }
.drow2 { display: grid; grid-template-columns: 34px 1fr 200px; gap: 12px;
  align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.drow2 .n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.drow2 .f { font-family: var(--font-dev); font-size: 21px; }
.drow2 .f .chg { background: var(--t-S-wash); color: var(--t-S); border-radius: 2px; padding: 0 2px; }
.drow2 .why { font-size: 12.5px; text-align: right; }
.drow2 .why .rt2 { font-family: var(--font-dev); font-size: 14px; display: block; }
.drow2.last { background: var(--t-AT-wash); margin: 0 -10px; padding: 9px 10px;
  border-radius: var(--rad); }
.src-varttika, .src-dhatupatha, .src-kashika, .src-kaumudi,
.src-unadi, .src-phit, .src-linganushasanam, .src-anyatra { color: var(--ink-faint); }
.engine { font-size: 12.5px; }
.wasmwarn { border-left: 3px solid var(--t-AD); padding-left: 10px; }
.noform { color: var(--ink-faint); }
.hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* the paradigm table itself */
.rupa { border-collapse: collapse; width: 100%; margin: 4px 0 2px; }
.rupa caption { text-align: left; font-size: 13px; color: var(--ink-soft);
  padding: 10px 0 4px; font-family: var(--font-dev); }
.rupa caption .en { font-family: var(--font-body); color: var(--ink-faint);
  font-size: 12px; margin-left: 8px; }
.rupa th { font-weight: 400; font-size: 12px; color: var(--ink-faint);
  text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line);
  white-space: nowrap; }
.rupa th.rh { font-family: var(--font-dev); font-size: 14px; color: var(--ink-soft);
  border-bottom: 1px solid var(--line-soft); width: 8.5em; }
.rupa td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-dev); font-size: 19px; vertical-align: baseline; }
.rupa td .frm { display: inline-block; }
.rupa tr:hover td { background: var(--panel); }
.cellbtn { font: inherit; font-family: var(--font-dev); font-size: 19px; color: var(--ink);
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
  border-bottom: 1px dotted var(--line); }
.cellbtn:hover { border-bottom-color: var(--ink); }
.agree { font-size: 11px; color: var(--t-AT); font-family: var(--font-mono); }
.differ { font-size: 12px; color: var(--t-P); font-family: var(--font-dev);
  border-bottom: 1px solid var(--t-P); }
.rupagrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 6px 26px; }

/* pratyaya catalogue (kṛt, uṇādi, taddhita) */
.ptab { border-collapse: collapse; width: 100%; font-size: 14px; }
.ptab th { text-align: left; font-weight: 400; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-faint); padding: 5px 8px;
  border-bottom: 1px solid var(--line); }
.ptab td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.ptab td.p { font-family: var(--font-dev); font-size: 17px; white-space: nowrap; }
.ptab td.p .en { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint);
  display: block; }
.ptab td.form { font-family: var(--font-dev); font-size: 19px; }
.ptab td.sut { font-size: 12px; text-align: right; white-space: nowrap; }
.ptab td.sut a { font-family: var(--font-mono); margin-left: 6px; }
.ptab tr:hover td { background: var(--panel); }
.grp { margin: 22px 0 2px; font-size: 15px; font-family: var(--font-dev); }
.grp .sub { font-size: 12.5px; color: var(--ink-soft); font-family: var(--font-dev);
  display: block; margin-top: 2px; font-weight: 400; }
.flag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  border: 1px solid var(--line); border-radius: 2px; padding: 0 4px; margin-left: 5px;
  color: var(--ink-faint); }
.ctl { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; margin: 0 0 10px; }
.ctl > div { min-width: 130px; }
.ctl label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-faint); display: block; margin-bottom: 3px; }
.ctl select { font: inherit; font-size: 14px; font-family: var(--font-dev); padding: 5px 8px;
  border: 1px solid var(--line); border-radius: var(--rad);
  background: var(--card); color: var(--ink); }
.dcap { margin: 0 0 4px; font-size: 13px; color: var(--ink-soft); }
.dcap .dv { font-family: var(--font-dev); font-size: 17px; }
.dcap .up { font-family: var(--font-dev); color: var(--ink-faint); }
.chips { margin: 6px 0 0; }
.chips .chip { font-family: var(--font-dev); font-size: 12.5px; border: 1px solid var(--line);
  border-radius: 10px; padding: 1px 8px; margin: 0 4px 4px 0; display: inline-block;
  color: var(--ink-soft); }
@media (max-width: 700px) {
  .drow2 { grid-template-columns: 26px 1fr; }
  .drow2 .why { grid-column: 2; text-align: left; }
  .rupa td { font-size: 17px; }
}

/* ── अभ्यासः: the sentence course ─────────────────────────────────────────── */
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px; }
.lbtn { display: flex; align-items: baseline; gap: 7px; text-align: left; font: inherit;
  padding: 7px 10px; cursor: pointer; background: var(--card); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--rad); }
.lbtn:hover { border-color: var(--ink-faint); color: var(--ink); }
.lbtn[aria-current="true"] { border-color: var(--t-S); background: var(--t-S-wash);
  color: var(--t-S); }
.lbtn .n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.lbtn .t { font-size: 13.5px; }
.lbtn .d { font-family: var(--font-dev); font-size: 13px; color: var(--ink-faint); }
.lbtn .s { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-faint); }

.vocab { display: flex; flex-wrap: wrap; gap: 5px; }
.vchip { display: inline-flex; align-items: baseline; gap: 5px; text-decoration: none;
  border: 1px solid var(--line); border-radius: 12px; padding: 2px 9px;
  background: var(--card); color: var(--ink); font-size: 13px; }
.vchip:hover { border-color: var(--ink-faint); background: var(--panel); }
.vchip span[lang="sa"] { font-family: var(--font-dev); font-size: 15px; }
.vchip .g { color: var(--ink-soft); font-size: 12px; }
.vchip .l { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); }
.vchip.vb { border-style: dashed; }

.prompt { font-size: 20px; line-height: 1.45; margin: 0; }
.dqrow #ans { flex: 1 1 auto; font: inherit; font-size: 20px; padding: 8px 12px;
  font-family: var(--font-dev); border: 1px solid var(--line); border-radius: var(--rad);
  background: var(--card); color: var(--ink); }
.go.alt { background: var(--card); color: var(--ink-soft); border: 1px solid var(--line); }
.go.alt:hover { color: var(--ink); border-color: var(--ink-faint); }

.fb { margin-top: 14px; padding: 10px 12px; border-radius: var(--rad);
  border-left: 3px solid var(--line); background: var(--panel); }
.fb.good { border-left-color: var(--t-AT); background: var(--t-AT-wash); }
.fb.bad { border-left-color: var(--t-P); background: var(--t-P-wash); }
.fb p { margin: 0 0 6px; }
.notes { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.notes li { padding: 3px 0; border-top: 1px solid var(--line-soft); line-height: 1.5; }
.notes li:first-child { border-top: 0; }
.notes span[lang="sa"] { font-family: var(--font-dev); font-size: 17px; }
.notes .tick { color: var(--t-AT); }
.notes .cross { color: var(--t-P); }
.notes li.ok { color: var(--ink-soft); }
.notes a.mono { font-family: var(--font-mono); font-size: 11.5px; margin-left: 4px; }
.answer { font-family: var(--font-dev); font-size: 27px; line-height: 1.5; margin: 0 0 10px; }
.fb .ptab td.form a { font-family: var(--font-dev); font-size: 19px; text-decoration: none; }

/* kāraka reference */
.karakatab td { vertical-align: top; }
.karakatab td.kn .num { font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-faint); border: 1px solid var(--line); border-radius: 50%;
  width: 22px; height: 22px; display: inline-flex; align-items: center;
  justify-content: center; }
.karakatab td.eg { font-size: 13px; }
.karakatab td.eg span[lang="sa"] { font-family: var(--font-dev); font-size: 17px; }
.karakatab td.eg .hi { background: var(--t-S-wash); color: var(--t-S); border-radius: 2px;
  padding: 0 3px; }
.sut2 { text-decoration: none; }
.sut2 span[lang="sa"] { font-family: var(--font-dev); font-size: 15px; }
.sut2 .mono { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.card.ed { border-left: 3px solid var(--ink-faint); background: var(--panel); }
.card.ed h3 { font-style: italic; font-weight: 400; }
.card.ed li { margin-bottom: 5px; }
.exid { margin: 0 0 2px; }
.exid a { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint);
  text-decoration: none; border-bottom: 1px dotted var(--line); }
.exid a:hover { color: var(--ink); }

/* पाठः — the lesson page */
.teach p { max-width: 74ch; line-height: 1.62; margin: 0 0 12px; }
.teach b[lang="sa"] { font-family: var(--font-dev); font-weight: 400; font-size: 19px; }
a.lbtn { text-decoration: none; }
.eg { border-top: 1px solid var(--line-soft); }
.eg:first-child { border-top: 0; }
.egline { display: flex; align-items: baseline; gap: 12px; width: 100%; text-align: left;
  font: inherit; background: none; border: 0; padding: 7px 4px; cursor: pointer;
  color: var(--ink); }
.egline:hover { background: var(--panel); }
.egline .sa { font-family: var(--font-dev); font-size: 19px; flex: 0 1 auto; }
.egline .en { color: var(--ink-soft); font-size: 13px; }
.egline .eid { margin-left: auto; font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-faint); }
.egline[aria-expanded="true"] { background: var(--panel); }
.egbody:not(:empty) { padding: 4px 4px 12px; }

/* ── सन्धिः ──────────────────────────────────────────────────────────────── */
.famnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.famnav a { text-decoration: none; border: 1px solid var(--line); border-radius: var(--rad);
  padding: 5px 12px; background: var(--card); color: var(--ink); font-size: 14px; }
.famnav a:hover { border-color: var(--ink-faint); }
.famnav span[lang="sa"] { font-family: var(--font-dev); font-size: 16px; }
.fam > h3 { margin: 28px 0 6px; font-size: 19px; font-weight: 400; }
.fam > h3 span[lang="sa"] { font-family: var(--font-dev); }
.scard { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.scard:first-child { border-top: 0; padding-top: 2px; }
.shead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.sref { text-decoration: none; }
.sref .sutra { font-family: var(--font-dev); font-size: 21px; color: var(--ink); }
.sref .mono { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint);
  margin-left: 7px; }
.shead .gist { font-family: var(--font-dev); font-size: 14px; color: var(--ink-soft); }
.roles { display: flex; flex-wrap: wrap; gap: 8px; margin: 7px 0 2px; }
.role { border: 1px solid var(--line); border-radius: var(--rad); padding: 3px 9px;
  background: var(--card); }
.role .rl { display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-faint); }
.role span[lang="sa"] { font-family: var(--font-dev); font-size: 17px; }
.role .mem { display: block; font-size: 14px; color: var(--ink-soft); }
.role .from { font-family: var(--font-mono); font-size: 10px; margin-left: 5px; }
.role.st { border-left: 3px solid var(--t-S); }
.role.ad { border-left: 3px solid var(--t-AT); }
.role.ni { border-left: 3px solid var(--t-AD); }
.sdemo { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.exswitch { display: flex; flex-wrap: wrap; gap: 4px; }
.exbtn { font-family: var(--font-dev); font-size: 14px; padding: 2px 8px; cursor: pointer;
  background: var(--card); color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: 10px; }
.exbtn.on { border-color: var(--t-S); color: var(--t-S); background: var(--t-S-wash); }
.stages { flex: 1 0 100%; margin-top: 6px; }
.sstage { opacity: 0; transform: translateY(4px); transition: opacity .35s, transform .35s;
  padding: 5px 0; border-top: 1px dotted var(--line); }
.sstage.on { opacity: 1; transform: none; }
.sstage:first-child { border-top: 0; }
.sform { font-family: var(--font-dev); font-size: 27px; line-height: 1.5; }
.sform .chg { background: var(--t-S-wash); color: var(--t-S); border-radius: 2px;
  padding: 0 3px; }
.sform .plus { color: var(--ink-faint); font-family: var(--font-body); font-size: 20px;
  margin: 0 9px; }
.sform .becomes { color: var(--ink-faint); font-family: var(--font-body); font-size: 20px;
  margin: 0 12px; }
.snote { font-size: 12.5px; color: var(--ink-soft); }
.snote b[lang="sa"] { font-family: var(--font-dev); font-size: 15px; font-weight: 400; }
@media (prefers-reduced-motion: reduce) { .sstage { transition: none; } }
.sform .gap { display: inline-block; width: 30px; }
.shead .rlabel { font-family: var(--font-dev); font-size: 14px; color: var(--t-S);
  background: var(--t-S-wash); border-radius: 10px; padding: 1px 9px; }
.shead .anchor { margin-left: auto; font-size: 12px; color: var(--ink-faint);
  text-decoration: none; }
.shead .anchor:hover { color: var(--t-S); }
.flash { animation: flash 1.4s ease-out 1; }
@keyframes flash { from { background: var(--t-S-wash); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }

/* the vowel table: layout ours, contents the corpus's */
.scrollx { overflow-x: auto; }
.vmat { border-collapse: collapse; font-size: 13px; min-width: 640px; }
.vmat th { font-weight: 400; font-size: 12px; color: var(--ink-faint); padding: 6px 8px;
  text-align: left; border-bottom: 1px solid var(--line); }
.vmat th[lang="sa"] { font-family: var(--font-dev); font-size: 16px; color: var(--ink-soft); }
.vmat tbody th { border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line); }
.vmat td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft); vertical-align: top; }
.vmat td.vempty { background: repeating-linear-gradient(135deg, transparent,
  transparent 5px, var(--line-soft) 5px, var(--line-soft) 6px); }
.vrule { display: block; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-faint); text-decoration: none; }
.vrule:hover { color: var(--t-S); }
.vex, .vres { display: block; }
.vex .dv { font-size: 15px; color: var(--ink-soft); }
.vex .plus { color: var(--ink-faint); margin: 0 3px; }
.vres .dv { font-size: 17px; color: var(--t-S); }

/* the exceptions, stated rather than drilled */
details.more { margin-top: 10px; }
details.more > summary { cursor: pointer; font-size: 13px; color: var(--ink-soft);
  padding: 6px 0; }
.mtab { width: 100%; border-collapse: collapse; font-size: 13px; }
.mtab td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line-soft);
  vertical-align: baseline; }
.mtab td:first-child { width: 4.5em; }
.mtab .dv { font-family: var(--font-dev); font-size: 17px; }
.mtab .becomes, .mtab .plus { color: var(--ink-faint); margin: 0 5px; }

/* a derivation from the corpus, step by step */
.ladder { list-style: none; margin: 6px 0 0; padding: 0; }
.lstep { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; padding: 3px 0;
  border-left: 2px solid var(--line); padding-left: 12px; }
.lstep.lfirst { border-left-color: transparent; }
.lstep.on { border-left-color: var(--t-S); background: var(--t-S-wash); }
.lform { font-family: var(--font-dev); font-size: 21px; }
.lwhy { font-size: 11px; color: var(--ink-faint); }
.lwhy a { font-family: var(--font-mono); color: var(--ink-faint); text-decoration: none;
  margin-right: 6px; }
.lwhy a:hover { color: var(--t-S); }
.branch { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.branch:first-child { border-top: 0; }
.bwhen { font-size: 12.5px; color: var(--ink-soft); }
.role.pu { border-left: 3px solid var(--t-P); }
