@font-face {
  font-family: 'Noto Naskh Arabic';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/noto-arabic.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, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 500 900;
  font-display: swap;
  src: url(fonts/nunito-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 500 900;
  font-display: swap;
  src: url(fonts/nunito-latin.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;
}
/* Duoduo — design tokens ------------------------------------------------ */
:root {
  --paper: #fbf7f0;
  --card: #ffffff;
  --ink: #1f2433;
  --ink-2: #4a5065;
  --muted: #8a8f9e;
  --line: #e7e1d6;
  --line-2: #d8d0c2;
  --go: #22b573;         /* primary action + correct */
  --go-deep: #178a57;
  --go-soft: #dcf5e8;
  --bad: #ef5b52;
  --bad-deep: #c63d35;
  --bad-soft: #fde4e2;
  --sun: #ffb020;        /* streak / xp */
  --sun-deep: #d98b00;
  --sky: #3d8bfd;
  --sky-deep: #2466c7;
  --tint: #16a39a;       /* per-course accent, overridden by [data-lang] */
  --tint-deep: #0f7a73;
  --tint-soft: #d7f2ef;
  --r: 16px;
  --r-lg: 22px;
  --shadow: 0 1px 0 rgba(31, 36, 51, .04), 0 8px 24px -12px rgba(31, 36, 51, .18);
  --ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --arabic: 'Noto Naskh Arabic', 'Geeza Pro', 'Traditional Arabic', serif;
  color-scheme: light;
}
[data-lang="ar"] { --tint: #16a39a; --tint-deep: #0f7a73; --tint-soft: #d7f2ef; }
[data-lang="ru"] { --tint: #5b5bd6; --tint-deep: #4343b0; --tint-soft: #e6e6fb; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151823; --card: #1e2230; --ink: #eef0f6; --ink-2: #c3c7d4; --muted: #8b90a3;
    --line: #2c3143; --line-2: #3a4058; --go-soft: #173a2b; --bad-soft: #43201f; --tint-soft: #1d3432;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) [data-lang="ru"] { --tint-soft: #26264a; }
}
:root[data-theme="dark"] {
  --paper: #151823; --card: #1e2230; --ink: #eef0f6; --ink-2: #c3c7d4; --muted: #8b90a3;
  --line: #2c3143; --line-2: #3a4058; --go-soft: #173a2b; --bad-soft: #43201f; --tint-soft: #1d3432;
  color-scheme: dark;
}
:root[data-theme="dark"] [data-lang="ru"] { --tint-soft: #26264a; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper); color: var(--ink); font: 600 16px/1.45 var(--ui);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input { font: inherit; color: inherit; }
a { color: var(--sky-deep); }
.ar { font-family: var(--arabic); font-weight: 600; direction: rtl; unicode-bidi: isolate; line-height: 1.9; }
.tl { color: var(--muted); font-weight: 700; font-size: .9em; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 10px; }

/* Buttons: chunky, pressable --------------------------------------------- */
.btn {
  --c: var(--go); --cd: var(--go-deep); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 50px; padding: 0 22px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--c); color: var(--fg); font-weight: 900; letter-spacing: .06em; text-transform: uppercase;
  font-size: 15px; box-shadow: 0 4px 0 var(--cd); transform: translateY(0);
  transition: transform .06s, box-shadow .06s, filter .15s; text-decoration: none; user-select: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--cd); }
.btn[disabled] { --c: var(--line); --cd: var(--line-2); --fg: var(--muted); cursor: default; filter: none; }
.btn[disabled]:active { transform: none; box-shadow: 0 4px 0 var(--cd); }
.btn.ghost { --c: var(--card); --cd: var(--line-2); --fg: var(--sky-deep); border: 2px solid var(--line-2); }
.btn.tint { --c: var(--tint); --cd: var(--tint-deep); }
.btn.bad { --c: var(--bad); --cd: var(--bad-deep); }
.btn.wide { width: 100%; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 13px; border-radius: 12px; }
.linkish { background: none; border: 0; padding: 6px; cursor: pointer; color: var(--sky-deep); font-weight: 800; }

/* Logo ------------------------------------------------------------------- */
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; font-size: 22px; letter-spacing: -.02em;
  color: var(--ink); text-decoration: none; }
.logo .dots { position: relative; width: 30px; height: 20px; }
.logo .dots::before, .logo .dots::after { content: ""; position: absolute; top: 0; width: 20px; height: 20px; border-radius: 50%; }
.logo .dots::before { left: 0; background: #16a39a; }
.logo .dots::after { left: 10px; background: #5b5bd6; mix-blend-mode: multiply; }

/* App shell -------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 2px solid var(--line);
}
.topbar-in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.topbar .spacer { flex: 1; }
.stat { display: inline-flex; align-items: center; gap: 5px; font-weight: 900; padding: 6px 10px; border-radius: 12px;
  background: none; border: 0; cursor: pointer; font-size: 16px; }
.stat:hover { background: var(--line); }
.stat svg { width: 22px; height: 22px; }
.stat.streak { color: var(--sun-deep); }
.stat.streak.off { color: var(--muted); filter: grayscale(1); }
.stat.xp { color: var(--sky-deep); }
.course-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--card); cursor: pointer; font-weight: 800; }
.glyph { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #fff;
  font-weight: 800; font-size: 18px; background: var(--tint); }
.glyph.ar { font-family: var(--arabic); line-height: 1; font-size: 20px; padding-bottom: 4px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900;
  background: var(--tint); border: 0; cursor: pointer; text-transform: uppercase; }

.layout { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px;
  padding: 24px 16px 120px; }
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } .side { display: none; } }
.side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; align-self: start; }
.panel { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.panel h3 { margin: 0 0 10px; font-size: 17px; font-weight: 900; }
.tabs { display: flex; gap: 6px; }
.tab { padding: 8px 14px; border-radius: 12px; border: 2px solid transparent; background: none; cursor: pointer; font-weight: 800;
  color: var(--ink-2); text-transform: uppercase; font-size: 13px; letter-spacing: .05em; text-decoration: none; }
.tab.on { border-color: var(--tint); color: var(--tint-deep); background: var(--tint-soft); }

/* Bottom nav on phones */
.bottomnav { display: none; }
@media (max-width: 880px) {
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--card);
    border-top: 2px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottomnav a { flex: 1; text-align: center; padding: 8px 4px; border-radius: 12px; font-size: 12px; font-weight: 900;
    color: var(--ink-2); text-decoration: none; text-transform: uppercase; letter-spacing: .04em; }
  .bottomnav a.on { color: var(--tint-deep); background: var(--tint-soft); }
  .topbar .tabs { display: none; }
}
@media (max-width: 520px) {
  .topbar-in { gap: 4px; padding: 8px 12px; }
  .course-chip { padding: 4px; border-width: 0; background: none; }
  .course-chip .nm, .topbar .logo span:not(.dots) { display: none; }
  .stat { padding: 6px; }
  .path .node-wrap { max-width: 100%; }
}
.layout main { min-width: 0; overflow-x: clip; }

/* Landing ---------------------------------------------------------------- */
.landing { max-width: 980px; margin: 0 auto; padding: 32px 16px 80px; }
.landing header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 40px; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; gap: 24px; } }
.hero h1 { font-size: clamp(34px, 5.4vw, 56px); line-height: 1.05; letter-spacing: -.03em; margin: 0 0 16px; font-weight: 900; }
.hero p.lead { font-size: 19px; color: var(--ink-2); margin: 0 0 28px; max-width: 30em; text-wrap: pretty; }
.hero-art { position: relative; aspect-ratio: 1; max-width: 400px; justify-self: center; width: 100%; }
.bubble { position: absolute; background: var(--card); border: 2px solid var(--line); border-radius: 22px; padding: 14px 20px;
  box-shadow: var(--shadow); font-size: 30px; font-weight: 800; animation: float 6s ease-in-out infinite; }
.bubble small { display: block; font: 700 13px var(--ui); color: var(--muted); }
.bubble.b1 { top: 6%; right: 4%; }
.bubble.b2 { top: 40%; left: 0; animation-delay: -2s; }
.bubble.b3 { bottom: 6%; right: 12%; animation-delay: -4s; }
.bubble .ar { font-size: 36px; line-height: 1.5; }
.hero-art .big { position: absolute; inset: 22%; border-radius: 50%; background:
  radial-gradient(circle at 35% 50%, #16a39a 0 34%, transparent 34.5%), radial-gradient(circle at 65% 50%, #5b5bd6 0 34%, transparent 34.5%);
  opacity: .9; }
@keyframes float { 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .bubble { animation: none; } }
.pick { margin-top: 56px; }
.pick h2 { font-size: 24px; margin: 0 0 16px; font-weight: 900; }
.course-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .course-cards { grid-template-columns: 1fr; } }
.course-card { text-align: left; background: var(--card); border: 2px solid var(--line); border-bottom-width: 5px; border-radius: var(--r-lg);
  padding: 22px; cursor: pointer; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center;
  transition: border-color .15s, transform .1s; }
.course-card:hover { border-color: var(--tint); }
.course-card:active { transform: translateY(2px); }
.course-card .glyph { width: 64px; height: 64px; border-radius: 18px; font-size: 34px; grid-row: span 2; }
.course-card .glyph.ar { font-size: 40px; }
.course-card h3 { margin: 0; font-size: 22px; font-weight: 900; }
.course-card p { margin: 0; color: var(--muted); font-weight: 700; }
.course-card .sample { grid-column: 1 / -1; margin-top: 12px; padding-top: 12px; border-top: 2px dashed var(--line); color: var(--ink-2); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 56px; }
@media (max-width: 720px) { .facts { grid-template-columns: 1fr; } }
.facts div { padding: 4px 0; }
.facts b { display: block; font-size: 17px; font-weight: 900; margin-bottom: 4px; }
.facts span { color: var(--ink-2); font-weight: 600; }
.foot { margin-top: 64px; color: var(--muted); font-size: 14px; display: flex; gap: 16px; flex-wrap: wrap; }
.foot a { color: var(--muted); }

/* Learning path ---------------------------------------------------------- */
.unit { margin-bottom: 28px; }
.unit-head { background: var(--tint); color: #fff; border-radius: var(--r-lg); padding: 16px 20px; display: flex;
  align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 4px 0 var(--tint-deep); }
.unit-head small { display: block; opacity: .85; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.unit-head h2 { margin: 0; font-size: 21px; font-weight: 900; }
.unit-head .btn { --c: rgba(255,255,255,.18); --cd: rgba(0,0,0,.18); border: 2px solid rgba(255,255,255,.35); }
.path { position: relative; display: flex; flex-direction: column; align-items: center; gap: 46px; padding: 56px 0 10px; }
.node-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.node-wrap.open { z-index: 10; }
.node {
  --c: var(--tint); --cd: var(--tint-deep);
  width: 72px; height: 66px; border-radius: 50%; border: 0; cursor: pointer; background: var(--c); color: #fff;
  box-shadow: 0 7px 0 var(--cd); display: grid; place-items: center; transition: transform .06s, box-shadow .06s; position: relative;
}
.node:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--cd); }
.node svg { width: 34px; height: 34px; }
.node.done { --c: var(--sun); --cd: var(--sun-deep); }
.node.locked { --c: var(--line); --cd: var(--line-2); color: var(--muted); cursor: not-allowed; }
.node.locked:active { transform: none; box-shadow: 0 7px 0 var(--cd); }
.node.current::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 4px solid var(--tint); opacity: .35;
  animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.92); opacity: .5; } 100% { transform: scale(1.18); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .node.current::after { animation: none; } }
.node-label { margin-top: 12px; font-size: 13px; font-weight: 800; color: var(--ink-2); max-width: 140px; text-align: center; line-height: 1.2; }
.start-tip { position: absolute; top: -46px; background: var(--card); border: 2px solid var(--line); color: var(--tint-deep); font-weight: 900;
  padding: 6px 14px; border-radius: 12px; text-transform: uppercase; font-size: 13px; letter-spacing: .06em; white-space: nowrap;
  animation: bob 1.6s ease-in-out infinite; }
.start-tip::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; background: var(--card);
  border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateX(-50%) rotate(45deg); }
@keyframes bob { 50% { transform: translateY(-4px); } }
.coming { text-align: center; color: var(--muted); font-weight: 700; padding: 20px; border: 2px dashed var(--line-2); border-radius: var(--r-lg); }

/* popover for a lesson node */
.pop { position: absolute; top: 84px; z-index: 5; width: 280px; background: var(--tint); color: #fff; border-radius: 18px; padding: 16px;
  box-shadow: var(--shadow); }
.pop h4 { margin: 0 0 4px; font-size: 18px; font-weight: 900; }
.pop p { margin: 0 0 14px; opacity: .9; }
.pop .btn { --c: #fff; --cd: rgba(0,0,0,.2); --fg: var(--tint-deep); width: 100%; }
.pop.locked { background: var(--card); color: var(--ink-2); border: 2px solid var(--line); }
.pop.locked .btn { --c: var(--line); --cd: var(--line-2); --fg: var(--muted); }

/* side widgets */
.goal-row { display: flex; align-items: center; gap: 14px; }
.ring { --p: 0; width: 58px; height: 58px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--sun) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; }
.ring::before { content: ""; width: 44px; height: 44px; border-radius: 50%; background: var(--card); grid-area: 1 / 1; }
.ring span { grid-area: 1 / 1; font-weight: 900; font-size: 13px; z-index: 1; }
.bar { height: 14px; border-radius: 8px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--go); border-radius: 8px; transition: width .4s ease; }
.muted { color: var(--muted); font-weight: 700; }
.save-card { background: var(--tint-soft); border-color: transparent; }

/* Lesson player ---------------------------------------------------------- */
.player { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.player-top { max-width: 1000px; width: 100%; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 18px 16px 8px; }
.x { width: 40px; height: 40px; border: 0; background: none; cursor: pointer; color: var(--muted); border-radius: 10px; display: grid; place-items: center; }
.x:hover { background: var(--line); }
.x svg { width: 22px; height: 22px; }
.progress { flex: 1; height: 16px; background: var(--line); border-radius: 10px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--go); border-radius: 10px; transition: width .35s ease;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.08), inset 0 4px 0 rgba(255,255,255,.25); }
.combo { color: var(--sun-deep); font-weight: 900; min-width: 44px; text-align: right; }
.stage { max-width: 640px; width: 100%; margin: 0 auto; padding: 16px 16px 24px; display: flex; flex-direction: column; }
.ex-kind { font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--tint-deep); margin: 6px 0 4px; }
.ex-title { font-size: clamp(22px, 4vw, 28px); font-weight: 900; margin: 0 0 22px; letter-spacing: -.01em; }
.prompt { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.prompt .say { font-size: 22px; font-weight: 700; background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 10px 16px; }
.prompt .say .ar { font-size: 28px; line-height: 1.6; }
.speak { flex: none; width: 56px; height: 56px; border-radius: 16px; border: 0; cursor: pointer; background: var(--sky); color: #fff;
  box-shadow: 0 4px 0 var(--sky-deep); display: grid; place-items: center; }
.speak:active { transform: translateY(4px); box-shadow: none; }
.speak svg { width: 28px; height: 28px; }
.speak.big { width: 120px; height: 120px; border-radius: 28px; box-shadow: 0 6px 0 var(--sky-deep); }
.speak.big svg { width: 56px; height: 56px; }
.speak.slow { width: 64px; height: 64px; border-radius: 18px; background: var(--card); color: var(--sky-deep); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line-2); }
.speak.slow svg { width: 30px; height: 30px; }
.listen-row { display: flex; align-items: flex-end; justify-content: center; gap: 16px; margin: 8px 0 26px; }

/* intro card */
.intro { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg); padding: 28px 22px; text-align: center; }
.intro .word { font-size: 44px; font-weight: 800; margin: 6px 0 2px; line-height: 1.3; }
.intro .word.ar { font-size: 54px; line-height: 1.6; }
.intro .en { font-size: 22px; font-weight: 800; color: var(--ink-2); margin-top: 8px; }
.intro .speak { margin: 0 auto 8px; }
.new-badge { display: inline-block; background: var(--sun); color: #fff; font-weight: 900; font-size: 12px; letter-spacing: .1em;
  padding: 4px 10px; border-radius: 8px; text-transform: uppercase; }

/* choices */
.choices { display: grid; gap: 12px; }
.choices.grid2 { grid-template-columns: 1fr 1fr; }
.choice { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; min-height: 60px; padding: 12px 16px;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 16px; cursor: pointer; font-weight: 700; font-size: 18px; }
.choice:hover { background: color-mix(in srgb, var(--card) 92%, var(--sky)); }
.choice .k { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center;
  font-size: 13px; color: var(--muted); font-weight: 900; }
.choice.sel { border-color: var(--sky); background: color-mix(in srgb, var(--card) 85%, var(--sky)); color: var(--sky-deep); }
.choice.sel .k { border-color: var(--sky); color: var(--sky-deep); }
.choice.right { border-color: var(--go); background: var(--go-soft); color: var(--go-deep); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-deep); }
.choice.faded { opacity: .45; }
.choice .ar { font-size: 24px; line-height: 1.6; }
.choice-audio { justify-content: center; min-height: 84px; }
.choice-audio svg { width: 30px; height: 30px; color: var(--sky); }

/* match pairs */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match .col { display: grid; gap: 12px; }
.match .choice { justify-content: center; text-align: center; min-height: 64px; }
.match .choice.gone { visibility: hidden; }
.match .choice.shake, .shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* sentence building */
.answer-line { min-height: 70px; border-bottom: 2px solid var(--line); border-top: 2px solid var(--line); display: flex; flex-wrap: wrap;
  align-content: flex-start; gap: 8px; padding: 10px 0; margin-bottom: 22px;
  background: repeating-linear-gradient(transparent 0 61px, var(--line) 61px 63px); }
.answer-line[dir="rtl"] { direction: rtl; }
.bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 60px; }
.bank[dir="rtl"] { direction: rtl; }
.tile { padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--card);
  cursor: pointer; font-weight: 700; font-size: 18px; min-height: 48px; }
.tile.ar { font-size: 24px; padding: 2px 14px 4px; line-height: 1.7; }
.tile.used { background: var(--line); color: transparent; border-color: var(--line); cursor: default; }
.tile:active:not(.used) { transform: translateY(2px); }

/* typing */
.type-box { width: 100%; min-height: 110px; resize: none; border: 2px solid var(--line); border-radius: 16px; background: var(--card);
  padding: 14px 16px; font-size: 22px; font-weight: 700; }
.type-box.ar { font-family: var(--arabic); font-size: 26px; direction: rtl; }
.type-box:focus { outline: none; border-color: var(--sky); }
.kbd { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.kbd[dir="rtl"] { direction: rtl; }
.kbd button { min-width: 38px; height: 42px; border-radius: 10px; border: 2px solid var(--line); border-bottom-width: 3px; background: var(--card);
  cursor: pointer; font-size: 18px; font-weight: 700; }
.kbd button.ar { font-family: var(--arabic); font-size: 20px; }
.kbd button.wide { padding: 0 12px; font-size: 13px; font-weight: 900; text-transform: uppercase; }

/* footer / feedback */
.foot-bar { border-top: 2px solid var(--line); background: var(--paper); }
.foot-bar.ok { background: var(--go-soft); border-color: transparent; }
.foot-bar.no { background: var(--bad-soft); border-color: transparent; }
.foot-in { max-width: 1000px; margin: 0 auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; align-items: center;
  gap: 16px; justify-content: space-between; min-height: 110px; }
.verdict { display: flex; align-items: center; gap: 14px; }
.verdict .mark { width: 60px; height: 60px; border-radius: 50%; background: var(--card); display: grid; place-items: center; flex: none; }
.verdict .mark svg { width: 34px; height: 34px; }
.ok .verdict { color: var(--go-deep); }
.no .verdict { color: var(--bad-deep); }
.verdict h3 { margin: 0; font-size: 22px; font-weight: 900; }
.verdict p { margin: 2px 0 0; font-weight: 700; }
.verdict p .ar { font-size: 20px; }
.foot-in .btn { min-width: 150px; }
.foot-in [data-main] { margin-left: auto; }
@media (max-width: 600px) {
  .foot-in { flex-direction: column; align-items: stretch; }
  .foot-in .btn { width: 100%; }
  .verdict .mark { display: none; }
  .foot-in .skip { display: none; }
}

/* tip before a lesson */
.tipcard { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.tipcard h3 { margin: 0 0 8px; font-size: 20px; font-weight: 900; }
.tipcard p { margin: 0; color: var(--ink-2); font-weight: 600; font-size: 17px; text-wrap: pretty; }
.tipcard .ar { font-size: 1.25em; }

/* results */
.done-screen { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  padding: 24px 16px; text-align: center; gap: 22px; }
.done-screen h1 { font-size: 34px; margin: 0; font-weight: 900; color: var(--sun-deep); }
.medals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.medal { border-radius: 16px; border: 2px solid var(--c, var(--sun)); overflow: hidden; background: var(--card); }
.medal small { display: block; background: var(--c, var(--sun)); color: #fff; font-weight: 900; font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; padding: 5px; }
.medal b { display: block; font-size: 24px; padding: 12px 4px; font-weight: 900; color: var(--c, var(--sun)); }
.confetti { font-size: 0; height: 110px; position: relative; }
.confetti i { position: absolute; width: 10px; height: 16px; border-radius: 3px; animation: fall 1.4s ease-out forwards; opacity: 0; }
@keyframes fall { 0% { opacity: 1; transform: translateY(40px) rotate(0); } 100% { opacity: 0; transform: translateY(-60px) rotate(260deg); } }

/* auth */
.auth { max-width: 400px; margin: 0 auto; padding: 32px 16px 80px; }
.auth h1 { text-align: center; font-size: 28px; font-weight: 900; margin: 20px 0 22px; }
.field { display: block; margin-bottom: 12px; }
.field input { width: 100%; height: 54px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); padding: 0 16px; font-weight: 700; }
.field input:focus { outline: none; border-color: var(--sky); }
.error { color: var(--bad-deep); font-weight: 800; min-height: 1.4em; margin: 4px 0 12px; }
.center { text-align: center; }

/* letters */
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.letter { background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 16px; padding: 12px 8px 10px;
  text-align: center; cursor: pointer; }
.letter:hover { border-color: var(--tint); }
.letter .big { font-size: 34px; font-weight: 800; line-height: 1.3; }
.letter .big.ar { font-size: 44px; line-height: 1.5; }
.letter .forms { font-family: var(--arabic); color: var(--ink-2); font-size: 18px; direction: rtl; letter-spacing: 6px; }
.letter .nm { font-weight: 800; color: var(--muted); font-size: 13px; }
.letter .snd { font-weight: 700; color: var(--ink-2); font-size: 12px; min-height: 2.4em; line-height: 1.2; margin-top: 4px; }
.letter .ex { margin-top: 6px; padding-top: 6px; border-top: 2px dashed var(--line); font-size: 15px; }
.letter .ex .ar { font-size: 20px; }
.letter.playing { border-color: var(--sky); }

/* profile */
.prof-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.prof-head .avatar { width: 72px; height: 72px; font-size: 30px; }
.prof-head h1 { margin: 0; font-size: 28px; font-weight: 900; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; background: var(--card); }
.kpi svg { width: 28px; height: 28px; flex: none; }
.kpi b { display: block; font-size: 20px; font-weight: 900; }
.kpi span { color: var(--muted); font-weight: 700; font-size: 13px; }
.cal { display: grid; grid-template-rows: repeat(7, 14px); grid-auto-flow: column; grid-auto-columns: 14px; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.cal i { border-radius: 4px; background: var(--line); }
.cal i.l1 { background: #ffd98a; } .cal i.l2 { background: #ffbf4a; } .cal i.l3 { background: var(--sun); } .cal i.l4 { background: var(--sun-deep); }
.cal i.today { outline: 2px solid var(--ink-2); outline-offset: 1px; }
.goal-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.goal-opts button { padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-weight: 800; }
.goal-opts button.on { border-color: var(--sun); background: #fff4dc; color: var(--sun-deep); }
.section-title { font-size: 20px; font-weight: 900; margin: 26px 0 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* credits */
.credits table { width: 100%; border-collapse: collapse; font-size: 14px; }
.credits td, .credits th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.credits .ar { font-size: 18px; }
.page { max-width: 760px; margin: 0 auto; padding: 24px 16px 100px; }
.page h1 { font-size: 30px; font-weight: 900; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px;
  border-radius: 14px; font-weight: 800; z-index: 99; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); font-weight: 800; }
