/* LingoDoc · Français professionnel pour architectes (Québec): v2 learner app.
   Visual identity: a drawing set. Navy ink (#112F3B) and brass gold (#E1B969) from the owner's logo files
   (app2/brand/), drafting paper, hairlines, sheet numbers, line drawings as covers (js/art.js).
   Mobile first (360 px), then tablet and desktop. Light and dark themes, contrast AA, visible focus.
   Fonts are bundled (fonts/, SIL Open Font Licence): IBM Plex Sans for French and English, Vazirmatn for Persian. */

@font-face { font-family: "Plex"; font-style: normal; font-weight: 100 700; font-display: swap; src: url(fonts/plex-sans-latin-var.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex"; font-style: normal; font-weight: 100 700; font-display: swap; src: url(fonts/plex-sans-latin-ext-var.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex"; font-style: italic; font-weight: 100 700; font-display: swap; src: url(fonts/plex-sans-latin-italic-var.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/vazirmatn-arabic-var.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

:root {
  --bg: #f6f3eb; --surface: #ffffff; --surface2: #efe9dc; --text: #13232b; --muted: #535f67;
  --line: #ddd4c2; --line-strong: #b9ad95;
  --accent: #112f3b; --accent-ink: #ffffff; --accent-soft: #e2eaed;
  --gold: #e1b969; --gold-ink: #7c5d22; --gold-soft: #f6ecd6;
  --plate: #112f3b; --plate-ink: #f4efe3; --plate-muted: #c9d3d6; --plate-line: rgba(225, 185, 105, .16);
  --ok: #1d6b3a; --ok-soft: #e3f2e8; --bad: #a3271f; --bad-soft: #fbe7e4; --warn: #8a5a00;
  --mark: #fbeec8; --focus: #c2410c;
  --g-m: #1f5f8b; --g-f: #a12d6a; --g-mf: #6b4fa0; --g-pl: #2f6b52;
  --radius: 12px; --radius-s: 8px; --gap: 12px;
  --top-h: 56px; --nav-h: 62px;
  --shadow: 0 1px 2px rgba(17, 47, 59, .06), 0 2px 8px rgba(17, 47, 59, .05);
  --font: "Plex", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-fa: "Vazirmatn", "Vazir", "Noto Naskh Arabic", "Noto Sans Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a161c; --surface: #102029; --surface2: #172d37; --text: #eee9de; --muted: #a9b4ba;
    --line: #26414d; --line-strong: #3b5a67;
    --accent: #e1b969; --accent-ink: #0a161c; --accent-soft: #2a2617;
    --gold: #e1b969; --gold-ink: #e1b969; --gold-soft: #2a2617;
    --plate: #112f3b; --plate-ink: #f4efe3; --plate-muted: #c3cdd1; --plate-line: rgba(225, 185, 105, .14);
    --ok: #7ad69a; --ok-soft: #173323; --bad: #ff9b8f; --bad-soft: #3a1c19; --warn: #f0c060;
    --mark: #4a3f12; --focus: #ffa060;
    --g-m: #8cc4ee; --g-f: #f29ac8; --g-mf: #c3a9f0; --g-pl: #8fd4b4;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a161c; --surface: #102029; --surface2: #172d37; --text: #eee9de; --muted: #a9b4ba;
  --line: #26414d; --line-strong: #3b5a67;
  --accent: #e1b969; --accent-ink: #0a161c; --accent-soft: #2a2617;
  --gold: #e1b969; --gold-ink: #e1b969; --gold-soft: #2a2617;
  --plate: #112f3b; --plate-ink: #f4efe3; --plate-muted: #c3cdd1; --plate-line: rgba(225, 185, 105, .14);
  --ok: #7ad69a; --ok-soft: #173323; --bad: #ff9b8f; --bad-soft: #3a1c19; --warn: #f0c060;
  --mark: #4a3f12; --focus: #ffa060;
  --g-m: #8cc4ee; --g-f: #f29ac8; --g-mf: #c3a9f0; --g-pl: #8fd4b4;
  --shadow: none;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); overflow-wrap: break-word; -webkit-font-smoothing: antialiased; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .3em 0 .25em; letter-spacing: -.02em; }
h2 { font-size: 1.18rem; line-height: 1.3; margin: 0 0 .6em; }
h3 { font-size: 1.04rem; margin: 1.1em 0 .4em; }
h4 { font-size: 1rem; margin: .8em 0 .3em; }
p { margin: .35em 0; }
strong { font-weight: 650; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 30; }
.skip:focus { left: 8px; }
.ico { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
.cover { display: block; width: 100%; height: auto; }
.cover .acc { stroke: var(--gold); }
.eyebrow { margin: 0; font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); }

/* ---------- language blocks ---------- */
.fa { font-family: var(--font-fa); direction: rtl; text-align: right; unicode-bidi: isolate; line-height: 1.95; }
.fa bdi { unicode-bidi: isolate; }
[lang="fa"] { font-family: var(--font-fa); }
.en { color: var(--muted); }
.sub { color: var(--muted); margin-top: 0; }
body.no-en .en { display: none; }
body.no-fa .fa { display: none; }
/* Content that exists only in English and Persian stays readable when both are off. */
body.no-en.no-fa .keep .en, body.no-en.no-fa .why .en { display: block; }
span.en, span.fa { display: block; }
.lessoncard span.en, .lessoncard span.fa, .unitcard span.en, .unitcard span.fa { font-size: .9em; }
:root[lang="fa"] body { font-family: var(--font-fa), var(--font); }

/* ---------- header ---------- */
/* The header is a navy plate in both themes, like the app icon. */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px 12px; min-height: var(--top-h); padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top, 0px)); background: var(--plate); color: var(--plate-ink); }
.top .tg { background: transparent; color: var(--plate-muted); border-color: rgba(244, 239, 227, .35); }
.top .tg[aria-pressed="true"] { background: var(--gold); color: #112f3b; border-color: var(--gold); }
.top #speed { background: transparent; color: var(--plate-ink); border-color: rgba(244, 239, 227, .35); }
.top #speed option { color: #13232b; background: #fff; }
.top :focus-visible { outline-color: var(--gold); }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold) 80%, transparent); opacity: .7; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--plate-ink); min-width: 0; }
.brand-emb { height: 30px; width: auto; flex: none; }
.brand-id { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.brand-word { height: 15px; width: auto; }
.brand-course { font-size: .6rem; line-height: 1.25; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.on-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .on-light { display: none; } :root:not([data-theme="light"]) .on-dark { display: block; } }
:root[data-theme="dark"] .on-light { display: none; }
:root[data-theme="dark"] .on-dark { display: block; }
.brandline { margin: 0 0 6px; font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-ink); }
.tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.tg { min-width: 44px; min-height: 40px; border: 1px solid var(--line); background: var(--surface2); color: var(--muted); border-radius: 999px; font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; text-decoration: line-through; }
.tg[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); text-decoration: none; }
select, input, textarea, button { font: inherit; color: inherit; }
select, input[type="text"], input:not([type]), textarea { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 8px 10px; max-width: 100%; }
#speed { padding: 6px 4px; min-height: 40px; border-radius: 999px; background: var(--surface2); border-color: var(--line); font-size: .85rem; }

/* navigation: a tab bar at the bottom on phones, in the header from 900 px */
.nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--nav-h); padding: 6px 2px; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600; line-height: 1.15; text-align: center; }
.nav a .ico { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--accent); }
.nav a[aria-current="page"] .ico { stroke-width: 2.1; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
.nav a { position: relative; }

main { max-width: 860px; margin: 0 auto; padding: 14px 16px 40px; outline: none; }
.foot { border-top: 1px solid var(--line); background: var(--surface); padding: 14px 16px 18px; font-size: .84rem; color: var(--muted); }
.foot .notice { max-width: 860px; margin: 0 auto; }
.foot .brandline { max-width: 860px; margin: 0 auto 6px; }
.foot .frt { color: var(--text); }

/* update and install banners */
.toast { position: fixed; z-index: 25; left: 12px; right: 12px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px); max-width: 520px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--plate); color: var(--plate-ink); box-shadow: 0 6px 24px rgba(0, 0, 0, .25); border: 1px solid var(--plate-line); }
.toast[hidden] { display: none; }
.toast p { margin: 0; flex: 1 1 200px; }
.toast .btn { background: var(--gold); border-color: var(--gold); color: #112f3b; }
.toast .btn.ghost { background: transparent; color: var(--plate-ink); border-color: rgba(244, 239, 227, .4); }

/* ---------- blocks ---------- */
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; box-shadow: var(--shadow); }
.block > h2, .lhead + .block > h2 { position: relative; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.block > h2::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 36px; height: 2px; background: var(--gold); }
[dir="rtl"] .block > h2::after { left: auto; right: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.row.center { justify-content: center; }
.hint { color: var(--muted); font-size: .9rem; }
.lab { color: var(--muted); font-size: .86rem; font-weight: 600; }
.tag { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.nf { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.tag.crit { font-weight: 700; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; line-height: 1.25; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
.btn:hover:not([disabled]) { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover:not([disabled]) { background: var(--accent-soft); filter: none; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn.big { font-size: 1.05rem; padding: 11px 22px; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #112f3b; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.recording { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.recording .ico { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.btn.def { border-width: 2px; }
.btn .ico { width: 18px; height: 18px; }
.play { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); cursor: pointer; display: inline-grid; place-items: center; padding: 0; }
.play .ico { width: 16px; height: 16px; margin-left: 2px; }
.play.playing, .btn.playing { background: var(--accent); color: var(--accent-ink); }
.filebtn { position: relative; }

/* ---------- lines, dialogue ---------- */
.line { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.line:last-child { border-bottom: 0; }
.lt { flex: 1; min-width: 0; }
.lt > p { margin: 0 0 2px; }
.who { display: block; font-weight: 700; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-ink); margin: 0 0 1px; }
.dialogue { margin-top: 8px; }
.trd summary { color: var(--muted); font-size: .85rem; cursor: pointer; }
.speakers { padding-left: 1.2em; }
.note { font-size: .92rem; }

/* ---------- documents ---------- */
.doc { position: relative; background: var(--surface2); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-s); padding: 14px 16px; margin: 10px 0; }
.doctitle { font-weight: 700; }
.reading { white-space: normal; }
.gl { font: inherit; color: inherit; background: var(--mark); border: 0; border-bottom: 2px dotted var(--accent); padding: 0 2px; cursor: pointer; border-radius: 2px; }
.glpop { display: none; }
.gl[aria-expanded="true"] + .glpop { display: block; margin: 4px 0; padding: 8px 10px; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius-s); }
.glossary dl { margin: 6px 0; }
.glossary dt { font-weight: 700; margin-top: 6px; }
.glossary dd { margin: 0 0 4px 0; }
mark.hl { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 3px; }
.hlno { display: inline-block; font-size: .7rem; font-weight: 800; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 6px; margin-right: 3px; text-decoration: none; vertical-align: super; }
.notes { padding-left: 1.2em; }

/* ---------- lexique ---------- */
.legend { font-size: .85rem; color: var(--muted); }
.terms { display: grid; grid-template-columns: 1fr; gap: 10px; }
.term { border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; background: var(--surface); }
.term.g-m { border-left-color: var(--g-m); } .term.g-f { border-left-color: var(--g-f); } .term.g-mf { border-left-color: var(--g-mf); } .term.g-pl { border-left-color: var(--g-pl); }
.tfr { font-weight: 650; font-size: 1.05rem; margin: 0; flex: 1; }
.gtag { font-size: .74rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; color: #fff; background: var(--muted); }
:root[data-theme="dark"] .gtag { color: #111; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gtag { color: #111; } }
.g-m.gtag { background: var(--g-m); } .g-f.gtag { background: var(--g-f); } .g-mf.gtag { background: var(--g-mf); } .g-pl.gtag { background: var(--g-pl); }
.pos { font-size: .8rem; color: var(--muted); }
.ex1 p { margin: 0; }
.sayit { padding: 8px 0; border-bottom: 1px dashed var(--line); }
del { color: var(--bad); text-decoration-thickness: 2px; }
.right { color: var(--ok); font-weight: 600; }
.err { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; margin: 8px 0; background: var(--surface); }
.clinic h3 .n { display: inline-block; min-width: 2em; text-align: center; background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-variant-numeric: tabular-nums; }
.contrast { background: var(--accent-soft); border-radius: var(--radius-s); padding: 10px 12px; }
.ipa { font-family: "Charis SIL", "Doulos SIL", "Plex", "Lucida Sans Unicode", "Segoe UI", sans-serif; color: var(--muted); }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; margin: 8px 0; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
thead th { background: var(--surface2); font-weight: 650; }

/* ---------- exercises ---------- */
.exlist { counter-reset: ex; }
.ex { position: relative; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 12px 12px 46px; margin: 10px 0; background: var(--surface); }
.ex.done { background: var(--surface2); }
.exnum { position: absolute; left: 10px; top: 12px; width: 26px; height: 26px; display: grid; place-items: center; font-size: .78rem; font-weight: 700; border-radius: 50%; background: var(--surface2); border: 1px solid var(--line-strong); font-variant-numeric: tabular-nums; }
.instr p { margin: 0; font-size: .88rem; }
.instr .i-fr { font-weight: 600; color: var(--muted); }
.q { font-weight: 600; }
.opts { display: grid; gap: 6px; margin: 6px 0; }
.opts.tf { grid-template-columns: 1fr 1fr; }
.opt { text-align: left; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); cursor: pointer; }
.opt:hover:not([disabled]) { border-color: var(--accent); }
.opt.sel { border: 2px solid var(--accent); background: var(--accent-soft); }
.opt.ok { border: 2px solid var(--ok); background: var(--ok-soft); }
.opt.bad { border: 2px solid var(--bad); background: var(--bad-soft); }
.opt[disabled] { cursor: default; color: var(--text); }
.gapq { line-height: 2.4; }
.gapin { width: 9em; padding: 4px 8px; margin: 0 4px; }
.wr { width: 100%; margin: 4px 0; }
.fb { border-radius: var(--radius-s); padding: 8px 10px; margin-top: 8px; }
.fb.ok { background: var(--ok-soft); color: var(--text); border-left: 4px solid var(--ok); }
.fb.bad { background: var(--bad-soft); color: var(--text); border-left: 4px solid var(--bad); }
.fb strong { display: block; }
.diff { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface); padding: 6px; border-radius: 6px; }
.diff ins { background: var(--ok-soft); color: var(--ok); text-decoration: underline; }
.diff del { background: var(--bad-soft); }
.order .line { min-height: 48px; border: 2px dashed var(--line-strong); border-radius: var(--radius-s); padding: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.tokens { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.tok { min-height: 40px; padding: 6px 10px; border-radius: var(--radius-s); border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text); cursor: pointer; }
.match .mrow { display: grid; gap: 4px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.match select { width: 100%; }
.okm { color: var(--ok); font-weight: 700; } .badm { color: var(--bad); }
.free { width: 100%; min-height: 8em; line-height: 1.6; }
.free.big { min-height: 16em; }
.free[readonly] { background: var(--surface2); }
.wc { font-size: .88rem; color: var(--muted); }
h3.lvl { border-top: 1px solid var(--line); padding-top: 10px; }
details.model, details.transcript { margin: 6px 0; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: 32px; }
.clipgroup { border: 2px solid var(--accent-soft); border-radius: var(--radius); padding: 10px; margin: 12px 0; }
.clipplayer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; background: var(--accent-soft); border-radius: var(--radius-s); }
.plays { font-size: .9rem; font-weight: 600; }
.score { font-weight: 700; }
.rec { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.rec .recwarn { flex-basis: 100%; margin: 4px 0 0; }
.quiz .opts { grid-template-columns: 1fr 1fr; }
.checklist { list-style: none; padding: 0; }
.checklist li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.checklist input { width: 20px; height: 20px; vertical-align: middle; margin-right: 6px; accent-color: var(--accent); }

/* ---------- home ---------- */
.plate { position: relative; overflow: hidden; margin: 4px 0 16px; padding: 22px 18px 20px; border-radius: 16px; background: var(--plate); color: var(--plate-ink);
  background-image: linear-gradient(var(--plate-line) 1px, transparent 1px), linear-gradient(90deg, var(--plate-line) 1px, transparent 1px);
  background-size: 22px 22px; background-position: -1px -1px; }
.plate::after { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(225, 185, 105, .35); border-radius: 11px; pointer-events: none; }
.plate .eyebrow { color: var(--gold); }
.plate h1 { color: var(--plate-ink); font-size: 1.55rem; max-width: 22ch; }
.plate .sub, .plate .en { color: var(--plate-muted); }
.plate .fa { color: var(--plate-muted); }
.plate .btn { background: var(--gold); border-color: var(--gold); color: #112f3b; margin-top: 10px; position: relative; z-index: 1; }
.plate .btn.ghost { background: transparent; color: var(--plate-ink); border-color: rgba(244, 239, 227, .45); }
.plate a:focus-visible { outline-color: var(--gold); }
.plate .cover { position: absolute; right: -10px; bottom: -6px; width: 170px; color: rgba(244, 239, 227, .22); pointer-events: none; }
.plate .cover .acc { stroke: rgba(225, 185, 105, .55); }
.plate > :not(.cover) { position: relative; z-index: 1; }

.today { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 0 0 8px; }
.tile { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--accent); }
.tile .tico { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: var(--gold-soft); color: var(--gold-ink); }
.tile .tico .ico { width: 24px; height: 24px; }
.tile .tt { flex: 1; min-width: 0; }
.tile .tt strong { display: block; font-size: 1rem; }
.tile .big-n { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }

.phase { margin: 28px 0 12px; }
.phasehead { display: flex; align-items: flex-end; gap: 12px; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 1px solid var(--line-strong); }
.phasehead .ph { flex: 1; min-width: 0; }
.phasehead h2 { margin: 2px 0 0; font-size: 1.25rem; }
.phasehead .sub { margin: 0; }
.phasehead .cover { flex: none; width: 92px; color: var(--line-strong); }
.plvl { display: inline-block; font-size: .74rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 6px; vertical-align: 2px; font-variant-numeric: tabular-nums; }
.units, .lessons { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.unitcard { display: grid; grid-template-columns: 92px 1fr; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); overflow: hidden; box-shadow: var(--shadow); }
.unitcard:hover { border-color: var(--accent); }
.uc-art { position: relative; display: grid; place-items: center; padding: 8px; background: var(--surface2); border-right: 1px solid var(--line); color: var(--accent); }
.uc-art .cover { width: 100%; }
.sheetno { position: absolute; left: 6px; top: 5px; font-size: .66rem; font-weight: 700; letter-spacing: .08em; color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.uc-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; min-width: 0; }
.uc-body .ut { font-weight: 600; line-height: 1.3; }
.uc-meta { display: flex; align-items: center; gap: 8px; margin-top: auto; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
progress.bar { flex: 1; min-width: 40px; height: 5px; border: 0; border-radius: 3px; background: var(--surface2); overflow: hidden; -webkit-appearance: none; appearance: none; color: var(--gold); }
progress.bar::-webkit-progress-bar { background: var(--surface2); border-radius: 3px; }
progress.bar::-webkit-progress-value { background: var(--gold); border-radius: 3px; }
progress.bar::-moz-progress-bar { background: var(--gold); border-radius: 3px; }
.uc-meta .offl { color: var(--ok); display: inline-flex; align-items: center; gap: 2px; }
.coming { color: var(--muted); font-style: italic; }
.notice-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 28px; font-size: .9rem; background: var(--surface); }
.notice-box h2 { font-size: 1rem; }
.prog { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-size: .8rem; color: var(--muted); gap: 2px; }

/* ---------- unit page ---------- */
.unithero { display: grid; gap: 4px; margin: 4px 0 6px; }
.unithero .art { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface2); color: var(--accent); padding: 14px 24px 10px; margin-bottom: 8px; overflow: hidden;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 20px 20px; }
.unithero .art .cover { max-width: 200px; margin: 0 auto; }
@media (min-width: 640px) { .unithero .art .cover { max-width: 280px; } }
.unithero .art .sheetno { left: 12px; top: 10px; font-size: .74rem; }
.titleblock { position: absolute; right: 10px; bottom: 10px; font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-strong); background: var(--surface); padding: 2px 6px; border-radius: 3px; }
.lessoncard { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.lessoncard:hover { border-color: var(--accent); }
.lessons { counter-reset: lesson; }
.lessoncard .lico { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.lessoncard .lico .ico { width: 22px; height: 22px; }
.lessoncard .lt { flex: 1; min-width: 0; font-weight: 600; line-height: 1.3; }
.lessoncard .ltype { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-ink); margin-bottom: 1px; }
.lessoncard .min { flex: none; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.lessoncard.done { border-color: var(--ok); }
.lessoncard.done .lico { background: var(--ok-soft); color: var(--ok); }
.lessoncard .ok { color: var(--ok); font-weight: 800; }

/* offline control */
.offline { display: grid; gap: 8px; }
.offline .ostate { display: flex; align-items: center; gap: 10px; }
.offline .ostate .ico { width: 26px; height: 26px; color: var(--gold-ink); }
.offline.is-done .ostate .ico { color: var(--ok); }
.offline progress { width: 100%; height: 8px; accent-color: var(--gold); }
.offline .row { margin: 0; }

/* ---------- lesson page ---------- */
.lhead { margin: 2px 0 8px; }
.lhead .ltype { display: inline-flex; align-items: center; gap: 6px; color: var(--gold-ink); font-weight: 700; font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; margin: 6px 0 0; }
.lhead .ltype .ico { width: 18px; height: 18px; }
.crumbs a { font-size: .86rem; text-decoration: none; color: var(--muted); }
.crumbs a::before { content: "← "; }
[dir="rtl"] .crumbs a::before { content: "→ "; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.objs { border-left: 3px solid var(--gold); padding: 2px 0 2px 12px; margin: 8px 0; }
.objs ul { margin: 4px 0; padding-left: 1.2em; }
.lfoot { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.cando { padding-left: 1.2em; }
.cando li { margin: 4px 0; }
.filters, .tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { min-height: 36px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; }
.chip.cur, .tabs a.cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tabs a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong); text-decoration: none; color: var(--text); }
.nbadd { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 10px 0; background: var(--surface); }
.field { display: grid; gap: 4px; margin: 10px 0; }
.field2 { display: grid; gap: 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 14px; padding: 22px 18px; text-align: center; margin: 12px 0; box-shadow: var(--shadow); }
.cardfr { font-size: 1.35rem; font-weight: 650; margin: 0; }
.card .back { margin: 12px 0; }
.card .fa, .card .en { text-align: center; }

/* ---------- simulator ---------- */
.stepper { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.step { min-height: 40px; padding: 4px 10px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface2); cursor: pointer; font-size: .88rem; }
.step.cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.timer { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); margin: 8px 0; background: var(--surface); }
.timer .clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.2rem; letter-spacing: .02em; }
.timer .clock.big { font-size: 1.6rem; }
.timer .clock.low { color: var(--bad); }
.timer.sitting { position: sticky; top: calc(var(--top-h) + 6px); z-index: 3; border-color: var(--accent); box-shadow: var(--shadow); }
.notes { display: grid; gap: 4px; margin: 8px 0; }
.notes textarea { width: 100%; }
.split { display: grid; gap: 12px; }
.turns { margin: 8px 0; }
.turn { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; margin: 8px 0; background: var(--surface); }
.turn.vous { border-color: var(--accent); background: var(--accent-soft); }
.said { color: var(--text); }
.tip { margin-top: 6px; }
.amodel { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px; margin: 10px 0; }
.amodel.lvl-tres-bien { border-left: 5px solid var(--ok); }
.amodel.lvl-bien { border-left: 5px solid var(--accent); }
.amodel.lvl-a-ameliorer { border-left: 5px solid var(--warn); }
.modeltext { white-space: normal; }
.mynotes { white-space: pre-wrap; font: inherit; background: var(--surface2); padding: 8px; border-radius: 6px; min-height: 3em; }
.mytext { white-space: normal; }
.steps, .structure { padding-left: 1.4em; }
.bilan-start { border-top: 3px solid var(--gold); }

/* ---------- settings ---------- */
.setgroup { margin: 18px 0; }
.storage-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.storage-line .nm { flex: 1 1 160px; }

/* ---------- wider screens ---------- */
@media (max-width: 419px) { .brand-course { display: none; } }
.uc-art .cover { stroke-width: 2.6; }
.phasehead .cover { stroke-width: 2.2; }
.plate .cover { stroke-width: 1.4; }
@media (min-width: 640px) {
  h1 { font-size: 1.9rem; }
  main { padding: 18px 24px 48px; }
  .plate { padding: 30px 250px 28px 30px; }
  .plate h1 { font-size: 2.1rem; }
  .plate .cover { width: 230px; right: 14px; bottom: 10px; }
  .today { grid-template-columns: 1fr 1fr; }
  .units { grid-template-columns: 1fr 1fr; }
  .unitcard { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .uc-art { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 28px 10px; }
  .uc-art .cover { max-width: 190px; }
  .uc-body { padding: 12px 14px 14px; }
  .terms { grid-template-columns: 1fr 1fr; }
  .opts { grid-template-columns: 1fr 1fr; }
  .match .mrow { grid-template-columns: 1fr 1fr auto; align-items: center; }
  .field2 { grid-template-columns: 2fr 1fr; gap: 10px; }
  .phasehead .cover { width: 130px; }
}
@media (min-width: 900px) {
  :root { --top-h: 64px; }
  body { padding-bottom: 0; }
  .top { padding: 8px 24px; }
  .brand-emb { height: 34px; }
  .brand-word { height: 17px; }
  .nav { position: static; display: flex; gap: 2px; border: 0; padding: 0; background: none; margin-left: 12px; }
  .nav a { flex-direction: row; gap: 7px; min-height: 40px; padding: 6px 12px; border-radius: 999px; font-size: .9rem; }
  .nav a .ico { width: 18px; height: 18px; }
  .nav a { color: var(--plate-muted); }
  .nav a:hover { background: rgba(244, 239, 227, .1); color: var(--plate-ink); }
  .nav a[aria-current="page"] { background: rgba(225, 185, 105, .16); color: var(--gold); }
  .nav a[aria-current="page"]::before { display: none; }
  .toast { bottom: 20px; }
}
@media (min-width: 1000px) {
  main { max-width: 1060px; }
  .units { grid-template-columns: 1fr 1fr 1fr; }
  .split { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) and (max-width: 1080px) {
  .brand-course { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
@media print { .top, .foot, .nav, .toast, .btn, .play { display: none !important; } body { padding: 0; } }
button.tile { width: 100%; text-align: left; font: inherit; cursor: pointer; }
.uc-meta .offl:empty { display: none; }
.uc-meta .offl .ico { width: 14px; height: 14px; }
.toast > .ico { width: 22px; height: 22px; color: var(--gold); }

/* ---------- learner's guide (guide/) ---------- */
body.guide { padding-bottom: 0; }
.gnav { position: sticky; top: var(--top-h); z-index: 15; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.gnav a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong); text-decoration: none; color: var(--text); font-size: .9rem; font-weight: 600; }
.gnav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ghead { margin: 6px 0 4px; }
.guide .bi { display: grid; gap: 14px; }
.guide .bi .en { color: var(--text); }
.guide .bi .fa { border-top: 1px dashed var(--line); padding-top: 10px; }
.guide .bi ol, .guide .bi ul { padding-inline-start: 1.4em; }
.guide .bi li { margin: 4px 0; }
body.guide.no-en .bi .fa { border-top: 0; padding-top: 0; }
.gfoot { margin: 20px 0; }
@media (min-width: 900px) {
  .gnav { justify-content: center; padding: 10px 24px; }
  .guide .bi { grid-template-columns: 1fr 1fr; gap: 28px; }
  .guide .bi .fa { border-top: 0; padding-top: 0; border-right: 0; }
  .guide .bi .en + .fa { border-left: 1px dashed var(--line); padding-left: 28px; }
  body.no-en .bi, body.no-fa .bi { grid-template-columns: 1fr; }
  body.no-en .bi .fa { border-left: 0; padding-left: 0; }
}
.lessoncard .sub, .uc-body .sub { font-weight: 400; }
.eyebrow [lang="fa"], .ltype [lang="fa"], .who[lang="fa"], .brand-course [lang="fa"] { letter-spacing: 0; text-transform: none; }
