/* Tamajaq Dictionary, after K.-G. Prasse (2003) */
:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --surface-2: #f0e9da;
  --ink: #1d2433;
  --ink-2: #5b6272;
  --line: #e0d6c2;
  --accent: #27368f;
  --accent-ink: #ffffff;
  --accent-soft: #e4e7fa;
  --w: #b4501f;
  --w-soft: #f8e4d8;
  --y: #176b87;
  --y-soft: #d9eef4;
  --other: #6b4f9a;
  --other-soft: #ebe4f6;
  --mark: #ffe58a;
  --shadow: 0 1px 2px rgba(40,30,10,.06), 0 4px 14px rgba(40,30,10,.05);
  --tam: "Gentium Plus", "Gentium Book Plus", "Charis SIL", "Cambria", "Noto Serif", "Times New Roman", serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151d;
    --surface: #1a1f2b;
    --surface-2: #232938;
    --ink: #ece8dd;
    --ink-2: #9aa1b3;
    --line: #2c3345;
    --accent: #8d9bff;
    --accent-ink: #0f1220;
    --accent-soft: #252c52;
    --w: #f0a47a;
    --w-soft: #3a2619;
    --y: #7ccbe3;
    --y-soft: #163541;
    --other: #c3a8f0;
    --other-soft: #2e2547;
    --mark: #6b5a12;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --bg: #12151d; --surface: #1a1f2b; --surface-2: #232938; --ink: #ece8dd; --ink-2: #9aa1b3;
  --line: #2c3345; --accent: #8d9bff; --accent-ink: #0f1220; --accent-soft: #252c52;
  --w: #f0a47a; --w-soft: #3a2619; --y: #7ccbe3; --y-soft: #163541;
  --other: #c3a8f0; --other-soft: #2e2547; --mark: #6b5a12; --shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--ui);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.tam { font-family: var(--tam); }

/* ---------- header ---------- */
.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.top-in {
  max-width: 1360px; margin: 0 auto; padding: 10px clamp(16px, 3vw, 40px);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; line-height: 1.15; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand b { font: 700 1.35rem var(--tam); letter-spacing: .2px; }
.brand span { font-size: .72rem; color: var(--ink-2); }
nav.tabs { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
nav.tabs a {
  padding: 7px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: .92rem;
}
nav.tabs a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
nav.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.theme-btn {
  border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 6px 10px; color: var(--ink-2);
}

main { max-width: 1360px; margin: 0 auto; padding: 20px clamp(16px, 3vw, 40px) 60px; }
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 1.6rem; margin: 0 0 .4em; }
h2 { font-size: 1.25rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1.02rem; margin: 1.2em 0 .4em; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }

/* ---------- search ---------- */
.searchbox {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow);
}
.qrow { display: flex; gap: 8px; }
.qrow input[type=search] {
  flex: 1; min-width: 0; font: 1.25rem var(--tam); padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg);
}
.qrow input[type=search]:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 14px; font-weight: 600;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.small { padding: 4px 10px; font-size: .85rem; border-radius: 8px; }

.modes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.modes label {
  position: relative;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px; cursor: pointer;
  font-size: .9rem; font-weight: 600; color: var(--ink-2); background: var(--surface);
}
.modes input { position: absolute; opacity: 0; pointer-events: none; }
.modes input:checked + span { color: var(--accent); }
.modes label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.modes label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.keys { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.keys button {
  min-width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font: 1.1rem var(--tam); padding: 0 6px;
}
.keys button:hover { background: var(--accent-soft); border-color: var(--accent); }
.keys-toggle { font-size: .85rem; background: none; border: none; color: var(--accent); padding: 0; margin-top: 10px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 12px; font-size: .9rem; }
.filters label { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.filters select {
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: var(--surface);
}
.filters .chk { cursor: pointer; }

.status { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin: 18px 2px 8px; color: var(--ink-2); font-size: .92rem; }

.rootbanner {
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 14px;
  margin: 14px 0 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.rootbanner b { font: 700 1.15rem var(--tam); color: var(--accent); }

/* ---------- entry cards ---------- */
.results { display: grid; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px 12px; box-shadow: var(--shadow);
}
.card.focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.hw { font: 700 1.55rem/1.2 var(--tam); color: var(--ink); word-break: break-word; }
.hw a { color: inherit; }
.badges { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.badge {
  display: inline-block; font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); letter-spacing: .2px; white-space: nowrap;
}
.badge.pos { background: var(--accent-soft); color: var(--accent); }
.badge.conj { background: var(--accent); color: var(--accent-ink); }
a.badge.conj:hover { text-decoration: none; filter: brightness(1.15); }
.dm {
  display: inline-block; font: 700 .68rem var(--ui); padding: 0 6px; border-radius: 5px; margin: 0 2px 0 3px;
  vertical-align: .12em; letter-spacing: .3px;
}
.dm-W  { background: var(--w-soft); color: var(--w); }
.dm-Y  { background: var(--y-soft); color: var(--y); }
.dm-WY { background: linear-gradient(90deg, var(--w-soft) 50%, var(--y-soft) 50%); color: var(--ink); }
.dm-o  { background: var(--other-soft); color: var(--other); }
.entryline { font: 1.05rem/1.45 var(--tam); color: var(--ink); margin: 4px 0 2px; }
.entryline abbr, .gloss abbr { text-decoration: underline dotted var(--ink-2); text-underline-offset: 3px; cursor: help; }
.sym {
  display: inline-block; font-family: var(--ui); font-weight: 700; font-size: .85em; padding: 0 5px;
  border-radius: 4px; background: var(--surface-2); color: var(--accent); cursor: help;
}
ol.senses { margin: 8px 0 0; padding: 0; list-style: none; counter-reset: s; }
ol.senses li { counter-increment: s; position: relative; padding: 4px 0 4px 28px; }
ol.senses li::before {
  content: counter(s); position: absolute; left: 0; top: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-2); color: var(--ink-2); font: 700 .72rem/20px var(--ui); text-align: center;
}
.en { font-size: 1.02rem; }
.fr { color: var(--ink-2); font-size: .9rem; font-style: italic; }
.fr::before { content: attr(data-l) " "; font: 700 .65rem var(--ui); font-style: normal; letter-spacing: .4px; color: var(--ink-2); opacity: .75; }
.nvnote { color: var(--ink-2); font-style: italic; }
.ex {
  margin: 4px 0 2px; padding: 3px 0 3px 10px; border-left: 3px solid var(--line);
  font: .98rem/1.4 var(--tam); color: var(--ink);
}
.ex .fr { display: block; font-family: var(--ui); }
.ex::before { content: "ex."; font: 700 .65rem var(--ui); color: var(--ink-2); margin-right: 6px; text-transform: uppercase; letter-spacing: .4px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: .82rem; color: var(--ink-2); }
.meta .chip, .chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 1px 10px;
  font-size: .82rem; color: var(--accent); cursor: pointer; font-weight: 600;
}
.chip:hover { background: var(--accent-soft); text-decoration: none; }
.meta .sp { flex: 1; }
.meta button.lnk { background: none; border: none; color: var(--ink-2); padding: 0; font-size: .82rem; }
.meta button.lnk:hover { color: var(--accent); text-decoration: underline; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.more { display: flex; justify-content: center; margin: 18px 0; }

/* ---------- home / empty ---------- */
.hero { text-align: center; padding: 26px 0 8px; }
.hero h1 { font: 700 2rem var(--tam); margin-bottom: 4px; }
.stats { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; margin: 16px 0 6px; }
.stats div { text-align: center; }
.stats b { display: block; font: 700 1.6rem var(--tam); color: var(--accent); }
.stats span { font-size: .8rem; color: var(--ink-2); }
.tryrow { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 18px 16px; box-shadow: var(--shadow); }

/* ---------- roots ---------- */
.letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
.letters button {
  min-width: 38px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font: 700 1rem var(--tam);
}
.letters button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.rootgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; }
.rootgrid a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 6px 10px; color: var(--ink);
}
.rootgrid a:hover { background: var(--accent-soft); border-color: var(--accent); text-decoration: none; }
.rootgrid b { font: 700 1.05rem var(--tam); }
.rootgrid span { font-size: .74rem; color: var(--ink-2); }
.rootnav { display: flex; justify-content: space-between; gap: 10px; margin: 8px 0 14px; flex-wrap: wrap; }
.rootnav h1 { font: 700 2.2rem var(--tam); margin: 0; letter-spacing: 1px; color: var(--accent); }

/* ---------- guide ---------- */
.guide { display: grid; grid-template-columns: 200px 1fr; gap: 28px; }
.toc { position: sticky; top: 76px; align-self: start; display: flex; flex-direction: column; gap: 2px; font-size: .9rem; }
.toc a { padding: 5px 10px; border-radius: 7px; color: var(--ink-2); font-weight: 600; }
.toc a:hover { background: var(--surface-2); text-decoration: none; }
.doc h2:first-child { margin-top: 0; }
.doc p { max-width: 90ch; }
table.t { border-collapse: collapse; width: 100%; font-size: .93rem; margin: 8px 0; }
table.t th, table.t td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-2); }
table.t td:first-child { font: 700 1rem var(--tam); white-space: nowrap; color: var(--accent); }
.cols2 { columns: 2; column-gap: 28px; }
.cols2 tr, .cols2 > div { break-inside: avoid; }
.note { background: var(--surface-2); border-left: 4px solid var(--accent); border-radius: 6px; padding: 8px 14px; margin: 12px 0; font-size: .92rem; }
.warn { border-left-color: var(--w); }
.exbox { font-family: var(--tam); font-size: 1.05rem; background: var(--surface-2); border-radius: 8px; padding: 8px 14px; margin: 8px 0; }

/* ---------- conjugations ---------- */
.conjwrap { display: grid; grid-template-columns: 230px 1fr; gap: 22px; }
.conjnav { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; padding-right: 6px; font-size: .88rem; }
.conjnav h4 { margin: 14px 0 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-2); }
.conjnav a { display: flex; justify-content: space-between; gap: 6px; padding: 4px 9px; border-radius: 7px; color: var(--ink); }
.conjnav a:hover { background: var(--surface-2); text-decoration: none; }
.conjnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.conjnav a small { color: var(--ink-2); }
.pagebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.pagebar h1 { margin: 0; font-size: 1.3rem; flex: 1; min-width: 200px; }
.forms { margin: 10px 0 2px; } .forms > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .92rem; }
.forms .fdia { margin: 10px 0 4px; font-weight: 600; } .forms .tw { margin-bottom: 6px; }
.viaform { margin: 6px 0 0; padding: 4px 10px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; display: inline-block; }
.conjwrap > * { min-width: 0; }
.conjtables { margin: 6px 0 14px; }
.ctitle { font-size: 1.05rem; margin: 18px 0 6px; }
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; background: var(--card, transparent); }
.ctab { border-collapse: collapse; width: 100%; font-size: .95rem; }
.ctab th, .ctab td { padding: 5px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.ctab th:last-child, .ctab td:last-child { border-right: 0; }
.ctab tr:last-child td { border-bottom: 0; }
.ctab th { font-size: .78rem; text-transform: none; letter-spacing: .02em; color: var(--muted); background: var(--accent-soft); white-space: normal; }
.ctab td:first-child { color: var(--muted); }
.ctab tr.hl td { background: var(--accent-soft); box-shadow: inset 0 0 0 9999px rgba(120,120,255,.08); }
.cpara { max-width: 90ch; line-height: 1.55; }
.cnotes { margin: 12px 0; padding: 10px 16px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; }
.cnotes h4 { margin: 0 0 6px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.cnotes ul { margin: 0; padding-left: 18px; } .cnotes li { margin: 5px 0; line-height: 1.5; }
.scanbox { margin: 16px 0; } .scanbox > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 6px 0; }
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; overflow: auto; box-shadow: var(--shadow); }
.sheet img { display: block; width: 100%; height: auto; margin: 0 auto; }
.sheet.full img { width: auto; max-width: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sheet img { filter: invert(.92) hue-rotate(180deg); } .sheet { background: #0c0e14; } }
:root[data-theme="dark"] .sheet img { filter: invert(.92) hue-rotate(180deg); }
:root[data-theme="dark"] .sheet { background: #0c0e14; }

/* examples: Tamajaq sentence, translation below */
.ex .extam { font-weight: 700; }
.ex .exen { display: block; font-family: var(--ui); font-size: .95rem; color: var(--ink); margin-top: 1px; }
.ex .exen .badge { font-size: .65rem; vertical-align: .1em; }

/* ---------- corrections & review ---------- */
.meta .fixbtn { color: var(--w); font-weight: 600; }
dialog#fixdlg {
  border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog#fixdlg::backdrop { background: rgba(20,20,30,.45); }
.fixform { padding: 18px 20px; display: grid; gap: 10px; }
.fixform h3 { margin: 0 0 4px; }
.fixform label { display: grid; gap: 4px; font-size: .88rem; color: var(--ink-2); }
.fixform label.chk { display: flex; align-items: center; gap: 8px; }
.fixform input:not([type=checkbox]), .fixform select {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); color: var(--ink); font-size: 1rem;
}
.fixform input.tam { font: 1.1rem var(--tam); }
.fixform .keys { margin: 0; }
.fixform .keys button { min-width: 30px; height: 30px; font-size: 1rem; }
#fx-msg { color: var(--w); margin: 0; min-height: 1em; }
.fxbtns { display: flex; justify-content: flex-end; gap: 8px; }
table.rv td:first-child { font: inherit; color: inherit; white-space: normal; }
table.rv td.tam { font-family: var(--tam); font-size: 1.05rem; }
.rvbtns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
del { color: var(--w); }

.fixline {
  margin-top: 8px; padding: 6px 10px; border-radius: 8px; font-size: .85rem; line-height: 1.7;
  background: var(--w-soft); color: var(--ink);
}
.fixline b { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--w); margin-right: 4px; }
ins { text-decoration: none; font-weight: 700; color: var(--y); }

/* Root labels: in Gentium the capital Ɣ looks like Y, show roots in the interface font, where Ɣ is distinct */
.rl, .rootbanner b, .rootgrid b, .rootnav h1 { font-family: var(--ui) !important; letter-spacing: .5px; }

.fr:not([data-l])::before { content: "FR "; }
.lang-btn { display: inline-flex; gap: 2px; padding: 4px; font-weight: 700; font-size: .8rem; }
.lang-btn span { padding: 2px 7px; border-radius: 6px; color: var(--ink-2); }
.lang-btn span.on { background: var(--accent); color: var(--accent-ink); }

/* ---------- terms with hover explanations ---------- */
.term { cursor: help; text-decoration: underline dotted color-mix(in srgb, var(--ink-2) 70%, transparent); text-underline-offset: 3px; border-radius: 3px; }
.term[data-href] { cursor: pointer; }
.term:hover, .term:focus-visible { background: var(--accent-soft); text-decoration-color: var(--accent); outline: none; }
.dm.term, .badge.term { text-decoration: none; }
.sym.term { text-decoration: none; }
.term.st { color: var(--ink-2); }
.term.cj { color: var(--accent); font-weight: 600; text-decoration-style: solid; }
.term.src { color: var(--other); }
a.xref { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; font-weight: 600; }
a.xref:hover { background: var(--accent-soft); }
#tip {
  position: fixed; z-index: 80; pointer-events: none; opacity: 0; transform: translateY(2px);
  transition: opacity .12s, transform .12s;
  background: var(--ink); color: var(--bg); font: .84rem/1.4 var(--ui); padding: 7px 11px; border-radius: 9px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: 340px;
}
#tip.on { opacity: 1; transform: none; }
#tip .tipmore { display: block; margin-top: 3px; font-size: .74rem; opacity: .75; }
tr.flash td { animation: flash 2.2s ease-out; }
@keyframes flash { 0%, 40% { background: var(--mark); } 100% { background: transparent; } }

.tw { font-family: var(--tam); font-size: 1.04em; }

/* ---------- misc ---------- */
.loading { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 50; }
.loading div { text-align: center; color: var(--ink-2); }
.loading b { display: block; font: 700 1.6rem var(--tam); color: var(--ink); margin-bottom: 6px; }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 8px 16px; border-radius: 999px; font-size: .9rem; z-index: 60; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.on { opacity: 1; }
footer { max-width: 1360px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px) 40px; color: var(--ink-2); font-size: .8rem; }

@media (max-width: 780px) {
  .guide, .conjwrap { grid-template-columns: 1fr; }
  .conjwrap .conjnav { order: 2; }
  .toc, .conjnav { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .conjnav { display: block; }
  .cols2 { columns: 1; }
  .top-in { gap: 8px; }
  nav.tabs { margin-left: 0; width: 100%; }
  .hw { font-size: 1.35rem; }
  .qrow input[type=search] { font-size: 1.1rem; }
}

/* =====================================================================
   Polish: motion, toggles, selects, navigation
   ===================================================================== */
:root { --ease: cubic-bezier(.22, .8, .3, 1); }
html { scroll-behavior: smooth; }
body { transition: background-color .25s, color .25s; }
.public .admin-only { display: none !important; }

/* page transition + staggered cards */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
main.enter > * { animation: rise .45s var(--ease) both; }
main.enter > *:nth-child(2) { animation-delay: .05s; }
main.enter > *:nth-child(3) { animation-delay: .1s; }
main.enter .results:not(.noanim) > .card { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
main.enter .hero .stats > div { animation: rise .6s var(--ease) both; }
main.enter .hero .stats > div:nth-child(2) { animation-delay: .08s; }
main.enter .hero .stats > div:nth-child(3) { animation-delay: .16s; }
main.enter .hero .stats > div:nth-child(4) { animation-delay: .24s; }

/* hover feedback */
.card { transition: box-shadow .25s var(--ease), border-color .25s, transform .25s var(--ease); }
.card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); box-shadow: 0 2px 4px rgba(40,30,10,.06), 0 10px 28px rgba(40,30,10,.08); }
.chip, .btn, .letters button, .keys button, nav.tabs a, .modes label, .theme-btn {
  transition: background-color .18s, border-color .18s, color .18s, transform .15s var(--ease), box-shadow .2s;
}
.chip:hover, .rootgrid a:hover { transform: translateY(-1px); }
.btn:active, .chip:active, .rootgrid a:active, .keys button:active, .theme-btn:active { transform: scale(.96); }
.btn.primary:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.qrow input[type=search] { transition: border-color .2s, box-shadow .25s; }
.rootgrid a { transition: transform .18s var(--ease), background-color .18s, border-color .18s, box-shadow .2s; }
.rootgrid a:hover { box-shadow: 0 4px 12px rgba(40,30,10,.1); }
.recent { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin: -6px 0 16px; }
.recent .lnk { background: none; border: none; color: var(--ink-2); font-size: .78rem; padding: 0 4px; }
.recent .lnk:hover { color: var(--accent); text-decoration: underline; }

/* header: shadow on scroll, animated tab underline */
.top { transition: box-shadow .25s, background-color .25s; }
.top.scrolled { box-shadow: 0 4px 18px rgba(40,30,10,.1); }
nav.tabs a { position: relative; display: inline-flex; align-items: center; gap: 6px; }
nav.tabs a svg { display: none; width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
nav.tabs a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease), opacity .2s;
}
nav.tabs a:hover::after { transform: scaleX(1); opacity: .45; }
nav.tabs a[aria-current="page"]::after { transform: scaleX(1); opacity: 1; }
.brand b { transition: color .2s; }
.brand:hover b { color: var(--accent); }

/* loading screen fades out */
.loading { transition: opacity .35s; }
.loading.done { opacity: 0; pointer-events: none; }
.loading b { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* dialog */
dialog#fixdlg[open] { animation: pop .25s var(--ease); }
dialog#fixdlg::backdrop { animation: fadein .25s; backdrop-filter: blur(3px); }

/* toast slides up */
.toast { transform: translate(-50%, 12px); transition: opacity .25s, transform .3s var(--ease); }
.toast.on { transform: translate(-50%, 0); }

/* back to top */
#totop {
  position: fixed; right: 18px; bottom: 22px; z-index: 40; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); color: var(--accent);
  display: grid; place-items: center; opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity .25s, transform .3s var(--ease), background-color .2s;
}
#totop svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#totop.on { opacity: 1; transform: none; pointer-events: auto; }
#totop:hover { background: var(--accent-soft); }

/* checkboxes -> toggle switches */
input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0; position: relative; cursor: pointer;
  width: 36px; height: 21px; border-radius: 999px; background: color-mix(in srgb, var(--ink-2) 28%, var(--surface-2));
  border: 1px solid var(--line); transition: background-color .22s, border-color .22s;
}
input[type=checkbox]::after {
  content: ""; position: absolute; top: 1px; left: 1px; width: 17px; height: 17px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .25s var(--ease);
}
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { transform: translateX(15px); }
input[type=checkbox]:hover { border-color: var(--accent); }
input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filters label.chk, .fixform label.chk, label.chk { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.filters label.chk:hover { color: var(--ink); }

/* selects */
select, .filters select, .fixform select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 30px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a8f9c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: border-color .2s, box-shadow .2s;
}
select:hover { border-color: var(--accent); }
select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* search-mode pills: a little more tactile */
.modes label:has(input:checked) { box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 22%, transparent); }
.modes label:hover { border-color: var(--accent); color: var(--accent); }

nav.tabs .t-short { display: none; }
/* mobile: bottom tab bar */
@media (max-width: 780px) {
  nav.tabs .t-full { display: none; }
  nav.tabs .t-short { display: inline; }
  body { padding-bottom: 74px; }
  nav.tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; width: 100%; margin: 0; gap: 0;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; flex-wrap: nowrap;
  }
  nav.tabs a { flex: 1; flex-direction: column; gap: 2px; padding: 7px 2px 5px; font-size: .66rem; border-radius: 10px; text-align: center; }
  nav.tabs a svg { display: block; }
  nav.tabs a::after { left: 30%; right: 30%; bottom: 1px; }
  .top-in { flex-wrap: nowrap; }
  .brand { flex: 1; min-width: 0; }
  .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #totop { bottom: 88px; right: 14px; }
  .toast { bottom: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* suggestion / fix dialog: never wider than its box */
.fixform { grid-template-columns: minmax(0, 1fr); }
.fixform input:not([type=checkbox]), .fixform select { width: 100%; min-width: 0; text-overflow: ellipsis; }
dialog#fixdlg { overflow-x: hidden; max-height: calc(100vh - 32px); overflow-y: auto; }

/* ---------- About page ---------- */
.about { max-width: none; margin: 0; }
.about-intro h1 { font: 700 2.3rem/1.1 var(--tam); margin: 0 0 14px; }
.about-intro .lead { font-size: 1.14rem; line-height: 1.6; max-width: 80ch; }
.about-intro p { max-width: 80ch; }
.about-stats { justify-content: flex-start !important; gap: 34px !important; margin: 22px 0 4px !important; }
.about-stats div { text-align: left !important; }

/* author card: profile picture next to name and bio */
.about-bio {
  display: flex; gap: 34px; align-items: center; margin: 32px 0 6px; padding: 28px 32px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
}
.about-bio .avatar {
  flex: none; width: 224px; height: 224px; border-radius: 50%; object-fit: cover; display: block;
  background: var(--surface-2); box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--accent), 0 14px 34px rgba(40,30,10,.22);
}
.bio-text { min-width: 0; }
.bio-text h2 { font: 700 1.7rem/1.15 var(--tam); margin: 0 0 10px; }
.bio-text p { margin: 0; color: var(--ink); line-height: 1.65; font-size: 1.02rem; }

.about-doc { max-width: none; margin-top: 34px; }
.about-doc h2 { margin-top: 1.9em; font-family: var(--tam); font-size: 1.35rem; }
.about-doc h2::before { content: ""; display: block; width: 34px; height: 3px; border-radius: 3px; background: var(--accent); margin-bottom: 8px; }
.about-doc > p, .about-doc > .note { max-width: 90ch; }
main.enter .about-hero > * { animation: rise .55s var(--ease) both; }
main.enter .about-hero > *:nth-child(2) { animation-delay: .1s; }
@media (max-width: 640px) {
  .about-intro h1 { font-size: 1.8rem; }
  .about-bio { flex-direction: column; text-align: center; padding: 24px 20px; gap: 20px; }
  .about-bio .avatar { width: 180px; height: 180px; }
}

.nvline { margin: 2px 0 6px; }
.nvline a { margin-right: 4px; }

.nofm { margin: 4px 0 8px; }

.att { text-decoration: underline; text-decoration-style: dotted; text-decoration-thickness: 2px; text-decoration-color: var(--accent, #4f7cff); text-underline-offset: 3px; cursor: help; }

.att2 { text-decoration-style: dashed; opacity: .85; }

/* pronunciation: respelling + IPA, per dialect */
.pron { margin: 4px 0 8px; cursor: help; }
.prow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 2px 0; }
.pr1 { font-family: var(--ui, system-ui, sans-serif); font-size: 1.08rem; font-weight: 700; color: var(--ink); letter-spacing: .02em; }
.pipa { font-family: 'Gentium Plus', 'Charis SIL', 'Doulos SIL', serif; font-size: .95rem; color: var(--muted, #8a93a6); }
.pron .pd, .pronpage .pd { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 2px; }
.pwhy { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 2px 8px; cursor: default; }
.plink { display: inline-block; margin-top: 2px; }
.pr { display: block; font-family: var(--ui, system-ui, sans-serif); font-size: .78rem; font-weight: 500; color: var(--muted, #8a93a6); letter-spacing: .02em; line-height: 1.25; cursor: help; }
.pr.prs { margin: 1px 0 2px; font-size: .84rem; }
.fpr { font-size: .7rem; min-height: 0; }
details.forms:not(.showpr) .fpr { display: none; }
.prsw, .prsw2 { font-size: .85rem; color: var(--muted, #8a93a6); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.prsw { margin: 4px 0; }
.pwbox { width: 100%; max-width: 34rem; padding: 8px 10px; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: var(--surface, #fff); color: var(--ink); }
.pwout { margin: 6px 0 14px; }

/* second source: the Dictionnaire Imagé */
.hn { font-size: .62em; margin-left: 1px; opacity: .75; }
.badge.srcT { background: #e9f1e4; color: #2f6b2f; border-color: #bcd5b2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.srcT { background: #223224; color: #9ccf9c; border-color: #3b5a3b; } }
:root[data-theme="dark"] .badge.srcT { background: #223224; color: #9ccf9c; border-color: #3b5a3b; }
.pic { float: right; margin: 4px 0 8px 14px; max-width: 42%; }
.pic img { display: block; max-width: 100%; border-radius: 8px; background: #fff; }
.extras { margin: 6px 0; line-height: 1.7; }
.alsoline { margin: 6px 0 0; }
@media (max-width: 560px) { .pic { float: none; max-width: 100%; margin: 6px 0; } }
.prassebox { margin: 10px 0; border: 1px solid var(--line, #3a3f52); border-radius: 10px; padding: 2px 10px 8px; }
.prassebox > summary { cursor: pointer; padding: 6px 0; }
.card.embed { box-shadow: none; border: 0; padding: 4px 0 0; margin: 0; background: transparent; }
.pic figcaption { text-align: center; margin-top: 3px; }
.badge.srcS { background: #e4ecf4; color: #2d4f7c; border-color: #b4c8de; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.srcS { background: #1f2b3a; color: #9cc0ea; border-color: #35506e; } }
:root[data-theme="dark"] .badge.srcS { background: #1f2b3a; color: #9cc0ea; border-color: #35506e; }

/* Burkina tab: phrases with clickable words */
.bkt { font-size: 1.05rem; }
.bke { color: var(--ink-2); }
.bkd { white-space: nowrap; width: 1%; }
a.bkw { color: inherit; text-decoration: underline dotted var(--accent); text-underline-offset: 3px; }
a.bkw:hover { color: var(--accent); text-decoration-style: solid; }
a.bkw-v { text-decoration-style: solid; }
.bkhl { background: var(--accent-soft, rgba(120, 120, 255, .22)); outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; padding: 0 4px; }
@media (max-width: 700px) { table.rv .bke { display: block; padding-left: 0; } }
.bkd .dm { display: inline-block; margin-right: 3px; }

/* Learn tab */
.lrn-units { display: grid; gap: 8px; margin: 8px 0 18px; }
.lrn-unit { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card, transparent); flex-wrap: wrap; }
.lrn-unit.planned { opacity: .6; }
.lrn-ls { display: flex; gap: 6px; flex-wrap: wrap; }
a.lrn-l { min-width: 34px; text-align: center; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: inherit; font-weight: 600; }
a.lrn-l:hover { border-color: var(--accent); }
a.lrn-l.done { background: var(--accent-soft, rgba(120,120,255,.2)); }
.lrn-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
.lrn-tam { font-size: 1.25rem; }
.lrn-en { margin-top: 2px; }
.lrn-meta { margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge.warn { background: rgba(230,160,0,.18); color: #c98a00; }
.lrn-fix { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--ink-2); font-size: 1rem; }
.lrn-q { font-size: 1.4rem; margin: 10px 0 14px; }
.lrn-opts { display: grid; gap: 8px; }
.lrn-opts .opt { text-align: left; justify-content: flex-start; }
.btn.good { border-color: #2e9e5b; background: rgba(46,158,91,.18); }
.btn.bad { border-color: #d44; background: rgba(220,60,60,.15); }
.lrn-good { color: #2e9e5b; } .lrn-bad { color: #d44; }
#lrnin { width: 100%; font-size: 1.2rem; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: inherit; }
.keys-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.lrn-built { min-height: 2.2rem; padding: 8px; border-bottom: 2px solid var(--line); margin-bottom: 10px; }
.tile { margin: 2px; }

.lrn-part > summary { cursor: pointer; list-style: none; }
.lrn-part > summary h2 { display: inline-block; }
a.lrn-l.notes { background: transparent; border-style: dashed; }
.lrn-notes { margin: 10px 0; }
.lrn-nav { font-size: .92rem; }

.badge.ok { background: rgba(46,158,91,.18); color: #2e9e5b; }

/* languages hub */
.lang-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 18px 0; }
.lang-card { display: block; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.lang-card:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }
.lang-card h2 { margin: 0 0 2px; font-size: 1.25rem; }
.lang-card p { margin: 6px 0; }

/* grammar contents */
.gtoc { display: grid; grid-template-columns: 64px 1fr 40px; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.gtoc .gn { color: var(--muted); font-variant-numeric: tabular-nums; }
.gtoc .gp { text-align: right; font-variant-numeric: tabular-nums; }
.gtoc.d0 { font-weight: 700; margin-top: 10px; border-bottom: 1px solid var(--accent); }
.gtoc.d2 { padding-left: 14px; } .gtoc.d3 { padding-left: 28px; font-size: .88rem; }
.ghit { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ghit mark { background: var(--accent-soft); color: var(--ink); border-radius: 3px; padding: 0 2px; }
.gtbl-wrap { overflow-x: auto; margin: 10px 0 16px; }
.gtbl { border-collapse: collapse; font-size: .9rem; }
.gtbl td { border: 1px solid var(--line); padding: 3px 8px; vertical-align: top; }
.gtbl tr:nth-child(odd) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }

/* grammar reader: text and the scan of the page side by side */
.about.gwide { max-width: none; }
.gsplit { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.gscan { position: static; }
.gscan img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.gscan-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
@media (min-width: 1000px) {
  .gsplit { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
  .gscan { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 90px); overflow: auto; }
}

.badge.srcH { background: color-mix(in srgb, #d98a3d 22%, transparent); color: #e9b374; border-color: color-mix(in srgb, #d98a3d 45%, transparent); }

/* grammar topics and the dictionary scan */
.topic { margin: 18px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.topic.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.topic h2 { margin: 0 0 8px; font-size: 1.15rem; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.tcol h4 { margin: 0; }
.tcol ul { margin: 6px 0 0; padding-left: 18px; }
.tcol li { margin: 2px 0; font-size: .93rem; }
.scanpg { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* the course */
.clist { padding-left: 0; list-style: none; }
.clist li { margin: 8px 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.clist li.done { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.clist li a { display: block; color: var(--ink); text-decoration: none; }
.clist li a span { display: block; color: var(--muted); font-size: .9rem; margin-top: 2px; }
.csec { margin: 20px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.csec h2 { margin-top: 0; font-size: 1.2rem; }
.cexpl, .chog { margin: 8px 0; }
.cexpl p { font-size: .95rem; }
.cverb { margin: 10px 0 16px; }
.copts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 14px 0; }
.copt.right { border-color: #3fae6a; background: color-mix(in srgb, #3fae6a 18%, transparent); }
.copt.wrong { border-color: #d05a5a; background: color-mix(in srgb, #d05a5a 18%, transparent); }

.bridge { margin: 4px 0 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.bridge .chip { font-size: .85rem; }

/* clean lesson layout */
.cless { max-width: 1080px; margin: 0 auto; }
.cgoal { font-size: 1.05rem; color: var(--muted); margin-top: -4px; }
.cstep { display: flex; gap: 14px; margin: 18px 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.cstepn { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; }
.cstepb { flex: 1; min-width: 0; }
.cstep h2 { margin: 2px 0 6px; font-size: 1.15rem; }
.csay { font-size: 1rem; line-height: 1.55; }
.ctiny td, .ctiny th { padding: 5px 10px; }
.cexs { margin-top: 10px; }
.cexs .ex, .cmore .ex { margin: 6px 0; }
.cmore, .cdeep { margin-top: 10px; }
.cdeep > summary, .cmore > summary { cursor: pointer; color: var(--muted); font-size: .92rem; }
.cdeep[open] { border-top: 1px dashed var(--line); padding-top: 8px; }
.cwords .cstepb h2 { margin-top: 0; }
.cnav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.srclist { padding-left: 1.2em; line-height: 1.55; }
.srclist li { margin: 6px 0; }

.cpart { margin: 26px 0 4px; font-size: 1.15rem; }

/* ---- Learn: linear path ---- */
.cprog { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 6px 0 18px; }
.cprog-bar { flex: 1 1 220px; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; max-width: 520px; }
.cprog-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), #8f7cff); transition: width .6s ease; }
.cprog-l { margin-top: 0; }
.cpartbox { margin: 30px 0 10px; }
.cpath { list-style: none; margin: 14px 0 0; padding: 0 0 0 4px; position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px 18px; }
.cpath li a { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  color: inherit; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; position: relative; }
.cpath li a:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.18); border-color: var(--accent); }
.pdot { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); border: 2px solid transparent; }
.cpath li.done .pdot { background: linear-gradient(135deg, #2bb673, #1e8f5a); color: #fff; }
.cpath li.next a { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cpath li.next .pdot { background: var(--accent); color: #fff; animation: pdotpulse 2.2s ease-in-out infinite; }
@keyframes pdotpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(120,130,255,.45); } 50% { box-shadow: 0 0 0 8px rgba(120,130,255,0); } }
.ptxt { display: flex; flex-direction: column; gap: 3px; }
.ptxt span { font-size: .88rem; color: var(--muted); }
/* lesson steps appear one after the other */
.cless .cstep { animation: cstepin .45s ease both; }
.cless .cstep:nth-of-type(2) { animation-delay: .05s; } .cless .cstep:nth-of-type(3) { animation-delay: .1s; } .cless .cstep:nth-of-type(4) { animation-delay: .15s; }
@keyframes cstepin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* practice ideas */
.cprac { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 160px); }
.cprac h3 { margin: 18px 0 6px; font-size: 1rem; }
.ptasks { margin: 0; padding-left: 1.3em; }
.ptasks li { margin: 8px 0; }
.ptask .pq { display: block; }
.ptask details { margin-top: 3px; }
.ptask summary { cursor: pointer; color: var(--accent); font-size: .85rem; list-style: none; display: inline-block; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--line); }
.ptask summary::-webkit-details-marker { display: none; }
.ptask details[open] summary { background: var(--accent-soft); }
.ptask .pa { margin-top: 6px; padding: 8px 12px; border-left: 3px solid var(--accent); border-radius: 6px; background: var(--surface); animation: cstepin .3s ease both; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 18px; }
.popen { list-style: none; padding-left: 0; }
.popen label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); }
.popen input:checked + span { text-decoration: line-through; opacity: .6; }

.ankibox { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin: 14px 0 18px; padding: 14px 18px;
  border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; background: var(--surface); }
.ankibox > div:first-child { flex: 1 1 420px; }
.ankibox p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.ankibtns { display: flex; gap: 8px; flex-wrap: wrap; }

/* word review page */
.rvt td { vertical-align: middle; }
.rvt tr.rvok td { background: rgba(43,182,115,.10); }
.rvt tr.rvbad td { background: rgba(220,70,70,.12); }
.rvt tr.rvfix td { background: rgba(240,180,40,.12); }
.rvbtns { white-space: nowrap; }
.rvbtns .btn { padding: 4px 10px; }
.rvin { width: 110px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-family: var(--tam); }
.rvnote { width: 160px; font-family: var(--ui); }
.rvbtns { display: flex; gap: 4px; border: 0; }
.rvt td { padding-top: 6px; padding-bottom: 6px; }
.rvin { width: 92px; } .rvnote { width: 130px; }

/* Part 4 conversations */
.cphr { display: grid; gap: 8px; margin: 8px 0; }
.cbub { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.cbub .ca { margin-top: 4px; padding-left: 14px; }
.cgr { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; margin: 6px 0; }
.cgr summary { cursor: pointer; }
.cpairs li { margin: 10px 0; }
.cpairs details summary { cursor: pointer; color: var(--accent); }
.cdlg { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.cline { max-width: 82%; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); display: flex; gap: 8px; align-items: baseline; }
.cline.cb { align-self: flex-end; background: color-mix(in srgb, var(--accent) 12%, var(--surface-2)); }
.cwho { font-size: 11px; font-weight: 700; opacity: .6; }
.ctext { line-height: 1.8; }

/* Anki: choose by skill or by lesson */
.ankichoose { margin: 14px 0 6px; padding: 12px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; }
.ankichoose > b { flex: 1 1 100%; }
.ankichoose label { cursor: pointer; }
.ankichoose p { flex: 1 1 100%; margin: 2px 0 0; }
.ankiset[hidden] { display: none; }

/* Anki section: mode pills, dropdown + one button */
.ankimain .ankimodes { margin: 8px 0 4px; }
.ankirow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ankisel { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; cursor: pointer; max-width: 100%; }
.ankisel:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.ankiset[hidden] { display: none !important; }

/* ---- styled dropdowns (see the 'Styled dropdowns' block in app.js) ---- */
.cs { position: relative; display: inline-block; max-width: 100%; vertical-align: middle; }
.cs-native { position: absolute !important; opacity: 0; pointer-events: none; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; overflow: hidden; }
.cs-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-width: 0; text-align: left;
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s;
}
.cs-btn:hover:not(:disabled) { border-color: var(--accent); }
.cs-btn:focus-visible, .cs.open .cs-btn { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cs-btn:disabled { opacity: .5; cursor: not-allowed; }
.cs-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-caret { flex: none; color: var(--ink-2); transition: transform .18s; }
.cs.open .cs-caret { transform: rotate(180deg); color: var(--accent); }
.cs-menu {
  display: none; position: absolute; z-index: 60; left: 0; top: calc(100% + 6px); min-width: 100%; width: max-content; max-width: min(92vw, 460px); max-height: 320px; overflow-y: auto;
  padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
}
.cs.open .cs-menu { display: block; animation: csin .12s ease-out; }
.cs.up .cs-menu { top: auto; bottom: calc(100% + 6px); }
@keyframes csin { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cs-opt { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); white-space: nowrap; }
.cs-opt .cs-check { opacity: 0; color: var(--accent); flex: none; }
.cs-opt.act { background: var(--accent-soft); }
.cs-opt.sel { color: var(--accent); font-weight: 600; }
.cs-opt.sel .cs-check { opacity: 1; }
.cs-opt.dis { opacity: .45; cursor: not-allowed; }
.cs-group { padding: 8px 10px 4px; font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
/* sizes in context */
.filters .cs-btn { padding: 5px 10px; border-radius: 8px; background: var(--surface); font-size: .9rem; }
.filters .cs-menu { font-size: .9rem; }
.fixform .cs, .ankirow .cs { display: block; }
.ankirow .cs { min-width: 250px; }
@media (max-width: 780px) { .ankirow .cs { flex: 1 1 100%; } .cs-menu { max-width: 94vw; } }

/* Tahaggart course (Tamahaq) */
.badge.srcR { background: color-mix(in srgb, #3fa58c 20%, transparent); color: #6fcfb4; border-color: color-mix(in srgb, #3fa58c 45%, transparent); }
:root[data-theme="light"] .badge.srcR { color: #1f6f5c; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .badge.srcR { color: #1f6f5c; } }
.hoglist { list-style: none; padding: 0; display: grid; gap: 8px; margin: 14px 0; }
.hoglist a { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); text-decoration: none; color: var(--ink); }
.hoglist a:hover { border-color: var(--accent); }
.hogsec { margin: 26px 0; padding-top: 6px; border-top: 1px solid var(--line); }
.hogscan { max-width: 100%; margin-top: 10px; border-radius: 8px; border: 1px solid var(--line); }
.hogex td { vertical-align: top; }

/* Lesson 1: recordings of the sounds */
.sndgrid { display: grid; gap: 10px; margin: 10px 0; }
.sndrow { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.sndl { display: flex; flex-direction: column; gap: 2px; }
.sndletter { font-size: 2rem; font-weight: 700; line-height: 1; color: var(--accent); }
.sndwords { display: flex; flex-wrap: wrap; gap: 8px; }
.snd { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; transition: border-color .15s, background .15s; }
.snd:hover { border-color: var(--accent); }
.snd .sndplay { color: var(--accent); font-size: .8rem; }
.snd .sndr { color: var(--ink-2); font-size: .8rem; }
.snd.playing { background: var(--accent-soft); border-color: var(--accent); }
.snd.playing .sndplay { animation: sndp .7s infinite alternate; }
@keyframes sndp { from { opacity: .35; } to { opacity: 1; } }
@media (max-width: 640px) { .sndrow { grid-template-columns: 1fr; } }

.sndpairs { display: flex; flex-direction: column; gap: 8px; }
.sndpair { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Learn: dialect pills + pronunciation switch on one aligned row */
.cdiaswitch { display: inline-flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; vertical-align: middle; }
.cdiaswitch .modes { margin-top: 0; display: inline-flex; gap: 6px; }
.cdiaswitch .prsw2 { display: inline-flex; align-items: center; gap: 9px; margin: 0; font-size: .9rem; color: var(--ink-2); cursor: pointer; user-select: none; line-height: 1; }
.cdiaswitch .prsw2 input { margin: 0; flex: none; }
.cdiaswitch .prsw2 + a { margin-left: -8px; line-height: 1; }
p:has(> .cdiaswitch) { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }

/* Learn password gate */
.lgate { max-width: 560px; }
.lgform { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 6px; }
.lgform input { flex: 1 1 220px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; }
.lgform input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.lgerr { min-height: 1.3em; color: #e06b6b; margin: 4px 0 14px; }

/* Conjugation tab: language headings in the side list */
.conjnav h3.cjlang { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin: 18px 0 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.conjnav h3.cjlang:first-child { border-top: 0; margin-top: 0; padding-top: 0; }

/* loading bar under the title while the dictionary data loads (moves on the compositor, so it keeps running while scripts load) */
.lbar { display: block; position: relative; overflow: hidden; width: min(260px, 70vw); height: 4px; margin: 18px auto 0; border-radius: 4px; background: var(--line); }
.lbar i { position: absolute; top: 0; bottom: 0; left: 0; width: 40%; border-radius: 4px; background: var(--accent); animation: lbar 1.3s ease-in-out infinite; }
@keyframes lbar { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .lbar i { animation-duration: 3s; } }

/* Kossmann, A Grammar of Ayer Tuareg: 'Go deeper' and the reader */
.kdeep > summary .muted { font-weight: 400; }
.ksec { border-top: 1px solid var(--line); padding: 6px 0; }
.ksec > summary { cursor: pointer; font-weight: 650; font-size: 1.02rem; padding: 4px 0; }
.ksid { display: inline-block; min-width: 2.6em; color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 700; }
.ktools { display: flex; gap: 10px; align-items: center; margin: 2px 0 8px; }
.kp1 { max-width: 78ch; line-height: 1.6; margin: .55em 0; }
.ktam, .kp1 i.ktam, .knote i.ktam, .klist i.ktam { font-family: 'Gentium Plus', 'Charis SIL', 'Noto Serif', serif; font-style: normal; color: var(--accent); }
.klist { list-style: none; padding-left: 0; max-width: 78ch; }
.klist li { margin: .35em 0; padding-left: 2em; text-indent: -2em; line-height: 1.55; }
.kmark { display: inline-block; width: 2em; text-indent: 0; color: var(--muted, #8a93a6); font-weight: 600; }
.knote { max-width: 76ch; margin: 12px 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; font-size: .93rem; line-height: 1.55; }
.knote > b { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 2px; }
.knote p { margin: .3em 0; }
.kex { display: flex; gap: 10px; margin: 12px 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface, #fff); max-width: 80ch; }
.klab { color: var(--muted, #8a93a6); font-weight: 600; min-width: 1.8em; }
.kexb { flex: 1; min-width: 0; }
.kil { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 4px; }
.kw { display: inline-flex; flex-direction: column; }
.kwt { font-family: 'Gentium Plus', 'Charis SIL', 'Noto Serif', serif; font-size: 1.08rem; font-weight: 700; color: var(--ink); }
.kg { font-size: .74rem; color: var(--muted, #8a93a6); letter-spacing: .01em; }
.kab { text-decoration: none; border-bottom: 1px dotted currentColor; cursor: help; font-variant: small-caps; text-transform: lowercase; letter-spacing: .03em; }
.kp { margin-top: 4px; }
.ken { margin-top: 6px; font-size: .98rem; color: var(--ink); }
.ktag { font-size: .68rem; padding: 0 4px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); cursor: help; vertical-align: .08em; }
.ksrc { font-size: .72rem; color: var(--muted, #8a93a6); cursor: help; border-bottom: 1px dotted currentColor; }
.ktbl { border-collapse: collapse; margin: 8px 0 12px; font-size: .95rem; }
.ktbl td { border-bottom: 1px solid var(--line); padding: 4px 14px 4px 0; vertical-align: top; }
.kfn { font-size: .82rem; color: var(--muted, #8a93a6); max-width: 76ch; }
.kpgbox { margin: 6px 0 10px; }
.kpgbox img { max-width: min(100%, 640px); border: 1px solid var(--line); border-radius: 6px; }
.kpgnav { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.kreader .kh1 { font-size: 1.5rem; }
.ktoc { list-style: none; padding: 0; }
.ktoc li { margin: 3px 0; }
.ktoc .kchap { margin-top: 14px; font-weight: 700; font-size: 1.05rem; }
.ktoc .klvl1 { padding-left: 1.2em; }
.ktoc .klvl2 { padding-left: 2.6em; font-size: .95rem; }
.ktoc .klvl3 { padding-left: 4em; font-size: .92rem; }
.kbookl { margin: 10px 0 18px; }

/* fuller explanations of a lesson step (course_explain.py) */
.cexpl { margin: .6rem 0 .8rem; padding-left: 1.3rem; display: grid; gap: .45rem; font-size: .97rem; line-height: 1.55; }
.cexpl li::marker { color: var(--accent); font-weight: 600; }
.cexpl i.tam, .cwatch i.tam { font-style: italic; font-weight: 500; }
.cexpl a.kref, .cwatch a.kref { font-size: .8em; white-space: nowrap; }
.cwatch { margin: .4rem 0 .9rem; padding: .55rem .8rem; border-left: 3px solid #d08a2c; background: color-mix(in srgb, #d08a2c 10%, transparent); border-radius: 0 6px 6px 0; font-size: .95rem; line-height: 1.5; }
.cwatch b { margin-right: .35rem; }
/* word-by-word dictionary links in example sentences */
a.wl { color: inherit; text-decoration: underline dotted; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 3px; }
a.wl:hover { text-decoration-style: solid; }
a.wl-p { text-decoration-style: dashed; text-decoration-color: color-mix(in srgb, currentColor 25%, transparent); }
#tip { white-space: pre-line; }
/* the course in stages (2026-11-19) */
.cstate { color: var(--ink-2); margin-bottom: .6rem; }
.cstate p { margin: .2rem 0 .4rem; }
.cpath li.prep .pdot { opacity: .55; }
.cprep { border-style: dashed; }
/* lesson opening, taught text and recap (course_intros.py, course_teach.py) */
.cintro, .cteach, .crecap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.25rem; margin: 1rem 0 1.25rem; line-height: 1.6; }
.cintro { border-left: 4px solid var(--accent); }
.cintro h2, .cteach h2, .crecap h2 { margin-top: 0; font-size: 1.15rem; }
.cteach h3 { margin: 1.1rem 0 .3rem; font-size: 1.02rem; }
.cwhy { margin: .6rem 0; }
.ccan { background: var(--accent-soft); border-radius: 8px; padding: .5rem .8rem; margin-top: .6rem; }
.ccan ul, .crecap ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.ccheck { margin: .5rem 0; padding: .45rem .7rem; border: 1px dashed var(--line); border-radius: 8px; }
.cteachex td { vertical-align: top; }
.crecap { border-left: 4px solid #2f8a4c; }
.cpracth { margin-top: 1.6rem; }
.cnote { display: inline-block; margin-left: 4px; font-size: .78em; color: var(--accent); cursor: help; vertical-align: super; line-height: 1; }
.calt { margin-top: 2px; color: var(--ink-2); } .calt a.tam { font-weight: 600; }
.snd.sndmini { padding: 2px 8px; min-height: 0; vertical-align: middle; }
/* a respelling that is not said as written: dotted line + mark; the tooltip says why (pronTip) */
.pr.prchg { text-decoration: underline dotted; text-underline-offset: 3px; }
.pr.prchg::after { content: " ≠"; font-size: .85em; color: var(--accent); }
.pr mark.psd { background: color-mix(in srgb, var(--accent) 18%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
/* a form of the other dialect quoted in a shared lesson text (dxMark) */
.dm.dxm { font-size: .68rem; vertical-align: 1px; cursor: help; }
.dxalt { color: var(--ink-2); font-size: .92em; }
.dxfrom { display: block; }
.cdxnote { border-left: 3px solid var(--accent); padding: 4px 10px; color: var(--ink-2); background: color-mix(in srgb, var(--accent) 6%, transparent); }
details.ankitips { display: block; }
details.ankitips summary { cursor: pointer; }
details.ankitips ul { margin: 10px 0 6px; padding-left: 20px; }
details.ankitips li { margin: 5px 0; font-size: .93rem; line-height: 1.45; }
.chip .ru { color: var(--muted); font-weight: 700; margin-left: 1px; }

/* ---- Learn path: stage timeline, units, unit reviews and stage checkpoints (2026-11-26) ---- */
.ctl { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 8px 0 22px; position: relative; }
.ctl::before { content: ""; position: absolute; left: 6%; right: 6%; top: 27px; height: 3px; background: var(--line); border-radius: 3px; z-index: 0; }
.ctl-st { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px 10px; border: 1px solid transparent;
  border-radius: 14px; background: none; color: inherit; font: inherit; cursor: pointer; text-align: center; transition: background .18s ease, border-color .18s ease; }
.ctl-st:hover { background: var(--surface); border-color: var(--line); }
.ctl-dot { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface); color: var(--ink-2); border: 2px solid var(--line); }
.ctl-st.some .ctl-dot { border-color: var(--accent); color: var(--accent); }
.ctl-st.cur .ctl-dot { background: var(--accent); border-color: var(--accent); color: #fff; animation: pdotpulse 2.2s ease-in-out infinite; }
.ctl-st.pass .ctl-dot { background: linear-gradient(135deg, #2bb673, #1e8f5a); border-color: #1e8f5a; color: #fff; }
.ctl-name { font-weight: 600; font-size: .86rem; line-height: 1.2; }
.ctl-lvl { font-size: .76rem; color: var(--ink-2); }
.ctl-bar { width: 80%; height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; }
.ctl-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #8f7cff); }
.ctl-st.pass .ctl-bar span { background: #2bb673; }
.ctl-test { font-size: .72rem; color: var(--ink-2); }
.ctl-here { font-size: .7rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 760px) {
  .ctl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ctl::before { display: none; }
}
.cunit { margin: 18px 0 6px; padding-left: 14px; border-left: 3px solid var(--line); }
.cunit-h { font-size: .98rem; margin: 0 0 2px; }
.cunit .cpath { margin-top: 8px; }
.cpath li.ctest a { border-style: dashed; background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.cpath li.ctest .pdot { background: var(--surface); border-color: var(--accent); }
.cpath li.ctest.done a { border-style: solid; }
.cpath li.ctest.done .pdot { background: linear-gradient(135deg, #2bb673, #1e8f5a); border-color: #1e8f5a; color: #fff; }
.cpath-stage { grid-template-columns: 1fr; margin-top: 16px; }
.cpath li.cstage a { padding: 18px 20px; border-width: 2px; border-style: solid; border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 70%, var(--surface)), var(--surface)); }
.cpath li.cstage .pdot { width: 44px; height: 44px; font-size: 1.2rem; }
.tprog { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 10px; }
.tq { font-size: 1.25rem; line-height: 1.45; }
.tres { display: flex; align-items: center; gap: 22px; padding: 18px 22px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); margin: 8px 0 16px; }
.tres h1 { margin: 0 0 4px; font-size: 1.3rem; }
.tres p { margin: 0; }
.tscore { flex: none; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: #fff; background: #d05a5a; }
.tres.pass .tscore { background: linear-gradient(135deg, #2bb673, #1e8f5a); }
.tres.pass { border-color: #2bb673; }
.tmiss { padding-left: 1.2rem; }
.tmiss li { margin: 0 0 12px; }
.tmiss s { opacity: .75; }
.ctasks { list-style: none; padding: 0; }
.ctasks li { margin: 6px 0; }
@media (max-width: 520px) { .tres { flex-direction: column; align-items: flex-start; } .tscore { width: 76px; height: 76px; font-size: 1.3rem; } }
.tselfa { padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 12px 12px 0; margin: 8px 0 12px; }
.ctest-page a.btn, .cprog a.btn { text-decoration: none; }
.cpathh { margin: 28px 0 6px; font-size: 1.3rem; }
.ttype { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 6px; }
.ttype .tin { flex: 1 1 260px; font-size: 1.25rem; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; }
.tkeys { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.tkeys .sp { min-width: 40px; padding: 6px 8px; font-size: 1.05rem; }
.tcloze { font-size: 1.2rem; margin: 10px 0 4px; line-height: 1.6; }
.tgap { display: inline-block; min-width: 70px; border-bottom: 2px solid var(--accent); color: var(--accent); text-align: center; }
.tsnd { margin-left: 8px; vertical-align: middle; }
.tok { color: #1e8f5a; } .tno { color: #d05a5a; }
.tnear { color: var(--ink-2); }
.tkinds span { display: inline-block; margin: 4px 12px 0 0; }
.cwarm .cstepb > h2 { font-size: 1.05rem; }
/* Listening gym */
.lsncard { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: inherit; text-decoration: none; transition: border-color .18s ease, transform .18s ease; }
.lsncard:hover { border-color: var(--accent); transform: translateY(-1px); }
.lsncard > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.lsnicon { font-size: 1.6rem; }
.lsnopts { display: grid; gap: 10px; margin: 12px 0 16px; }
.lsnopts .modes { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 8px; }
.lplay { font-size: 1.05rem; padding: 10px 16px; margin: 6px 0 10px; }
.treveal { margin-top: 10px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 12px 12px 0; }
.lfollow { font-size: 1.2rem; line-height: 1.7; }
.lfollow span.lon { background: color-mix(in srgb, var(--accent) 28%, transparent); border-radius: 4px; }
.ankiver { margin-top: 6px; }
.ankiver .ankinew { color: var(--accent); }
.ankisteps { margin: 6px 0 8px 1.2em; padding: 0; color: var(--muted); font-size: .92rem; }
.ankisteps li { margin: 4px 0; }

/* ── Tifinagh (tifinagh_ui.js) ── */
.tf-tif { display: none; font-family: 'Noto Sans Tifinagh', Ebrima, sans-serif; letter-spacing: .04em; font-style: normal; }
body.tf-both .tf-tif { display: inline; margin-left: .45em; color: var(--ink-2); }
body.tf-both .hw .tf-tif { display: block; margin-left: 0; font-size: .82em; color: var(--ink); }
body.tf-only .tf-lat { display: none; }
body.tf-only .tf-tif { display: inline; margin-left: 0; }
.tf-tif a { color: inherit; text-decoration: none; }
.tf-wd { font-family: 'Noto Sans Tifinagh', Ebrima, sans-serif; letter-spacing: .04em; font-style: normal; }
.tif-btn { font-family: 'Noto Sans Tifinagh', Ebrima, sans-serif; font-size: 1.05rem; }
.tif-btn.on { background: var(--accent); color: var(--accent-ink); }
#tifpanel { position: absolute; z-index: 50; box-sizing: border-box; max-width: calc(100vw - 24px); background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: 0 8px 28px rgba(0,0,0,.18); font-size: .92rem; }
#tifpanel .tf-modes { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 6px 0 10px; }
#tifpanel .tf-row { display: block; margin: 6px 0; }
#tifpanel select { max-width: 100%; }
#tifpanel .tf-note { color: var(--ink-2); font-size: .8rem; margin: 10px 0 0; }
.tf-keys { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex-basis: 100%; width: 100%; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.tf-keys button { font-family: 'Noto Sans Tifinagh', Ebrima, sans-serif; }
.tf-keys-l { font-size: .8rem; color: var(--ink-2); margin-right: 4px; }
.tf-sep { font-family: 'Gentium Plus', Georgia, serif; color: var(--ink-2); opacity: .7; margin: 0 .55em; font-size: .85em; letter-spacing: 0; }

.tf-keys .tf-change { font: inherit; font-size: .82rem; color: var(--accent); background: none; border: none; text-decoration: underline; cursor: pointer; padding: 4px 6px; }
@keyframes tfpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(39,54,143,0); } 40% { box-shadow: 0 0 0 8px rgba(39,54,143,.35); } }
.tif-btn.tf-pulse { animation: tfpulse .9s ease-out 3; }
.qrow .miclang { max-width: 7.5em; font-size: 13px; padding: 0 4px; border: 1px solid var(--line, #ccc); border-radius: 8px; background: var(--bg, #fff); color: inherit; }
.qrow .mic { display: inline-flex; align-items: center; justify-content: center; }
.qrow .mic.rec { background: #c62828; color: #fff; border-color: #c62828; animation: tfpulse 1.2s ease-out infinite; }
.micst { margin: 6px 2px 0; }
/* real recording of a dictionary word (New Testament reader), next to its pronunciation */
.snd.wsnd { padding: 1px 9px; min-height: 0; gap: 3px; font-size: .85em; vertical-align: middle; margin-left: 6px; color: var(--accent); }
.snd.wsnd .wsl { font-size: .72em; opacity: .7; }

/* multi-select filters (2026-12-01) */
.ms { position: relative; display: inline-block; }
.ms-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; cursor: pointer; max-width: 260px; }
.ms-btn:hover, .ms-btn[aria-expanded="true"] { border-color: var(--accent); }
.ms-btn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ms-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-caret { font-size: .75em; color: var(--ink-2); }
.ms-menu { position: absolute; z-index: 60; left: 0; top: calc(100% + 6px); min-width: 300px; max-width: min(92vw, 420px); max-height: 360px; overflow-y: auto;
  padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 14px 34px rgba(0, 0, 0, .28); font-size: .9rem; }
.ms-group { padding: 8px 8px 4px; font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.ms-opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.ms-opt:hover { background: var(--accent-soft); }
.ms-opt input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.ms-foot { display: flex; justify-content: space-between; gap: 8px; padding: 8px 4px 2px; border-top: 1px solid var(--line); margin-top: 6px; position: sticky; bottom: -6px; background: var(--surface); }
.ms-foot button { font: inherit; font-size: .85rem; padding: 5px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.ms-foot .ms-done { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 560px) { .ms-menu { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; max-width: none; max-height: 60vh; } }
.ms-note { padding: 6px 8px 8px; font-size: .8rem; color: var(--ink-2); line-height: 1.35; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ms-opt input[type="checkbox"] { width: 18px; height: 18px; border-radius: 5px; background: var(--surface); border: 1.5px solid var(--ink-2); transition: background-color .15s, border-color .15s; }
.ms-opt input[type="checkbox"]::after { content: ""; top: 2px; left: 5px; width: 5px; height: 9px; border-radius: 0; background: none; box-shadow: none;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform .15s; }
.ms-opt input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.ms-opt input[type="checkbox"]:checked::after { transform: rotate(45deg) scale(1); }
.ms-opt span { color: var(--ink); }
/* 2026-12-01: source name as a small grey note in the card footer (no coloured badges at the top) */
.srcnote { color: var(--ink-2); font-size: .82em; cursor: help; border-bottom: 1px dotted currentColor; }
/* 2026-12-01: Arabic, right to left; Tamajaq (Latin) and Tifinagh stay left to right inside it */
html[dir="rtl"] body { font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif; }
html[dir="rtl"] .tam, html[dir="rtl"] .hw, html[dir="rtl"] .entryline, html[dir="rtl"] .tw, html[dir="rtl"] input[type="search"] { direction: ltr; unicode-bidi: isolate; }
html[dir="rtl"] .gloss[data-l="EN"], html[dir="rtl"] .fr.gloss { direction: ltr; text-align: right; }

/* 2026-12-01: Latin / Tifinagh / Arabic (Sahel) in any combination */
.tf-arb { display: none; font-family: 'Noto Naskh Arabic', 'Segoe UI', Tahoma, sans-serif; font-style: normal; }
body.tf-showtif .tf-tif { display: inline; margin-inline-start: .45em; color: var(--ink-2); }
body.tf-showarb .tf-arb { display: inline; margin-inline-start: .45em; color: var(--ink-2); }
body:not(.tf-showtif) .tf-tif { display: none; }
body.tf-nolat .tf-lat { display: none; }
body.tf-nolat .tf-tif, body.tf-nolat .tf-arb { color: inherit; }
body.tf-nolat .tf-showtif .tf-tif:first-of-type { margin-inline-start: 0; }
body.tf-both .hw .tf-arb { display: none; }
body.tf-showarb.tf-both .hw .tf-arb, body.tf-showarb.tf-nolat .hw .tf-arb { display: block; margin-inline-start: 0; font-size: .82em; color: var(--ink); }
body.tf-nolat .hw .tf-tif { display: none; }
body.tf-nolat.tf-showtif .hw .tf-tif { display: block; font-size: 1em; margin: 0; color: var(--ink); }
.tf-wa { font-family: 'Noto Naskh Arabic', 'Segoe UI', Tahoma, sans-serif; margin-inline-start: .35em; }
body:not(.tf-showtif) .hw .tf-tif, body:not(.tf-showtif) .tf-tif { display: none !important; }
body:not(.tf-showarb) .tf-arb { display: none !important; }
/* Scripts page */
.tf-tbl { font-family: 'Noto Sans Tifinagh', Ebrima, sans-serif; font-size: 1.25em; }
.ar-tbl { font-family: 'Noto Naskh Arabic', 'Segoe UI', Tahoma, sans-serif; font-size: 1.25em; }
.scripttbl td, .scripttbl th { text-align: center; white-space: nowrap; }
.scriptspage .lead { font-size: 1.05rem; color: var(--ink-2); }
.scriptspage .scard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 18px 0; }
.scriptspage .scard h2 { margin-top: 0; }
.scriptspage #scrtry { width: 100%; max-width: 420px; font-size: 1.2rem; padding: 8px 12px; }
.scriptspage .skeys { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.scriptspage .skeys button { min-width: 2.2em; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; font-size: 1rem; }
.scriptspage .sout { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 8px; }
.scriptspage .sbig { font-size: 2rem; line-height: 1.4; min-height: 1.4em; padding: 6px 0; }
.scriptspage .sgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 22px; }
.scriptspage .sgrid h3 { margin: 0 0 6px; }
.scriptspage .sgrid ul { margin: 0; padding-inline-start: 18px; }
.scripttbl th:first-child { text-align: center; }
.scripttbl tbody th { text-transform: none; font-size: 1.15rem; font-weight: 700; letter-spacing: 0; }

/* ---------- guide (2026-12-02: shorter, cards + folds) ---------- */
.gdoc section { margin-bottom: 30px; }
.gshort { padding-left: 1.2em; line-height: 1.6; max-width: 80ch; }
.gshort li { margin: 4px 0; }
.gsteps { padding-left: 1.4em; line-height: 1.7; }
.gsteps li { margin: 3px 0; }
.gcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin: 10px 0; }
.gcard { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.gcard p { margin: 3px 0 0; font-size: .9rem; color: var(--ink-2); }
.gic { flex: 0 0 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .95rem; }
.gfold { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; margin: 8px 0; }
.gfold summary { cursor: pointer; font-weight: 700; }
.gfold[open] summary { margin-bottom: 8px; }
.gdoc table.t td:first-child { white-space: normal; min-width: 90px; }

.wsy{font-size:.68em;margin-inline-start:.3em;opacity:.7;font-weight:500;letter-spacing:.02em}

/* text boxes outside the search bar (Scripts page "Try a word", Pronunciation): theme colours, readable in dark mode */
input.inp, .pronpage input[type=text], .scriptspage input[type=text] {
  font: 1.2rem var(--tam); padding: 11px 14px; color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 10px; width: 100%; box-sizing: border-box;
}
input.inp:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
