/* Uses logical sides (inline-start/end) everywhere so the Arabic interface mirrors right-to-left. */

/* ---------- Shared pieces ---------- */
.p1 { --pc: var(--r1); } .p2 { --pc: var(--r2); } .p3 { --pc: var(--r3); }
.p4 { --pc: var(--r4); } .p5 { --pc: var(--r5); } .p6 { --pc: var(--r6); }

.panel { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; margin: 0 0 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.panel-head h2 { margin: 0; }
.panel p { margin: 0 0 10px; }

.meter { display: block; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 8px 0; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border: 2px solid var(--ink); border-radius: 10px;
  background: transparent; color: var(--ink); font-weight: 800; font-size: 16px; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn[aria-pressed="true"], .btn-primary { background: var(--strong-bg); border-color: var(--strong-bg); color: var(--strong-ink); }
.btn-primary:hover { background: var(--strong-bg); opacity: .9; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.flag {
  display: inline-block; vertical-align: 2px; margin: 0 4px;
  padding: 1px 7px; border: 1.5px solid var(--flag); border-radius: 6px;
  color: var(--flag); font-size: 12.5px; font-weight: 800; white-space: nowrap;
}
.flag-note { margin: 0; padding: 8px 14px; border-top: 1.5px dashed var(--flag); color: var(--flag); font-size: 15px; }

.play {
  flex: 0 0 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--strong-bg); color: var(--strong-ink); font-size: 13px;
}
.no-tts .play, .no-tts .word-say { display: none; }

/* A word's languages after its Najdi Arabic: meaning in the interface language, the others, formal Arabic */
.m1 { display: block; color: var(--ink); }
.m2, .msa { display: block; color: var(--muted); font-size: 15px; }
.m2 i, .msa i { font-style: normal; font-weight: 800; font-size: 12px; letter-spacing: .05em; margin-inline-end: 6px; text-transform: uppercase; }
.msa .ar { font-size: 18px; }
.tr { font-weight: 800; }

.now-tag {
  display: inline-block; vertical-align: 3px; margin-inline-start: 6px; padding: 2px 8px;
  border-radius: 6px; background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 800;
}
.hint { color: var(--muted); max-width: 70ch; }
.checks { margin: 0; padding-inline-start: 20px; }
.checks li { margin: 0 0 8px; }

/* ---------- The parapet: the whole plan as a row of Najdi rooftop crenellations, one per week ---------- */
.parapet { margin: 18px 0 6px; }
.parapet svg { display: block; width: 100%; height: auto; overflow: visible; }
.parapet .wk { fill: var(--viz-future); }
.parapet .wk.done { fill: var(--pc, var(--accent)); }
.parapet .wk.empty { opacity: .45; }
.parapet .wk.now { fill: var(--pc, var(--accent)); stroke: var(--ink); stroke-width: 2; }
.parapet .wk:hover, .parapet .wk:focus-visible { stroke: var(--ink); stroke-width: 2; outline: none; }
.parapet .base { fill: var(--trim); opacity: .9; }
.parapet-labels { position: relative; height: 40px; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.parapet-labels span { position: absolute; top: 0; white-space: nowrap; }
/* The Script stage is only two weeks wide: its label sits on a second line so it never runs into Stage 1 */
.parapet-labels span:first-child { top: 18px; }
.parapet-labels .is-now { color: var(--ink); }
@media (max-width: 560px) {
  .parapet-labels span:not(.is-now, [data-short=""]) { font-size: 0; }
  .parapet-labels span:not(.is-now, [data-short=""])::before { content: attr(data-short); content: attr(data-short) / ""; font-size: 13px; }
}
.parapet-caption { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

/* ---------- Stat tiles ---------- */
.stat-pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 14px; }
.stat-pairs dt { color: var(--muted); font-size: 14px; font-weight: 700; }
.stat-pairs dd { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat-pairs dd small { font-size: 15px; color: var(--muted); font-weight: 700; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 0 0 18px; }
@media (min-width: 1250px) { .stats-row { grid-template-columns: 1.7fr repeat(5, 1fr); } }
.stat { background: var(--surface); border-radius: 14px; padding: 14px 16px; }
.stat dt { color: var(--muted); font-size: 14px; font-weight: 700; }
.stat dd { margin: 2px 0 0; font-size: 32px; font-weight: 800; line-height: 1.1; }
.stat dd small { font-size: 15px; color: var(--muted); font-weight: 700; }
.stat .meter { margin-bottom: 0; }
.stat.hero dd { font-size: 52px; }

/* ---------- Charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; max-height: 260px; overflow: visible; }
.chart .grid { stroke: var(--viz-grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 600 calc(12px * var(--k, 1)) var(--font-ui); }
html[dir="rtl"] .chart .axis { font-family: var(--font-ui-ar); }
.chart .bar { fill: var(--viz-bar); pointer-events: none; }
.chart .col { outline: none; }
.chart .col:hover .bar, .chart .col:focus-visible .bar { opacity: .72; }
.chart .col:focus-visible .hit { stroke: var(--ink); stroke-width: 1.5; }
.chart .bar.deemph { fill: var(--viz-deemph); }
.chart .goal { stroke: var(--ink); stroke-width: 1; opacity: .55; }
.chart .goal-label { fill: var(--muted); font: 700 calc(12px * var(--k, 1)) var(--font-ui); }
.chart .hit { fill: transparent; cursor: default; }
.chart .value-label { fill: var(--ink); font: 700 12px var(--font-ui); }
.chart-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 0 20%; text-align: center; color: var(--muted); font-weight: 700; pointer-events: none;
}
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 700; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--viz-bar); }
.chart-legend i.deemph { background: var(--viz-deemph); }
.chart-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; }
.table-details { margin-top: 6px; }
.table-details summary { cursor: pointer; color: var(--accent); font-weight: 700; font-size: 14px; }
.table-details[open] .when-closed, .table-details:not([open]) .when-open { display: none; }
.data-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: start; }
.data-table td.num, .data-table th.num { text-align: end; }
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; min-width: 120px; max-width: 260px;
  padding: 8px 10px; border-radius: 10px; background: var(--ink); color: var(--bg);
  font-size: 14px; line-height: 1.35; box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.tooltip b { display: inline; margin-inline-end: 8px; }
.tooltip .tip-key { display: inline-block; width: 12px; height: 3px; margin-inline-end: 6px; vertical-align: middle; border-radius: 2px; background: var(--viz-bar); }
.tooltip .tip-key:empty:not(.deemph) { background: transparent; width: 0; margin: 0; }
.tooltip .tip-key.deemph { background: var(--viz-deemph); }
.tooltip .tip-title { margin-top: 2px; opacity: .8; font-size: 13px; }

/* ---------- Today ---------- */
.today { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.focus { font-size: 20px; font-weight: 700; margin: 6px 0 10px; }
.focus-letters {
  display: inline-block; margin: 0 0 12px; padding: 4px 16px 10px;
  border-radius: 12px; background: var(--tile); color: var(--ink); text-decoration: none;
  font-size: 40px; font-weight: 400; line-height: 1.5;
}
.tasks { list-style: none; margin: 0; padding: 0; }
.task {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 72px; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1.5px solid var(--line);
}
.task label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.task input { flex: 0 0 auto; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.task.is-done .task-text { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.task.is-next { background: linear-gradient(to var(--end-side, right), color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%); border-radius: 8px; }
html[dir="rtl"] { --end-side: left; }
.task-min { color: var(--muted); font-size: 15px; white-space: nowrap; }
.task-go { justify-self: end; font-size: 15px; }
.day-done {
  display: flex; align-items: center; gap: 12px; margin: 12px 0 0; padding: 12px 14px;
  border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); font-weight: 800;
}
.day-done span { font-size: 22px; color: var(--accent); }
.weekly { margin-top: 12px; padding-top: 12px; border-top: 1.5px solid var(--line); font-size: 16px; }
.weekly ul { margin: 4px 0 0; padding-inline-start: 20px; }
.weekly li { margin: 0 0 3px; }

.timer .clock { margin: 4px 0 0; font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.timer .btn-primary { width: 100%; margin: 8px 0 10px; padding: 12px; }
.timer .btn-row .btn { flex: 1; }
.ring-wrap { display: flex; align-items: center; gap: 14px; }
.ring { flex: 0 0 auto; }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }

.nudge { margin-top: 14px; padding-top: 14px; border-top: 1.5px solid var(--line); }
.nudge p { margin: 0 0 8px; font-weight: 700; }
.nudge .btn { flex: 1; padding: 6px 8px; font-size: 15px; }
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 40px; margin: 8px 0 2px; }
.mini-bars span { flex: 1; min-height: 3px; border-radius: 3px 3px 0 0; background: var(--viz-bar); }
.mini-bars span.zero { background: var(--viz-future); }
.mini-bars span:hover, .mini-bars span:focus-visible { opacity: .75; outline: none; }

/* ---------- Phrases ---------- */
.phrase-list { display: grid; gap: 10px; }
.phrase-row { background: var(--surface); border-radius: 14px; overflow: hidden; }
.phrase {
  display: flex; align-items: center; gap: 18px; width: 100%;
  padding: 12px 16px; border: 0; border-radius: 12px; background: var(--bg); text-align: start;
}
.phrase-row .phrase { background: transparent; border-radius: 0; }
.phrase:hover { background: var(--surface-2); }
/* Arabic sits on its own right edge, next to its pronunciation, in both interface directions. */
.phrase-ar { flex: 0 0 auto; min-width: 170px; font-size: 30px; line-height: 1.5; text-align: right; }
.phrase-t { flex: 1; }
.phrase-t b { font-size: 18px; }
.pnote { display: block; margin-top: 2px; font-size: 15px; color: var(--muted); font-style: italic; }
.ua { margin: 6px 0 0; font-weight: 700; }
.ua > span { font-weight: 400; color: var(--muted); margin-inline-end: 6px; }
.pday { margin: 0 0 26px; }
.pday .phrase-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 560px), 1fr)); }
.pday h2 { font-size: 20px; }
.pday.is-today .phrase-row { border-inline-start: 4px solid var(--accent); }

/* ---------- Letters ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.chip {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 6px 12px 5px; border: 1.5px solid var(--line); border-radius: 999px; background: transparent;
}
.chip:hover { border-color: var(--ink); }
.chip .d { font-size: 14px; font-weight: 700; color: var(--muted); }
.chip .ar { font-size: 20px; line-height: 1; }
.chip .ok { font-size: 13px; font-weight: 800; color: var(--good); }
.chip .now { font-size: 12px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.chip[aria-pressed="true"] { background: var(--strong-bg); border-color: var(--strong-bg); color: var(--strong-ink); }
.chip[aria-pressed="true"] .d, .chip[aria-pressed="true"] .ok, .chip[aria-pressed="true"] .now { color: inherit; opacity: .8; }

.gintro { margin: 0 0 16px; }
.gintro h2 { margin: 0; font-size: 26px; }
.gintro p { margin: 4px 0 0; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.top { display: flex; gap: 14px; padding: 14px; flex: 1; }
.glyph {
  flex: 0 0 96px; height: 108px; padding-bottom: 10px; border: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tile); color: var(--ink); font-size: 74px; line-height: 1;
}
.meta { flex: 1; min-width: 0; }
.name { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.name b { font-size: 22px; font-weight: 800; }
.name .ar { font-size: 20px; color: var(--muted); }
.tag { font-size: 13px; font-weight: 700; padding: 1px 8px; border-radius: 6px; border: 1.5px solid currentColor; }
.tag.h { color: var(--hard); }
.tag.nc { color: var(--muted); }
.sound { margin: 4px 0 0; }

/* The forms row is always Arabic order (start form on the right), whatever the interface language. */
.forms { display: flex; direction: rtl; border-top: 1.5px solid var(--line); }
.forms div { flex: 1; text-align: center; padding: 8px 4px 10px; border-left: 1.5px solid var(--line); }
.forms div:last-child { border-left: 0; }
.forms .ar { display: block; font-size: 36px; line-height: 1.5; }
.forms small { display: block; unicode-bidi: plaintext; font-size: 13px; color: var(--muted); }

.ex {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px;
  border: 0; border-top: 1.5px solid var(--line); background: transparent; text-align: start;
}
.ex:hover, .vrow:hover { background: var(--surface-2); }
.ex > .ar { font-size: 30px; line-height: 1.4; }
.ex .t { flex: 1; }
.ex .t b { font-size: 17px; }

.najdi { background: var(--accent); color: var(--accent-ink); padding: 10px 14px; font-size: 16px; }
.najdi b { font-weight: 800; }

.done {
  width: 100%; max-width: 420px; margin: 4px 0 10px; padding: 13px;
  border: 2px solid var(--ink); border-radius: 12px; background: transparent; font-weight: 800; font-size: 17px;
}
.done[aria-pressed="true"] { background: var(--strong-bg); border-color: var(--strong-bg); color: var(--strong-ink); }

/* ---------- Vowels ---------- */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.vsec { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.vsec h2 { margin: 0 0 4px; font-size: 21px; }
.vsec > p { margin: 0 0 10px; color: var(--muted); }
.vrow {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 9px 4px;
  border: 0; border-top: 1.5px solid var(--line); background: transparent; text-align: start;
}
.vrow > .ar { flex: 0 0 64px; text-align: center; font-size: 38px; line-height: 1.5; }
.vrow .t { flex: 1; }
.vrow .t b { display: block; }
.vrow .t span { color: var(--muted); font-size: 15px; }

/* ---------- Quiz ---------- */
.quiz { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.qglyph {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 340px; border-radius: 18px; background: var(--tile);
}
.qglyph .ar { font-size: 150px; line-height: 1.2; }
.qglyph small { color: var(--ink); opacity: .75; font-weight: 700; font-size: 15px; }
.qhead { display: flex; justify-content: space-between; margin: 0 0 10px; color: var(--muted); }
.qhead p { margin: 0; }
.qhead b { color: var(--ink); font-size: 18px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt {
  position: relative; padding: 16px 8px; border: 2px solid var(--line); border-radius: 12px;
  background: var(--surface); text-align: center;
}
.opt:not(:disabled):hover { border-color: var(--ink); }
.opt kbd { position: absolute; top: 8px; inset-inline-start: 8px; }
.opt b { display: block; font-size: 24px; }
.opt span { font-size: 14px; color: var(--muted); }
.opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--surface)); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, var(--surface)); }
.fb { min-height: 52px; margin: 12px 0 0; font-size: 16px; }
.next {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px;
  border: 0; border-radius: 12px; background: var(--strong-bg); color: var(--strong-ink); font-weight: 800; font-size: 17px;
}
.next kbd { color: inherit; border-color: currentColor; opacity: .7; }

/* ---------- Reading ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar p { margin: 0; }
.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.word { background: var(--surface); border-radius: 14px; overflow: hidden; }
.word.is-locked { opacity: .55; }
.word-ar {
  width: 100%; padding: 14px 10px 18px; border: 0; background: transparent;
  font-family: var(--font-ar); font-size: 42px; line-height: 1.4;
}
.word-ar:hover { background: var(--surface-2); }
.word-back { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1.5px solid var(--line); }
.word-back b { font-size: 17px; }
.word-say { padding: 0; border: 0; background: none; }
.word .flag-note { font-size: 14px; }

/* ---------- Words (vocabulary) ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 4px; border-radius: 12px; background: var(--surface); width: fit-content; }
.tabs button { padding: 8px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 800; }
.tabs button[aria-selected="true"] { background: var(--strong-bg); color: var(--strong-ink); }
.topic { margin: 0 0 22px; }
.topic h2 { font-size: 20px; }
.vocab { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 10px; }
.vocab .phrase { background: var(--surface); }
.to-her { display: block; margin-top: 3px; font-size: 15px; }
.to-her .ar { font-size: 20px; }
.anki { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.anki ol { margin: 6px 0 0; padding-inline-start: 20px; }
.anki-downloads { flex-direction: column; align-items: stretch; }
.trap { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; padding: 10px 14px; }
.trap-side { display: flex; flex-direction: column; gap: 4px; }
.trap .phrase { padding: 6px 0; background: transparent; }
.strike { text-decoration: line-through; text-decoration-color: var(--bad); text-decoration-thickness: 2px; opacity: .75; }
.anki li { margin: 0 0 4px; }

/* ---------- Calendar (study heatmap) ---------- */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0 0 10px; font-size: 15px; color: var(--muted); font-weight: 700; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.heat-scale { display: inline-flex; gap: 3px; }
.sw, .ring-key, .heat-key { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.heat-key.l0 { box-shadow: inset 0 0 0 1.5px var(--line); }
.heat-key.l1, .cal-day.l1 { background: color-mix(in srgb, var(--viz-bar) 25%, var(--surface)); }
.heat-key.l2, .cal-day.l2 { background: color-mix(in srgb, var(--viz-bar) 50%, var(--surface)); }
.heat-key.l3, .cal-day.l3 { background: color-mix(in srgb, var(--viz-bar) 78%, var(--surface)); color: var(--surface); }
.heat-key.l4, .cal-day.l4 { background: var(--viz-bar); color: var(--surface); }
.ring-key { box-shadow: inset 0 0 0 2px var(--ink); }
.miss-key { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1.5px dashed var(--bad); }
.stage-key { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); opacity: .6; }

.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; margin-top: 18px; }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.month { background: var(--surface); border-radius: 14px; padding: 12px; }
.month h2 { margin: 0; color: var(--ink); letter-spacing: 0; text-transform: none; font-size: 17px; }
.month .stage-names { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-wd { text-align: center; font-size: 12px; font-weight: 800; color: var(--muted); padding-bottom: 2px; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 0;
  border: 1.5px solid transparent; border-radius: 7px; background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.cal-day.l1, .cal-day.l2, .cal-day.l3, .cal-day.l4 { box-shadow: none; }
button.cal-day:hover { border-color: var(--ink); }
.cal-day.is-out { box-shadow: none; color: var(--muted); opacity: .4; }
.cal-day.s-missed { box-shadow: none; border: 1.5px dashed var(--bad); color: var(--muted); }
.cal-day.stage-start { position: relative; }
.cal-day.stage-start::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); opacity: .6; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--ink); }
.cal-day.is-selected { outline: 3px solid var(--accent); outline-offset: 1px; }

.detail { position: sticky; top: 24px; }
.detail h2 { margin: 0 0 2px; font-size: 28px; }
.detail .focus { font-size: 18px; }
.detail-status { display: inline-block; margin: 4px 0 8px !important; padding: 2px 10px; border-radius: 6px; font-weight: 800; font-size: 14px; background: var(--surface-2); }
.detail-status.s-done { background: var(--viz-bar); color: var(--surface); }
.detail-tasks { margin: 0 0 12px; padding: 0; list-style: none; font-size: 15px; }
.detail-tasks li { padding: 6px 0; border-top: 1.5px solid var(--line); }
.detail-tasks label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.detail-tasks label > span { min-width: 0; }
.detail-tasks input { margin-top: 3px; accent-color: var(--accent); }
.backup { margin-top: 22px; max-width: 720px; }
.backup label.btn { cursor: pointer; }
.backup h3 { margin-top: 18px; }
.cloud { margin-bottom: 8px; }
.cloud-status { font-weight: 700; }
.cloud-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.cloud-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 15px; }
.cloud-form input { min-width: 280px; padding: 9px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; }
.cloud-form input:focus-visible { border-color: var(--accent); }

/* ---------- Plan ---------- */
.plan-intro { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.plan-intro .panel { margin: 0; }
.big { font-size: 20px; }
.phases { list-style: none; margin: 22px 0; padding: 0; display: grid; gap: 14px; }
.phase { background: var(--surface); border-radius: var(--radius); padding: 18px 22px; border-inline-start: 6px solid var(--pc); }
.phase.is-now { box-shadow: 0 0 0 2px var(--pc); }
.phase.is-past .phase-n { background: var(--viz-deemph); }
.phase-head { display: flex; gap: 14px; align-items: center; }
.phase-head h2 { margin: 0; }
.phase-head p { margin: 2px 0 0; }
.phase-n {
  flex: 0 0 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--pc); color: var(--surface); font-size: 20px; font-weight: 800;
}
.phase .meter > span { background: var(--pc); }
.phase-focus { margin: 10px 0 6px; font-size: 19px; font-weight: 700; }

/* ---------- Progress ---------- */
.progress-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.progress-grid .panel { margin: 0; }
.progress-grid .wide { grid-column: 1 / -1; }
.meters { display: grid; gap: 12px; }
.meters dt { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; }
.meters dt span { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.meters dd { margin: 0; }
.stage-bar { position: relative; display: flex; gap: 2px; height: 22px; margin: 10px 0 4px; } /* the today mark is placed inside it */
.stage-bar div { position: relative; background: var(--pc); border-radius: 4px; }
.stage-bar .today-mark { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.stage-names-row { display: flex; gap: 2px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.stage-names-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Narrow windows ---------- */
@media (max-width: 1100px) {
  .today, .cal-layout, .progress-grid { grid-template-columns: 1fr; }
  .detail { position: static; }
}
@media (max-width: 760px) {
  .plan-intro, .quiz, .anki { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .qglyph { height: 220px; }
  .qglyph .ar { font-size: 110px; }
  .phrase { flex-wrap: wrap; gap: 8px 14px; }
  .phrase-ar { min-width: 0; }
  .task { grid-template-columns: minmax(0, 1fr) auto; }
  .task-go { grid-column: 1 / -1; justify-self: start; margin-inline-start: 32px; }
}

/* ======================================================================================================
   Art: the Najdi scene on Today, the page illustrations, and the Sadu weave band (core/art.js)
   ====================================================================================================== */
.a-sky-top { stop-color: var(--sky-top); }
.a-sky-bottom { stop-color: var(--sky-bottom); }
.a-sun { fill: var(--art-sun); }
.a-sun-glow { fill: var(--art-sun-glow); }
.a-moon path { fill: var(--art-moon); }
.a-moon-glow { fill: var(--art-moon); opacity: .12; }
.a-star { fill: var(--art-star); }
.a-star.twinkle { animation: twinkle 3.2s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .25; } }
.a-far { fill: var(--art-far); opacity: .55; }
.a-far .a-far-ball { fill: var(--art-far-ball); opacity: .9; }
.a-dune-far { fill: var(--art-sand-far); }
.a-dune { fill: var(--art-sand); }
.a-ground { fill: var(--art-ground); }
.a-wall { fill: var(--art-wall); }
.a-wall-shade { fill: var(--art-wall-shade); }
.a-band { fill: var(--art-band); }
.a-vent { fill: var(--art-vent); }
.a-door path:first-child, .a-door { fill: var(--art-door); }
.a-door-paint { fill: var(--art-door-paint); }
.a-trunk { fill: var(--art-trunk); }
.a-trunk-line { stroke: var(--art-trunk-line); stroke-width: 1.2; fill: none; }
.a-frond { fill: var(--art-palm); }
.a-dates circle { fill: var(--art-dates); }
.a-brass { fill: var(--art-brass); }
.a-brass-shade { fill: var(--art-brass-shade); }
.a-brass-dark { fill: var(--art-brass-dark); stroke: var(--art-brass-dark); }
.a-shine { fill: var(--art-shine); opacity: .8; }
.a-shadow { fill: var(--art-shadow); }
.a-cup { fill: var(--art-cup); }
.a-cup-band { fill: var(--art-cup-band); }
.a-steam { fill: none; stroke: var(--art-steam); stroke-width: 1.6; stroke-linecap: round; }
.a-moon-solid { fill: var(--art-brass); }
.a-star-solid { fill: var(--art-brass); }
.a-path { fill: none; stroke: var(--art-wall-shade); stroke-width: 2.2; stroke-dasharray: 1 6; stroke-linecap: round; }
.a-flag { fill: var(--art-green); }
.a-flag-pole { stroke: var(--art-vent); stroke-width: 1.6; }
.a-paper { fill: var(--art-paper); stroke: var(--art-rule); stroke-width: 1; }
.a-paper-shadow { fill: var(--art-shadow); }
.a-rule { stroke: var(--art-rule); stroke-width: 1.2; fill: none; }
.a-ar { font-family: var(--font-ar); font-size: 17px; direction: rtl; }
.a-ink { fill: var(--art-ink); }
.a-trace { fill: var(--art-trace); }
.a-green { fill: var(--art-green); }
.a-cream { fill: var(--art-cream); }
.a-big { font-size: 58px; }
.a-huge { font-size: 96px; }
.a-qalam { fill: var(--art-trunk); }
.a-qalam-tip { fill: var(--art-vent); }
.a-ink-pot { fill: var(--art-green); }
.a-card { fill: var(--art-paper); stroke: var(--art-rule); stroke-width: 1.2; }
.a-card-back { fill: var(--art-green); opacity: .85; }
.a-card-trim { fill: var(--art-brass); }
.a-book { fill: var(--art-paper); stroke: var(--art-rule); stroke-width: 1.2; }
.a-book-2 { fill: var(--art-paper); stroke: var(--art-rule); stroke-width: 1.2; }
.a-sadu { fill: var(--sadu-red); }
.a-arch { fill: var(--art-green); }
.a-lamp-glow { fill: none; }
.vignette { display: block; overflow: visible; }

/* Al Sadu — the Bedouin weave: red ground, rows of "teeth" and diamond "eyes" */
.sadu {
  height: 14px;
  background-color: var(--sadu-red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Cpath fill='%23231A14' d='M0 0h28v2H0zM0 12h28v2H0z'/%3E%3Cpath fill='%23F3E7CF' d='M0 2l3.5 3L7 2l3.5 3L14 2l3.5 3L21 2l3.5 3L28 2zM0 12l3.5-3L7 12l3.5-3L14 12l3.5-3L21 12l3.5-3L28 12zM14 3.5L18 7l-4 3.5L10 7z'/%3E%3Cpath fill='%23231A14' d='M14 5.5L15.6 7 14 8.5 12.4 7z'/%3E%3Cpath fill='%23006C35' d='M0 6.2h4v1.6H0zM24 6.2h4v1.6h-4z'/%3E%3C/svg%3E");
  background-size: 28px 14px;
  background-repeat: repeat-x;
}

/* ---------- Today: the scene ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 250px; margin: 0 0 14px; border-radius: 22px;
  background: var(--sky-bottom); color: var(--hero-ink);
}
.hero .scene { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
html[dir="rtl"] .hero .scene { transform: scaleX(-1); }
.hero::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 12px; background: inherit; }
.hero-text { position: relative; padding: 26px 30px 56px; max-width: 560px; }
.hero .eyebrow { color: var(--hero-muted); }
.hero h1 { font-size: 46px; }
.hero h1 .of { color: var(--hero-muted); }
.hero-sub { margin: 6px 0 14px; color: var(--hero-muted); font-size: 18px; font-weight: 700; }
.greet {
  display: inline-flex; align-items: center; gap: 12px; padding: 8px 14px 8px 16px; border: 0; border-radius: 16px;
  background: color-mix(in srgb, var(--sky-bottom) 70%, transparent); color: var(--hero-ink); text-align: start;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hero-ink) 12%, transparent);
  transition: transform .15s ease;
}
.greet:hover { transform: translateY(-1px); }
.greet:active { transform: scale(.98); }
.greet-ar { font-size: 30px; line-height: 1.3; white-space: nowrap; }
.greet-t { display: flex; flex-direction: column; line-height: 1.25; font-size: 15px; }
.greet-t > span { color: var(--hero-muted); }
.greet-t small { color: var(--hero-muted); font-size: 13px; }
.greet-t small .ar { font-size: 16px; }
.greet > .i { width: 22px; height: 22px; opacity: .8; }

/* ---------- Page illustrations sit in the heading (core/dom.js pageHead) ---------- */
.page-head.has-art .page-head-text { padding-bottom: 2px; }

/* ---------- Buttons: sizes ---------- */
.btn { transition: background-color .15s ease, border-color .15s ease, transform .1s ease; }
.btn:active { transform: scale(.98); }
.btn .i { width: 18px; height: 18px; }
.btn-big { padding: 13px 22px; font-size: 18px; border-radius: 12px; }
.btn-wide { width: 100%; padding: 12px; }
.btn-small { padding: 5px 11px; font-size: 14.5px; border-width: 1.5px; border-radius: 9px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.linkish { padding: 0; border: 0; background: none; color: var(--muted); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--ink); }
.btn-row.center { justify-content: center; }
.play .i { width: 17px; height: 17px; }
.callout { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--flag) 12%, var(--surface)); color: var(--ink); max-width: 90ch; }
.callout .i { color: var(--flag); margin-top: 2px; }
.empty-note { padding: 18px; border-radius: 14px; background: var(--surface); color: var(--muted); font-weight: 700; }

/* ---------- Today: cards panel, timer, stats ---------- */
.today-cards h2 .i, .timer h2 .i { color: var(--accent); vertical-align: -3px; }
.due-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 14px; }
.due-counts > div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.due-counts dt { font-size: 13.5px; font-weight: 800; color: var(--muted); }
.due-counts dd { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.due-counts .c-new dd { color: var(--c-new); }
.due-counts .c-learn dd { color: var(--c-learn); }
.due-counts .c-due dd { color: var(--c-due); }
.due-counts.compact dd { font-size: 26px; }
.all-done { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-weight: 800; color: var(--good); }
.stat-pairs dt { display: flex; align-items: center; gap: 6px; }
.stat-pairs dt .i { width: 16px; height: 16px; color: var(--accent); }
.stat-pairs dd, .stat dd { font-variant-numeric: tabular-nums; }
.timer.is-running .clock { color: var(--accent); }
.day-done .i { color: var(--accent); }
.task-go { display: inline-flex; align-items: center; gap: 4px; }
.task-go .i { width: 16px; height: 16px; }

/* Words you know, on the way to 1000 */
.words-meter { margin-top: 4px; }
.words-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.words-big b { font-size: 38px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.words-big span { color: var(--muted); font-weight: 700; }
.wm-track { position: relative; display: flex; height: 12px; margin: 0 0 22px; border-radius: 99px; background: var(--line); }
.wm-track > span { height: 100%; }
.wm-strong { background: var(--r5); border-start-start-radius: 99px; border-end-start-radius: 99px; }
.wm-learned { background: var(--r2); }
.wm-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--muted); font-style: normal; }
.wm-mark b { position: absolute; top: 18px; transform: translateX(-50%); font-size: 12px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
html[dir="rtl"] .wm-mark b { transform: translateX(50%); }
.wm-mark:last-child b { transform: translateX(-100%); }
html[dir="rtl"] .wm-mark:last-child b { transform: translateX(100%); }
.wm-mark.is-passed { background: var(--accent); }
.wm-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: 14px; font-weight: 700; }
.wm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wm-key { width: 12px; height: 12px; border-radius: 3px; }
.wm-key.strong { background: var(--r5); }
.wm-key.learned { background: var(--r2); }

/* ======================================================================================================
   Cards (spaced repetition)
   ====================================================================================================== */
.cards-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 28px; align-items: center; }
.cards-today h2 { margin-bottom: 4px; }
.decks { width: 100%; border-collapse: collapse; margin-top: 6px; }
.decks th, .decks td { padding: 12px 10px; border-top: 1.5px solid var(--line); text-align: start; vertical-align: middle; }
.decks thead th { border-top: 0; padding-top: 4px; font-size: 13.5px; color: var(--muted); font-weight: 800; }
.decks .num { width: 90px; text-align: center; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.decks thead .num { font-size: 13.5px; }
.decks .c-new { color: var(--c-new); }
.decks .c-learn { color: var(--c-learn); }
.decks .c-due { color: var(--c-due); }
.deck-name { display: block; font-weight: 800; font-size: 17px; }
.deck-size { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; font-weight: 700; }
.deck-size .i { width: 14px; height: 14px; }
.decks tr.is-locked .deck-name { color: var(--muted); }
.deck-go { width: 90px; text-align: end; }
.cards-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.cards-foot .panel { margin: 0; }
details.panel > summary { list-style: none; cursor: pointer; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
details.panel > summary h2::after { content: "+"; margin-inline-start: auto; color: var(--muted); font-weight: 700; }
details.panel[open] > summary h2::after { content: "−"; }
details.panel[open] > summary { margin-bottom: 12px; }
.settings-form { display: grid; gap: 14px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; }
.field input { width: 90px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); text-align: center; font-size: 17px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: 0 0 auto; }
.check small { display: block; color: var(--muted); font-weight: 400; font-size: 14.5px; }
.keys { color: var(--muted); font-size: 14.5px; }

/* Studying: one card at a time, centred like Anki */
.study-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -6px 0 18px; }
.study-deck { margin: 0; font-weight: 800; color: var(--muted); }
.study-counts { display: flex; gap: 14px; margin: 0 0 0 auto; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
html[dir="rtl"] .study-counts { margin: 0 auto 0 0; }
.study-counts .c-new { color: var(--c-new); }
.study-counts .c-learn { color: var(--c-learn); }
.study-counts .c-due { color: var(--c-due); }
.study-counts .is-now { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.study-card {
  position: relative; max-width: 760px; min-height: 340px; margin: 0 auto; padding: 22px 28px 30px;
  border-radius: 24px; background: var(--surface); text-align: center;
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px color-mix(in srgb, var(--ink) 35%, transparent);
}
.study-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 8px; border-radius: 24px 24px 0 0; background: inherit; }
.study-card.kind-p { background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(135deg, var(--c-new), var(--accent)) border-box; border: 2px solid transparent; }
.study-kind { margin: 0 0 8px; color: var(--muted); font-weight: 800; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
html[dir="rtl"] .study-kind { letter-spacing: 0; text-transform: none; }
.study-kind { padding-inline: 56px; }
.study-front { min-height: 150px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.study-ar { margin: 0; line-height: 1.5; }
.study-ar .ar { font-size: 44px; }
.study-ar.big .ar { font-size: clamp(52px, 8vw, 84px); }
.study-meaning { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.2; }
.study-meaning-2 { margin: 6px 0 0; color: var(--muted); font-size: 18px; }
.study-meaning-2 i { font-style: normal; font-weight: 800; font-size: 12px; letter-spacing: .05em; margin-inline-end: 6px; }
.study-prompt { margin: 14px 0 0; color: var(--muted); font-weight: 700; }
.study-back hr { width: 60%; margin: 18px auto; border: 0; border-top: 1.5px dashed var(--line); }
.study-back > * { animation: rise .2s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.study-say { margin: 0 0 8px; font-size: 24px; }
.study-say .tr { font-weight: 800; }
.study-back .study-meaning { font-size: 26px; }
.study-msa { margin: 12px 0 0; color: var(--muted); font-size: 15px; }
.study-msa i { font-style: normal; font-weight: 800; font-size: 12px; letter-spacing: .05em; margin-inline-end: 6px; text-transform: uppercase; }
.study-msa .ar { font-size: 22px; }
.study-extra { margin: 8px 0 0; font-size: 16px; }
.study-extra .ar { font-size: 22px; }
.study-note { margin: 8px auto 0; max-width: 56ch; color: var(--muted); font-style: italic; font-size: 15.5px; }
.hear {
  position: absolute; top: 16px; inset-inline-end: 16px; width: 48px; height: 48px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--strong-bg); color: var(--strong-ink);
}
.hear .i { width: 22px; height: 22px; }
.study-actions { max-width: 760px; margin: 18px auto 0; }
.show-answer { width: 100%; justify-content: center; gap: 12px; }
.show-answer kbd { color: inherit; border-color: currentColor; opacity: .7; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grade {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px 12px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--surface); position: relative;
  transition: border-color .15s ease, background-color .15s ease, transform .1s ease;
}
.grade:active { transform: scale(.97); }
.grade b { font-size: 18px; }
.grade-ivl { font-size: 14px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.grade kbd { position: absolute; top: 6px; inset-inline-start: 6px; font-size: 11px; padding: 2px 5px; }
.grade.again { --gc: var(--c-learn); }
.grade.hard { --gc: var(--hard); }
.grade.good { --gc: var(--c-due); }
.grade.easy { --gc: var(--c-new); }
.grade b { color: var(--gc); }
.grade:hover, .grade:focus-visible { border-color: var(--gc); background: color-mix(in srgb, var(--gc) 8%, var(--surface)); }
.study-more { max-width: 760px; margin: 16px auto 0; display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; }
.finished { max-width: 560px; margin: 10px auto; text-align: center; }
.finished .vignette { width: 220px; height: 165px; margin: 0 auto 6px; }
.finished .sub { margin-inline: auto; }
@media (hover: none) { .study-more .muted, .grade kbd, .show-answer kbd { display: none; } }

/* ---------- Word list: search, badges ---------- */
.words-tools { display: flex; gap: 12px; align-items: center; margin: 0 0 16px; }
.search {
  flex: 1; max-width: 560px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--muted);
}
.search:focus-within { border-color: var(--accent); color: var(--accent); }
.search input { flex: 1; min-width: 0; padding: 12px 0; border: 0; background: transparent; color: var(--ink); font-size: 17px; outline: none; }
.search input::placeholder { color: var(--muted); opacity: .85; }
.tabs a { padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 800; text-decoration: none; display: inline-flex; align-items: center; }
.tabs a[aria-selected="true"], .tabs a[aria-current="page"] { background: var(--strong-bg); color: var(--strong-ink); }
.tabs a:hover:not([aria-selected="true"], [aria-current="page"]) { background: var(--surface-2); color: var(--ink); }
.topic { content-visibility: auto; contain-intrinsic-size: auto 600px; }
.topic h2 .muted { font-weight: 700; }
.wstate { display: inline-flex; align-items: center; gap: 3px; margin: 0 4px; padding: 1px 7px; border-radius: 6px; font-size: 12.5px; font-weight: 800; vertical-align: 2px; background: var(--surface-2); color: var(--muted); }
.wstate .i { width: 13px; height: 13px; }
.wstate.learned, .wstate.strong { color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--surface)); }
.in-stage { display: block; margin-bottom: 2px; font-size: 12.5px; font-weight: 800; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.anki { margin-top: 24px; }
.anki-downloads .btn { justify-content: flex-start; }

/* ---------- Printables: the list ---------- */
.print-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 16px; margin-bottom: 18px; }
.print-item { display: flex; gap: 16px; padding: 20px; border-radius: var(--radius); background: var(--surface); }
.pi-icon { flex: 0 0 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); }
.pi-icon .i { width: 28px; height: 28px; }
.print-item h2 { margin: 2px 0 4px; }
.print-item p { margin: 0 0 12px; }
.pi-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pi-links [lang="ar"] { font-family: var(--font-ar); font-size: 1.1em; }
.how-print h2 { display: flex; align-items: center; gap: 8px; }
.print-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -8px 0 18px; padding: 10px 0; background: var(--bg); }
.print-bar p { margin: 0 auto 0 0; }
html[dir="rtl"] .print-bar p { margin: 0 0 0 auto; }

/* ---------- Narrow screens for the new pieces ---------- */
@media (max-width: 1100px) {
  .cards-hero, .cards-foot { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .hero { min-height: 230px; border-radius: 18px; }
  .hero-text { padding: 20px 20px 48px; }
  .hero h1 { font-size: 36px; }
  .study-card { padding: 18px 16px 24px; min-height: 300px; border-radius: 20px; }
  .study-meaning { font-size: 26px; }
  .grades { gap: 6px; }
  .grade { padding: 12px 2px; }
  .grade b { font-size: 16px; }
  .decks .num { width: 52px; font-size: 18px; }
  .deck-go { width: auto; }
  .study-bar .btn-ghost span { display: none; }
}
@media (max-width: 560px) {
  .hero .scene { opacity: .9; }
  .hero-text { max-width: none; }
  .greet { width: 100%; }
  .greet-ar { font-size: 26px; }
  .decks thead th:first-child { width: 40%; }
  .deck-go .btn { padding: 6px 10px; }
  .due-counts dd { font-size: 24px; }
}

/* Teacher view: Dima sees his progress; nothing she does is saved (core/store.js) */
.teacher-banner {
  display: flex; gap: 10px; align-items: flex-start; margin: 0 0 18px; padding: 12px 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--warn, #C8961E) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn, #C8961E) 45%, transparent);
  font-size: 15.5px; line-height: 1.45;
}
.teacher-banner .i { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px; }
.teacher-banner > span { flex: 1; }
.teacher-banner .btn { flex: 0 0 auto; align-self: center; white-space: nowrap; }
.teacher-banner.is-watching { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
@media (max-width: 560px) { .teacher-banner { flex-wrap: wrap; } .teacher-banner .btn { width: 100%; } }
.teacher-banner small { display: block; margin-top: 2px; color: var(--muted); font-size: 14.5px; }

/* Correcting a word: ✎ on each word, and the form in a dialog (core/editor.js) */
.word-wrap { position: relative; }
.word-edit {
  position: absolute; z-index: 1; top: 8px; inset-inline-start: 8px; width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 80%, transparent); color: var(--muted); font-size: 17px; cursor: pointer; opacity: .75;
}
.word-edit:hover, .word-edit:focus-visible { opacity: 1; color: var(--ink); }
/* Phones: the cards are narrow, so ✎ gets its own strip at the start instead of sitting on the Arabic word */
@media (max-width: 760px) {
  .word-wrap > .phrase { padding-inline-start: 52px; }
  .word-wrap > .word-edit { top: 50%; translate: 0 -50%; }
}
.her-voice { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; color: var(--accent); font-size: 13.5px; font-weight: 800; }
.her-voice .i { width: 15px; height: 15px; }
.editor { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); }
.editor::backdrop { background: rgba(4, 16, 10, .55); }
.editor-form { display: grid; gap: 12px; padding: 22px; }
.editor-form h2 { margin: 0 0 4px; }
.editor-field { display: grid; gap: 4px; font-weight: 800; font-size: 14.5px; color: var(--muted); }
.editor-field input { padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font-size: 17px; font-weight: 400; }
.editor-field input[dir="rtl"] { font-family: var(--font-ar); font-size: 21px; }
.editor-field input:focus { outline: none; border-color: var(--accent); }
.editor-field small { font-weight: 400; }
.editor-msg { margin: 0; min-height: 1em; color: var(--bad); font-size: 14.5px; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-revert { margin-inline-start: auto; }

/* The computer voice owns up to not being Saudi */
.voice-toast {
  position: fixed; z-index: 60; left: 0; right: 0; margin-inline: auto; width: max-content; bottom: calc(24px + env(safe-area-inset-bottom)); translate: 0 12px; max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 14.5px; font-weight: 700; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, translate .2s ease;
}
.voice-toast.is-on { opacity: 1; translate: 0 0; }
dialog .voice-toast { top: calc(14px + env(safe-area-inset-top)); bottom: auto; translate: 0 -12px; } /* over a window: at the top, clear of its buttons */
dialog .voice-toast.is-on { translate: 0 0; }
@media (max-width: 860px) { .voice-toast { bottom: calc(86px + env(safe-area-inset-bottom)); } dialog .voice-toast { bottom: auto; } }

/* Record page (Dima) */
body:not(.can-record) .nav-record { display: none; }
.rec-total { color: var(--muted); }
.seg { display: inline-flex; gap: 4px; margin: 0 0 14px; padding: 4px; border-radius: 12px; background: var(--surface); }
.seg button { min-height: 40px; padding: 6px 14px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 800; }
.seg button[aria-pressed="true"] { background: var(--strong-bg); color: var(--strong-ink); }
.rec-total { display: grid; gap: 2px; max-width: 640px; margin: 0 0 14px; }
.rec-total .meter { margin: 6px 0; }
.rec-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.rec-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 6px; border-radius: 16px; background: var(--surface); border: 2px solid transparent; }
.rec-row.is-done { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.rec-open {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
  padding: 10px 12px; border: 0; border-radius: 12px; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer;
}
.rec-open:hover { background: var(--surface-2); }
@keyframes rec-pulse { 50% { opacity: .7; } }
.rec-word { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.rec-ar { font-size: 30px; line-height: 1.4; }
.rec-t { color: var(--muted); }
.rec-state { flex: 0 0 auto; }
.rec-go { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 99px; background: var(--strong-bg); color: var(--strong-ink); font-weight: 800; }
.rec-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.rec-actions .btn { min-height: 44px; min-width: 44px; padding: 6px; justify-content: center; border-color: transparent; }
.rec-ok { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 800; font-size: 14px; }
.rec-ok .i { width: 16px; height: 16px; }
.no-rec .rec-go { display: none; }
@media (max-width: 700px) { .rec-row { flex-wrap: wrap; } .rec-open { flex-basis: 100%; } .rec-actions { margin-inline-start: auto; } }
.rec-dot { display: inline-block; width: 12px; height: 12px; margin-inline-end: 8px; border-radius: 50%; background: var(--bad); }

/* The voice studio (core/studio.js): a sheet on the iPhone, a card on the iPad and computer */
.studio {
  width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 24px;
  background: var(--bg); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); overflow-y: auto; overscroll-behavior: contain;
}
.studio::backdrop { background: rgba(4, 16, 10, .6); }
.studio[open] { display: grid; gap: 12px; padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); }
.st-top { display: flex; align-items: center; gap: 8px; }
.st-count { color: var(--muted); font-weight: 800; font-size: 14.5px; }
.st-nav { display: flex; gap: 4px; margin-inline-start: auto; }
.st-iconbtn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; }
.st-iconbtn:disabled { opacity: .35; cursor: default; }
.st-iconbtn .i { width: 20px; height: 20px; }
html[dir="rtl"] .st-nav .i { transform: scaleX(-1); }
.st-word { text-align: center; padding: 4px 0 2px; }
.st-word h2 { margin: 0; }
.st-ar { font-size: 44px; line-height: 1.5; font-weight: 400; }
.st-word p { margin: 0; color: var(--muted); font-size: 17px; }
.st-card { display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: var(--surface); }
.st-card.is-empty { background: none; padding-block: 0; }
.st-label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 800; font-size: 15px; color: var(--accent); }
.st-saved.is-empty .st-label { color: var(--muted); font-weight: 600; justify-content: center; text-align: center; }
.st-label .i { width: 18px; height: 18px; }
.st-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.st-row .btn { min-height: 44px; }
.st-danger { margin-inline-start: auto; color: var(--bad); border-color: transparent; }
.st-prev { padding-top: 10px; border-top: 1.5px dashed var(--line); color: var(--muted); font-size: 15px; font-weight: 700; }
.st-prev .btn { border-color: transparent; }
.st-takes { display: flex; flex-wrap: wrap; gap: 6px; }
.st-takes button { min-height: 36px; padding: 4px 14px; border: 2px solid var(--line); border-radius: 99px; background: none; color: var(--muted); font-weight: 800; cursor: pointer; }
.st-takes button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.st-wave { position: relative; height: 96px; border-radius: 14px; background: var(--bg); touch-action: none; }
.st-new.is-empty .st-wave { background: none; border: 2px dashed var(--line); }
.st-wave canvas { position: absolute; inset: 8px 10px; width: calc(100% - 20px); height: calc(100% - 16px); }
.st-wave-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 16px; color: var(--muted); font-weight: 700; text-align: center; }
.st-dim { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--bg) 55%, transparent); pointer-events: none; }
.st-dim-a { left: 0; width: calc(10px + (100% - 20px) * var(--a)); border-radius: 14px 0 0 14px; }
.st-dim-b { right: 0; width: calc(10px + (100% - 20px) * (1 - var(--b))); border-radius: 0 14px 14px 0; }
.st-handle {
  position: absolute; top: -4px; bottom: -4px; width: 28px; margin-left: -14px; padding: 0; border: 0; background: none; cursor: ew-resize; touch-action: none;
}
.st-handle[data-h="a"] { left: calc(10px + (100% - 20px) * var(--a)); }
.st-handle[data-h="b"] { left: calc(10px + (100% - 20px) * var(--b)); }
.st-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 12px; width: 4px; border-radius: 2px; background: var(--art-brass, #C8A24A); }
.st-handle::after { content: ""; position: absolute; top: 50%; left: 5px; width: 18px; height: 30px; margin-top: -15px; border-radius: 9px; background: var(--art-brass, #C8A24A); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.st-handle:focus-visible { outline: none; }
.st-handle:focus-visible::after { box-shadow: 0 0 0 3px var(--accent); }
.st-playhead { position: absolute; top: 6px; bottom: 6px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; pointer-events: none; }
.st-playhead { left: 0; transform: translateX(10px); } /* inside the padding like the bars */
.st-hint { margin: 0; color: var(--muted); font-size: 14.5px; }
.st-rec { display: grid; justify-items: center; gap: 6px; padding: 4px 0; }
.st-mic {
  --p: 0; position: relative; display: grid; place-items: center; width: 84px; height: 84px; padding: 0; border: 0; border-radius: 50%;
  background: var(--bad); color: #fff; cursor: pointer; box-shadow: 0 10px 26px -10px color-mix(in srgb, var(--bad) 80%, transparent);
  transition: transform .12s ease;
}
.st-mic:active { transform: scale(.95); }
.st-mic .i { width: 36px; height: 36px; }
.st-mic::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; background: conic-gradient(var(--bad) calc(var(--p) * 1turn), var(--line) 0); -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); mask: radial-gradient(closest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); }
.st-mic:not(.is-on)::before { background: none; }
.st-mic.is-on { animation: rec-pulse 1.2s ease-in-out infinite; }
.st-mic:focus-visible { outline: 3px solid var(--accent); outline-offset: 10px; }
.st-rec-label { margin: 0; color: var(--muted); font-weight: 800; }
.st-time { color: var(--bad); font-variant-numeric: tabular-nums; margin-inline-end: 4px; }
.st-msg { margin: 0; color: var(--bad); font-weight: 700; text-align: center; }
.st-msg:empty { display: none; }
.st-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.st-actions .btn { flex: 1 1 180px; min-height: 52px; font-size: 17px; }
html[dir="rtl"] .st-actions .i { transform: scaleX(-1); }
@media (max-width: 560px) {
  .studio { width: 100vw; max-width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .st-ar { font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) { .st-mic.is-on { animation: none; } }

/* A toast with an Undo button can be pressed */
.voice-toast.has-action.is-on { pointer-events: auto; display: flex; align-items: center; gap: 14px; }
.voice-toast button { flex: 0 0 auto; min-height: 36px; padding: 4px 14px; border: 0; border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; }
.tabs a small { margin-inline-start: 6px; font-weight: 700; }

/* Grammar lessons */
.gr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.gr-card { display: flex; align-items: center; gap: 14px; height: 100%; padding: 16px 18px; border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; border: 2px solid transparent; transition: border-color .15s ease, transform .15s ease; }
.gr-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); transform: translateY(-1px); }
.gr-card > span:nth-child(2) { flex: 1; display: grid; gap: 4px; }
.gr-card .i { color: var(--muted); }
html[dir="rtl"] .gr-card > .i { transform: scaleX(-1); }
.gr-num { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--strong-bg); color: var(--strong-ink); font-size: 20px; font-weight: 800; }
.gr-peek { color: var(--muted); font-size: 18px; }
.gr-back { margin: 0 0 8px; }
.gr-back a { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }
.gr-intro p { margin: 0; font-size: 18px; line-height: 1.6; }
.gr-intro .gr-verb { margin-top: 10px; font-weight: 800; }
.gr-rows { margin-bottom: 22px; }
.gr-row.is-her { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.gr-mean { font-weight: 800; }
.gr-mean-2 { color: var(--muted); font-size: 15px; }
.gr-msa { color: var(--muted); font-size: 15px; }
.gr-msa i { font-style: normal; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; margin-inline-end: 4px; }
.gr-her { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 800; font-size: 13.5px; }
.gr-her .i { width: 14px; height: 14px; }
.gr-quiz h2 { display: flex; align-items: center; gap: 8px; }
.gr-q { display: grid; gap: 4px; margin: 0 0 12px; font-size: 18px; }
.gr-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.gr-opt { min-height: 64px; padding: 10px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink); font-size: 26px; cursor: pointer; }
.gr-opt:hover:not(:disabled) { border-color: var(--accent); }
.gr-opt.is-right { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg)); }
.gr-opt.is-wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--bg)); }
.gr-feedback { margin: 12px 0; font-size: 17px; }
.gr-score { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.gr-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.gr-row .phrase-t { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }

/* Weekly lessons */
.ls-today { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; padding: 14px 18px; border-radius: 16px; background: var(--strong-bg); color: var(--strong-ink); text-decoration: none; }
.ls-today > span { flex: 1; display: grid; }
.ls-today small { opacity: .8; font-weight: 700; }
html[dir="rtl"] .ls-today > .i:last-child, html[dir="rtl"] .gr-nav .i, html[dir="rtl"] .gr-back .i { transform: scaleX(-1); }
.ls-stage { margin: 0 0 22px; }
.ls-weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.ls-week { display: grid; gap: 3px; height: 100%; padding: 12px 14px; border-radius: 14px; background: var(--surface); color: var(--ink); text-decoration: none; border: 2px solid transparent; }
.ls-week:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.ls-week.is-now { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.ls-week.is-past { opacity: .75; }
.ls-week > span { font-weight: 700; }
.ls-week > span > span + span::before { content: " · "; }
.ls-week small { color: var(--muted); }
.ls-goal p { margin: 0; font-size: 17px; }
.ls-goal h2, .ls-tasks h2 { display: flex; align-items: center; gap: 8px; }
.ls-block { margin: 22px 0; }
.ls-block .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ls-tasks ul { margin: 0; padding-inline-start: 22px; display: grid; gap: 6px; font-size: 17px; }
.dialogue { display: grid; gap: 10px; }
.dl-line { display: grid; gap: 4px; max-width: 640px; }
.dl-line.is-you { justify-self: end; }
.dl-who { font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
html[dir="rtl"] .dl-who { letter-spacing: 0; }
.dl-line.is-her .dl-bubble { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.dl-bubble .phrase-t { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.ls-block .phrase-t { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.dl-line { width: min(640px, 92%); }
.dl-bubble { width: 100%; border-radius: 18px; background: var(--surface); }
.dl-line.is-you .dl-who { justify-self: end; }
.dl-line.is-you .dl-bubble { background: color-mix(in srgb, var(--ink) 6%, var(--surface)); }

/* The study card, drawn like the deck picture: a paper card with a row of gold Najdi crenellations,
   a second card tilted behind it — in the colors of the current theme (tokens.css --art-*). */
.study-stack { position: relative; max-width: 760px; margin: 0 auto; isolation: isolate; }
.study-stack::before {
  content: ""; position: absolute; inset: 10px 14px -8px; z-index: -1; border-radius: 26px;
  background: var(--art-green); opacity: .8; transform: rotate(-2.2deg) translate(-10px, 4px);
}
.study-card {
  background: var(--art-paper); border: 1.5px solid var(--art-rule); border-radius: 26px;
  padding-top: 46px; transform: rotate(.6deg);
  box-shadow: 0 24px 50px -28px rgba(0, 0, 0, .55);
}
.study-card.kind-p { background: var(--art-paper); border: 1.5px solid var(--art-rule); }
.study-card::before {
  inset: 18px 84px auto; height: 12px; border-radius: 0; background: var(--art-brass);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='12'%3E%3Cpath d='M1.5 12L9 1.5 16.5 12z'/%3E%3C/svg%3E") repeat-x center / 18px 12px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='12'%3E%3Cpath d='M1.5 12L9 1.5 16.5 12z'/%3E%3C/svg%3E") repeat-x center / 18px 12px;
}
.study-card::after { content: ""; position: absolute; inset: auto 30px 16px; height: 2px; border-radius: 2px; background: color-mix(in srgb, var(--art-brass) 45%, transparent); }
.study-card .study-ar .ar, .study-card .study-meaning { color: var(--art-ink); }
.study-card.kind-p::before { background: var(--art-green); } /* "say it" cards wear green crenels */
@media (prefers-reduced-motion: no-preference) {
  .study-card { transition: transform .25s cubic-bezier(.2, .7, .2, 1); }
  .study-card.is-revealed { transform: rotate(0deg); }
}
@media (max-width: 560px) { .study-stack::before { inset: 8px 8px -6px; } .study-card::before { inset: 14px 18px auto; } }

/* Decks as cards: each one drawn like the study card (paper, gold crenellations, a card behind), its first word on the face */
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 26px 20px; margin: 8px 0 0; padding: 6px 4px 10px; list-style: none; }
.deck-grid li { position: relative; isolation: isolate; }
.deck-grid li::before { content: ""; position: absolute; inset: 8px 6px -6px; z-index: -1; border-radius: 18px; background: var(--art-green); opacity: .75; transform: rotate(calc(var(--t, -3deg))); }
.deck-grid li:nth-child(even)::before { --t: 3deg; }
.deck-card {
  position: relative; display: grid; gap: 4px; justify-items: center; height: 100%; padding: 36px 14px 16px; border-radius: 18px;
  background: var(--art-paper); border: 1.5px solid var(--art-rule); color: var(--ink); text-align: center; text-decoration: none;
  transform: rotate(var(--tilt)); box-shadow: 0 16px 34px -24px rgba(0, 0, 0, .6);
  transition: transform .2s cubic-bezier(.2, .7, .2, 1), box-shadow .2s ease;
}
a.deck-card:hover, a.deck-card:focus-visible { transform: rotate(0deg) translateY(-4px); box-shadow: 0 22px 40px -22px rgba(0, 0, 0, .6); }
.deck-card::before {
  content: ""; position: absolute; inset: 12px 18px auto; height: 9px; background: var(--art-brass);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 9L7 1l6 8z'/%3E%3C/svg%3E") repeat-x center / 14px 9px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 9L7 1l6 8z'/%3E%3C/svg%3E") repeat-x center / 14px 9px;
}
.deck-face { font-family: var(--font-ar); font-size: 38px; line-height: 1.5; color: var(--art-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.deck-card .deck-name { font-weight: 800; font-size: 16.5px; line-height: 1.25; }
.deck-card .deck-size { color: var(--muted); font-size: 13.5px; }
.deck-counts { display: flex; gap: 12px; margin-top: 4px; font-size: 18px; font-variant-numeric: tabular-nums; }
.deck-counts .c-new { color: var(--c-new); } .deck-counts .c-learn { color: var(--c-learn); } .deck-counts .c-due { color: var(--c-due); }
.deck-study { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 6px 14px; border-radius: 999px; background: var(--strong-bg); color: var(--strong-ink); font-weight: 800; font-size: 14.5px; }
.deck-study .i { width: 16px; height: 16px; }
html[dir="rtl"] .deck-study .i { transform: scaleX(-1); }
.deck-card.is-locked { opacity: .72; }
.deck-card.is-locked .deck-face { filter: grayscale(.6); }
@media (max-width: 560px) { .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; } .deck-face { font-size: 30px; } }
.deck-card.is-locked { opacity: 1; }
.deck-card.is-locked > * { opacity: .62; }
.deck-card .deck-size { display: block; line-height: 1.4; }
.deck-card .deck-size .i { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; }
.deck-face { white-space: normal; overflow: visible; font-size: clamp(26px, 3.2vw, 38px); line-height: 1.35; }

/* Saudi life */
.sa-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.sa-top h2, .sa-block > h2 { display: flex; align-items: center; gap: 8px; }
.sa-hijri { margin: 4px 0 0; font-family: var(--font-ar); font-size: 30px; font-weight: 700; line-height: 1.4; color: var(--accent); }
.sa-hijri-lat { margin: 0; font-weight: 800; font-size: 17px; }
.sa-next { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.sa-next .i { color: var(--art-brass); }
.city-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.city-chips button { min-height: 36px; padding: 5px 11px; border: 1.5px solid var(--line); border-radius: 999px; background: none; color: var(--ink); font-weight: 700; font-size: 14px; }
.city-chips button[aria-pressed="true"] { background: var(--strong-bg); color: var(--strong-ink); border-color: transparent; }
.pr-next { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; font-size: 18px; }
.pr-next .ar { font-size: 22px; }
.pr-next em { color: var(--accent); font-style: normal; font-weight: 800; }
.pr-list { margin: 0 0 8px; padding: 0; list-style: none; display: grid; gap: 2px; }
.pr-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; border-radius: 10px; }
.pr-list li b { font-variant-numeric: tabular-nums; }
.pr-name { display: flex; align-items: baseline; gap: 8px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-align: start; }
.pr-name .ar { font-size: 19px; }
.pr-name span { color: var(--muted); font-size: 14px; }
.pr-list .is-past, .pr-list .is-past .pr-name span { color: var(--muted); }
.pr-list .is-sun { font-style: italic; }
.pr-list .is-prev { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pr-list .is-next { background: color-mix(in srgb, var(--accent) 16%, transparent); font-weight: 800; }
.qibla-compass { display: block; width: min(200px, 100%); margin: 0 auto; }
.qc-face { fill: var(--art-paper); stroke: var(--art-rule); stroke-width: 1.5; }
.qc-ticks line { stroke: var(--muted); stroke-width: 1; }
.qc-n { fill: var(--ink); font-weight: 800; font-size: 11px; font-family: var(--font-ui); }
.qc-arrow { fill: var(--accent); }
.qc-tail { fill: var(--muted); opacity: .5; }
.qc-kaaba { fill: #1b1b1b; }
.qc-band { fill: #D4A437; }
.qc-pin { fill: var(--ink); }
.qibla-num { text-align: center; margin: 8px 0 2px; font-size: 17px; }
.sa-block { margin: 26px 0; }
.sa-year { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.sa-year li { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface); }
.sa-year span { color: var(--muted); font-size: 14px; }
.sa-year em { color: var(--accent); font-style: normal; font-weight: 800; }
.sa-stories { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.sa-story summary { display: grid; gap: 4px; cursor: pointer; list-style: none; }
.sa-story summary::-webkit-details-marker { display: none; }
.sa-story summary h3 { margin: 0; font-size: 19px; letter-spacing: 0; text-transform: none; color: var(--ink); }
.sa-story[open] summary { margin-bottom: 8px; }
.sa-story p { font-size: 16.5px; line-height: 1.6; }
.sa-story h4 { margin: 12px 0 6px; font-size: 14px; color: var(--muted); }
.sa-tag { justify-self: start; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.sa-tag.is-north { background: color-mix(in srgb, var(--art-brass) 30%, transparent); }
.sa-tag.is-najd { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.sa-words .phrase-t { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.sa-facts { display: grid; gap: 8px; padding-inline-start: 22px; font-size: 16.5px; }
@media (max-width: 1000px) { .sa-top { grid-template-columns: 1fr 1fr; } .sa-qibla { grid-column: 1 / -1; } }
@media (max-width: 620px) { .sa-top { grid-template-columns: 1fr; } }

/* Edit mode: every text can be tapped; a bar at the bottom says so */
/* Edit mode: everything that can be changed is tinted gold */
body.editing [data-editable] { background: rgba(244, 194, 77, .22); box-shadow: 0 0 0 2px rgba(244, 194, 77, .45); border-radius: 5px; cursor: text; }
body.editing [data-editable]:hover { background: rgba(244, 194, 77, .42); }
body.editing :is([data-edit-id], .word-wrap, .rec-row, .dl-line) { outline: 2px dashed rgba(212, 164, 55, .85); outline-offset: 3px; cursor: text; }
body.editing :is([data-edit-id], .word-wrap, .rec-row, .dl-line):hover { outline-style: solid; }
.edit-bar {
  position: fixed; z-index: 55; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); translate: -50% 0;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px); padding: 10px 12px 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5);
}
.edit-bar > span:nth-child(2) { display: grid; line-height: 1.25; font-size: 14.5px; }
.edit-bar small { opacity: .75; }
.edit-bar .btn { background: var(--bg); color: var(--ink); border-color: transparent; min-height: 38px; padding: 6px 16px; }
.edit-bar-dot { width: 10px; height: 10px; border-radius: 50%; background: #F4C24D; box-shadow: 0 0 0 4px rgba(244, 194, 77, .3); animation: rec-pulse 1.4s ease-in-out infinite; }
@media (max-width: 860px) { .edit-bar { bottom: calc(80px + env(safe-area-inset-bottom)); } }
.editor-msg.is-good { color: var(--accent); font-weight: 800; }
.editor-field textarea { padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; font-weight: 400; resize: vertical; }
.editor-field textarea[dir="rtl"] { font-family: var(--font-ar); font-size: 19px; }

/* Suggestions (review) */
.rv-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.rv-kind { margin: 0 0 8px; font-weight: 800; }
.rv-table { width: 100%; border-collapse: collapse; }
.rv-table th, .rv-table td { padding: 6px 8px; text-align: start; vertical-align: top; border-top: 1px solid var(--line); }
.rv-table thead th { border-top: 0; color: var(--muted); font-size: 13px; }
.rv-table tbody th { width: 22%; color: var(--muted); font-size: 14px; }
.rv-before { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.rv-after { font-weight: 800; }
.rv-arrow { color: var(--muted); width: 1%; }
.rv-table .ar { font-size: 20px; }
.rv-checked { display: flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 800; }
.rv-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.hear-slow { top: 72px; width: 40px; height: 40px; inset-inline-end: 20px; background: var(--surface-2); color: var(--ink); }
.hear-slow .i { width: 22px; height: 22px; }
.rv-history { margin: 30px 0 12px; }
.rv-card.is-done { opacity: .85; }
.rv-status { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 8px; padding: 2px 10px; border-radius: 99px; font-size: 13.5px; }
.rv-status .i { width: 15px; height: 15px; }
.rv-status.is-approved { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.rv-status.is-rejected { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }

/* The voice of a word, at the top of its editor */
.editor-voice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--surface-2); }
.ev-state { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; font-size: 14.5px; }
.ev-state.is-hers { color: var(--accent); }
.ev-state .i { width: 17px; height: 17px; }
.ev-btns { display: flex; gap: 4px; }
.ev-btns .btn { min-height: 44px; min-width: 44px; padding: 6px 10px; }
.ev-btns .btn-ghost { border-color: transparent; }
.st-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.st-confirm p { flex: 1 1 100%; margin: 0; font-weight: 800; }
.st-mic.is-starting { opacity: .6; pointer-events: none; }

/* The whole alphabet (#/letters/all): a table on the computer, cards on the iPad and iPhone */
.lt-back { margin: 0 0 14px; }
.lt-back a { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }
html[dir="rtl"] .lt-back .i { transform: scaleX(-1); }
.lt-all { gap: 8px; }
.lt-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.lt-table th { padding: 12px 10px; text-align: start; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
html[dir="rtl"] .lt-table th { letter-spacing: 0; }
.lt-table td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.lt-table tr.is-hard .lt-char { background: color-mix(in srgb, var(--hard) 8%, transparent); }
.lt-n { width: 1%; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.lt-glyph { display: grid; place-items: center; width: 58px; height: 58px; padding: 0; border: 0; border-radius: 14px; background: var(--surface-2); color: var(--ink); font-size: 36px; line-height: 1; cursor: pointer; }
.lt-glyph:hover { background: var(--tile); }
.lt-name { min-width: 120px; }
.lt-name .ar { font-size: 20px; margin-inline-start: 4px; }
.lt-name .tag { display: inline-block; margin: 4px 4px 0 0; }
.lt-sound b { font-size: 17px; white-space: nowrap; }
.lt-ua { color: var(--muted); font-size: 15px; min-width: 110px; }
.lt-f { text-align: center; }
.lt-f .ar, .lt-fh { font-size: 26px; }
.lt-fh { font-size: 12px !important; text-align: center !important; }
.lt-exbtn { display: grid; gap: 2px; padding: 6px 10px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.lt-exbtn:hover { background: var(--surface-2); }
.lt-exbtn .ar { font-size: 22px; }
.lt-exbtn span { color: var(--muted); font-size: 14px; }
@media (max-width: 1100px) {
  .lt-table, .lt-table tbody { display: block; background: none; border-radius: 0; overflow: visible; }
  .lt-table thead { display: none; }
  .lt-table tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
  .lt-table tr { display: grid; grid-template-columns: 64px repeat(4, 1fr); gap: 4px 8px; align-items: center; padding: 12px; border-radius: var(--radius); background: var(--surface); }
  .lt-table td { display: block; padding: 0; border: 0; }
  .lt-table tr.is-hard .lt-char { background: none; }
  .lt-n { display: none !important; }
  .lt-char { grid-row: 1 / span 3; grid-column: 1; align-self: start; }
  .lt-name { grid-column: 2 / -1; grid-row: 1; }
  .lt-sound { grid-column: 2; grid-row: 2; }
  .lt-ua { grid-column: 3 / -1; grid-row: 2; }
  .lt-f { grid-row: 3; padding: 6px 0 2px !important; border-radius: 10px; background: var(--bg) !important; }
  .lt-f .ar { font-size: 24px; }
  .lt-f::after { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); }
  .lt-f:nth-child(6) { grid-column: 2; } .lt-f:nth-child(7) { grid-column: 3; } .lt-f:nth-child(8) { grid-column: 4; } .lt-f:nth-child(9) { grid-column: 5; }
  .lt-ex { grid-column: 1 / -1; grid-row: 4; border-top: 1px solid var(--line) !important; padding-top: 4px !important; }
  .lt-exbtn { width: 100%; display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: center; gap: 10px; }
}

/* To her ♥ (#/love) */
.lv-intro p { display: flex; gap: 10px; align-items: flex-start; }
.lv-intro p .i { flex: 0 0 auto; width: 22px; height: 22px; color: #D63A5E; fill: color-mix(in srgb, #D63A5E 20%, transparent); margin-top: 3px; }
.lv-jump { margin: 0 0 8px; }
.lv-jump small { opacity: .7; margin-inline-start: 4px; }
.lv-section { scroll-margin-top: 80px; margin: 22px 0 0; }
.lv-sections.is-hidden .gr-mean, .lv-sections.is-hidden .gr-msa, .lv-sections.is-hidden .pnote { visibility: hidden; }
.nav-love .i { color: #F7A8B8; }
.lv-phrase .phrase-ar { flex: 0 1 auto; max-width: 100%; min-width: 0; }
.lv-phrase .gr-mean { display: block; font-weight: 800; font-size: 17px; }
.lv-phrase .gr-msa { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; }
.lv-phrase .gr-msa i { font-style: normal; font-weight: 800; font-size: 11.5px; letter-spacing: .04em; margin-inline-end: 6px; }
.lv-phrase .gr-msa .ar { font-size: 18px; }

/* Her birthday (#/birthday) — his profile only */
body.is-teacher .nav-bday { display: none; }
.bd-count { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 0 0 16px; }
.bd-days { display: grid; gap: 2px; padding: 18px 20px; border-radius: var(--radius); background: linear-gradient(135deg, #7A1330, #D63A5E); color: #FFF4F6; }
.bd-days.is-a1 { background: var(--strong-bg); color: var(--strong-ink); }
.bd-days b { font-size: 54px; line-height: 1; font-variant-numeric: tabular-nums; }
.bd-days span { font-weight: 800; font-size: 17px; }
.bd-days small { opacity: .85; font-weight: 700; }
.bd-ramadan { display: flex; gap: 10px; align-items: flex-start; }
.bd-ramadan .i { flex: 0 0 auto; margin-top: 3px; }
.bd-score { font-weight: 800; color: var(--accent); }
.bd-goals { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.bd-goal { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; }
.bd-goal:hover { background: var(--surface-2); }
.bd-goal .check { flex: 1; min-height: 40px; align-items: center; }
.bd-goal.is-done .check span { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.bd-go { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--accent); }
.bd-go:hover { background: var(--bg); }
html[dir="rtl"] .bd-go .i { transform: scaleX(-1); }
.bd-speech .panel-head h2 { display: flex; align-items: center; gap: 8px; }
.bd-speech .panel-head .i { color: #D63A5E; }
.bd-lines { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.bd-line { width: 100%; background: var(--bg) !important; align-items: center; }
.bd-n { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-weight: 800; font-size: 14px; }
.bd-body { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-width: 0; }
.bd-body .phrase-ar { flex: 0 1 auto; max-width: 100%; min-width: 0; }
.bd-line .gr-mean { display: block; }
.bd-line .gr-msa { display: block; }
.is-testing .bd-line:not(.is-open) :is(.bd-ar, .bd-say, .gr-msa) { display: none; }
.bd-today { background: linear-gradient(135deg, #7A1330, #D63A5E); color: #FFF4F6; }

/* Her words and the rude ones (Phrases page) */
.pday.hers h2 { color: #B0284C; }
:root[data-theme$="dark"] .pday.hers h2, :root[data-theme="dark"] .pday.hers h2 { color: #F7A8B8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .pday.hers h2 { color: #F7A8B8; } }
.rude { margin-top: 28px; }
.rude summary { cursor: pointer; list-style: none; }
.rude summary h2 { display: inline; }
.rude summary::before { content: "▸ "; color: var(--muted); }
.rude[open] summary::before { content: "▾ "; }
.rude-tag { display: inline-block; vertical-align: 2px; margin: 0 4px; padding: 1px 7px; border-radius: 6px; background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.rude-tag.is-very { background: var(--bad); color: #fff; }

/* Numbers & time (#/numbers) */
.nm-input { display: flex; gap: 8px; margin: 8px 0 12px; }
.nm-input input { flex: 1; min-width: 0; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nm-input input:focus { outline: none; border-color: var(--accent); }
.nm-big, .nm-answer { position: relative; display: grid; justify-items: start; gap: 4px; width: 100%; padding: 16px 64px 16px 18px; border: 0; border-radius: 16px; background: var(--bg); color: inherit; font: inherit; text-align: start; cursor: pointer; }
.nm-big .play, .nm-answer .play { position: absolute; inset-inline-end: 16px; top: 50%; translate: 0 -50%; }
.nm-digits { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nm-digits span { margin-inline-start: 12px; color: var(--muted); }
.nm-words { font-size: 34px; line-height: 1.5; }
.nm-say { color: var(--muted); font-size: 17px; }
.nm-q { margin: 6px 0; font-size: 48px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nm-q span { margin-inline-start: 14px; color: var(--muted); }
.nm-answer { margin: 0 0 12px; }
.nm-answer > span:not(.play) { color: var(--muted); }
.nm-practice .seg { margin: 0; flex-wrap: wrap; }
.nm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0 0 22px; }
.nm-chip { display: grid; justify-items: start; gap: 0; padding: 10px 12px; border: 0; border-radius: 14px; background: var(--surface); color: inherit; font: inherit; text-align: start; cursor: pointer; }
.nm-chip:hover { background: var(--surface-2); }
.nm-chip b { font-size: 20px; font-variant-numeric: tabular-nums; }
.nm-chip .ar { font-size: 22px; line-height: 1.5; }
.nm-chip small { color: var(--muted); font-size: 13.5px; }
.nm-timebox { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin: 6px 0 12px; }
.nm-clock { width: 150px; height: 150px; flex: 0 0 auto; }
.nm-face { fill: var(--bg); stroke: var(--accent); stroke-width: 3; }
.nm-ticks { fill: var(--muted); }
.nm-hands { stroke: var(--ink); }
.nm-pin { fill: var(--accent); }
.nm-time { flex: 1 1 260px; min-width: 0; }
.nm-clockpanel h3 { margin-top: 10px; }

/* Chats to read (#/chats) */
.ch-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.ch-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; }
.ch-card:hover { background: var(--surface-2); }
.ch-level { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--strong-bg); color: var(--strong-ink); font-weight: 800; }
.ch-card-text { flex: 1; min-width: 0; display: grid; }
.ch-card-text .ar { font-size: 20px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-count { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; font-weight: 700; }
.ch-count .i { width: 16px; height: 16px; color: var(--accent); }
.ch-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; }
.ch-thread { display: flex; flex-direction: column; gap: 8px; max-width: 720px; margin: 14px 0; padding: 16px 12px; border-radius: 20px; list-style: none;
  background: color-mix(in srgb, var(--accent) 7%, var(--bg)); }
.ch-msg { display: flex; }
.ch-msg.is-him { justify-content: flex-end; }
.ch-bubble { display: grid; gap: 2px; max-width: min(84%, 460px); padding: 8px 14px 10px; border: 0; border-radius: 18px; font: inherit; text-align: start; cursor: pointer;
  background: var(--surface); color: var(--ink); box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }
.is-him .ch-bubble { background: var(--strong-bg); color: var(--strong-ink); border-end-end-radius: 6px; }
.is-her .ch-bubble, .is-other .ch-bubble { border-end-start-radius: 6px; }
.ch-who { font-size: 12.5px; font-weight: 800; color: var(--her-name); }
.is-other .ch-who { color: var(--accent); }
.ch-ar { font-size: 24px; line-height: 1.55; direction: rtl; text-align: right; }
.ch-say, .ch-mean { display: none; font-size: 14.5px; }
.ch-say { opacity: .85; }
.ch-mean { font-weight: 700; }
.is-open .ch-say, .is-open .ch-mean, .show-say .ch-say, .show-mean .ch-mean { display: block; }
.ch-end { display: flex; flex-wrap: wrap; gap: 8px; }
html[dir="rtl"] .ch-end .i:last-child { transform: scaleX(-1); }
.is-her .ch-bubble, .is-other .ch-bubble { background: var(--surface-2); border: 1px solid var(--line); }
.ch-thread { background: var(--bg); border: 1.5px solid var(--line); }

/* ---------- Stories (views/stories.js): a page to read, tap-a-word panel, true/false ---------- */
.st-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 6px; }
.st-count { margin: 0; font-weight: 800; }
.st-step { margin: 28px 0 0; }
.st-step h2 { margin-bottom: 2px; }
.st-step > .muted { margin: 0 0 12px; }
.ch-level.st-lv-easy { font-size: 13px; background: #F4C24D; color: #3B2A00; }
.ch-level.st-lv-A2 { background: var(--ink); color: var(--bg); }
.st-tools { margin-bottom: 6px; }
.st-tools [data-listen][aria-pressed="true"] { background: var(--strong-bg); color: var(--strong-ink); border-color: var(--strong-bg); }
.st-text { max-width: 820px; margin: 12px 0 12px; padding: 22px 28px; border-radius: 20px; background: var(--surface); border: 1.5px solid var(--line); }
.st-flow { margin: 0; direction: rtl; text-align: right; font-size: 29px; line-height: 2.15; }
.st-text.lv-easy .st-flow { font-size: 36px; line-height: 2; }
.st-w { display: inline; margin: 0; padding: 0 2px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; line-height: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.st-w:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.st-w:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.st-w.is-sel { background: rgba(244, 194, 77, .45); box-shadow: 0 0 0 2px rgba(244, 194, 77, .75); }
.st-s.is-playing { border-radius: 8px; background: color-mix(in srgb, var(--accent) 16%, transparent); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.st-lines { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.st-line { display: flex; align-items: flex-start; gap: 12px; }
.st-line > div { flex: 1; min-width: 0; }
.st-lines .st-s { display: block; direction: rtl; text-align: right; font-size: 27px; line-height: 1.9; }
.st-text.lv-easy .st-lines .st-s { font-size: 32px; }
.st-say { margin: 2px 0 0; color: var(--muted); font-size: 16.5px; }
.st-mean { margin: 2px 0 0; font-size: 16.5px; font-weight: 700; }
.st-play { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; margin-top: 6px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--accent); cursor: pointer; }

.st-panel { position: sticky; bottom: 14px; z-index: 20; max-width: 820px; margin: 0 0 16px; padding: 14px 16px 16px; border-radius: 18px;
  background: var(--surface); border: 1.5px solid color-mix(in srgb, #F4C24D 70%, var(--line)); box-shadow: 0 12px 32px rgba(0, 0, 0, .16); }
.st-panel[hidden] { display: none; }
.st-panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding-inline-end: 48px; }
.st-big { display: inline-flex; align-items: center; gap: 8px; padding: 2px 12px; border: 0; border-radius: 12px; background: rgba(244, 194, 77, .24); color: var(--ink); font: inherit; cursor: pointer; }
.st-big .ar { font-size: 34px; line-height: 1.45; }
.st-pron { font-size: 19px; font-weight: 800; color: var(--muted); }
.st-x { position: absolute; top: 10px; inset-inline-end: 10px; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.st-meaning { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 8px 0 0; }
.st-meaning .m1 { font-size: 19px; font-weight: 800; }
.st-meaning .m2 { flex-basis: 100%; color: var(--muted); }
.st-meaning .m1 i, .st-meaning .m2 i { font-style: normal; font-size: 11.5px; font-weight: 800; letter-spacing: .04em; margin-inline-end: 4px; }
.st-form { display: inline-block; padding: 3px 12px; border-radius: 99px; background: var(--surface-2); font-size: 14.5px; font-weight: 800; }
.st-meaning .st-form { font-size: 15px; }
.st-parts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; }
.st-lab { margin-inline-end: 4px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.st-part { display: inline-grid; justify-items: center; padding: 4px 10px 6px; border-radius: 12px; background: var(--surface-2); }
.st-part .ar { font-size: 23px; line-height: 1.35; }
.st-part small { max-width: 18ch; color: var(--muted); font-size: 12.5px; font-weight: 700; text-align: center; }
.st-plus { color: var(--muted); font-weight: 800; }
.st-base { flex-basis: 100%; font-weight: 700; }
.st-base .ar { font-size: 23px; }
.st-panel-sent { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.st-panel-sent p { flex: 1 1 240px; margin: 0; color: var(--muted); }
.st-panel-sent p span { display: block; color: var(--ink); font-weight: 700; }

.st-words, .st-quiz { margin: 30px 0 0; }
.st-quiz ol { display: grid; gap: 10px; max-width: 820px; margin: 12px 0 0; padding: 0; list-style: none; }
.st-q { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); }
.st-q.is-right { border-color: var(--good); }
.st-q.is-wrong { border-color: var(--bad); }
.st-q-ar { flex: 1 1 260px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: right; cursor: pointer; }
.st-q-ar .ar { font-size: 25px; line-height: 1.6; }
.st-q-btns { display: flex; gap: 8px; }
.st-q-btns .btn:disabled { opacity: .55; cursor: default; }
.st-q-btns .btn[aria-pressed="true"] { opacity: 1; background: var(--strong-bg); color: var(--strong-ink); border-color: var(--strong-bg); }
.st-q-fb { flex-basis: 100%; margin: 0; color: var(--muted); }
.st-q-fb b { display: inline-flex; align-items: center; gap: 4px; color: var(--good); }
.is-wrong .st-q-fb b { color: var(--bad); }
.st-q-fb span { display: block; color: var(--ink); font-weight: 700; }
.st-score { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 0; font-size: 18px; font-weight: 800; }
[data-quiz] + .ch-end { margin-top: 26px; }

@media (max-width: 860px) {
  .st-panel { bottom: calc(74px + env(safe-area-inset-bottom)); max-height: min(46vh, 440px); overflow-y: auto; overscroll-behavior: contain; }
}
@media (max-width: 600px) {
  .st-text { padding: 16px 16px; border-radius: 16px; }
  .st-flow { font-size: 25px; line-height: 2.1; }
  .st-text.lv-easy .st-flow { font-size: 31px; }
  .st-lines .st-s { font-size: 24px; }
  .st-text.lv-easy .st-lines .st-s { font-size: 28px; }
  .st-big .ar { font-size: 28px; }
  .st-panel { padding: 10px 12px 12px; }
  .st-panel-sent { margin-top: 10px; padding-top: 10px; }
  .st-panel-sent .btn { min-height: 40px; padding: 6px 12px; }
  .st-meaning .m1 { font-size: 17.5px; }
}

/* ---------- Practice by topic (views/practice.js) ---------- */
.pr-list .ch-card-text small { font-size: 14px; font-weight: 700; }
.pr-best { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 13.5px; font-weight: 800; }
.pr-best.is-full { background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--good); }
.pr-best .i { width: 15px; height: 15px; }
.pr-top { display: flex; align-items: center; gap: 14px; max-width: 720px; margin: 0 0 12px; color: var(--muted); font-weight: 800; }
.pr-top .meter { flex: 1; margin: 0; }
.pr-card { max-width: 720px; padding: 20px 22px 22px; border-radius: 20px; background: var(--surface); border: 1.5px solid var(--line); }
.pr-kind { margin: 0 0 10px; color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.pr-prompt { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; margin: 0 0 16px; padding: 14px; border: 0; border-radius: 16px; background: var(--surface-2); color: var(--ink); font: inherit; cursor: pointer; }
.pr-prompt .ar { font-size: 44px; line-height: 1.5; }
.pr-mean { cursor: default; font-size: 25px; font-weight: 800; text-align: center; }
.pr-listen { display: grid; place-items: center; width: 96px; height: 96px; margin: 4px auto 18px; border: 0; border-radius: 50%; background: var(--strong-bg); color: var(--strong-ink); cursor: pointer; }
.pr-listen .i { width: 40px; height: 40px; }
.pr-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pr-opt { display: flex; align-items: center; gap: 10px; min-height: 64px; padding-inline-start: 44px; text-align: start; }
.pr-opt kbd { top: 50%; transform: translateY(-50%); }
.pr-opt b { font-size: 17px; line-height: 1.3; }
.pr-opt:disabled { opacity: 1; color: var(--muted); cursor: default; }
.pr-opt.right, .pr-opt.wrong { color: var(--ink); }
.pr-opts.is-ar .pr-opt { flex-wrap: wrap; justify-content: flex-start; }
.pr-opts.is-ar .pr-opt .ar { font-size: 27px; line-height: 1.4; }
.pr-opts.is-ar .pr-opt > span:not(.ar) { flex-basis: 100%; margin-top: -4px; color: var(--muted); font-size: 14px; font-weight: 700; }
.pr-fb { display: grid; gap: 10px; margin-top: 14px; }
.pr-fb:empty { display: none; }
.pr-verdict { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 18px; font-weight: 800; }
.pr-verdict.is-right { color: var(--good); }
.pr-verdict.is-wrong { color: var(--bad); }
.pr-fb .btn { justify-self: start; }
.pr-big { margin: 0 0 10px; font-size: 30px; font-weight: 800; }
.pr-perfect { font-size: 18px; font-weight: 700; color: var(--good); }
.pr-end .btn-row { margin-top: 16px; }
.topic-practice { margin-inline-start: 8px; min-height: 36px; padding: 4px 12px; font-size: 15px; vertical-align: middle; }
@media (max-width: 600px) {
  .pr-card { padding: 16px 14px 18px; }
  .pr-opts { grid-template-columns: 1fr; }
  .pr-prompt .ar { font-size: 38px; }
}

/* ---------- Verbs (views/verbs.js) ---------- */
.vb-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.vb-list a { display: inline-grid; justify-items: center; min-width: 76px; padding: 6px 12px 8px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); text-decoration: none; }
.vb-list a:hover { border-color: var(--ink); }
.vb-list a[aria-current="page"] { background: var(--strong-bg); border-color: var(--strong-bg); color: var(--strong-ink); }
.vb-list .ar { font-size: 23px; line-height: 1.4; }
.vb-list small { font-size: 12.5px; font-weight: 700; opacity: .85; }
.vb-card { max-width: 900px; }
.vb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 0 0 12px; }
.vb-big { display: inline-flex; align-items: center; gap: 10px; padding: 4px 14px; border: 0; border-radius: 16px; background: var(--surface-2); color: var(--ink); font: inherit; cursor: pointer; }
.vb-big .ar { font-size: 42px; line-height: 1.4; }
.vb-mean { margin: 0; font-size: 22px; font-weight: 800; }
.vb-head .muted { margin: 2px 0 0; }
.vb-head .muted .ar { font-size: 20px; }
.vb-seg { display: none; }
.vb-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; overflow: hidden; }
.vb-table th, .vb-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.vb-table tr:last-child th, .vb-table tr:last-child td { border-bottom: 0; }
.vb-table thead th { color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.vb-table tbody th { width: 9.5em; font-size: 15px; font-weight: 800; white-space: nowrap; }
.vb-table tbody th .i { width: 15px; height: 15px; color: #D63A5E; fill: currentColor; vertical-align: -2px; }
.vb-table tr.is-her { background: color-mix(in srgb, #D63A5E 8%, transparent); }
.vb-form { display: inline-grid; justify-items: start; gap: 0; padding: 2px 6px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.vb-form:hover { background: var(--surface-2); }
.vb-form .ar { font-size: 25px; line-height: 1.45; }
.vb-form span { color: var(--muted); font-size: 14.5px; font-weight: 700; }
.vb-imp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 12px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); }
.vb-imp .muted { font-weight: 800; font-size: 14px; }
.vb-imp .muted .i { width: 14px; height: 14px; color: #D63A5E; fill: currentColor; vertical-align: -2px; }
.vb-card h3 { margin: 22px 0 10px; }
.vb-drill { margin: 32px 0 0; }
.vb-mix { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.vb-mix input { width: 20px; height: 20px; accent-color: var(--accent); }
.vb-ask { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin: 0; }
.vb-ask .ar { font-size: 34px; line-height: 1.4; }
.vb-ask span { font-weight: 800; color: var(--muted); }
.vb-who { margin: 4px 0 14px; font-size: 22px; font-weight: 800; }
@media (max-width: 700px) {
  .vb-list { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .vb-list a { flex: 0 0 auto; }
  .vb-seg { display: inline-flex; }
  .vb-table.show-now .c-past, .vb-table.show-now .c-will, .vb-table.show-past .c-now, .vb-table.show-past .c-will,
  .vb-table.show-will .c-now, .vb-table.show-will .c-past { display: none; }
  .vb-table tbody th { width: auto; }
  .vb-big .ar { font-size: 36px; }
}

/* ---------- Talk about yourself (views/me.js) ---------- */
.me-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 28px; align-items: start; }
.me-form { position: sticky; top: 16px; display: grid; gap: 12px; padding: 18px; border-radius: 18px; background: var(--surface); border: 1.5px solid var(--line); }
.me-form > label { display: grid; gap: 4px; font-weight: 800; font-size: 14.5px; }
.me-form select, .me-form input[type="number"] { min-height: 44px; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; font-weight: 600; }
.me-form fieldset { margin: 0; padding: 0; border: 0; }
.me-form legend { margin-bottom: 6px; font-weight: 800; font-size: 14.5px; }
.me-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.me-checks label { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 4px 10px; border: 1.5px solid var(--line); border-radius: 99px; font-size: 14.5px; font-weight: 700; cursor: pointer; }
.me-checks label:has(input:checked) { background: var(--strong-bg); border-color: var(--strong-bg); color: var(--strong-ink); }
.me-checks input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.me-out { margin: 0 0 28px; }
.me-out h2 { margin-top: 0; }
.me-lines { display: grid; gap: 8px; }
.me-lines .phrase.is-playing { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.me-qa { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.me-qa > li { display: grid; gap: 6px; padding: 10px; border-radius: 18px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.me-a { padding-inline-start: 22px; }
@media (max-width: 1000px) {
  .me-grid { grid-template-columns: 1fr; }
  .me-form { position: static; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
  .me-form fieldset { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .me-out .phrase { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; }
  .me-out .phrase .phrase-ar { grid-column: 1 / -1; min-width: 0; font-size: 26px; text-align: right; }
  .me-out .phrase .play { grid-column: 2; grid-row: 2; width: 42px; min-width: 42px; height: 42px; }
  .me-a { padding-inline-start: 10px; }
}

/* ---------- Your path (views/path.js) ---------- */
.pa-top { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.pa-top > div { display: grid; min-width: 130px; padding: 10px 16px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); }
.pa-top b { font-size: 26px; line-height: 1.2; }
.pa-top span { color: var(--muted); font-size: 13.5px; font-weight: 700; }
.pa-weeks { display: grid; gap: 10px; max-width: 880px; }
.pa-week { border-radius: 18px; background: var(--surface); border: 1.5px solid var(--line); }
.pa-week.is-now { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.pa-week summary { display: flex; align-items: center; gap: 14px; padding: 12px 16px; cursor: pointer; list-style: none; }
.pa-week summary::-webkit-details-marker { display: none; }
.pa-n { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); font-weight: 800; }
.pa-week.is-now .pa-n { background: var(--strong-bg); color: var(--strong-ink); }
.pa-week.is-full .pa-n { background: color-mix(in srgb, var(--good) 20%, var(--surface)); color: var(--good); }
.pa-head { flex: 1; min-width: 0; display: grid; }
.pa-head b { font-size: 17.5px; }
.pa-head small { color: var(--muted); font-weight: 700; }
.pa-count { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 800; }
.pa-count.is-full { color: var(--good); }
.pa-count .i { width: 16px; height: 16px; }
.pa-goal { display: flex; gap: 10px; align-items: flex-start; margin: 0 16px 10px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, #F4C24D 16%, var(--surface)); font-weight: 700; }
.pa-goal .i { flex: 0 0 auto; width: 20px; height: 20px; color: #B98300; margin-top: 2px; }
.pa-steps { display: grid; gap: 4px; margin: 0; padding: 0 10px 12px; list-style: none; }
.pa-step { display: flex; align-items: center; gap: 10px; }
.pa-box { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 2px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--strong-ink); }
button.pa-box { cursor: pointer; }
.pa-box.is-done { border-color: var(--good); background: var(--good); }
.pa-box .i { width: 18px; height: 18px; color: #fff; }
.pa-step > a, .pa-plain { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; min-height: 44px; padding: 6px 10px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.pa-step > a:hover { background: var(--surface-2); }
.pa-step > a > .i { margin-inline-start: auto; width: 18px; height: 18px; color: var(--muted); }
html[dir="rtl"] .pa-step > a > .i { transform: scaleX(-1); }
.pa-kind { min-width: 6.5em; color: var(--muted); font-size: 12.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pa-text { font-weight: 700; }
.pa-text .ar { font-size: 20px; }
.pa-step small { color: var(--muted); font-weight: 700; }
.pa-step.is-done .pa-text { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
@media (max-width: 600px) {
  .pa-kind { min-width: 0; flex-basis: 100%; }
  .pa-top > div { min-width: calc(50% - 5px); flex: 1; }
}
.gr-more { margin: 32px 0 4px; }
.st-text.is-hidden { position: relative; cursor: pointer; }
.st-text.is-hidden .st-flow, .st-text.is-hidden .st-lines { filter: blur(9px); user-select: none; pointer-events: none; }
@media (prefers-reduced-transparency: reduce) { .st-text.is-hidden .st-flow, .st-text.is-hidden .st-lines { filter: none; opacity: 0; } }

/* ---------- Page scenes (core/scenes.js) ---------- */
.page-head.has-scene { align-items: center; }
.scene-card { position: relative; flex: 0 1 460px; min-width: 300px; margin: 0 0 6px; aspect-ratio: 3 / 1; border-radius: 20px; overflow: hidden; background: var(--scene-bottom); box-shadow: 0 0 0 1px var(--line), 0 10px 28px -18px rgba(0, 0, 0, .45); isolation: isolate; }
.pscene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }
.scene-cap { position: absolute; inset-inline-start: 10px; top: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 20px); min-height: 40px; padding: 3px 4px 3px 12px; border: 0; border-radius: 99px;
  background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: var(--ink); font: inherit; text-align: start; box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .35); cursor: pointer; transition: transform .15s ease, background-color .15s ease; }
html[dir="rtl"] .scene-cap { padding: 3px 12px 3px 4px; }
.scene-cap:hover { background: var(--surface); }
.scene-cap:active { transform: scale(.97); }
.scene-cap .ar { font-size: 21px; line-height: 1.2; }
.scene-say { color: var(--muted); font-size: 14px; font-weight: 800; white-space: nowrap; }
.scene-mean { overflow: hidden; font-size: 13.5px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.scene-cap .play { flex: 0 0 auto; width: 32px; height: 32px; }

.ps-sky-top { stop-color: var(--scene-top); }
.ps-sky-bottom { stop-color: var(--scene-bottom); }
.ps-night { opacity: var(--scene-night); }
.ps-day { opacity: calc(1 - var(--scene-night)); }
.pscene .a-moon path { fill: var(--art-moon); }
.ps-nafud-far { fill: var(--nafud-far); } .ps-nafud { fill: var(--nafud); } .ps-nafud-near { fill: var(--nafud-near); }
.ps-tent { fill: var(--tent); } .ps-tent-line { stroke: var(--tent-line); stroke-width: 1.4; fill: none; } .ps-tent-in { fill: var(--tent-in); }
.ps-rope { stroke: var(--rope); stroke-width: 1; fill: none; } .ps-rope-dark { stroke: var(--tent); stroke-width: 1.2; fill: none; }
.ps-lamp { fill: var(--lamp); } .ps-lamp-glow { fill: var(--lamp); opacity: .22; }
.ps-glow { fill: var(--fire-glow); } .ps-log { fill: var(--art-trunk); }
.ps-flame { fill: var(--flame); } .ps-flame-core { fill: var(--flame-core); }
.ps-sadu-red { fill: var(--sadu-red); } .ps-sadu-cream { fill: var(--sadu-cream); } .ps-sadu-dark { fill: var(--sadu-dark); } .ps-sadu-green { fill: var(--sadu-green); }
.ps-camel { fill: var(--art-wall-shade); } .ps-saddle { fill: var(--sadu-red); } .ps-saddle-band { fill: var(--sadu-cream); }
.ps-tail { stroke: var(--art-wall-shade); stroke-width: 2; fill: none; stroke-linecap: round; }
.ps-tracks { fill: none; stroke: var(--art-wall-shade); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; opacity: .6; }
.ps-pole { stroke: var(--wood); stroke-width: 4; stroke-linecap: round; fill: none; }
.ps-falcon { fill: var(--falcon); } .ps-falcon-chest { fill: var(--falcon-chest); } .ps-falcon-wing { fill: var(--falcon-wing); }
.ps-falcon-spot { stroke: var(--falcon-wing); stroke-width: 1.6; stroke-linecap: round; }
.ps-hood { fill: var(--hood); } .ps-hood-band { fill: var(--art-brass); } .ps-plume { fill: var(--sadu-red); }
.ps-beak { fill: var(--beak); } .ps-malar { fill: none; stroke: var(--hood); stroke-width: 2.2; stroke-linecap: round; }
.ps-wing-line { fill: none; stroke: var(--falcon); stroke-width: 1.2; opacity: .7; } .ps-talon { stroke: var(--beak); stroke-width: 1.8; stroke-linecap: round; }
.ps-leash { fill: none; stroke: var(--sadu-red); stroke-width: 1.6; }
.ps-awning { fill: var(--sadu-red); } .ps-awning-2 { fill: var(--sadu-cream); } .ps-awning-edge { stroke: var(--sadu-dark); stroke-width: 2; }
.ps-wood { fill: var(--wood); } .ps-bowl { fill: var(--bowl); } .ps-basket { fill: var(--art-trunk); } .ps-basket-line { stroke: var(--art-trunk-line); stroke-width: 1.4; fill: none; }
.ps-spice-1 { fill: var(--spice-1); } .ps-spice-2 { fill: var(--spice-2); } .ps-spice-3 { fill: var(--spice-3); } .ps-spice-4 { fill: var(--spice-4); }
.ps-tag-stick { stroke: var(--wood); stroke-width: 1.4; } .ps-tag-card { fill: var(--tag); stroke: var(--line); }
.ps-tag-text { font-family: var(--font-ar); font-size: 11px; font-weight: 700; fill: var(--tag-ink); }
.ps-hill { fill: var(--hill); } .ps-stem { fill: none; stroke: var(--stem); stroke-width: 1.8; } .ps-leaf { fill: var(--leaf); }
.ps-rose { fill: var(--rose); } .ps-rose-in { fill: none; stroke: var(--rose-in); stroke-width: 1.3; stroke-linecap: round; }
.ps-heart { fill: var(--rose); }
.ps-glass { fill: var(--glass); stroke: var(--glass-line); stroke-width: 1; } .ps-glass-in { fill: var(--rosewater); opacity: .8; } .ps-cork { fill: var(--art-trunk); }
.ps-pour { fill: none; stroke: var(--art-brass); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 5 4; }
.ps-carpet { fill: var(--carpet); } .ps-carpet-line { stroke: var(--carpet-line); stroke-width: 2; stroke-dasharray: 8 5; }
.ps-car-body { fill: var(--car); } .ps-car-glass { fill: var(--car-glass); } .ps-wheel { fill: var(--wheel); }
.ps-spout { fill: var(--wood); }
.ps-plaster { fill: var(--plaster); } .ps-plaster-shade { fill: var(--plaster-shade); }
.ps-window rect { fill: var(--scene-top); stroke: var(--wood); stroke-width: 3; } .ps-window-bar { stroke: var(--wood); stroke-width: 2.5; }
.ps-light { fill: var(--lamp); opacity: calc(.14 - var(--scene-night) * .08); }
.ps-cushion { fill: var(--cushion); } .ps-armrest { fill: var(--armrest); } .ps-armrest-band { stroke: var(--sadu-cream); stroke-width: 2; }
.ps-smoke { fill: none; stroke: var(--art-steam); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 60; }
.ps-warp { stroke: var(--sadu-cream); stroke-width: 1.2; opacity: .8; }
.ps-wool-red { fill: var(--sadu-red); } .ps-wool-cream { fill: var(--sadu-cream); } .ps-wool-line { fill: none; stroke: rgba(0, 0, 0, .25); stroke-width: 1.2; }
.ps-grass { fill: var(--grass); } .ps-grass-far { fill: var(--grass-far); }
.ps-flower-1 { fill: var(--flower-1); } .ps-flower-2 { fill: var(--flower-2); } .ps-flower-3 { fill: var(--flower-3); }
.ps-truffle { fill: var(--truffle); } .ps-truffle-line { fill: none; stroke: rgba(0, 0, 0, .3); stroke-width: 1; }
.ps-cloud path:first-child { fill: var(--cloud); } .ps-rain { fill: none; stroke: var(--rain); stroke-width: 1.8; stroke-linecap: round; }
.ps-crescent-moon { fill: var(--art-brass); }
.ps-desk { fill: var(--desk); } .ps-callig { font-size: 52px; }
.ps-skin { fill: var(--skin); } .ps-string { stroke: var(--sadu-dark); stroke-width: .9; opacity: .75; }
.ps-tassel { fill: none; stroke: var(--sadu-red); stroke-width: 1.6; stroke-linecap: round; }
.ps-bow-wood { fill: none; stroke: var(--wood); stroke-width: 2.6; stroke-linecap: round; } .ps-bow-hair { stroke: var(--sadu-cream); stroke-width: 1; }
.ps-wave { fill: none; stroke: var(--art-brass); stroke-width: 2; stroke-linecap: round; opacity: .55; }
.ps-door-in { fill: var(--tent-in); } .ps-door-warm { fill: var(--lamp); opacity: .16; } .ps-door-plank { stroke: var(--art-trunk-line); stroke-width: 1; } .ps-door-blue { fill: var(--door-blue); }
.ps-door-small { fill: none; stroke: var(--art-trunk-line); stroke-width: 1.4; }
.ps-knocker { fill: none; stroke: var(--art-brass); stroke-width: 1.6; } .ps-stud { fill: var(--art-brass); }
.ps-lantern { fill: var(--lamp); }
.ps-stone { fill: var(--stone); } .ps-stone-top { fill: var(--stone-top); } .ps-stone-line { fill: none; stroke: var(--stone-line); stroke-width: 1.1; }
.ps-well-hole { fill: var(--tent-in); } .ps-water { fill: var(--water); } .ps-dalw { fill: var(--art-trunk); }
.ps-rope-line { fill: none; stroke: var(--rope); stroke-width: 1.3; } .ps-spoke { stroke: var(--art-trunk-line); stroke-width: 1.2; }

/* Movement: gentle, and none at all with "reduce motion". Tapping a scene (.is-play) makes it do something. */
@media (prefers-reduced-motion: no-preference) {
  .ps-flame, .ps-flame-core { transform-box: fill-box; transform-origin: 50% 100%; animation: ps-flicker 1.6s ease-in-out infinite; }
  .ps-flame-core { animation-duration: 1.1s; }
  .ps-glow { animation: ps-glow 2.4s ease-in-out infinite; }
  .ps-walk { animation: ps-bob 1.4s ease-in-out infinite; }
  .ps-plume { transform-box: fill-box; transform-origin: 50% 100%; animation: ps-sway 3.2s ease-in-out infinite; }
  .ps-heart { transform-box: fill-box; animation: ps-rise 6s ease-in infinite; opacity: 0; }
  .ps-pour, .pscene .a-steam { animation: ps-flow 1.2s linear infinite; }
  .pscene .a-steam { stroke-dasharray: 4 5; }
  .ps-smoke { animation: ps-smoke 4s ease-in-out infinite; }
  .ps-cloud { animation: ps-drift 14s ease-in-out infinite alternate; }
  .ps-rain { stroke-dasharray: 3 9; animation: ps-flow .9s linear infinite; }
  .ps-lamp-glow { animation: ps-glow 3s ease-in-out infinite; }
  .ps-wing { transform-box: fill-box; transform-origin: 30% 10%; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
  .ps-yarn { transform-box: fill-box; transform-origin: 50% 50%; }
  .scene-card.is-play .ps-flame { animation-duration: .45s; }
  .scene-card.is-play .ps-walk { animation-duration: .45s; }
  .scene-card.is-play .ps-wing { transform: rotate(-28deg); }
  .scene-card.is-play .ps-heart { animation-duration: 1.6s; }
  .scene-card.is-play .ps-yarn { animation: ps-roll .8s ease-out; }
  .scene-card.is-play .pscene { animation: ps-pop .5s ease-out; }
  .ps-wave { animation: ps-wave 2.4s ease-in-out infinite; }
  .ps-water { animation: ps-glow 3s ease-in-out infinite; }
  .ps-door-leaf { transform-box: fill-box; transform-origin: 0 50%; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
  .ps-bucket, .ps-bucket-rope { transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
  .ps-bucket-rope { transform-box: fill-box; transform-origin: 50% 0; }
  .ps-pulley { transform-box: fill-box; transform-origin: 50% 50%; }
  .scene-card.is-play .ps-wave { animation-duration: .7s; }
  .scene-card.is-play .ps-bow { animation: ps-bow .4s ease-in-out 4; }
  .scene-card.is-play .ps-door-leaf { transform: scaleX(.3); }
  .scene-card.is-play .ps-bucket { transform: translateY(-24px); }
  .scene-card.is-play .ps-bucket-rope { transform: scaleY(.35); }
  .scene-card.is-play .ps-pulley { animation: ps-spin .7s ease-out; }
}
@keyframes ps-flicker { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(.93, 1.08); } 60% { transform: scale(1.05, .94); } }
@keyframes ps-glow { 50% { opacity: .55; } }
@keyframes ps-bob { 50% { transform: translateY(-1.8px); } }
@keyframes ps-sway { 50% { transform: rotate(9deg); } }
@keyframes ps-rise { 0% { opacity: 0; transform: translateY(20px); } 20% { opacity: .9; } 100% { opacity: 0; transform: translateY(-26px); } }
@keyframes ps-flow { to { stroke-dashoffset: -18; } }
@keyframes ps-smoke { 0% { stroke-dashoffset: 60; opacity: 0; } 30% { opacity: .9; } 100% { stroke-dashoffset: -60; opacity: 0; } }
@keyframes ps-drift { to { transform: translateX(-26px); } }
@keyframes ps-roll { 50% { transform: translateX(10px) rotate(160deg); } }
@keyframes ps-pop { 40% { transform: scale(1.02); } }
@keyframes ps-wave { 0%, 100% { opacity: .15; } 50% { opacity: .9; } }
@keyframes ps-bow { 50% { transform: translate(12px, -4px); } }
@keyframes ps-spin { to { transform: rotate(-360deg); } }

@media (max-width: 1100px) {
  .scene-card { flex-basis: 340px; min-width: 260px; }
  .scene-mean { display: none; }
}
@media (max-width: 700px) {
  .page-head.has-scene { flex-direction: column; align-items: stretch; gap: 14px; }
  .page-head.has-scene .scene-card { flex: 0 0 auto; width: 100%; min-width: 0; aspect-ratio: auto; height: 112px; margin: 0; border-radius: 16px; }
  .page-head.has-scene .scene-mean { display: inline; }
}
@media (max-width: 420px) {
  .page-head.has-scene .scene-mean { display: none; }
}

/* ---------- Culture card (views/culture.js): a true story about her world, under every page ---------- */
.culture-slot { margin-top: 40px; }
.culture { max-width: 940px; overflow: hidden; border-radius: 22px; border: 1.5px solid var(--line);
  background: color-mix(in srgb, var(--art-sand-far) 24%, var(--surface)); }
.culture .sadu { height: 14px; }
.culture-body { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 22px; align-items: start; padding: 20px 22px 22px; }
.culture-pic { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 18px; background: var(--scene-bottom); box-shadow: 0 0 0 1px var(--line); }
.culture-kind { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--hard); font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.culture-kind .i { width: 16px; height: 16px; }
.culture h2 { margin: 4px 0 8px; font-size: 26px; }
.culture-text > p:not(.culture-kind) { max-width: 68ch; margin: 0; font-size: 17px; line-height: 1.62; }
.culture-text .ar-in { font-size: 1.15em; }
.culture-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; }
.culture-word { display: inline-flex; align-items: center; gap: 10px; min-height: 46px; padding: 4px 6px 4px 14px; border: 0; border-radius: 99px;
  background: var(--surface); box-shadow: 0 0 0 1.5px var(--line); color: var(--ink); font: inherit; text-align: start; cursor: pointer; transition: box-shadow .15s ease, transform .15s ease; }
html[dir="rtl"] .culture-word { padding: 4px 14px 4px 6px; }
.culture-word:hover { box-shadow: 0 0 0 1.5px var(--accent); }
.culture-word:active { transform: scale(.97); }
.culture-word .ar { font-size: 23px; line-height: 1.3; }
.culture-word span { color: var(--muted); font-size: 14px; font-weight: 800; }
.culture-word small { font-size: 13.5px; font-weight: 700; }
.culture-next { margin-inline-start: auto; }
@media (max-width: 700px) {
  .culture-body { grid-template-columns: 1fr; gap: 14px; padding: 14px 14px 16px; }
  .culture-pic { aspect-ratio: 5 / 2; }
  .culture h2 { font-size: 22px; }
  .culture-text > p:not(.culture-kind) { font-size: 16.5px; }
  .culture-next { margin-inline-start: 0; }
}

/* ---------- Life: lists flow in when a page opens, cards lift under the pointer, a burst for finishing ---------- */
@media (prefers-reduced-motion: no-preference) {
  #view.is-entering :is(.ch-list, .gr-list, .vocab, .pa-weeks, .nm-grid, .me-lines, .me-qa, .vb-list, .words, .st-lines, .decks, .print-list, .hc-tiles, .lv-sections > .lv-section) > *,
  #view.is-entering .culture { animation: enter-rise .5s cubic-bezier(.2, .7, .2, 1) both; }
  #view.is-entering :is(.ch-list, .gr-list, .vocab, .pa-weeks, .nm-grid, .me-lines, .me-qa, .vb-list, .words, .st-lines, .decks, .print-list, .hc-tiles) > :nth-child(2) { animation-delay: .04s; }
  #view.is-entering :is(.ch-list, .gr-list, .vocab, .pa-weeks, .nm-grid, .me-lines, .me-qa, .vb-list, .words, .st-lines, .decks, .print-list, .hc-tiles) > :nth-child(3) { animation-delay: .08s; }
  #view.is-entering :is(.ch-list, .gr-list, .vocab, .pa-weeks, .nm-grid, .me-lines, .me-qa, .vb-list, .words, .st-lines, .decks, .print-list, .hc-tiles) > :nth-child(4) { animation-delay: .12s; }
  #view.is-entering :is(.ch-list, .gr-list, .vocab, .pa-weeks, .nm-grid, .me-lines, .me-qa, .vb-list, .words, .st-lines, .decks, .print-list, .hc-tiles) > :nth-child(5) { animation-delay: .16s; }
  #view.is-entering :is(.ch-list, .gr-list, .vocab, .pa-weeks, .nm-grid, .me-lines, .me-qa, .vb-list, .words, .st-lines, .decks, .print-list, .hc-tiles) > :nth-child(6) { animation-delay: .2s; }
  #view.is-entering :is(.ch-list, .gr-list, .vocab, .pa-weeks, .nm-grid, .me-lines, .me-qa, .vb-list, .words, .st-lines, .decks, .print-list, .hc-tiles) > :nth-child(n+7) { animation-delay: .24s; }
  .scene-card { animation: enter-scene .6s cubic-bezier(.2, .7, .2, 1) both; }
  :is(.ch-card, .gr-card, .vb-list a, .pa-step > a, .culture-word, .scene-cap) { transition: transform .18s cubic-bezier(.2, .7, .2, 1), box-shadow .18s ease, background-color .15s ease; }
  .btn:active, .opt:not(:disabled):active, .ch-card:active, .gr-card:active { transform: scale(.975); }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  :is(.ch-card, .gr-card):hover { transform: translateY(-2px); box-shadow: 0 12px 24px -16px rgba(0, 0, 0, .4), 0 0 0 1px var(--line); }
  .vb-list a:hover { transform: translateY(-2px); }
}
@keyframes enter-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes enter-scene { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.confetti { position: fixed; z-index: 1000; width: 9px; height: 9px; border-radius: 1.5px; pointer-events: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }

/* Stories: Dima's recorded ones, and her record button */
.st-voiced { display: inline-flex; vertical-align: -3px; margin-inline-start: 6px; color: var(--accent); }
.st-voiced svg { width: 16px; height: 16px; }
.st-rec-n { font-weight: 600; opacity: .8; font-variant-numeric: tabular-nums; }

/* Today: her city now — the time in Saudi, the Hijri date, the next prayer, the next occasion */
.hc { margin: 20px 0 22px; }
.hc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.hc-head h2 { margin: 0; font-size: 19px; }
.hc-head a { font-weight: 700; }
.hc-head a .i { width: 14px; height: 14px; vertical-align: -2px; }
.hc-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hc-tile { position: relative; display: grid; align-content: start; gap: 5px; min-width: 0; min-height: 118px; margin: 0; padding: 20px 16px 14px;
  overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); font: inherit; text-align: start; }
.hc-tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--sadu-red) linear-gradient(90deg, var(--sadu-cream) 0 50%, transparent 0) 0 2px / 7px 2px repeat-x; }
button.hc-tile { cursor: pointer; padding-inline-end: 50px; }
button.hc-tile .play { position: absolute; inset-inline-end: 12px; bottom: 12px; width: 36px; }
.hc-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.hc-label .i { width: 16px; height: 16px; color: var(--accent); }
.hc-big { font-size: 22px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.hc-big .ar { font-size: 26px; font-weight: 700; }
.hc-hijri .ar { white-space: nowrap; font-size: 24px; }
.hc-clock { font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.hc-time { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
.hc-small { color: var(--muted); font-size: 14px; line-height: 1.4; }
.hc-small b { color: var(--hard); }
@media (hover: hover) and (pointer: fine) { button.hc-tile:hover { border-color: var(--accent); } }
@media (max-width: 1180px) { .hc-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .hc-tiles { gap: 10px; }
  .hc-tile { min-height: 0; padding: 18px 12px 12px; }
  button.hc-tile { padding-inline-end: 12px; padding-bottom: 50px; }
  .hc-big { font-size: 19px; } .hc-big .ar { font-size: 22px; } .hc-clock { font-size: 26px; } .hc-time { font-size: 17px; }
  .hc-small { font-size: 13px; }
  .hc-hijri .ar { white-space: normal; font-size: 21px; }
}

/* Today: the story of the day */
.td-story-slot:empty { display: none; }
.td-story { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 18px; align-items: center; margin: 0 0 18px; padding: 14px 18px 14px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--art-sand-far) 24%, var(--surface)); color: var(--ink); text-decoration: none; }
html[dir="rtl"] .td-story { padding: 14px 14px 14px 18px; }
.td-story-pic { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 14px; background: var(--scene-bottom); }
.td-story-text { display: grid; gap: 4px; min-width: 0; }
.td-story-kind { display: flex; align-items: center; gap: 6px; color: var(--hard); font-size: 12.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.td-story-kind .i { width: 16px; height: 16px; }
.td-story-text > b { font-size: 20px; line-height: 1.25; }
.td-story-ar { justify-self: start; max-width: 100%; font-size: 24px; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-story-meta { color: var(--muted); font-size: 14px; }
@media (hover: hover) and (pointer: fine) { .td-story:hover { border-color: var(--accent); } }
@media (max-width: 560px) {
  .td-story { grid-template-columns: 84px minmax(0, 1fr); gap: 12px; padding: 12px; }
  html[dir="rtl"] .td-story { padding: 12px; }
  .td-story-go { grid-column: 1 / -1; justify-content: center; }
  .td-story-text > b { font-size: 18px; }
  .td-story-ar { font-size: 21px; }
}

/* iPhone: a long row of choices (word-list stages, To her sections, letter groups) stays one line and scrolls
   sideways, instead of stacking four rows deep above the words; the edges fade to show there's more. */
@media (max-width: 560px) {
  .tabs, .chips, .lv-jump { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none;
    padding-inline: 18px; -webkit-mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 18px), transparent); }
  .tabs::-webkit-scrollbar, .chips::-webkit-scrollbar, .lv-jump::-webkit-scrollbar { display: none; }
  :is(.tabs, .chips, .lv-jump) > * { flex: 0 0 auto; scroll-snap-align: center; white-space: nowrap; }
}

/* Touch screens (her iPad and iPhone): everything you tap is at least 44 px. Buttons grow; small things inside a line
   of text (a prayer name, a verb form, "Open") keep their look and get a bigger invisible edge to tap instead. */
@media (pointer: coarse) {
  .btn, .chip, .tabs a, .tabs button, .scene-cap, .city-chips button, .city-chips a { min-height: 44px; }
  .sky-toggle, .bd-go { min-width: 44px; min-height: 44px; }
  .edit-fab { min-height: 44px; }
  .pa-box, .pr-name, .vb-form, .task-go, a.small, .table-details summary, .check input, .task input, .detail-tasks input { position: relative; }
  .pa-box::after, .pr-name::after, .vb-form::after, .task-go::after, a.small::after, .table-details summary::after { content: ""; position: absolute; inset: -8px; }
  .task input, .check input, .detail-tasks input { width: 24px; height: 24px; }
}
