/* Layout: navy masthead band, parchment ground, white working surfaces; roadmap reads as a site programme (phases → skills → three level nodes). */
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }

:root {
  --navy: #0B2545; --parchment: #F5F0E8; --terracotta: #A64B2A; --sand: #C9A876; --graphite: #1F2937;
  --bg: #F5F0E8; --surface: #FFFFFF; --surface-2: #FBF8F3; --fg: #1F2937; --muted: #5C6573; --line: #E3DBCD;
  --head: #0B2545; --accent: #A64B2A; --accent-fg: #FFFFFF; --gold: #C9A876; --good: #2F7D4F; --good-bg: #E5F2EA; --bad: #B23A2A; --bad-bg: #F8E6E2;
  --band: #0B2545; --band-fg: #F5F0E8; --lock: #B9B2A6;
  --font: "Montserrat", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1626; --surface: #112038; --surface-2: #0E1B30; --fg: #E9E4DA; --muted: #A3ACBA; --line: #22344F;
    --head: #F5F0E8; --accent: #D0714D; --accent-fg: #FFFFFF; --gold: #D4B88A; --good: #6CC08F; --good-bg: #133326; --bad: #F08A78; --bad-bg: #3A1A16;
    --band: #06101D; --band-fg: #F5F0E8; --lock: #4A5568; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1626; --surface: #112038; --surface-2: #0E1B30; --fg: #E9E4DA; --muted: #A3ACBA; --line: #22344F;
  --head: #F5F0E8; --accent: #D0714D; --accent-fg: #FFFFFF; --gold: #D4B88A; --good: #6CC08F; --good-bg: #133326; --bad: #F08A78; --bad-bg: #3A1A16;
  --band: #06101D; --band-fg: #F5F0E8; --lock: #4A5568; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3, h4 { color: var(--head); line-height: 1.25; text-wrap: balance; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
.wrap { max-width: 1160px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* buttons & inputs */
button, .btn { font: inherit; font-weight: 600; font-size: 0.9rem; border-radius: 8px; padding: 10px 16px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; line-height: 1.2; }
button:hover, .btn:hover { border-color: var(--sand); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
button.primary:hover { filter: brightness(1.07); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.small { padding: 6px 10px; font-size: 0.8rem; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
textarea { min-height: 160px; resize: vertical; line-height: 1.5; }
label { font-size: 0.82rem; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }

/* masthead */
.mast { background: var(--band); color: var(--band-fg); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--band); }
.mast .wrap { display: flex; align-items: center; gap: 20px; padding-block: 12px; flex-wrap: wrap; }
.mast img { height: 34px; width: auto; display: block; }
.mast .brandname { font-weight: 700; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; border-inline-start: 1px solid rgba(245,240,232,0.3); padding-inline-start: 16px; }
.mast nav { display: flex; gap: 4px; flex-wrap: wrap; }
.mast nav a { color: var(--band-fg); text-decoration: none; font-weight: 600; font-size: 0.86rem; padding: 8px 12px; border-radius: 6px; opacity: 0.8; }
.mast nav a:hover, .mast nav a.on { opacity: 1; background: rgba(245,240,232,0.1); }
.mast .who { font-size: 0.82rem; display: flex; align-items: center; gap: 10px; }
.mast .who b { color: var(--gold); }
.mast button { background: transparent; color: var(--band-fg); border-color: rgba(245,240,232,0.3); }

main { padding-block: 28px 64px; }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .side { background: var(--band); color: var(--band-fg); padding: 48px max(24px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.login .side img { width: 220px; }
.login .side h1 { color: var(--band-fg); font-size: 2.2rem; max-width: 14ch; }
.login .side p { opacity: 0.8; max-width: 44ch; }
.login .side ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, auto); gap: 18px 28px; justify-content: start; }
.login .side li b { display: block; font-size: 1.6rem; color: var(--gold); font-weight: 800; }
.login .side li { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.9; }
.login .form { display: flex; align-items: center; justify-content: center; padding: 32px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
.login form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.login .links { display: flex; justify-content: space-between; font-size: 0.85rem; }
.err { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 10px 12px; font-size: 0.88rem; font-weight: 500; }
.ok { background: var(--good-bg); color: var(--good); border-radius: 8px; padding: 10px 12px; font-size: 0.88rem; font-weight: 500; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.hello { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin-bottom: 28px; }
.stats { display: flex; gap: 28px; flex-wrap: wrap; }
.stat b { display: block; font-size: 1.6rem; font-weight: 800; color: var(--head); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }

/* roadmap */
.phase { display: grid; grid-template-columns: 200px 1fr; gap: 24px; padding-block: 24px; border-top: 1px solid var(--line); }
.phase:first-of-type { border-top: 0; }
.phase-head .n { font-size: 2.6rem; font-weight: 800; color: var(--sand); line-height: 1; }
.phase-head h2 { margin-top: 6px; }
.phase-head p { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.skill { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.skill:hover { border-color: var(--sand); }
.skill h3 { font-size: 0.98rem; }
.skill p { font-size: 0.8rem; color: var(--muted); line-height: 1.45; }
.levels { display: flex; align-items: center; gap: 0; margin-top: auto; }
.node { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--lock); display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; color: var(--lock); background: var(--surface); flex: none; }
.node.open { border-color: var(--accent); color: var(--accent); }
.node.going { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
.node.done { border-color: var(--navy); background: var(--navy); color: var(--gold); }
:root[data-theme="dark"] .node.done { border-color: var(--gold); background: var(--gold); color: #0A1626; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .node.done { border-color: var(--gold); background: var(--gold); color: #0A1626; } }
.link { flex: 1; height: 2px; background: var(--lock); }
.link.done { background: var(--navy); }
.skill .foot { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); font-weight: 600; }

/* skill page */
.crumbs { font-size: 0.82rem; margin-bottom: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.course-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.ccard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ccard.locked { opacity: 0.6; }
.ccard ul { margin: 0; padding-inline-start: 18px; font-size: 0.86rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.done { background: var(--good-bg); color: var(--good); border-color: transparent; }
.chip.going { background: var(--bad-bg); color: var(--accent); border-color: transparent; }

/* course player */
.player { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
.steps { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.steps a { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--fg); font-size: 0.86rem; font-weight: 500; }
.steps a:hover { background: var(--surface); }
.steps a.on { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; }
.steps a.lock { color: var(--lock); pointer-events: none; }
.tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 0.7rem; }
.tick.y { background: var(--good); border-color: var(--good); color: #fff; }
.lesson { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(18px, 3vw, 36px); display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.lesson .body p + p { margin-top: 14px; }
.lesson .body { font-size: 1rem; line-height: 1.75; max-width: 68ch; }
.keypts { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; }
.keypts ul { margin: 8px 0 0; padding-inline-start: 18px; }
.keypts li + li { margin-top: 4px; }
.media { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mediabox { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: flex; gap: 14px; align-items: center; min-width: 0; }
.mediabox .ico { width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: var(--parchment); display: grid; place-items: center; flex: none; }
.mediabox .ico svg { width: 18px; height: 18px; fill: currentColor; }
.mediabox div { min-width: 0; }
.mediabox b { display: block; font-size: 0.88rem; }
.mediabox small { color: var(--muted); font-size: 0.78rem; display: block; overflow: hidden; text-overflow: ellipsis; }
.embed { aspect-ratio: 16 / 9; width: 100%; max-width: 100%; border: 0; border-radius: 8px; background: #000; }
.question { border: 1px solid var(--line); border-radius: 8px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.question .q { font-weight: 600; color: var(--head); }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { text-align: start; justify-content: flex-start; font-weight: 500; width: 100%; background: var(--surface-2); }
.opt.sel { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
:root[data-theme="dark"] .opt.sel { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .opt.sel { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); } }
.opt.right { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.opt.wrong { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.numrow { display: flex; gap: 10px; align-items: center; max-width: 340px; }
.numrow span { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.feedback { font-size: 0.88rem; border-radius: 8px; padding: 10px 12px; }
.feedback.y { background: var(--good-bg); color: var(--good); }
.feedback.n { background: var(--bad-bg); color: var(--bad); }
.lesson-foot { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 18px; }
.score { font-size: 3rem; font-weight: 800; color: var(--head); line-height: 1; }

/* leaderboard */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: 0; border-radius: 0; background: transparent; padding: 10px 14px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--head); border-bottom-color: var(--accent); }
.board { width: 100%; border-collapse: collapse; }
.board th { text-align: start; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.board td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.board tr.me td { background: var(--surface-2); }
.board td.r { text-align: end; font-variant-numeric: tabular-nums; }
.board th.r { text-align: end; }
.rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; background: var(--surface-2); color: var(--muted); }
.rank.r1 { background: var(--gold); color: #0B2545; }
.rank.r2 { background: #C9CED6; color: #0B2545; }
.rank.r3 { background: #C08A64; color: #FFFFFF; }
.tablewrap { overflow-x: auto; }

/* certificates */
.certs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.cert-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cert-card .kind { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.cert-card.program { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.modal { position: fixed; inset: 0; background: rgba(6, 16, 29, 0.7); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal .box { background: var(--surface); border-radius: var(--r); padding: 18px; max-width: 980px; width: 100%; max-height: 92vh; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal canvas { width: 100%; height: auto; border-radius: 4px; border: 1px solid var(--line); }

/* admin */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.matrix td.cell { text-align: center; padding: 6px; }
.dot3 { display: inline-flex; gap: 3px; }
.dot3 i { width: 9px; height: 9px; border-radius: 2px; background: var(--line); display: block; }
.dot3 i.d { background: var(--navy); }
.dot3 i.g { background: var(--sand); }
:root[data-theme="dark"] .dot3 i.d { background: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dot3 i.d { background: var(--gold); } }
.newcred { font-family: var(--mono); background: var(--surface-2); border: 1px dashed var(--sand); border-radius: 8px; padding: 12px 14px; font-size: 0.95rem; }
.sub { border-top: 1px solid var(--line); padding-block: 14px; display: flex; flex-direction: column; gap: 8px; }
.sub pre { white-space: pre-wrap; font-family: var(--font); margin: 0; font-size: 0.88rem; background: var(--surface-2); padding: 12px; border-radius: 8px; }
.vidrow { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 10px; align-items: center; padding-block: 8px; border-bottom: 1px solid var(--line); }
.vidrow small { color: var(--muted); display: block; }
.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--navy); color: var(--parchment); padding: 12px 18px; border-radius: 8px; font-weight: 600; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,0.25); max-width: calc(100vw - 32px); }
.toast.cert { background: var(--accent); }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login .side { min-height: auto; }
  .phase { grid-template-columns: 1fr; gap: 14px; }
  .course-cards { grid-template-columns: 1fr; }
  .player { grid-template-columns: 1fr; }
  .steps { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .steps a { grid-template-columns: 20px auto; white-space: nowrap; }
  .hello { grid-template-columns: 1fr; }
  .media { grid-template-columns: 1fr; }
  .vidrow { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .login .side ul { grid-template-columns: repeat(3, 1fr); }
  .mast .brandname { display: none; }
  h1 { font-size: 1.45rem; }
  .board .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  body * { visibility: hidden; }
  .modal, .modal canvas { visibility: visible; }
  .modal { position: absolute; inset: 0; background: none; padding: 0; }
  .modal .box { box-shadow: none; padding: 0; max-height: none; }
  .modal canvas { position: absolute; left: 0; top: 0; width: 100%; border: 0; }
}
.board select { min-width: 120px; padding: 6px 8px; }
@media (max-width: 700px) { .mast { position: static; } }

/* Arabic: right-to-left, Arabic typeface, no letter-spacing or capitals (they break joined script) */
.hello-side { align-items: flex-end; gap: 14px; }
[dir="rtl"] .steps a.on { box-shadow: inset -3px 0 0 var(--accent); }
html[lang="ar"] { --font: "IBM Plex Sans Arabic", "Montserrat", Tahoma, Arial, sans-serif; }
html[lang="ar"] body { font-size: 16px; line-height: 1.75; }
html[lang="ar"] .eyebrow, html[lang="ar"] .stat span, html[lang="ar"] .board th, html[lang="ar"] .mast .brandname,
html[lang="ar"] .login .side li, html[lang="ar"] .cert-card .kind, html[lang="ar"] .chip { letter-spacing: 0; text-transform: none; }
html[lang="ar"] .lesson .body { line-height: 1.95; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { line-height: 1.45; letter-spacing: 0; }
@media (max-width: 900px) { .hello-side { align-items: flex-start; } }

/* ---------- interactive layer: reader, games, exam game, ranks, badges, podium ---------- */
button.big, .btn.big { padding: 13px 22px; font-size: 0.98rem; border-radius: 10px; }
button.primary, .btn.primary { transition: transform .12s ease, filter .12s ease; box-shadow: 0 2px 0 rgba(0,0,0,.18); }
button.primary:active, .btn.primary:active { transform: translateY(1px); box-shadow: none; }
@keyframes rise { from { opacity: .001; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: none; } 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
@keyframes toastIn { from { opacity: .001; transform: translate(-50%, 12px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.enter { animation: rise .35s ease both; }
.pop { animation: pop .35s ease; }
.shake { animation: shake .4s ease; }
.toast { animation: toastIn .25s ease both; }
.toast.badge { background: var(--gold); color: #0B2545; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }
.note { margin-top: 10px; display: inline-block; background: var(--surface); border: 1px dashed var(--sand); padding: 6px 12px; border-radius: 8px; font-size: .85rem; }

/* lesson reader */
.reader { display: flex; flex-direction: column; gap: 16px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 26px; height: 5px; border-radius: 99px; background: var(--line); transition: background .3s; }
.dots i.on { background: var(--accent); }
.after { display: flex; flex-direction: column; gap: 22px; }
.after.enter > * { animation: rise .4s ease both; }
.keypts li { animation: rise .4s ease both; animation-delay: calc(var(--d, 0) * 90ms); }

/* English activities */
.act { display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--surface-2); }
.act-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.act-head .muted { font-size: .82rem; }
.flashes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.flash { position: relative; height: 96px; perspective: 600px; cursor: pointer; }
.flash .face { position: absolute; inset: 0; border-radius: 10px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px 12px; backface-visibility: hidden; transition: transform .45s ease; border: 1px solid var(--line); }
.flash .front { background: var(--surface); flex-direction: column; gap: 4px; }
.flash .front b { font-size: 1rem; color: var(--head); }
.flash .back { background: var(--navy); color: var(--parchment); transform: rotateY(180deg); font-size: .88rem; font-weight: 500; }
.flash.flipped .front { transform: rotateY(180deg); }
.flash.flipped .back { transform: rotateY(360deg); }
.flash:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; border-radius: 10px; }
button.say { width: 32px; height: 32px; padding: 0; border-radius: 50%; justify-content: center; flex: none; background: var(--surface); }
button.say svg { width: 16px; height: 16px; fill: var(--accent); }
button.say.talking { background: var(--accent); border-color: var(--accent); }
button.say.talking svg { fill: #fff; }
.sentences { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sentences li { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-weight: 500; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tile { justify-content: center; text-align: center; min-height: 48px; font-weight: 500; background: var(--surface); transition: transform .12s, opacity .3s, background .2s; }
.tile.picked { border-color: var(--navy); background: var(--navy); color: var(--parchment); transform: scale(1.02); }
.tile.nope { animation: shake .4s ease; border-color: var(--bad); }
.tile.gone { opacity: .35; background: var(--good-bg); color: var(--good); border-color: var(--good); cursor: default; }
.answer { min-height: 54px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border: 2px dashed var(--line); border-radius: 10px; background: var(--surface); }
.answer.good { border-color: var(--good); border-style: solid; background: var(--good-bg); }
.bank { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-w { padding: 8px 14px; border-radius: 99px; font-weight: 600; background: var(--surface); box-shadow: 0 2px 0 var(--line); }
.chip-w.in { background: var(--navy); color: var(--parchment); border-color: var(--navy); box-shadow: none; }
.bmsg { font-size: .88rem; display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.goodtxt { color: var(--good); }
.mdone:empty { display: none; }

/* exam game */
.examhead { display: flex; flex-direction: column; gap: 10px; }
.streakchip { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.streakchip svg { width: 18px; height: 18px; fill: var(--lock); transition: fill .2s, transform .2s; }
.streakchip.hot { color: var(--accent); }
.streakchip.hot svg { fill: var(--accent); transform: scale(1.2); }
.qcard .question { border-width: 2px; padding: 22px; }
.question.is-right { border-color: var(--good); }
.question.is-wrong { border-color: var(--bad); }
.opt .ltr-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-size: .78rem; font-weight: 700; flex: none; }
.opt { min-height: 48px; }
.result { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding-block: 12px; }
.result .score { font-size: 3.4rem; }
.stars { display: inline-flex; gap: 2px; }
.stars i { display: inline-flex; }
.stars svg { width: 18px; height: 18px; fill: var(--line); }
.stars i.on svg { fill: var(--gold); }
.stars.big svg { width: 46px; height: 46px; }
.stars.big i.on { animation: pop .5s ease both; }
.stars.big i:nth-child(2) { animation-delay: .15s; }
.stars.big i:nth-child(3) { animation-delay: .3s; }
.review summary { cursor: pointer; font-weight: 600; color: var(--head); }

/* rank card on the roadmap */
.rankcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 280px; }
.rank-badge { width: 44px; height: 44px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; flex: none; }
.rank-badge svg { width: 24px; height: 24px; fill: var(--gold); }
.rank-name { display: block; font-size: 1.15rem; color: var(--head); }
.bar.gold i { background: linear-gradient(90deg, var(--sand), var(--accent)); }
.stat-row { gap: 22px; margin-top: 4px; }
.stat b svg { width: 22px; height: 22px; fill: var(--lock); vertical-align: -3px; margin-inline-end: 2px; }
.stat.streak.on b svg { fill: var(--accent); }
.skill.mastered { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.hello { align-items: start; }

/* badges */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; opacity: .5; filter: grayscale(1); }
.badge.got { opacity: 1; filter: none; background: var(--surface-2); border-color: var(--sand); }
.badge .bico { width: 42px; height: 42px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; }
.badge .bico svg { width: 22px; height: 22px; fill: var(--gold); }
.badge b { font-size: .86rem; color: var(--head); }
.badge small { font-size: .74rem; color: var(--muted); line-height: 1.35; }

/* podium */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 6px 0 20px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 150px; max-width: 32%; text-align: center; min-width: 0; }
.pod .pname { font-weight: 700; color: var(--head); font-size: .9rem; overflow-wrap: anywhere; }
.pod .prank { font-size: .72rem; color: var(--muted); }
.pod b { font-size: 1rem; }
.pod .block { width: 100%; border-radius: 10px 10px 0 0; display: grid; place-items: center; color: #0B2545; font-weight: 800; font-size: 1.6rem; margin-top: 6px; animation: rise .5s ease both; }
.pod.p1 .block { height: 110px; background: var(--gold); }
.pod.p2 .block { height: 80px; background: #C9CED6; animation-delay: .1s; }
.pod.p3 .block { height: 60px; background: #C08A64; color: #fff; animation-delay: .2s; }
.pod.me .pname { color: var(--accent); }

/* the English course keeps an English typeface inside an Arabic interface */
.player[lang="en"] { font-family: "Montserrat", "Segoe UI", Helvetica, Arial, sans-serif; line-height: 1.6; }
.player[lang="en"] .lesson .body { line-height: 1.75; }

@media (max-width: 900px) { .rankcard { min-width: 0; } }
@media (max-width: 520px) { .match { gap: 6px; } .tile { font-size: .82rem; padding: 8px; } .flashes { grid-template-columns: 1fr 1fr; } }
.opt:disabled { opacity: 1; cursor: default; }
.opt:disabled:not(.right):not(.wrong) { opacity: .55; }
