@font-face { font-family: 'Alif Naskh'; src: url(../fonts/noto-naskh.woff2) format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #f4f6f1; --surface: #ffffff; --surface-2: #eef2ec; --surface-3: #e2e9e1;
  --text: #17231d; --muted: #5f6f66; --border: #dfe6de;
  --primary: #1f7a55; --primary-2: #26996a; --primary-soft: #dff2e8; --on-primary: #fff;
  --accent: #e8a33d; --accent-soft: #fbefd9; --gold: #f2b636;
  --danger: #c8443a; --danger-soft: #fbe6e3; --ok: #1f9a5c; --ok-soft: #dcf4e6; --blue: #3b7dd8;
  --shadow: 0 1px 2px rgba(20, 35, 28, .06), 0 6px 18px rgba(20, 35, 28, .07);
  --radius: 18px; --radius-sm: 12px;
  --ar: 'Alif Naskh', 'Noto Naskh Arabic', 'Traditional Arabic', serif;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', Arial, sans-serif;
  --side-w: 236px; --top-h: 58px; --bn-h: 64px;
  --ink: #17402f; --guide: #cfdcd4; --line: #dfe6de;
  --tile: 64px; --big-glyph: 150px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0e1a16; --surface: #142420; --surface-2: #1a2e28; --surface-3: #22392f;
  --text: #e5eee9; --muted: #93a49b; --border: #26403a;
  --primary: #3cba82; --primary-2: #5fd09c; --primary-soft: #183a2e; --on-primary: #07150f;
  --accent: #f0b65a; --accent-soft: #33291a; --gold: #f2c14e;
  --danger: #ef6b5e; --danger-soft: #3c1d1a; --ok: #4cc98a; --ok-soft: #173a2a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .28);
  --ink: #bdf0d6; --guide: #2b4a40; --line: #26403a;
  color-scheme: dark;
}
/* age skins: same content, different feel */
[data-skin="kids"] { --radius: 24px; --tile: 76px; --big-glyph: 180px; --ui: 'Comic Sans MS', 'Chalkboard SE', 'Baloo 2', system-ui, sans-serif; }
[data-skin="adults"] { --radius: 12px; --tile: 58px; --big-glyph: 130px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: var(--primary-2); text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6em .75em; width: 100%; min-height: 44px; }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; accent-color: var(--primary); }
input[type=range] { padding: 0; border: 0; accent-color: var(--primary); }
textarea { resize: vertical; }
:focus-visible { outline: 3px solid var(--primary-2); outline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: fixed; top: -60px; inset-inline-start: 8px; background: var(--primary); color: var(--on-primary); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 8px; }
.ar { font-family: var(--ar); direction: rtl; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.ar.inline { font-size: 1.3em; line-height: 1; }
.small { font-size: .85rem; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.nowrap { flex-wrap: nowrap; margin-top: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stack > * + * { margin-top: 12px; }
.ic { flex: none; vertical-align: middle; }
.warn { background: var(--accent-soft); padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9rem; }

/* ---------- layout */
#app { display: flex; min-height: 100vh; }
#sidebar { display: none; }
#column { flex: 1; min-width: 0; }
#topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; padding-top: env(safe-area-inset-top); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); }
.top-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.pill { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: .85rem; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pill.streak.on { background: #ffe9d6; color: #d9601c; }
[data-theme="dark"] .pill.streak.on { background: #3d2516; color: #ff9b5c; }
.pill.xp { background: var(--accent-soft); color: #b7791f; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--primary-soft); color: var(--primary); font-weight: 800; cursor: pointer; }
.offline-pill { display: inline-flex; color: var(--accent); }
main { max-width: 880px; margin: 0 auto; padding: 18px 16px calc(var(--bn-h) + 28px + env(safe-area-inset-bottom)); outline: none; }
#bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: calc(var(--bn-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: flex; background: var(--surface); border-top: 1px solid var(--border); }
.bn-link { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .72rem; position: relative; }
.bn-link.active { color: var(--primary); font-weight: 700; }
.bn-link.active .nav-ic { background: var(--primary-soft); }
.nav-ic { display: grid; place-items: center; width: 52px; height: 30px; border-radius: 99px; transition: background .2s; }
.badge { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; }
[dir="rtl"] .badge { left: auto; right: calc(50% + 8px); }
body.in-lesson #bottomnav, body.in-lesson #topbar { display: none; }
body.in-lesson main { padding-bottom: 24px; }
@media (min-width: 900px) {
  #sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: none; padding: 16px 12px; border-inline-end: 1px solid var(--border); background: var(--surface); }
  .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; color: var(--text); }
  .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
  .brand-name { font-weight: 800; font-size: 1.15rem; }
  .brand-tag { font-size: .75rem; color: var(--muted); }
  .side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
  .side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text); position: relative; font-weight: 500; }
  .side-link .nav-ic { width: auto; height: auto; }
  .side-link:hover { background: var(--surface-2); }
  .side-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
  .side-link .badge { position: static; margin-inline-start: auto; }
  .side-foot { border-top: 1px solid var(--border); padding-top: 8px; }
  .copyright { font-size: .7rem; color: var(--muted); padding: 8px 12px 0; }
  #bottomnav, .top-brand { display: none; }
  main { padding: 26px 32px 60px; }
  body.in-lesson #sidebar { display: none; }
}

/* ---------- components */
.boot { min-height: 60vh; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.boot-logo { animation: pulse 1.6s ease-in-out infinite; border-radius: 22px; }
@keyframes pulse { 50% { opacity: .5; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card, section + section, .card + section, section + .card { margin-top: 16px; }
.card.error { border-color: var(--danger); }
.section-title { margin: 24px 0 10px; font-size: 1.1rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--border); border-bottom-width: 3px; background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; text-align: center; transition: transform .08s, background .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(2px); border-bottom-width: 1px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: color-mix(in srgb, var(--primary) 70%, #000); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { background: var(--danger); border-color: color-mix(in srgb, var(--danger) 70%, #000); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .88rem; border-radius: 11px; }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 58px; font-size: 1.1rem; border-radius: 18px; padding: 0 26px; }
.icon-btn { display: inline-grid; place-items: center; min-width: 42px; height: 42px; border: 0; background: transparent; border-radius: 12px; cursor: pointer; color: var(--text); }
.icon-btn:hover { background: var(--surface-2); }
.linkish { border: 0; background: none; cursor: pointer; padding: 0; text-align: start; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-weight: 700; color: var(--muted); font-size: .9rem; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 12px 0 16px; scrollbar-width: none; }
.tabs button { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 7px 14px; font-weight: 700; cursor: pointer; white-space: nowrap; color: var(--muted); }
.tabs button.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.switch-row, .setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row small { display: block; color: var(--muted); font-size: .8rem; }
.setting-row:last-child, .switch-row:last-child { border-bottom: 0; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.tag.heavy { background: #fde3d0; color: #b4541b; }
[data-theme="dark"] .tag.heavy { background: #3d2516; color: #ff9b5c; }
.tags { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 6px 0; }
.stars { color: var(--surface-3); letter-spacing: 1px; white-space: nowrap; }
.star.on { color: var(--gold); }
.stars.big { font-size: 3rem; text-align: center; }
.stars.big .star { display: inline-block; animation: pop-in .45s backwards; }
.stars.big .star:nth-child(2) { animation-delay: .15s; } .stars.big .star:nth-child(3) { animation-delay: .3s; }
@keyframes pop-in { from { transform: scale(0) rotate(-30deg); } }
.grade { color: var(--gold); letter-spacing: 1px; }
.code-pill { display: inline-block; font-family: ui-monospace, Consolas, monospace; font-weight: 800; letter-spacing: .08em; background: var(--surface-2); padding: 4px 10px; border-radius: 10px; }
.code-pill.big { font-size: 1.4rem; }
.code-input { text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 10px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { font-size: .8rem; color: var(--muted); }
.goal { margin-top: 14px; }
.goal-bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.goal-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 99px; transition: width .5s; }
.ring-bg { stroke: var(--surface-3); } .ring-fg { stroke: var(--lv, var(--primary)); } .ring-text { font-size: 15px; font-weight: 700; fill: var(--text); }
.level-rings { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; text-align: center; }
.level-ring b { display: block; font-size: .85rem; margin-top: 4px; }

/* ---------- toasts, sheets, choosers, confetti */
#toasts { position: fixed; left: 50%; bottom: calc(var(--bn-h) + 18px); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; opacity: 0; transform: translateY(10px); transition: .25s; }
.toast.show { opacity: 1; transform: none; }
.sheet-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; }
.sheet-wrap.open { opacity: 1; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 88vh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; transform: translateY(30px); transition: transform .22s; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 0; }
.sheet-head h3 { margin: 0; }
.sheet-body { padding: 14px 18px; overflow-y: auto; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 0 18px 18px; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 22px; } }
.choose-list { display: grid; gap: 4px; }
.choose-item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; text-align: start; padding: 11px 12px; border: 0; background: transparent; border-radius: 12px; cursor: pointer; }
.choose-item:hover { background: var(--surface-2); }
.choose-item.active { background: var(--primary-soft); }
.ci-label { font-weight: 600; flex: 1; }
.ci-sub { color: var(--muted); font-size: .8rem; width: 100%; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px; animation: fall 2.2s ease-in forwards; }
@keyframes fall { to { top: 110vh; transform: rotate(720deg) translateX(40px); } }

/* ---------- Qalam */
.qalam { display: flex; align-items: flex-end; gap: 10px; margin: 8px 0 14px; }
.qalam-fig { width: 84px; flex: none; }
.qalam.small .qalam-fig { width: 56px; }
.qalam-svg { width: 100%; display: block; overflow: visible; }
.qalam-bubble { position: relative; background: var(--primary-soft); color: var(--text); padding: 10px 14px; border-radius: 18px; border-end-start-radius: 4px; font-weight: 600; max-width: 520px; }
.q-pen { transform-origin: 30% 80%; }
.q-spark, .q-ink { opacity: 0; transform-origin: center; }
.mood-happy .q-pen { animation: bob 2.4s ease-in-out infinite; }
.mood-cheer .q-pen { animation: hop .6s ease-in-out 3; }
.mood-cheer .q-spark { animation: twinkle 1s ease-in-out infinite; }
.mood-think .q-pen { animation: tilt 2s ease-in-out infinite; }
.mood-oops .q-pen { animation: wobble .8s ease-in-out 2; }
.mood-oops .q-ink { opacity: 1; animation: drip 1.4s ease-in 1; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-3deg); } }
@keyframes hop { 50% { transform: translateY(-14px) rotate(8deg); } }
@keyframes tilt { 50% { transform: rotate(-10deg); } }
@keyframes wobble { 25% { transform: rotate(8deg); } 75% { transform: rotate(-8deg); } }
@keyframes twinkle { 50% { opacity: 1; transform: scale(1.2); } }
@keyframes drip { from { transform: translateY(-6px); opacity: 0; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .q-pen, .q-spark, .q-ink, .stars.big .star { animation: none !important; } }

/* ---------- welcome */
.welcome { max-width: 560px; margin: 4vh auto; text-align: center; }
.welcome .qalam { justify-content: center; text-align: start; }
.welcome-logo { width: 96px; border-radius: 26px; }
.welcome input { margin: 8px 0 14px; font-size: 1.2rem; text-align: center; }
.choice-grid { display: grid; gap: 10px; margin: 14px 0; }
.choice-grid.two { grid-template-columns: 1fr 1fr; }
.choice { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; color: var(--text); text-align: center; }
.choice:hover, .choice.on { border-color: var(--primary-2); background: var(--primary-soft); }
.choice b { font-size: 1.1rem; }
.choice small { color: var(--muted); }
.choice-emo { font-size: 2rem; }

/* ---------- home path */
.hero .qalam-bubble { font-size: 1.05rem; }
.hero-row { display: flex; gap: 10px; flex-wrap: wrap; }
.lvl-sec { margin-top: 26px; }
.level-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px; border-radius: var(--radius); background: var(--lv); color: #fff; }
.level-head h2 { margin: 0; color: #fff; }
.level-head .muted { color: rgba(255, 255, 255, .85); margin: 0; }
.level-id { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.level-count { font-weight: 800; background: rgba(255, 255, 255, .2); padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.lvl-sec.locked .level-head { filter: grayscale(.8); opacity: .7; }
.path { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.stone-btn { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); margin-inline-start: calc(var(--zig, 0) * 1px); }
.stone:nth-child(4n+2) .stone-btn { --zig: 24; } .stone:nth-child(4n+3) .stone-btn { --zig: 48; } .stone:nth-child(4n+4) .stone-btn { --zig: 24; }
a.stone-btn:hover { border-color: var(--lv); }
.stone-dot { flex: none; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-weight: 800; font-size: 1.1rem; border-bottom: 4px solid var(--surface-3); }
.stone.done .stone-dot { background: var(--lv); color: #fff; border-color: color-mix(in srgb, var(--lv) 70%, #000); }
.stone.next .stone-dot { background: var(--accent); color: #fff; border-color: #b87918; animation: glow 1.8s ease-in-out infinite; }
.stone.test .stone-dot { border-radius: 14px; }
.stone.locked .stone-btn { opacity: .55; }
.stone-text { display: flex; flex-direction: column; min-width: 0; }
.next-tag { color: var(--accent); font-weight: 800; }
@keyframes glow { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent); } }

/* ---------- lesson player */
.lesson-player { max-width: 680px; margin: 0 auto; min-height: 80vh; display: flex; flex-direction: column; }
.lp-top { display: flex; align-items: center; gap: 12px; padding: 4px 0 14px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.lp-bar { flex: 1; height: 14px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.lp-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 99px; transition: width .4s; }
.lp-xp { font-weight: 800; color: #b7791f; white-space: nowrap; }
.lp-body { flex: 1; display: flex; flex-direction: column; padding-bottom: 120px; }
.lp-intro, .lp-result { text-align: center; padding-top: 4vh; }
.lp-intro .qalam, .lp-result .qalam { justify-content: center; text-align: start; }
.intro-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 6px 0 22px; font-size: 2.6rem; }
.result-stats { display: flex; justify-content: center; gap: 12px; margin: 16px 0; }
.result-stats > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 18px; min-width: 90px; }
.result-stats b { display: block; font-size: 1.4rem; }
.result-stats span { font-size: .8rem; color: var(--muted); }
.result-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.instr { font-size: 1.25rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 14px; }
.instr-ar { font-size: 1.05rem; color: var(--muted); font-weight: 400; }
.instr-target { font-size: 2.2rem; color: var(--primary); }
.learn-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.learn-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 18px; text-align: center; box-shadow: var(--shadow); }
.big-glyph { display: block; margin: 0 auto; border: 0; background: none; cursor: pointer; font-size: var(--big-glyph); line-height: 1.35; color: var(--text); padding: 0 20px; min-height: calc(var(--big-glyph) * 1.2); }
.big-glyph.word { font-size: calc(var(--big-glyph) * .55); min-height: 0; }
.big-glyph:active { transform: scale(.96); }
.lc-name { font-size: 1.15rem; font-weight: 700; display: flex; justify-content: center; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.lc-ar { font-size: 1.8rem; }
.lc-tr { color: var(--muted); font-style: italic; }
.lc-sound { margin: 8px auto; max-width: 460px; }
.lc-word { display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 16px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.lc-w { font-size: 1.8rem; }
.pic { font-size: 2rem; line-height: 1; }
.pic.big { font-size: 4.2rem; margin-bottom: 4px; }
.tip-body { text-align: start; font-size: 1.05rem; }
.tip .read-grid { margin-top: 12px; }
.q { display: flex; flex-direction: column; gap: 18px; }
.q-prompt { display: flex; justify-content: center; align-items: center; gap: 14px; min-height: 120px; flex-wrap: wrap; }
.q-big { font-size: calc(var(--big-glyph) * .8); line-height: 1.4; }
.q-pic { text-align: center; }
.q-pic .pic { font-size: 4.5rem; }
.q-mean { font-size: 1.5rem; font-weight: 800; }
.hear { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--primary-soft); color: var(--primary); cursor: pointer; }
.hear.big { width: 110px; height: 110px; background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 0 color-mix(in srgb, var(--primary) 65%, #000); }
.hear.big:active { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--primary) 65%, #000); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt { min-height: 84px; border: 2px solid var(--border); border-bottom-width: 5px; border-radius: var(--radius); background: var(--surface); cursor: pointer; padding: 8px; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; transition: transform .08s; }
.opt:hover { border-color: var(--primary-2); }
.opt:active { transform: translateY(2px); }
.opt-ar { font-size: 2.6rem; line-height: 1.3; }
.opt-ar.sm { font-size: 1.7rem; line-height: 1.6; }
.opt-ar.xs { font-size: 1.3rem; line-height: 1.7; }
.opts.long { grid-template-columns: 1fr; }
.opts.long .opt { min-height: 60px; }
.conj { display: grid; gap: 6px; margin-top: 12px; }
.conj-row { display: grid; grid-template-columns: 1fr 1fr; align-items: center; direction: rtl; border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 2px 12px; cursor: pointer; }
.conj-p { font-size: 1.3rem; color: var(--muted, #777); }
.conj-v { font-size: 1.7rem; font-weight: 700; }
.ayah { margin: 14px 0 6px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--primary-soft); text-align: center; }
.ayah-text { font-size: 1.8rem; line-height: 2.2; }
.ayah figcaption { margin-top: 4px; }
.ayah.hadith { background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface)); border: 1px dashed var(--border); }
.ayah-list { display: grid; gap: 10px; text-align: center; }
.q-gram { text-align: center; }
.q-gram p { margin: 0 0 8px; }
.q-sent { font-size: 2.1rem; line-height: 1.9; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); animation: shake .35s; }
.opts.done .opt:not(.right):not(.wrong) { opacity: .5; }
.fb { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px max(16px, calc(50% - 330px)) calc(16px + env(safe-area-inset-bottom)); animation: slide-up .2s; }
.fb.ok { background: var(--ok-soft); color: var(--ok); }
.fb.bad { background: var(--danger-soft); color: var(--danger); }
.fb-text b { font-size: 1.2rem; }
.fb-text .ar { font-size: 1.6rem; }
@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.shake { animation: shake .35s; }
/* trace */
.trace-wrap { position: relative; width: 100%; max-width: 420px; margin: 0 auto; border-radius: var(--radius); background: var(--surface); border: 2px dashed var(--border); overflow: hidden; }
.trace-wrap canvas { position: absolute; inset: 0; }
.trace-ink { cursor: crosshair; }
.trace-head { margin-bottom: 10px; }
.trace-label { font-size: 2.2rem; }
/* pop */
.pop-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.pop { aspect-ratio: 1; border-radius: 50%; border: 0; background: radial-gradient(circle at 35% 30%, #fff, var(--primary-soft) 60%); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .06), var(--shadow); cursor: pointer; font-size: 2.1rem; transition: transform .2s, opacity .2s; }
[data-theme="dark"] .pop { background: radial-gradient(circle at 35% 30%, #2f5547, var(--primary-soft) 60%); }
.pop.gone { transform: scale(1.4); opacity: 0; pointer-events: none; }
/* match */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: grid; gap: 10px; }
.tile { min-height: var(--tile); border: 2px solid var(--border); border-bottom-width: 5px; border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 700; padding: 6px 10px; }
.tile .ar { font-size: 2rem; }
.tile.small { min-height: 54px; min-width: 54px; }
.tile.sel { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, var(--surface)); }
.tile.matched { border-color: var(--ok); background: var(--ok-soft); opacity: .45; pointer-events: none; }
.tile.used { opacity: .25; }
.pic-tile .pic { font-size: 2.2rem; }
/* sort */
.buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.bucket { min-height: 76px; border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; padding: 10px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.bucket:hover { border-color: var(--primary-2); border-style: solid; }
/* read / forms / build */
.read-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.read-grid.wide { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.read-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 84px; border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; padding: 6px; }
.read-tile .ar { font-size: 2.1rem; line-height: 1.5; }
.read-tile.heard { border-color: var(--ok); }
.forms-table { display: grid; gap: 6px; margin: 10px 0; }
.forms-row { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; cursor: pointer; }
.forms-row.head { background: none; border: 0; font-size: .8rem; color: var(--muted); font-weight: 700; cursor: default; }
.forms-row .form { font-size: 2.2rem; line-height: 1.6; }
.forms-row.big { cursor: default; margin: 12px 0; }
.forms-row.big > div { display: flex; flex-direction: column; }
.build-answer { min-height: 90px; border-bottom: 3px solid var(--border); display: grid; place-items: center; margin: 10px 0 16px; }
.build-word { font-size: 3rem; }
.build-sent { font-size: 2rem; line-height: 1.8; }
.tile.word .ar { font-size: 1.6rem; }
.build-bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---------- letters chart */
.alphabet { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; margin: 14px 0; }
.abc { display: flex; flex-direction: column; align-items: center; padding: 6px 4px; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.abc .ar { font-size: 2.4rem; line-height: 1.5; }
.abc small { font-size: .72rem; color: var(--muted); direction: ltr; }
.abc.heavy { border-color: #f2c7a6; }
.abc.extra { background: var(--surface-2); }
.letter-detail { text-align: center; }

/* ---------- class + teacher */
.class-id { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.assign-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; color: var(--text); }
.assign-card.fresh { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.assign-card.link:hover { border-color: var(--primary-2); }
.assign-card h3 { margin: 6px 0 2px; }
.assign-card .btn { margin-top: 10px; }
.status { font-size: .75rem; font-weight: 800; padding: 2px 9px; border-radius: 99px; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.due { background: var(--primary-soft); color: var(--primary); }
.status.late { background: var(--danger-soft); color: var(--danger); }
.status.pend { background: var(--accent-soft); color: #b7791f; }
.teacher-says { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0; white-space: pre-wrap; }
.work-img { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-top: 8px; background: #fff; }
.work-img.big { max-height: 60vh; }
.review-text { font-size: 2.4rem; }
.thread { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); align-self: flex-start; }
.msg.me { align-self: flex-end; background: var(--primary-soft); }
.msg.announce { border: 1px solid var(--accent); }
.msg-time { font-size: .7rem; color: var(--muted); }
.league { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.league li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.league li.me { background: var(--primary-soft); font-weight: 700; }
.league .rank { width: 28px; text-align: center; font-weight: 800; }
.league .who { flex: 1; }
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.class-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.class-card:hover { border-color: var(--primary-2); }
.class-card.archived { opacity: .6; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover { background: var(--surface-2); }
.table .badge { position: static; display: inline-grid; margin-inline-start: 6px; }
.lesson-strip { margin: 10px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { display: inline-flex; flex-direction: column; align-items: center; min-width: 44px; padding: 4px 6px; border-radius: 10px; background: var(--surface-2); font-size: .8rem; font-weight: 700; color: var(--muted); }
.chip.done { background: var(--ok-soft); color: var(--ok); }
.chip .stars { font-size: .6rem; }
.grade-pick { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.grade-btn { font-size: 2rem; border: 0; background: none; cursor: pointer; color: var(--surface-3); padding: 0 2px; }
.grade-btn.on { color: var(--gold); }
.more { display: grid; gap: 4px; padding: 8px; }
.more-link { display: flex; align-items: center; gap: 14px; padding: 14px 12px; border-radius: 12px; color: var(--text); font-weight: 600; border: 0; background: none; cursor: pointer; text-align: start; }
.more-link:hover { background: var(--surface-2); }
.list { display: grid; gap: 4px; margin-bottom: 12px; }
.list-row { padding: 10px 12px; border-radius: 10px; }
.list-row.on { background: var(--primary-soft); }
/* recorder (shared with MushafMind) */
.rec-row, .rec-panel { display: flex; flex-direction: column; gap: 10px; align-items: stretch; margin: 14px 0; }
.rec-panel audio, .rec-row audio, audio { width: 100%; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; display: inline-block; }
.rec-time { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.level { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 0; }
.level i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .05s; }
.rec-warn { font-size: .85rem; color: var(--danger); }

@media (max-width: 520px) {
  :root { --big-glyph: 120px; }
  [data-skin="kids"] { --big-glyph: 140px; }
  .opt-ar { font-size: 2.2rem; }
  .pop-grid { gap: 8px; }
  .stone:nth-child(4n+2) .stone-btn { --zig: 12; } .stone:nth-child(4n+3) .stone-btn { --zig: 24; } .stone:nth-child(4n+4) .stone-btn { --zig: 12; }
  .result-stats > div { padding: 8px 10px; min-width: 0; }
  .choice-grid.two { grid-template-columns: 1fr; }
  .table th:nth-child(n+6), .table td:nth-child(n+6) { display: none; }
}

/* dictionary */
.dict-input { width: 100%; font-size: 1.1rem; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); margin: 8px 0; }
.dict-results { margin-top: 16px; }
.dict-root-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dict-rootletters { font-size: 1.6rem; letter-spacing: .3em; color: var(--primary); }
.dict-words { list-style: none; padding: 0; margin: 8px 0 0; }
.dict-words li { padding: 8px 0; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.dict-head { font-size: 1.35rem; }
.dict-en { color: var(--text); }
.dict-ar-def { flex-basis: 100%; color: var(--muted); font-family: var(--font-ar, inherit); font-size: 1.05rem; }
.dict-say { border: 0; background: var(--surface-2); border-radius: 50%; width: 30px; height: 30px; display: inline-grid; place-items: center; cursor: pointer; color: var(--primary); }
.ar-block { font-size: 1.15rem; line-height: 2; white-space: pre-wrap; max-height: 55vh; overflow: auto; }

/* exam timer and topic breakdown */
.lp-timer { font-variant-numeric: tabular-nums; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: var(--surface-2); }
.lp-timer.late { color: var(--danger); }
.topic-table { margin: 12px auto; border-collapse: collapse; min-width: 260px; }
.topic-table caption { font-weight: 700; margin-bottom: 6px; }
.topic-table td { padding: 6px 10px; border-top: 1px solid var(--border); }
.topic-table tr.weak td { color: var(--danger); }
.review-text.written { font-size: 1.45rem; text-align: right; white-space: pre-wrap; line-height: 2.1; }
/* Writing track: compose step and on-screen Arabic keyboard */
.compose-box { width: 100%; font-size: 1.5rem; line-height: 2; padding: .5rem .75rem; border: 2px solid var(--line, #d7e0d9); border-radius: 12px; resize: vertical; background: var(--card, #fff); color: inherit; }
.compose-box:focus { outline: none; border-color: var(--green, #1f7a55); }
.compose-frame { display: block; margin-top: .5rem; color: var(--green, #1f7a55); }
.compose-bank { margin: .5rem 0; }
.compose-tools { margin: .35rem 0; }
.compose-hint { background: #fff8e6; border-radius: 10px; padding: .5rem .75rem; }
.compose-result .checks { list-style: none; padding: 0; margin: .5rem 0; }
.compose-result .checks li.ok { color: #1f7a55; } .compose-result .checks li.bad { color: #b42318; }
.compose-model { background: var(--soft, #eef3ef); border-radius: 12px; padding: .5rem .75rem; margin-top: .4rem; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; text-align: right; }
.arkb { display: grid; gap: 4px; margin: .5rem 0; user-select: none; }
.kb-row { display: flex; gap: 4px; justify-content: center; }
.kb-key { flex: 1 1 0; min-width: 0; max-width: 3.2rem; height: 2.6rem; font-size: 1.25rem; font-family: inherit; border: 1px solid var(--line, #d7e0d9); border-radius: 8px; background: var(--card, #fff); color: inherit; cursor: pointer; padding: 0; }
.kb-key:active { background: var(--soft, #eef3ef); }
.kb-key.mark { font-size: 1.4rem; } .kb-key.wide { max-width: 4.5rem; } .kb-key.space { max-width: none; flex: 4 1 0; font-size: .9rem; }
.compose-task { flex-direction: column; align-items: center; gap: .35rem; }

/* ---------- placement test */
.placement h1 { margin-top: 0; }
.pl-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pl-stages { flex: 1; display: flex; gap: 6px; }
.pl-stages span { flex: 1; text-align: center; font-size: .75rem; font-weight: 700; padding: 4px 0; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pl-stages span.done { background: var(--primary-soft); color: var(--primary); }
.pl-stages span.now { background: var(--primary); color: var(--on-primary); }
.opt.picked { border-color: var(--primary-2); background: var(--primary-soft); }

/* ---------- Quran words meter (Progress) */
.qm-row { display: flex; align-items: center; gap: 16px; }
.qm-pct { font-size: 2.4rem; color: var(--primary); min-width: 4ch; text-align: center; }
.qm-text { flex: 1; }
.qm-text p { margin: 6px 0 0; }
.qm-next { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.qm-next li { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: baseline; padding: 6px 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
.qm-next .ar { font-size: 1.35rem; grid-row: span 2; }
.qm-next .tiny { grid-column: 2; }

/* ---------- stories */
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.story-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 12px 8px; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: var(--radius); background: var(--surface); color: var(--text); }
.story-tile:hover { border-color: var(--primary-2); }
.story-tile.done { border-color: var(--primary-soft); background: var(--surface-2); }
.story-pic { font-size: 2rem; line-height: 1; }
.story-pic.big { font-size: 3rem; }
.story-names { display: flex; flex-direction: column; }
.story-ar { font-size: 1.3rem; line-height: 1.6; }
.story-ar.big { font-size: 1.9rem; }
.story-stage .level-head { margin-bottom: 12px; }
.story-stage .level-head h2 { font-size: 1.15rem; }
.story-stage.locked .level-head { filter: grayscale(.8); opacity: .7; }
.story-title { display: flex; align-items: center; gap: 14px; margin: 8px 0; }
.story-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.seg { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 99px; padding: 3px 4px 3px 10px; }
.seg-btn { border: 0; background: transparent; color: var(--text); font: inherit; font-size: .85rem; padding: 5px 10px; border-radius: 99px; cursor: pointer; min-height: 32px; }
.seg-btn.on { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.story-body { display: flex; flex-direction: column; gap: 6px; }
.sline { display: flex; gap: 8px; align-items: flex-start; padding: 6px 4px; border-radius: var(--radius-sm); }
.sline.now { background: var(--primary-soft); }
.sline-say { border: 0; background: var(--surface-2); color: var(--primary); border-radius: 50%; width: 32px; height: 32px; flex: none; display: grid; place-items: center; cursor: pointer; margin-top: 10px; }
.sline-main { flex: 1; min-width: 0; }
.sline-ar { display: flex; flex-wrap: wrap; column-gap: .35em; row-gap: 2px; font-family: var(--ar-font, 'Alif Naskh', 'Noto Naskh Arabic', serif); }
.sw-cell { display: inline-flex; flex-direction: column; align-items: center; }
.sw { border: 0; background: none; color: inherit; font: inherit; font-size: 1.65rem; line-height: 1.9; padding: 0 1px; border-radius: 6px; cursor: pointer; }
.sw:hover, .sw:focus-visible { background: var(--accent-soft, var(--primary-soft)); }
.sw-irab { display: none; font-size: .72rem; line-height: 1.3; color: var(--muted); max-width: 9em; text-align: center; }
.sline.show-irab .sw-irab { display: block; }
.sline.show-irab .sw-cell { padding-bottom: 6px; }
.sline-en { display: none; font-size: .92rem; color: var(--muted); text-align: start; }
.sline.show-en .sline-en { display: block; }
.word-sheet { text-align: center; }
.ws-row { display: flex; justify-content: center; align-items: center; gap: 14px; }
.ws-word { font-size: 2.6rem; line-height: 1.6; }
.ws-mean { font-size: 1.2rem; font-weight: 700; margin: 6px 0; }
.ws-irab { color: var(--muted); }
.word-sheet .row { justify-content: center; }
.story-quiz .opts .opt { min-height: 60px; }

/* ---------- listen and compare */
.cmp { display: flex; flex-direction: column; gap: 6px; }
.cmp-shapes { width: 100%; height: 110px; background: var(--surface-2); border-radius: var(--radius-sm); }
.cmp-info { margin: 0; }
.cmp-btns { flex-wrap: wrap; gap: 6px; }
.cmp-list { display: flex; flex-direction: column; gap: 14px; }
.cmp-item { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.cmp-ar { display: block; text-align: center; font-size: 1.8rem; line-height: 1.7; }
.ws-practise { text-align: start; margin-top: 8px; }
.ws-practise summary { cursor: pointer; font-weight: 700; color: var(--primary-2); padding: 6px 0; }
.trace-order { gap: 10px; margin: 6px 0; flex-wrap: wrap; }

/* ---------- weekly report */
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 120px; align-items: end; margin: 12px 0; }
.wb { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.wb i { display: block; width: 70%; min-height: 3px; background: var(--primary); border-radius: 6px 6px 2px 2px; }
.wb small { color: var(--muted); font-size: .72rem; }
.chip { display: inline-block; background: var(--surface-2); border-radius: 99px; padding: 2px 12px; margin: 3px; font-size: 1.3rem; }
.report-text { white-space: pre-wrap; background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); font: inherit; font-size: .9rem; }
@media print {
  #sidebar, #bottomnav, #topbar, .report .btn, .report select { display: none !important; }
  .report-text { display: none; }
  body, .card { background: #fff !important; color: #000 !important; box-shadow: none !important; }
}

/* ---------- conversations */
.talk-task { background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-sm); margin: 8px 0; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 8px 12px; border-radius: 16px; background: var(--surface-2); align-self: flex-start; }
.bubble.me { align-self: flex-end; background: var(--primary-soft); }
.bubble-who { font-size: .75rem; color: var(--muted); }
.bubble-ar { font-family: 'Alif Naskh', 'Noto Naskh Arabic', serif; font-size: 1.45rem; line-height: 1.8; }
.bubble-en, .opt-en { display: none; font-size: .85rem; color: var(--muted); text-align: start; }
.chat.show-en .bubble-en, .chat-choices.show-en .opt-en { display: block; }
.bubble-tools { display: flex; gap: 4px; }
.bubble-tip, .talk-tip { font-size: .88rem; background: var(--accent-soft, #fff4dc); border-radius: 10px; padding: 6px 10px; margin: 6px 0 0; }
.chat-choices { margin-top: 14px; }
.talk-opt { flex-direction: column; gap: 2px; }
.talk-opt .ar { font-size: 1.35rem; line-height: 1.7; }
.btn.on { background: var(--primary-soft); }

/* ---------- speaking track */
.shadow-line { text-align: center; margin: 10px 0; }
.shadow-ar { font-size: 1.9rem; line-height: 1.8; display: block; }
.speak-task { background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); margin-bottom: 8px; }
.speak-phrases { display: flex; flex-wrap: wrap; gap: 6px; direction: rtl; margin-bottom: 8px; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 2px 12px; cursor: pointer; font-size: 1.2rem; }
.speak-clock { font-size: 3rem; font-weight: 800; text-align: center; color: var(--primary); }
.speak-model { margin: 10px 0; }
.speak-model summary { cursor: pointer; font-weight: 700; color: var(--primary-2); }
/* speaking marks (teacher review + student feedback card) */
.small-stars .grade-btn { font-size: 1.4rem; }
.rubric-label { flex: 1; font-size: .9rem; }
.self-check { list-style: none; padding: 0; margin: 0; }
.rubric-list { display: grid; gap: 2px; margin: 6px 0; }
.rubric-list .grade { font-size: 1rem; }
/* Android app update banner */
.apk-banner { position: fixed; left: 8px; right: 8px; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line, #ccc); border-radius: 14px; padding: 8px 10px; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: .9rem; }
.apk-banner span { flex: 1; }
/* Find a teacher: one card per teacher, their classes inside */
.teacher-card > summary { list-style: none; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.teacher-card > summary::-webkit-details-marker { display: none; }
.teacher-avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.2rem;
  background: var(--accent-soft, #e3f1ea); color: var(--accent, #1f7a55); }
.teacher-info { flex: 1; min-width: 0; }
.teacher-info h3 { margin: 0; }
.teacher-card[open] > summary .btn { display: none; }
.dir-classes { margin-top: 10px; }
.dir-class { border-top: 1px solid var(--line, #e2e2e2); padding-top: 10px; }
/* live class */
.live-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--surface-3, #bbb); display: inline-block; margin-inline-end: 8px; }
.live-dot.on { background: #d93025; box-shadow: 0 0 0 0 rgba(217,48,37,.6); animation: livepulse 1.6s infinite; }
@keyframes livepulse { 70% { box-shadow: 0 0 0 10px rgba(217,48,37,0); } 100% { box-shadow: 0 0 0 0 rgba(217,48,37,0); } }
.live-head { margin-bottom: 6px; }
.live-stage { position: relative; background: #0f1a16; border-radius: 16px; aspect-ratio: 16 / 9; overflow: hidden; display: grid; place-items: center; margin: 8px 0; }
.live-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.live-self { position: absolute; right: 8px; bottom: 8px; width: 28%; border-radius: 8px; border: 2px solid #fff; background: #000; }
.live-placeholder { text-align: center; color: #e8f1ec; }
.live-placeholder .small { color: #b9cfc4; }
.live-avatar { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; font-size: 2.2rem; font-weight: 700; background: #1f7a55; color: #fff; }
.live-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 8px 0 12px; }
.live-btn { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px; font-size: .78rem; padding: 8px 10px; }
.live-btn.on { background: var(--accent, #1f7a55); color: #fff; }
.live-btn.off { opacity: .75; }
.live-panel { margin-top: 8px; }
.live-person { padding: 6px 0; border-top: 1px solid var(--line, #e2e2e2); }
.live-chat-list { max-height: 220px; overflow-y: auto; margin: 8px 0; display: grid; gap: 4px; font-size: .92rem; }
.live-msg.teacher b { color: var(--accent, #1f7a55); }
.live-chat-list + form input { flex: 1; }
.live-banner { display: flex; align-items: center; gap: 10px; border: 2px solid #d93025; }
.live-banner .grow { flex: 1; }
.apk-banner .live-dot { flex: none; }
.live-lobby .switch-row small { display: block; color: var(--muted, #777); margin-top: 2px; }

/* spelling (hija'): each letter keeps its colour from the chant to the joined word */
:root { --sp0: #c0392b; --sp1: #1f6fb2; --sp2: #8e44ad; --sp3: #1e8449; --sp4: #b9770e; --sp5: #117a8b; }
[data-theme="dark"] { --sp0: #ff8a7a; --sp1: #7fb8ff; --sp2: #d39cf0; --sp3: #6fdc9b; --sp4: #f5c26b; --sp5: #6fd6e6; }
.sp-c0 { --spc: var(--sp0); } .sp-c1 { --spc: var(--sp1); } .sp-c2 { --spc: var(--sp2); } .sp-c3 { --spc: var(--sp3); } .sp-c4 { --spc: var(--sp4); } .sp-c5 { --spc: var(--sp5); }
.sp-l[class*="sp-c"] { color: var(--spc); }
.sp-joined { font-size: 2.4rem; line-height: 1.8; }
.sp-joined.sp-big { font-size: 3.6rem; }
.sp-head { display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 8px; }
.sp-head .pic { font-size: 2rem; }
.sp-demo { text-align: center; }
.sp-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0 12px; }
.sp-box { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 84px; padding: 8px 8px 10px; border: 2px solid var(--border); border-top: 5px solid var(--spc); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; opacity: .55; transition: transform .2s, opacity .2s, box-shadow .2s; }
.sp-box.on { opacity: 1; transform: translateY(-4px) scale(1.06); box-shadow: 0 0 0 3px color-mix(in srgb, var(--spc) 35%, transparent); }
.sp-box.done { opacity: 1; }
.sp-box.silent .sp-glyph { opacity: .45; }
.sp-glyph { font-size: 2.6rem; line-height: 1.5; color: var(--spc, var(--text)); }
.sp-name { font-size: 1.05rem; color: var(--text); }
.sp-cap { font-size: .78rem; color: var(--muted); }
.sp-note { font-size: .72rem; font-weight: 700; color: var(--spc); }
.sp-tr { font-size: .9rem; color: var(--muted); font-style: italic; }
.sp-tr-tap:not(.tr-on) .sp-tr, .sp-tr-tap:not(.tr-on) .sp-cap { visibility: hidden; }
.sp-blend { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-height: 56px; }
.sp-syl { display: flex; flex-direction: column; align-items: center; padding: 4px 12px; border: 2px dashed var(--border); border-radius: 999px; background: var(--surface-2); cursor: pointer; animation: sp-pop .25s; }
.sp-syl .ar { font-size: 1.8rem; line-height: 1.4; }
.sp-whole { animation: sp-pop .3s; }
@keyframes sp-pop { from { transform: scale(.7); opacity: 0; } }
.sp-answer { min-height: 110px; display: grid; place-items: center; border-bottom: 3px solid var(--border); margin: 6px 0 10px; }
.sp-shapes { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.sp-shape { display: flex; flex-direction: column; align-items: center; min-width: 70px; padding: 4px 6px; border-radius: var(--radius-sm); background: var(--surface-2); border-top: 4px solid var(--spc); }
.sp-shape .ar { color: var(--spc); line-height: 1.4; }
.sp-iso { font-size: 1.5rem; opacity: .7; }
.sp-form { font-size: 2rem; }
.sp-arrow { font-size: .8rem; color: var(--muted); line-height: 1; }
.sp-shape small { font-size: .72rem; color: var(--muted); }
.sp-shape .sp-break { color: var(--danger); font-weight: 700; max-width: 80px; line-height: 1.2; }
.sp-shape.changed { animation: sp-flash .9s; }
@keyframes sp-flash { 0%, 60% { box-shadow: 0 0 0 4px var(--accent); } }
.sp-slots { margin-top: 10px; }
.sp-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 58px; min-height: 76px; border: 2px dashed var(--border); border-radius: var(--radius-sm); }
.sp-slot.filled { border-style: solid; border-top: 4px solid var(--spc); }
.sp-chant { list-style: none; padding: 0; margin: 8px auto; max-width: 420px; text-align: start; }
.sp-chant li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 4px 10px; border-inline-start: 4px solid var(--spc, var(--primary)); margin-bottom: 4px; background: var(--surface); border-radius: 8px; }
.sp-chant li .ar { font-size: 1.35rem; }
.sp-chant .sp-last { border-color: var(--primary); }
.sp-loc { font-size: .8rem; font-weight: 700; color: var(--spc, var(--text)); }
