/* Englishfinjal. Layout: a fixed navy "finjal" sidebar carries progress on every page; the main column holds the current lesson.
   Arabic always sits on a highlighter swatch; gold marks rewards and the coffee motif. */
:root {
  --bg: #F3F6FB;
  --surface: #FFFFFF;
  --surface-2: #EEF2F9;
  --ink: #14213D;
  --muted: #5A6681;
  --line: #DCE3EF;
  --accent: #2950B8;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3EAFA;
  --gold: #D9A62E;
  --gold-soft: #FFF3D1;
  --hl: #FFE36E;
  --hl-ink: #2B2300;
  --good: #1D8A4E;
  --good-soft: #DDF3E6;
  --bad: #C73B3B;
  --bad-soft: #FBE3E3;
  --side-bg: #14213D;
  --side-ink: #E9EDF7;
  --side-muted: #9AA6C3;
  --side-line: #26355E;
  --a1: #2950B8; --a2: #0F8A7E; --b1: #8A4FC9; --b2: #B86E12;
  --shadow: 0 1px 2px rgba(20,33,61,.06), 0 8px 24px rgba(20,33,61,.07);
  --f-display: "Bricolage Grotesque", "Cairo", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Lexend", "Cairo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-ar: "Cairo", "Geeza Pro", "Segoe UI", Tahoma, sans-serif;
  --r: 14px;
  --side-w: 272px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1424; --surface: #172038; --surface-2: #1D2844; --ink: #E9EDF7; --muted: #9AA6C3; --line: #29355A;
    --accent: #7FA2FF; --accent-ink: #0E1424; --accent-soft: #22305A; --gold: #F2C94C; --gold-soft: #3A2F10;
    --hl: #5C4B0E; --hl-ink: #FFEBA3; --good: #5FD39A; --good-soft: #143826; --bad: #FF8A8A; --bad-soft: #3D1A1F;
    --side-bg: #0A1020; --side-ink: #E9EDF7; --side-muted: #8D99B8; --side-line: #1F2A48;
    --a1: #7FA2FF; --a2: #4FD1C1; --b1: #C29BFF; --b2: #F0A94B;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1424; --surface: #172038; --surface-2: #1D2844; --ink: #E9EDF7; --muted: #9AA6C3; --line: #29355A;
  --accent: #7FA2FF; --accent-ink: #0E1424; --accent-soft: #22305A; --gold: #F2C94C; --gold-soft: #3A2F10;
  --hl: #5C4B0E; --hl-ink: #FFEBA3; --good: #5FD39A; --good-soft: #143826; --bad: #FF8A8A; --bad-soft: #3D1A1F;
  --side-bg: #0A1020; --side-ink: #E9EDF7; --side-muted: #8D99B8; --side-line: #1F2A48;
  --a1: #7FA2FF; --a2: #4FD1C1; --b1: #C29BFF; --b2: #F0A94B;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.6; }
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.ar { font-family: var(--f-ar); direction: rtl; unicode-bidi: isolate; font-size: 1.1em; font-weight: 500; line-height: 1.75; }
.tr { font-family: var(--f-ar); direction: rtl; unicode-bidi: isolate; font-size: 1.1em; line-height: 1.6; background: var(--hl); color: var(--hl-ink); padding: 1px 10px; border-radius: 4px 10px 6px 12px; font-weight: 500; transition: filter .2s; }
body.hide-ar .tr { filter: blur(6px); cursor: pointer; }
body.hide-ar .tr:hover, body.hide-ar .tr.show { filter: none; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: max(18px, env(safe-area-inset-top, 0px)) 18px 24px max(18px, env(safe-area-inset-left, 0px)); display: grid; gap: 18px; align-content: start; }
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--side-ink); }
.brand b { font-family: var(--f-display); font-size: 23px; font-weight: 800; letter-spacing: -0.02em; }
.brand b span { color: var(--gold); }
.brand .ar { color: var(--gold); font-size: 16px; }
.ring-wrap { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center; background: rgba(255,255,255,.04); border: 1px solid var(--side-line); border-radius: 16px; padding: 14px; }
.ring { position: relative; width: 92px; height: 92px; }
.ring svg { width: 92px; height: 92px; transform: rotate(-90deg); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.ring-wrap .lbl { font-size: 13px; color: var(--side-muted); line-height: 1.4; }
.ring-wrap .lbl b { display: block; color: var(--side-ink); font-size: 15px; font-family: var(--f-display); }
.side .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side .stat { background: rgba(255,255,255,.04); border: 1px solid var(--side-line); border-radius: 12px; padding: 8px 10px; }
.side .stat b { display: block; font-family: var(--f-display); font-size: 18px; font-variant-numeric: tabular-nums; }
.side .stat span { font-size: 11px; color: var(--side-muted); text-transform: uppercase; letter-spacing: .06em; }
.lvl-bars { display: grid; gap: 8px; }
.lvl-bar { display: grid; grid-template-columns: 30px 1fr 40px; gap: 8px; align-items: center; font-size: 12px; }
.lvl-bar b { font-family: var(--f-display); }
.lvl-bar .track { height: 6px; border-radius: 99px; background: var(--side-line); overflow: hidden; }
.lvl-bar .track span { display: block; height: 100%; border-radius: 99px; }
.lvl-bar .v { text-align: end; color: var(--side-muted); font-variant-numeric: tabular-nums; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--side-ink); text-decoration: none; font-size: 15px; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a.on { background: rgba(242,201,76,.14); color: var(--gold); }
.nav a .lock { margin-inline-start: auto; font-size: 11px; color: var(--side-muted); }
.side .tools { display: flex; flex-wrap: wrap; gap: 6px; }
.side .tools button { background: transparent; border: 1px solid var(--side-line); color: var(--side-ink); border-radius: 99px; padding: 4px 10px; font-size: 12px; }
.side .tools button[aria-pressed="true"] { background: rgba(242,201,76,.16); border-color: var(--gold); color: var(--gold); }

.topbar { display: none; }
main { min-width: 0; padding: 28px max(16px, env(safe-area-inset-right, 0px)) 80px max(16px, env(safe-area-inset-left, 0px)); }
.page { max-width: 1060px; margin: 0 auto; display: grid; gap: 22px; }
.scrim { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); z-index: 40; transform: translateX(-105%); transition: transform .25s; height: 100%; }
  body.menu-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(8,12,24,.45); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--side-bg); }
  .topbar { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--side-bg); color: var(--side-ink); padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
  .topbar .menu { background: transparent; border: 1px solid var(--side-line); color: var(--side-ink); border-radius: 10px; width: 40px; height: 40px; display: grid; place-items: center; }
  .topbar .mini { display: grid; gap: 4px; min-width: 0; }
  .topbar .mini .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--side-muted); }
  .topbar .mini .row b { color: var(--gold); font-family: var(--f-display); font-size: 14px; }
  .topbar .track { height: 6px; background: var(--side-line); border-radius: 99px; overflow: hidden; }
  .topbar .track span { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
  .topbar .brand b { font-size: 18px; }
  main { padding-top: 18px; }
}

/* ---------- Common components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card.raised { box-shadow: var(--shadow); }
.btn { border: 0; border-radius: 12px; padding: 10px 18px; background: var(--accent); color: var(--accent-ink); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: transform .1s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.gold { background: var(--gold); color: #2B2300; }
.btn.sm { padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn svg { width: 18px; height: 18px; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.speak { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; color: var(--accent); padding: 0; }
.speak:hover { background: var(--accent-soft); border-color: var(--accent); }
.speak svg { width: 17px; height: 17px; }
.speak.sm { width: 28px; height: 28px; }
.speak.sm svg { width: 13px; height: 13px; }
.speak.slow { color: var(--b2); }
.pill { font-size: 12px; padding: 2px 10px; border-radius: 99px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.pill.new { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.prog { background: var(--accent-soft); color: var(--accent); }
.pill.done { background: var(--good-soft); color: var(--good); }
.pill.gold { background: var(--gold-soft); color: var(--b2); }
.lvl { font-family: var(--f-display); font-weight: 800; font-size: 13px; color: #fff; background: var(--lvl, var(--a1)); border-radius: 7px; padding: 2px 8px; }
:root[data-theme="dark"] .lvl { color: #0E1424; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lvl { color: #0E1424; } }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid > * { min-width: 0; }
.page-head { display: grid; gap: 6px; }
.page-head h1 { font-size: clamp(28px, 4.4vw, 42px); font-weight: 800; }
.page-head .ar { color: var(--muted); font-size: 18px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; background: none; border: 0; padding: 0; justify-self: start; }
.crumb:hover { color: var(--accent); }
.crumb svg { width: 16px; height: 16px; flex: none; }
.crumb { white-space: nowrap; }
a.step { text-decoration: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.tab { padding: 10px 14px; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs button[aria-selected="true"], .tabs a.tab[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
input.field, textarea.field, select.field { width: 100%; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; }
input.field:focus, textarea.field:focus, select.field:focus { outline: none; border-color: var(--accent); }
textarea.field { min-height: 260px; resize: vertical; line-height: 1.7; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 90; max-width: calc(100% - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.notice { border-radius: 12px; padding: 12px 14px; background: var(--gold-soft); color: var(--ink); font-size: 14px; border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.notice.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }

/* ---------- Dashboard ---------- */
.banner { border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.banner svg { display: block; width: 100%; height: auto; }
.slogan { margin: -6px 0 0; text-align: center; font-family: "Aref Ruqaa", var(--f-ar); font-weight: 700; font-size: clamp(30px, 5.4vw, 50px); line-height: 1.5; color: var(--gold); text-shadow: 0 2px 0 color-mix(in srgb, var(--gold) 25%, transparent); display: flex; justify-content: center; align-items: center; gap: 14px; }
.slogan::before, .slogan::after { content: ""; flex: 0 1 90px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--gold)); }
.slogan::after { background: linear-gradient(90deg, var(--gold), transparent); }
.slogan .drop { font-size: .55em; filter: saturate(.8); }
.continue { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.continue h2 { font-size: 24px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi b { display: block; font-family: var(--f-display); font-size: 26px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--muted); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.feature { text-align: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 6px; text-decoration: none; color: var(--ink); align-content: start; }
.feature:hover { border-color: var(--accent); }
.feature .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.feature .ic svg { width: 20px; height: 20px; }
.feature h3 { font-size: 17px; }
.feature p { font-size: 14px; color: var(--muted); }
.feature .ar { font-size: 14px; color: var(--muted); }
@media (max-width: 700px) { .kpis { grid-template-columns: 1fr 1fr; } .continue { grid-template-columns: 1fr; } }

/* ---------- Course map ---------- */
.level-sec { display: grid; gap: 12px; }
.level-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.level-head h2 { font-size: 24px; }
.level-head .ar { color: var(--muted); }
.level-head .right { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.sessions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sess { text-align: start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; color: var(--ink); text-decoration: none; position: relative; }
.sess:hover { border-color: var(--lvl); }
.sess .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sess b { font-size: 14px; line-height: 1.3; font-weight: 600; }
.sess .ar { font-size: 12px; color: var(--muted); }
.sess.done { background: color-mix(in srgb, var(--good-soft) 70%, var(--surface)); border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.sess.done::after { content: "✓"; position: absolute; top: 8px; inset-inline-end: 10px; color: var(--good); font-weight: 700; }
.sess.next { border: 2px solid var(--gold); }

/* ---------- Session ---------- */
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--muted); }
.step i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 700; background: var(--surface-2); }
.step.on { border-color: var(--accent); color: var(--ink); }
.step.on i { background: var(--accent); color: var(--accent-ink); }
.step.ok i { background: var(--good); color: #fff; }
.word-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.wcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.wcard.known { border-color: color-mix(in srgb, var(--good) 55%, var(--line)); }
.wcard .w { min-width: 0; display: grid; gap: 2px; }
.wlink { background: none; border: 0; padding: 0; font-family: var(--f-display); font-size: 19px; font-weight: 700; color: var(--ink); text-align: start; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 4px; }
.wlink:hover { color: var(--accent); }
.wcard .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.pos { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.know { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.know[aria-pressed="true"] { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.rule { display: grid; gap: 14px; }
.rule h2 { font-size: 26px; }
.rule .form { font-family: var(--f-display); font-size: 17px; background: var(--surface-2); border-radius: 10px; padding: 10px 14px; overflow-x: auto; }
.rule ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rule li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.rule li .en { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.rule li .ar { color: var(--muted); font-size: 14px; }

/* ---------- Exercises ---------- */
.ex { max-width: 680px; margin: 0 auto; width: 100%; display: grid; gap: 16px; }
.ex-top { display: flex; align-items: center; gap: 12px; }
.ex-top .bar { flex: 1; }
.ex-top span { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); display: grid; gap: 18px; }
.qprompt { font-family: var(--f-display); font-size: clamp(21px, 3.8vw, 28px); font-weight: 700; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qprompt .tr { font-size: 24px; font-weight: 600; }
.gap { display: inline-block; min-width: 70px; border-bottom: 3px solid var(--accent); text-align: center; color: var(--accent); }
.big-listen { width: 80px; height: 80px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.big-listen svg { width: 34px; height: 34px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { border: 2px solid var(--line); background: var(--surface); border-radius: 14px; padding: 13px; font-size: 17px; font-weight: 500; text-align: center; }
.opt.arabic { font-family: var(--f-ar); font-size: 21px; font-weight: 600; }
@media (hover: hover) { .opt:hover:not(:disabled) { border-color: var(--accent); } }
.opt.right { border-color: var(--good); background: var(--good-soft); color: var(--good); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.opt:disabled { cursor: default; }
.feedback { border-radius: 14px; padding: 12px 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.feedback.good { background: var(--good-soft); color: var(--good); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback .msg { display: grid; gap: 2px; }
.feedback .msg small { color: var(--ink); opacity: .85; }
.typein { display: flex; gap: 10px; flex-wrap: wrap; }
.typein input { flex: 1; min-width: 0; font-size: 20px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); }
.typein input:focus { outline: none; border-color: var(--accent); }
.slots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; font-family: var(--f-display); }
.slot { min-width: 38px; height: 46px; border-radius: 10px; display: grid; place-items: center; font-size: 22px; font-weight: 700; background: var(--surface-2); border: 2px solid var(--line); padding: 0 6px; }
.slot.blank { border-style: dashed; border-color: var(--accent); color: var(--accent); }
.slot.space { background: transparent; border: 0; min-width: 14px; }
.tiles { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tile { min-width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-family: var(--f-display); font-size: 20px; font-weight: 700; box-shadow: 0 2px 0 var(--line); padding: 0 10px; }
.tile:disabled { opacity: .25; }
.tile.word { font-family: var(--f-body); font-size: 16px; font-weight: 500; }
.result { text-align: center; display: grid; gap: 12px; justify-items: center; }
.result .score { font-family: var(--f-display); font-size: 68px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.heard { font-size: 14px; color: var(--muted); }
.diff span { padding: 1px 3px; border-radius: 4px; }
.diff .ok { background: var(--good-soft); color: var(--good); }
.diff .miss { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }
.mic { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; display: grid; place-items: center; }
.mic svg { width: 34px; height: 34px; }
.mic.live { animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 55%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }

/* ---------- Games ---------- */
.game-hud { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.game-hud .target { font-family: var(--f-display); font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.lives { color: var(--bad); letter-spacing: 2px; }
.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mcard { aspect-ratio: 4 / 3; border-radius: 14px; border: 1px solid var(--line); background: var(--accent); color: var(--accent-ink); font-weight: 600; display: grid; place-items: center; padding: 8px; text-align: center; font-size: 15px; max-width: 100%; }
.mcard.open { background: var(--surface); color: var(--ink); }
.mcard.matched { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.mcard .ar { font-size: 16px; }
@media (max-width: 520px) { .memory { grid-template-columns: repeat(3, 1fr); } .opts { grid-template-columns: 1fr; } }

/* ---------- Word study window ---------- */
.ws-backdrop { position: fixed; inset: 0; background: rgba(8,12,24,.5); z-index: 60; display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
.ws { width: min(920px, 100%); max-height: 100%; background: var(--bg); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.35); display: grid; grid-template-rows: auto auto 1fr; overflow: hidden; border: 1px solid var(--line); }
.ws-title { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--side-bg); color: var(--side-ink); }
.ws-title .dots { display: flex; gap: 6px; }
.ws-title .dots i { width: 11px; height: 11px; border-radius: 50%; background: #F25F5C; }
.ws-title .dots i:nth-child(2) { background: #F2C94C; }
.ws-title .dots i:nth-child(3) { background: #4FD1C1; }
.ws-title b { font-family: var(--f-display); font-size: 15px; }
.ws-title .ar { color: var(--gold); font-size: 14px; }
.ws-title button { margin-inline-start: auto; background: transparent; border: 1px solid var(--side-line); color: var(--side-ink); border-radius: 8px; padding: 2px 10px; }
.ws-head { padding: 18px 20px 0; display: grid; gap: 10px; background: var(--surface); }
.ws-word { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ws-word h2 { font-size: clamp(30px, 6vw, 44px); font-weight: 800; }
.ws-word .tr { font-size: 22px; }
.ws-body { overflow-y: auto; padding: 18px 20px 24px; display: grid; gap: 16px; align-content: start; }
.tense-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.tense-table th, .tense-table td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tense-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; }
.tense-table td.t { font-weight: 600; }
.tense-table td.t .ar { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.tense-table td.f { font-family: var(--f-display); }
.scroll-x { overflow-x: auto; }
.fam { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.fam .m { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; }
.fam .m .top { display: flex; align-items: center; gap: 8px; }
.fam .m b { font-family: var(--f-display); font-size: 17px; }
.fam .m.self { border-color: var(--gold); background: var(--gold-soft); }
.ai-box { display: grid; gap: 12px; }
.ai-box ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }

/* ---------- Writing & AI feedback ---------- */
.editor { display: grid; gap: 10px; }
.editor-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.editor-bar .wc { font-variant-numeric: tabular-nums; font-weight: 600; }
.editor-bar .wc.ok { color: var(--good); }
.timer { font-family: var(--f-display); font-variant-numeric: tabular-nums; font-weight: 700; }
.fb { display: grid; gap: 14px; }
.fb h3 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.bands { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.band { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.band b { display: block; font-family: var(--f-display); font-size: 26px; font-variant-numeric: tabular-nums; }
.band span { font-size: 11px; color: var(--muted); }
.band.overall { background: var(--side-bg); color: var(--side-ink); border-color: var(--side-bg); }
.band.overall b { color: var(--gold); }
.band.overall span { color: var(--side-muted); }
.fix { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.fix .chg { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fix del { color: var(--bad); }
.fix ins { color: var(--good); text-decoration: none; font-weight: 600; }
.model { background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--gold); border-radius: 12px; padding: 16px 18px; white-space: pre-wrap; line-height: 1.75; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
@media (max-width: 600px) { .bands { grid-template-columns: repeat(3, 1fr); } }
.spinner { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- IELTS ---------- */
.lock-hero { display: grid; grid-template-columns: 1fr 220px; gap: 20px; align-items: center; background: var(--side-bg); color: var(--side-ink); border-radius: 18px; padding: 26px; }
.lock-hero h2 { font-size: 28px; }
.lock-hero p { color: var(--side-muted); }
.lock-hero .big { font-family: var(--f-display); font-size: 56px; font-weight: 800; color: var(--gold); line-height: 1; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .lock-hero { grid-template-columns: 1fr; } }
.topic-list { display: grid; gap: 8px; }
.topic { text-align: start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; color: var(--ink); }
.topic:hover { border-color: var(--accent); }
.topic .id { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.topic .q { min-width: 0; font-size: 15px; }
.topic .t { font-size: 11px; }
.chart-box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; overflow-x: auto; }
.chart-box svg { display: block; width: 100%; height: auto; min-width: 460px; }
.data-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.passage { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; line-height: 1.8; max-height: 60vh; overflow-y: auto; }
.passage p + p { margin-top: 12px; }
.reading-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: start; }
.reading-layout > * { min-width: 0; }
@media (max-width: 900px) { .reading-layout { grid-template-columns: 1fr; } .passage { max-height: none; } }
.res { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.res a { font-family: var(--f-display); font-weight: 700; font-size: 17px; text-decoration: none; }
.res .kind { justify-self: start; }
.transcript { display: grid; gap: 6px; font-size: 15px; }
.transcript div { display: grid; grid-template-columns: 28px 1fr; gap: 8px; }
.transcript b { color: var(--accent); }
.modal { position: fixed; inset: 0; background: rgba(8,12,24,.5); display: grid; place-items: center; z-index: 80; padding: 16px; }
.modal .card { max-width: 440px; display: grid; gap: 14px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 520px) { .slogan { font-size: 30px; gap: 8px; white-space: nowrap; } .slogan::before, .slogan::after { flex-basis: 28px; } }

/* ---------- Business: trial, activation, WhatsApp ---------- */
.trial { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); background: color-mix(in srgb, var(--gold-soft) 60%, var(--surface)); }
@media (max-width: 600px) { .trial { grid-template-columns: 1fr; } }
.sess.locked { opacity: .55; }
.sess.locked::after { content: "🔒"; position: absolute; top: 9px; inset-inline-end: 10px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
#sideAct { justify-self: stretch; }
.btn.wa, .side-wa { background: #25D366; color: #06371B; }
.side-wa { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 12px; border-radius: 12px; text-decoration: none; font-weight: 600; font-size: 14px; }
.wa-fab { position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 50; display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 99px; background: #25D366; color: #06371B; text-decoration: none; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.wa-fab svg { width: 22px; height: 22px; }
@media (max-width: 600px) { .wa-fab span { display: none; } .wa-fab { padding: 14px; } }

/* ---------- Bubbles game (its own underwater world, same in light and dark) ---------- */
.bg-wrap { display: grid; gap: 12px; }
.bg-hud { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 18px; color: #EAF2FF; background: linear-gradient(135deg, #17346a, #0b1a38); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 10px 30px rgba(6,18,38,.35); }
.bg-ask { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: #9FB6DD; }
.bg-word { font-family: var(--f-display); font-size: clamp(26px, 4.6vw, 36px); font-weight: 800; display: flex; align-items: center; gap: 12px; line-height: 1.15; text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.bg-word .tr { font-size: clamp(24px, 4vw, 30px); }
.bg-word .speak { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.bg-stats { display: flex; align-items: center; gap: 14px; }
.bg-score b { font-family: var(--f-display); font-size: 30px; color: #F2C94C; font-variant-numeric: tabular-nums; }
.bg-score span { color: #9FB6DD; margin-inline-start: 4px; }
.bg-lives { display: flex; gap: 2px; }
.bg-snd { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; display: grid; place-items: center; padding: 0; }
.bg-snd svg { width: 16px; height: 16px; }
.bg-snd[aria-pressed="false"] { opacity: .4; }
.bg-progress { height: 8px; border-radius: 99px; background: rgba(127,162,255,.18); overflow: hidden; }
.bg-progress span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #F2C94C, #FF9F5A); transition: width .4s; }
.bg-help { font-size: 14px; }
.bubble-stage { position: relative; height: 460px; border-radius: 24px; overflow: hidden; isolation: isolate; touch-action: manipulation; user-select: none;
  background: radial-gradient(110% 70% at 50% -12%, #3B86D1 0%, #1A4F8C 30%, #0C2B57 62%, #061530 100%);
  box-shadow: inset 0 0 90px rgba(0,0,0,.5), 0 22px 44px rgba(6,18,38,.35); }
.bubble-stage::after { content: ""; position: absolute; inset: auto 0 0 0; height: 70px; background: radial-gradient(80% 100% at 50% 100%, rgba(242,201,76,.22), transparent 70%); z-index: 0; pointer-events: none; }
.bubble-stage .rays { position: absolute; inset: -30% -20% 20%; z-index: 0; pointer-events: none; mix-blend-mode: screen; filter: blur(14px);
  background: repeating-linear-gradient(105deg, rgba(190,225,255,.10) 0 46px, transparent 46px 130px); animation: rays 11s ease-in-out infinite alternate; }
@keyframes rays { from { transform: translateX(-6%) skewX(-4deg); opacity: .7; } to { transform: translateX(6%) skewX(4deg); opacity: 1; } }
.bubble-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fx-back { z-index: 0; } .fx-front { z-index: 4; }
.bubble-stage.hurt::before { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; background: radial-gradient(circle, transparent 40%, rgba(255,60,80,.38)); animation: hurt .45s forwards; }
@keyframes hurt { to { opacity: 0; } }
.bubble { position: absolute; left: 0; top: 0; z-index: 2; width: var(--size); height: var(--size); padding: 0; border: 0; background: none; cursor: pointer; will-change: transform; -webkit-tap-highlight-color: transparent; }
.bubble:focus-visible { outline: none; }
.bubble:focus-visible .orb { box-shadow: 0 0 0 4px #F2C94C, 0 14px 28px rgba(0,0,0,.35); }
.orb { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; animation: wobble 2.6s ease-in-out infinite; animation-delay: var(--d);
  background:
    radial-gradient(circle at 31% 24%, rgba(255,255,255,.98) 0 4%, rgba(255,255,255,.55) 8%, transparent 20%),
    radial-gradient(ellipse 30% 14% at 38% 16%, rgba(255,255,255,.55), transparent 70%),
    radial-gradient(circle at 72% 80%, rgba(255,255,255,.35) 0 5%, transparent 16%),
    radial-gradient(circle at 50% 54%, rgba(4,16,40,.42) 0 40%, rgba(4,16,40,.12) 58%, transparent 66%),
    radial-gradient(circle at 50% 50%, hsla(var(--h),95%,70%,.06) 0 50%, hsla(var(--h),95%,62%,.34) 68%, hsla(var(--h),100%,78%,.85) 90%, hsla(var(--h),100%,92%,.95) 100%);
  box-shadow: inset -12px -16px 28px hsla(var(--h),80%,22%,.5), inset 10px 12px 24px rgba(255,255,255,.26), 0 16px 30px rgba(0,0,0,.38), 0 0 26px hsla(var(--h),100%,70%,.38); transition: filter .15s; }
.sheen { position: absolute; inset: 3%; border-radius: 50%; mix-blend-mode: screen; filter: blur(3px); pointer-events: none; animation: spin 8s linear infinite;
  background: conic-gradient(from 0deg, transparent, rgba(255,120,200,.26), rgba(120,220,255,.26), rgba(140,255,170,.2), rgba(255,236,120,.24), transparent);
  -webkit-mask: radial-gradient(circle, transparent 56%, #000 76%); mask: radial-gradient(circle, transparent 56%, #000 76%); }
.txt { position: relative; z-index: 1; max-width: 84%; font-family: "Baloo Bhaijaan 2", var(--f-display); font-weight: 800; font-size: var(--fs, 24px); line-height: 1.1; overflow-wrap: anywhere; letter-spacing: .01em;
  color: rgba(255,255,255,.94);
  /* engraved into the glass: dark upper edge, light lower edge, soft inner glow in the bubble's colour */
  text-shadow: 0 -1.5px 0 rgba(0,18,48,.7), 0 1.5px 0 rgba(255,255,255,.55), 0 0 12px hsla(var(--h),100%,85%,.65), 0 3px 10px rgba(0,10,30,.55); }
.txt.ar { font-family: "Baloo Bhaijaan 2", var(--f-ar); font-weight: 700; line-height: 1.25; }
.bubble:hover .orb { filter: brightness(1.18) saturate(1.1); }
.bubble.popped { pointer-events: none; }
.bubble.popped .orb { animation: popOrb .3s ease-out forwards; }
.bubble.wrong .orb { animation: wrongShake .45s; box-shadow: 0 0 0 4px rgba(255,90,110,.9), 0 0 30px rgba(255,60,80,.6); }
@keyframes wobble { 0%, 100% { transform: scale(1, 1); } 25% { transform: scale(1.04, .97); } 50% { transform: scale(.98, 1.03); } 75% { transform: scale(1.02, .98); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes popOrb { 40% { transform: scale(1.25); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@keyframes wrongShake { 20% { transform: translateX(-10px) rotate(-4deg); } 40% { transform: translateX(9px) rotate(3deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.float { position: absolute; z-index: 6; transform: translate(-50%, -50%); font-family: var(--f-display); font-weight: 800; font-size: 32px; color: #F2C94C; text-shadow: 0 2px 10px rgba(0,0,0,.6); pointer-events: none; animation: floatUp .95s ease-out forwards; }
@keyframes floatUp { from { opacity: 0; margin-top: 0; } 15% { opacity: 1; } to { opacity: 0; margin-top: -70px; } }
.combo { position: absolute; top: 14px; left: 50%; z-index: 6; transform: translateX(-50%) scale(.6); padding: 6px 16px; border-radius: 99px; font-family: var(--f-display); font-weight: 800; font-size: 22px; color: #1B1200; background: linear-gradient(90deg, #FFB86B, #F2C94C); box-shadow: 0 6px 18px rgba(0,0,0,.35); opacity: 0; pointer-events: none; }
.combo.on { animation: comboIn 1.1s ease-out forwards; }
@keyframes comboIn { 0% { opacity: 0; transform: translateX(-50%) scale(.6); } 15% { opacity: 1; transform: translateX(-50%) scale(1.15); } 30% { transform: translateX(-50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) scale(1) translateY(-10px); } }
.bg-stars { display: flex; gap: 6px; font-size: 40px; line-height: 1; }
.bg-stars span { color: var(--line); }
.bg-stars span.on { color: #F2C94C; text-shadow: 0 2px 10px rgba(242,201,76,.5); }
@media (max-width: 520px) { .bubble-stage { height: 420px; } .bg-word { font-size: 26px; } }
@media (prefers-reduced-motion: reduce) { .orb, .sheen, .rays { animation: none !important; } }

/* Correct answer: green flash, then the next question appears by itself */
.qcard.is-correct { border-color: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 35%, transparent), var(--shadow); animation: okPulse .5s ease-out; }
.qcard.is-correct .typein input, .qcard.is-correct .slot { border-color: var(--good); background: var(--good-soft); color: var(--good); }
.qcard.is-correct .feedback { animation: okIn .25s ease-out; }
@keyframes okPulse { 0% { transform: scale(1); } 40% { transform: scale(1.015); } 100% { transform: scale(1); } }
@keyframes okIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Practice sets */
.sets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.set { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; min-width: 0; }
.set:hover { border-color: var(--accent); }
.set.on { border: 2px solid var(--gold); background: color-mix(in srgb, var(--gold-soft) 55%, var(--surface)); }
.set .sn { grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; background: var(--surface-2); }
.set.on .sn { background: var(--gold); color: #2B2300; }
.set .st { display: grid; min-width: 0; line-height: 1.25; }
.set .st b { font-size: 14px; }
.set .st .ar { font-size: 13px; color: var(--muted); }
.set .pill { grid-column: 2; justify-self: start; }
@media (max-width: 900px) { .sets { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .sets { grid-template-columns: 1fr 1fr; } }

.side-priv { font-size: 12px; color: var(--side-muted); text-align: center; text-decoration: none; }
.side-priv:hover { color: var(--gold); }

/* ---------- Arabic interface (right to left) ----------
   The page reads right to left in Arabic. The English being learned is marked lang="en" and kept left to right.
   The sidebar and the ☰ menu button stay on the left, where learners already know them. */
html[dir="rtl"] body { font-size: 16.5px; }
[dir="rtl"] .label { text-transform: none; letter-spacing: 0; font-size: 13px; }
[dir="rtl"] .side .stat span, [dir="rtl"] .tense-table th { text-transform: none; letter-spacing: 0; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4 { letter-spacing: 0; line-height: 1.35; }
.shell { direction: ltr; }
.shell > * { direction: rtl; }
[lang="en"] { direction: ltr; unicode-bidi: isolate; font-family: var(--f-body); }
h1[lang="en"], h2[lang="en"], .qprompt[lang="en"], .ws-word h2 { font-family: var(--f-display); }
.en-sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.page-head .en-sub, .rule .en-sub { font-size: 14px; }
.sess .en-sub { font-size: 11.5px; }
.crumb svg, .crumb + * .crumb svg { transform: scaleX(-1); }
.qprompt { justify-content: center; text-align: center; }
.qprompt[lang="en"] { direction: ltr; }
.opt:not(.arabic) { direction: ltr; font-family: var(--f-body); }
.slots, .tiles, .typein input, .wlink, .ws-word h2, .rule .form, .rule li .en, .tense-table td.f, .fam .m .top, .bg-word, .diff, .model, .transcript, .passage, .chart-box svg, .data-table { direction: ltr; }
.wlink { unicode-bidi: isolate; justify-self: start; }
.rule li .en { justify-content: flex-end; }
.ws-word { direction: rtl; }
.ws-word h2 { unicode-bidi: isolate; }
.step-arrow { color: var(--muted); align-self: center; }
.step.off { opacity: .55; }
.steps { align-items: center; }
.step { padding: 6px 6px 6px 12px; }
.btn.big { font-size: 18px; padding: 14px 26px; border-radius: 14px; font-weight: 700; }
.go-next { display: flex; justify-content: center; padding: 8px 0 4px; }
.result .btn.big { margin: 4px 0; }
.howto { display: grid; gap: 12px; }
.howto-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.howto-steps li { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: 15px; }
.howto-steps b { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #2B2300; font-size: 17px; }
@media (max-width: 700px) { .howto-steps { grid-template-columns: 1fr; } }
.sets-box summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 4px 0; }
.sets-box .sets { margin-top: 10px; }
.slogan::before { background: linear-gradient(270deg, transparent, var(--gold)); }
.slogan::after { background: linear-gradient(270deg, var(--gold), transparent); }
/* Sidebar / menu */
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-top .brand { direction: ltr; }
.side-close { display: none; background: transparent; border: 1px solid var(--side-line); color: var(--side-ink); border-radius: 8px; width: 34px; height: 34px; }
.nav a { font-size: 16px; }
.nav a.nav-go { background: var(--gold); color: #2B2300; font-weight: 700; margin-bottom: 4px; }
.nav a.nav-go svg { opacity: 1; }
.nav a.nav-go small { display: block; font-weight: 500; font-size: 12px; opacity: .8; }
.nav a .lock svg { width: 13px; height: 13px; }
.topbar { direction: ltr; }
.topbar .mini { direction: rtl; }
.topbar .menu { width: auto !important; padding: 0 12px; gap: 6px; display: flex !important; align-items: center; font-weight: 600; font-family: var(--f-ar); }
.topbar .menu svg { width: 20px; height: 20px; }
.home-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--side-line); border-radius: 10px; color: var(--side-ink); }
.home-btn svg { width: 20px; height: 20px; }
@media (max-width: 900px) {
  .topbar { grid-template-columns: auto auto 1fr; }
  .side-close { display: grid; place-items: center; }
}
.wa-fab span { font-family: var(--f-ar); }
.banner, .banner svg, .bubble-stage, .bg-hud .bg-stats { direction: ltr; }
.ws-body > *, .ws-body .card { min-width: 0; }
.tense-table td.t .en-sub { display: block; font-size: 12px; }
.ws-body { grid-auto-rows: max-content; }

/* ---------- Placement test and activation welcome ---------- */
.place-rules, .welcome-list { margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; }
.place-prev { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.place-q .place-text { font-size: 18px; line-height: 1.7; background: var(--bg-2, rgba(127,127,127,.08)); border-radius: 12px; padding: 14px 16px; margin: 0; }
.place-q .big-listen { justify-self: center; }
.place-q .opt.picked { outline: 3px solid var(--gold); }
.place-q .place-idk { opacity: .8; font-size: 16px; }
.place-result { display: grid; gap: 12px; text-align: center; justify-items: center; }
.place-level { display: flex; align-items: center; gap: 14px; }
.place-level b { font-family: var(--f-display); font-size: 44px; color: #fff; background: var(--lvl); border-radius: 16px; padding: 6px 18px; direction: ltr; }
.place-level span { display: grid; font-size: 26px; font-weight: 700; text-align: start; }
.place-level small { font-size: 15px; font-weight: 500; opacity: .75; }
.place-bars { display: grid; gap: 8px; width: 100%; max-width: 460px; }
.place-bars .pb { display: grid; grid-template-columns: 34px 1fr 44px; align-items: center; gap: 10px; direction: ltr; }
.place-bars .pb.off { opacity: .45; }
.place-bars .bar { margin: 0; }
.place-home { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.place-home > div { display: grid; gap: 6px; flex: 1 1 280px; }
.place-home h2 { font-size: 22px; }
.welcome { display: grid; gap: 12px; text-align: center; justify-items: center; }
.welcome h1 { font-size: 30px; }
.welcome-list { text-align: start; }
.welcome-badge { width: 72px; height: 72px; border-radius: 50%; background: var(--good, #2e9d5b); color: #fff; display: grid; place-items: center; animation: pop .5s ease-out; }
.welcome-badge svg { width: 38px; height: 38px; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }

/* Placement test progress: how many questions are done and left */
.place-progress { display: grid; gap: 8px; margin-bottom: 14px; }
.place-progress .pp-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.place-progress .pp-pct { font-family: var(--f-display); font-size: 18px; color: var(--gold); direction: ltr; }
.pp-bar { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
.pp-bar span { display: block; height: 100%; border-radius: inherit; background: var(--gold); transition: width .35s ease; }
/* No option looks chosen when a new question appears (phones keep the last tap's hover and focus) */
.place-q .opt:focus:not(:focus-visible) { outline: none; }
