/* Bayna Yadayk — design system
   Warm paper, deep teal ink, saffron accent (a nod to the textbook's cover).
   Mobile first: base styles target a 280px-wide phone; wider layouts are added with min-width queries. */

:root {
  --bg: #FBF7F0; --surface: #FFFFFF; --surface-2: #F5EEE2; --ink: #1B2928; --muted: #66736F; --line: #E9E0D1;
  --brand: #0E5A55; --brand-2: #127068; --brand-ink: #FFFFFF; --brand-soft: #E3F1EE;
  --accent: #E59A1C; --accent-soft: #FCEFD3; --accent-ink: #7A4B00;
  --good: #23855B; --good-soft: #E0F3E9; --bad: #C44F38; --bad-soft: #FBE6E0;
  --shadow-1: 0 1px 2px rgba(40, 30, 10, .05), 0 4px 14px rgba(40, 30, 10, .05);
  --shadow-2: 0 2px 6px rgba(40, 30, 10, .06), 0 14px 34px rgba(40, 30, 10, .10);
  --r: 18px; --r-sm: 12px; --r-lg: 26px;
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.4, .5, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --arabic: "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", "Tahoma", serif;
  --nav-h: 64px; --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #0F1716; --surface: #172322; --surface-2: #1F2E2C; --ink: #EAF0EE; --muted: #93A29F; --line: #283A38; --brand: #58C2B3; --brand-2: #6FD0C2; --brand-ink: #06231F; --brand-soft: #173632; --accent: #F0B347; --accent-soft: #3A2D12; --accent-ink: #F6D48E; --good: #5CC796; --good-soft: #173527; --bad: #EE8B76; --bad-soft: #3E211B; --shadow-1: 0 1px 2px rgba(0,0,0,.3); --shadow-2: 0 14px 34px rgba(0,0,0,.45); color-scheme: dark; } }
:root[data-theme="dark"] { --bg: #0F1716; --surface: #172322; --surface-2: #1F2E2C; --ink: #EAF0EE; --muted: #93A29F; --line: #283A38; --brand: #58C2B3; --brand-2: #6FD0C2; --brand-ink: #06231F; --brand-soft: #173632; --accent: #F0B347; --accent-soft: #3A2D12; --accent-ink: #F6D48E; --good: #5CC796; --good-soft: #173527; --bad: #EE8B76; --bad-soft: #3E211B; --shadow-1: 0 1px 2px rgba(0,0,0,.3); --shadow-2: 0 14px 34px rgba(0,0,0,.45); color-scheme: dark; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
h1, h2, h3, h4, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font: 600 clamp(1.55rem, 5.5vw, 2.1rem)/1.15 var(--display); letter-spacing: -.01em; text-wrap: balance; }
h2 { font: 600 clamp(1.2rem, 4.4vw, 1.45rem)/1.2 var(--display); text-wrap: balance; }
h3 { font: 600 1.02rem/1.3 var(--font); }
h4 { font: 600 .95rem/1.3 var(--font); display: flex; align-items: center; gap: 6px; }
a { color: var(--brand); text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.eyebrow { font: 600 .72rem/1.2 var(--font); letter-spacing: .09em; text-transform: uppercase; color: var(--accent-ink); }
.lead { font-size: 1.04rem; color: var(--muted); text-wrap: pretty; }
.icon { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; }
.icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Arabic text: generous line height so the vowel marks never collide */
.ar { font-family: var(--arabic); direction: rtl; line-height: 2; font-weight: 500; color: var(--ink); unicode-bidi: isolate; }
.ar.sm { font-size: 1.05rem; } .ar.md { font-size: 1.4rem; } .ar.lg { font-size: clamp(1.55rem, 6.4vw, 1.9rem); } .ar.xl { font-size: clamp(2rem, 9.5vw, 2.8rem); line-height: 1.8; font-weight: 600; }
.ar.inline { font-size: 1.22em; line-height: 1; padding: 0 .12em; }
.tr { font-size: .92rem; color: var(--brand); font-style: italic; letter-spacing: .01em; }
.en { font-size: .95rem; color: var(--muted); }
.no-tr .tr, .no-en .en { display: none; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(26px); } }
@keyframes slideBack { from { opacity: 0; transform: translateX(-26px); } }
@keyframes pop { 0% { opacity: 0; transform: scale(.92); } 60% { transform: scale(1.02); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 45%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }
@keyframes float { 50% { transform: translateY(-14px) rotate(var(--rot, 4deg)); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fall { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), 120px) rotate(300deg); opacity: 0; } }
.view-enter { animation: rise .34s var(--ease) both; }
.slide-in { animation: slideIn .32s var(--ease) both; } .slide-back { animation: slideBack .32s var(--ease) both; }
.pop { animation: pop .45s var(--spring) both; } .shake { animation: shake .4s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- buttons, chips, inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .96rem; line-height: 1.2; background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); text-align: center; transition: transform .16s var(--ease), background .2s, box-shadow .2s, border-color .2s, opacity .2s; user-select: none; }
.btn:active { transform: scale(.97); } .btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 28%, transparent); }
.btn.primary:hover { background: var(--brand-2); }
.btn.soft { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.btn.ghost { background: transparent; color: var(--muted); border-color: transparent; } .btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.light { background: #fff; color: #0E5A55; border-color: transparent; }
.btn.lg { min-height: 54px; padding: 14px 24px; font-size: 1.02rem; } .btn.sm { min-height: 36px; padding: 6px 13px; font-size: .86rem; }
.btn.block { display: flex; width: 100%; } .btn.grow { flex: 1; } .btn.icon-only { padding: 10px; aspect-ratio: 1; }
.btn.busy::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--muted); flex: none; transition: background .2s, color .2s, transform .16s var(--ease); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); } .icon-btn:active { transform: scale(.9); }
.icon-btn.play { color: var(--brand); background: var(--brand-soft); } .icon-btn.mic { color: var(--accent-ink); background: var(--accent-soft); }
.is-playing.icon-btn, .is-playing > .line-btns .play { background: var(--brand); color: var(--brand-ink); }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-size: .84rem; font-weight: 500; color: var(--muted); transition: all .2s; }
.chip.on { background: var(--brand-soft); border-color: transparent; color: var(--brand); } .chip.ex { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.tag.amber, .tag.help { background: var(--accent-soft); color: var(--accent-ink); } .tag.good { background: var(--good-soft); color: var(--good); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: rgba(255,255,255,.16); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; } .row.center { justify-content: center; }
.stack { display: grid; gap: 12px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input:not([type]) { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); transition: border-color .2s, box-shadow .2s; }
input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.field { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; } .field small { font-weight: 400; }
.field-input { position: relative; } .field-input .icon-btn { position: absolute; right: 4px; top: 4px; } .field-input input[type="password"], .field-input:has(.icon-btn) input { padding-right: 48px; }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: var(--r-sm); font-size: .9rem; animation: shake .4s; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .25s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .28s var(--spring); }
.switch input:checked + i { background: var(--brand); } .switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; flex: none; }
.seg button { padding: 6px 12px; border-radius: 999px; font-size: .84rem; font-weight: 600; color: var(--muted); transition: all .2s; } .seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- cards & common blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow-1); }
.card.tap { display: block; color: inherit; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.card.tap:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); } .card.tap:active { transform: scale(.985); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .7s var(--ease); }
.ring { position: relative; flex: none; } .ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring circle { fill: none; } .ring-bg { stroke: var(--surface-2); } .ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease); } .ring.full .ring-fg { stroke: var(--good); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; } .ring-label b { font: 600 1.45rem var(--display); } .ring-label small { font-size: .66rem; color: var(--muted); }
.empty { text-align: center; padding: 44px 16px; display: grid; gap: 10px; justify-items: center; color: var(--muted); } .empty > .icon { width: 44px; height: 44px; color: var(--accent); } .empty h2, .empty h3 { color: var(--ink); } .empty p { max-width: 42ch; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 0 12px; gap: 12px; } .section-head a { font-weight: 600; font-size: .9rem; }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-ink); font-size: .93rem; } .callout .icon { margin-top: 2px; }
.note { display: flex; gap: 8px; font-size: .85rem; color: var(--muted); }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-size: .9rem; max-width: min(92vw, 440px); opacity: 0; pointer-events: none; transition: all .3s var(--ease); z-index: 90; text-align: center; box-shadow: var(--shadow-2); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.boot { min-height: 100dvh; display: grid; place-items: center; } .boot .brand-mark { animation: pop .8s var(--spring) infinite alternate; }

/* ---------- shell & navigation ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: var(--brand); color: #F6C760; font: 700 1.5rem/1 var(--arabic); padding-bottom: 6px; flex: none; }
.brand-text { display: grid; line-height: 1.15; } .brand-text b { font: 600 1.05rem var(--display); } .brand-text small { font: 500 .8rem var(--arabic); color: var(--muted); }
.shell { min-height: 100dvh; }
.main { padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav .brand { display: none; }
.nav-items { display: flex; height: var(--nav-h); max-width: 560px; margin: 0 auto; }
.nav-item { flex: 1; min-width: 0; display: grid; place-content: center; justify-items: center; gap: 2px; color: var(--muted); font-size: .66rem; font-weight: 600; position: relative; transition: color .2s; }
.nav-item span:not(.icon) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nav-item .icon { width: 24px; height: 24px; transition: transform .3s var(--spring); }
.nav-item.active { color: var(--brand); } .nav-item.active .icon { transform: translateY(-2px) scale(1.08); }
.nav-item.active::before { content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 3px; margin-left: -14px; border-radius: 0 0 4px 4px; background: var(--brand); animation: pop .3s var(--spring); }
.badge { position: absolute; top: 8px; left: 50%; margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #3a2400; font: 700 .66rem/18px var(--font); font-style: normal; text-align: center; }
.page { max-width: 1080px; margin: 0 auto; padding: 22px var(--gutter) 8px; } .page.narrow { max-width: 640px; }
.page-head { margin-bottom: 18px; display: grid; gap: 4px; } .page-head p.muted { margin-top: 6px; max-width: 56ch; }
.crumb { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: .9rem; margin-bottom: 12px; }

/* ---------- welcome & auth ---------- */
.welcome { min-height: 100dvh; display: grid; align-items: center; position: relative; overflow: hidden; padding: 28px var(--gutter) calc(28px + env(safe-area-inset-bottom)); background: radial-gradient(120% 70% at 50% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.welcome-art { position: absolute; inset: 0; pointer-events: none; }
.welcome-art span { position: absolute; font: 700 clamp(4rem, 16vw, 9rem)/1 var(--arabic); color: var(--accent); opacity: .1; left: calc(6% + var(--i) * 12.500%); top: calc(4% + (var(--i) * 37%) - (var(--i) * var(--i) * 3.100%)); --rot: calc((var(--i) - 3) * 3deg); animation: float calc(7s + var(--i) * .9s) ease-in-out infinite; animation-delay: calc(var(--i) * -1.3s); }
.welcome-body { position: relative; max-width: 480px; margin: 0 auto; display: grid; gap: 14px; animation: rise .6s var(--ease) both; }
.welcome-ar { color: var(--brand); margin: 6px 0 -8px; }
.features { display: grid; gap: 12px; margin: 8px 0; }
.features li { display: flex; gap: 12px; animation: rise .5s var(--ease) both; } .features li:nth-child(2) { animation-delay: .08s; } .features li:nth-child(3) { animation-delay: .16s; } .features li:nth-child(4) { animation-delay: .24s; }
.features .icon { width: 38px; height: 38px; padding: 8px; border-radius: 12px; background: var(--surface); color: var(--brand); box-shadow: var(--shadow-1); }
.features b { display: block; font-size: .96rem; } .features span { font-size: .88rem; color: var(--muted); }
.welcome-cta { display: grid; gap: 8px; margin-top: 8px; }
.auth { min-height: 100dvh; padding: 16px var(--gutter) 32px; display: grid; grid-template-rows: auto 1fr; background: radial-gradient(120% 60% at 50% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; font-size: .9rem; padding: 8px 0; justify-self: start; }
.auth-card { width: 100%; max-width: 420px; margin: auto; display: grid; gap: 10px; } .auth-card h1 { margin-top: 10px; }
.auth-form { display: grid; gap: 14px; margin-top: 12px; } .auth-alt { text-align: center; color: var(--muted); font-size: .92rem; margin-top: 8px; } .auth-alt a { font-weight: 600; }

/* ---------- onboarding ---------- */
.onb { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; max-width: 560px; margin: 0 auto; padding: 18px var(--gutter) calc(18px + env(safe-area-inset-bottom)); }
.dots { display: flex; gap: 6px; justify-content: center; padding: 6px 0 18px; } .dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--line); transition: all .35s var(--ease); } .dots i.on { width: 28px; background: var(--brand); } .dots i.past { background: var(--brand); opacity: .4; }
.onb-slide { display: grid; gap: 14px; align-content: start; padding-bottom: 20px; }
.onb-foot { display: flex; justify-content: space-between; gap: 12px; position: sticky; bottom: 0; padding: 12px 0 0; background: linear-gradient(transparent, var(--bg) 30%); } .onb-foot .btn.primary { flex: 1; max-width: 280px; margin-left: auto; }
.onb-books { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.onb-book { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 4px; text-align: center; display: grid; gap: 2px; animation: rise .5s var(--ease) both; } .onb-book:nth-child(2) { animation-delay: .07s; } .onb-book:nth-child(3) { animation-delay: .14s; } .onb-book:nth-child(4) { animation-delay: .21s; }
.onb-book b { font: 600 1.5rem var(--display); color: var(--brand); } .onb-book span { font-size: .68rem; color: var(--muted); overflow-wrap: anywhere; }
.loop { display: grid; gap: 10px; counter-reset: s; }
.loop li { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * .09s); }
.loop .icon { width: 36px; height: 36px; padding: 8px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); } .loop b { display: block; } .loop span { font-size: .88rem; color: var(--muted); }
.options { display: grid; gap: 10px; }
.option { text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 14px 16px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); transition: all .2s var(--ease); }
.option span { grid-column: 1; font-size: .88rem; color: var(--muted); } .option .icon { grid-area: 1 / 2 / 3 / 3; align-self: center; width: 24px; height: 24px; padding: 4px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); opacity: 0; transform: scale(.5); transition: all .25s var(--spring); }
.option.on { border-color: var(--brand); background: var(--brand-soft); } .option.on .icon { opacity: 1; transform: none; } .option:active { transform: scale(.985); }
.sample { margin-top: 4px; }

/* ---------- home ---------- */
.home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.greet-ar { color: var(--accent-ink); line-height: 1.5; text-align: left; direction: rtl; unicode-bidi: plaintext; }
.streak { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: .82rem; flex: none; } .streak b { font-size: 1rem; color: var(--ink); } .streak.on .icon { color: var(--accent); } .streak.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.home-grid { display: grid; gap: 14px; } .home-main { display: grid; gap: 12px; align-content: start; } .home-side { display: grid; gap: 12px; align-content: start; }
.card.hero { background: linear-gradient(150deg, #0E5A55, #0A4541 70%); color: #fff; border: 0; padding: 22px; position: relative; overflow: hidden; box-shadow: 0 16px 34px rgba(14, 90, 85, .28); }
.card.hero::after { content: "ع"; position: absolute; right: -14px; bottom: -78px; font: 700 13rem/1 var(--arabic); color: #fff; opacity: .07; pointer-events: none; }
.card.hero .eyebrow { color: #F6C760; } .card.hero h2 { margin: 6px 0; font-size: clamp(1.3rem, 5.2vw, 1.7rem); } .hero-meta { color: rgba(255,255,255,.78); font-size: .88rem; }
.hero-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; position: relative; z-index: 1; }
.tile-card { display: flex !important; align-items: center; gap: 14px; padding: 14px; } .tile-card > div:nth-child(2) { flex: 1; min-width: 0; } .tile-card p { font-size: .86rem; } .chev { color: var(--muted); flex: none; }
.tile-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; } .tile-icon .icon { width: 22px; height: 22px; }
.tile-icon.amber { background: var(--accent-soft); color: var(--accent-ink); } .tile-icon.teal { background: var(--brand-soft); color: var(--brand); } .tile-icon.ink { background: var(--surface-2); color: var(--ink); }
.today { display: flex; gap: 16px; align-items: center; } .today p { font-size: .88rem; }
.week { display: flex; gap: 6px; margin-top: 10px; } .day { display: grid; justify-items: center; gap: 3px; font-size: .64rem; color: var(--muted); } .day i { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); transition: background .4s; } .day.on i { background: var(--accent); } .day.today i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--line); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 8px; text-align: center; } .stats b { display: block; font: 600 1.5rem var(--display); } .stats span { font-size: .74rem; color: var(--muted); }
.unit-strip { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.unit-mini { display: flex !important; gap: 12px; align-items: flex-start; padding: 14px; } .unit-mini > div { flex: 1; min-width: 0; display: grid; gap: 4px; } .unit-mini .ar { line-height: 1.6; color: var(--muted); }
.unit-n { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: var(--surface-2); font: 600 1.1rem var(--display); color: var(--brand); flex: none; }

/* ---------- course map ---------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px var(--gutter) 10px; margin: 0 calc(var(--gutter) * -1); scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; min-width: 84px; display: grid; gap: 1px; padding: 9px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); text-align: left; transition: all .2s var(--ease); } .tab small { font-size: .7rem; color: var(--muted); }
.tab.on { background: var(--brand); border-color: transparent; color: var(--brand-ink); } .tab.on small { color: inherit; opacity: .8; }
.book-intro { margin: 6px 0 16px; } .book-intro .ar { color: var(--brand); line-height: 1.6; }
.unit-list { display: grid; gap: 10px; }
.unit-row { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); color: inherit; text-align: left; width: 100%; animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * .035s); transition: transform .2s var(--ease), box-shadow .2s; }
.unit-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); } .unit-row:active { transform: scale(.985); }
.unit-info { flex: 1; min-width: 0; display: grid; gap: 3px; } .unit-info .ar { line-height: 1.5; color: var(--muted); } .unit-info .progress { margin: 4px 0 2px; }
.unit-row.current { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow-1); } .unit-row.current .unit-n, .unit-row.done .unit-n { background: var(--brand); color: var(--brand-ink); }
.unit-row.test { background: transparent; box-shadow: none; border-style: dashed; padding: 10px 14px; } .unit-row.test .unit-n { background: var(--accent-soft); color: var(--accent-ink); }
.unit-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 18px; } .unit-head .ar { color: var(--brand); line-height: 1.6; } .unit-head p.muted { margin-top: 6px; max-width: 60ch; }
.lesson-list { display: grid; gap: 0; position: relative; }
.lesson-list li { animation: rise .4s var(--ease) both; animation-delay: calc(var(--i) * .04s); position: relative; }
.lesson-list li:not(:last-child)::before { content: ""; position: absolute; left: 33px; top: 52px; bottom: -14px; width: 2px; background: var(--line); }
.lesson-row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--r); color: inherit; transition: background .2s; position: relative; }
.lesson-row:hover { background: var(--surface); }
.lesson-dot { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); color: var(--muted); flex: none; z-index: 1; transition: all .25s var(--ease); }
.lesson-row.done .lesson-dot { background: var(--good); border-color: var(--good); color: #fff; } .lesson-row.started .lesson-dot { border-color: var(--accent); color: var(--accent-ink); }
.lesson-row.current { background: var(--surface); box-shadow: var(--shadow-1); } .lesson-row.current .lesson-dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 0 0 5px var(--brand-soft); }
.lesson-info { flex: 1; min-width: 0; display: grid; gap: 2px; justify-items: start; } .lesson-info b { font-size: 1rem; }

/* ---------- lesson player ---------- */
.player { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; max-width: 760px; margin: 0 auto; }
.player-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px var(--gutter); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.player-bar { flex: 1; height: 10px; } .player-title { flex: 1; display: grid; line-height: 1.2; } .player-title small, .count { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.player-body { padding: 8px var(--gutter) 24px; min-width: 0; }
.player-foot { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 10px; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: 0 -14px 14px -4px var(--bg); align-items: center; } .player-foot:empty { display: none; }
.step { display: grid; gap: 16px; min-width: 0; } .step-head { display: grid; gap: 6px; } .step-tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; } .step-ar { color: var(--brand); line-height: 1.5; }
.src-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--brand-soft); color: var(--brand); } .src-chip .icon { width: 13px; height: 13px; }
.step-body { display: grid; gap: 14px; min-width: 0; }
.step.intro { text-align: center; justify-items: center; padding-top: 6vh; gap: 10px; } .intro-icon { width: 76px; height: 76px; border-radius: 26px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; animation: pop .6s var(--spring) both; } .intro-icon .icon { width: 34px; height: 34px; }
.step.intro h2 { font: 500 1.1rem var(--font); color: var(--muted); } .step.intro .ar { color: var(--brand); } .step.intro .lead { max-width: 46ch; }
.goals { display: grid; gap: 8px; text-align: left; margin: 8px 0; width: 100%; max-width: 420px; } .goals li { display: flex; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; font-size: .93rem; animation: rise .45s var(--ease) both; } .goals li:nth-child(2) { animation-delay: .08s; } .goals li:nth-child(3) { animation-delay: .16s; } .goals li:nth-child(4) { animation-delay: .24s; } .goals .icon { color: var(--good); margin-top: 2px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dlg-photo, .crop { border-radius: var(--r-sm); background-repeat: no-repeat; background-color: var(--surface-2); width: 100%; } .dlg-photo { max-width: 360px; margin: 0 auto; box-shadow: var(--shadow-1); }
.dlg { display: grid; gap: 10px; }
.line { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 6px 20px 20px 20px; padding: 10px 14px 12px; margin-left: 9%; display: grid; gap: 1px; cursor: pointer; transition: border-color .25s, box-shadow .25s, transform .2s var(--ease); animation: rise .4s var(--ease) both; }
.line.b { margin: 0 9% 0 0; border-radius: 20px 6px 20px 20px; background: var(--brand-soft); border-color: transparent; }
.line:nth-child(2) { animation-delay: .05s; } .line:nth-child(3) { animation-delay: .1s; } .line:nth-child(4) { animation-delay: .15s; } .line:nth-child(n+5) { animation-delay: .2s; }
.line.is-playing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); transform: scale(1.01); }
.who { display: flex; gap: 6px; align-items: baseline; justify-content: flex-end; color: var(--accent-ink); font-weight: 600; font-size: .82rem; } .who small { color: var(--muted); font-weight: 500; }
.line .ar { text-align: right; } .line .tr, .line .en { text-align: left; }
.line-btns { display: flex; gap: 6px; margin-top: 8px; } .line-btns .icon-btn { width: 34px; height: 34px; } .line-btns .icon { width: 17px; height: 17px; }
.notes { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 14px; display: grid; gap: 8px; } .notes h4 .icon { color: var(--accent); } .notes ul { display: grid; gap: 8px; font-size: .93rem; } .notes li { padding-left: 14px; position: relative; } .notes li::before { content: ""; position: absolute; left: 0; top: .65em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.vgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.vcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px 12px; text-align: center; display: grid; gap: 1px; align-content: start; cursor: pointer; box-shadow: var(--shadow-1); transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; animation: rise .4s var(--ease) both; animation-delay: calc(var(--i) * .04s); }
.vcard:active { transform: scale(.97); } .vcard.is-playing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.vcard .crop { margin-bottom: 4px; } .vcard .line-btns { justify-content: center; } .vnote { font-size: .78rem; color: var(--accent-ink); background: var(--accent-soft); border-radius: 8px; padding: 3px 7px; margin-top: 4px; }
.arline { display: flex; gap: 10px; align-items: center; justify-content: space-between; } .arline-main { flex: 1; min-width: 0; display: grid; gap: 0; } .arline-main .ar { text-align: right; } .arline-btns { display: flex; gap: 6px; flex: none; }
.explain { font-size: 1rem; } .explain > p { text-wrap: pretty; } .explain h4 { margin-top: 6px; font: 600 1.1rem var(--display); } .explain ul { display: grid; gap: 6px; padding-left: 18px; list-style: disc; }
.examples { display: grid; gap: 8px; } .examples .arline, .example .arline, .missed .arline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); } table { border-collapse: collapse; width: 100%; font-size: .92rem; } th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; } tr:last-child td { border-bottom: 0; } th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); } td.ar { font-size: 1.25rem; line-height: 1.7; text-align: right; }

/* exercises */
.ex-instr { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px 14px; display: grid; gap: 2px; } .ex-instr .ar { line-height: 1.7; } .ex-instr p:not(.ar) { color: var(--muted); font-size: .93rem; }
.example { display: grid; gap: 8px; } .example > small { font-weight: 600; color: var(--accent-ink); font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; }
.ex-run { min-width: 0; } .ex-item { display: grid; gap: 14px; } .ex-count { font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.prompt { display: grid; gap: 8px; } .prompt .arline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow-1); }
.q { font-weight: 600; font-size: 1.05rem; } .cue { color: var(--muted); font-size: .95rem; } .ask { display: grid; gap: 4px; }
.listen-big { display: grid; justify-items: center; gap: 8px; padding: 24px; border-radius: var(--r); background: var(--brand-soft); color: var(--brand); font-weight: 600; width: 100%; transition: transform .2s var(--ease); } .listen-big .icon { width: 44px; height: 44px; } .listen-big:active { transform: scale(.97); }
.opts { display: grid; gap: 10px; } .opts.cols { grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); }
.opt, .pair { display: grid; gap: 0; justify-items: center; text-align: center; min-height: 56px; padding: 10px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); box-shadow: 0 2px 0 var(--line); transition: transform .15s var(--ease), border-color .2s, background .2s, box-shadow .2s; align-content: center; width: 100%; }
.opt:not([disabled]):hover, .pair:not([disabled]):hover { border-color: var(--brand); } .opt:not([disabled]):active, .pair:not([disabled]):active { transform: translateY(2px); box-shadow: none; }
.opt .ar, .pair .ar { line-height: 1.7; } .opt .en, .pair .en { color: var(--ink); font-weight: 500; }
.opt.right { background: var(--good-soft); border-color: var(--good); box-shadow: 0 2px 0 var(--good); animation: pop .35s var(--spring); } .opt.wrong { background: var(--bad-soft); border-color: var(--bad); box-shadow: 0 2px 0 var(--bad); animation: shake .4s; } .opt[disabled]:not(.right):not(.wrong) { opacity: .5; }
.feedback:empty { display: none; }
.fb { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); animation: rise .3s var(--ease) both; flex-wrap: wrap; } .fb > div { flex: 1; min-width: 120px; } .fb p { font-size: .9rem; margin-top: 2px; } .fb > .icon { width: 28px; height: 28px; padding: 5px; border-radius: 50%; color: #fff; }
.fb.good { background: var(--good-soft); } .fb.good > .icon { background: var(--good); } .fb.good b { color: var(--good); } .fb.bad { background: var(--bad-soft); } .fb.bad > .icon { background: var(--bad); } .fb.bad b { color: var(--bad); }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .match-col { display: grid; gap: 10px; align-content: start; }
.pair.sel { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 2px 0 var(--accent); } .pair.matched { background: hsl(var(--hue) 55% 93%); border-color: hsl(var(--hue) 45% 62%); box-shadow: none; opacity: .9; animation: pop .35s var(--spring); }
:root[data-theme="dark"] .pair.matched { background: hsl(var(--hue) 35% 20%); } @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pair.matched { background: hsl(var(--hue) 35% 20%); } }
.slot { min-height: 68px; border-radius: var(--r-sm); border: 2px dashed var(--line); padding: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; transition: all .25s; background: var(--surface); } .slot.right { border: 2px solid var(--good); background: var(--good-soft); } .slot.wrong { border: 2px solid var(--bad); background: var(--bad-soft); animation: shake .4s; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; justify-content: center; }
.tile { min-height: 46px; padding: 4px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); box-shadow: 0 2px 0 var(--line); font-weight: 600; animation: pop .25s var(--spring); transition: transform .12s; } .tile:active { transform: translateY(2px); box-shadow: none; } .tile .ar { line-height: 1.6; }
.ex-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.ex-done { text-align: center; display: grid; gap: 6px; justify-items: center; padding: 26px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.ex-done-mark, .finish-mark { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); } .ex-done-mark.good, .finish-mark { background: var(--good); color: #fff; } .ex-done-mark .icon, .finish-mark .icon { width: 30px; height: 30px; }
.speak { display: grid; gap: 14px; } .speak-target { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; position: relative; box-shadow: var(--shadow-1); display: grid; gap: 4px; }
.speak-target.veiled .arline { filter: blur(9px); opacity: .5; pointer-events: none; user-select: none; } .unveil { position: absolute; inset: 0; margin: auto; height: 36px; width: max-content; background: var(--surface) !important; box-shadow: var(--shadow-1); } .speak-target:not(.veiled) .unveil { display: none; }
.speak-ctl { display: grid; justify-items: center; gap: 10px; text-align: center; } .speak-status { color: var(--muted); font-size: .92rem; min-height: 1.5em; }
.mic-btn { width: 76px; height: 76px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 35%, transparent); transition: transform .2s var(--spring), background .2s; } .mic-btn .icon { width: 32px; height: 32px; } .mic-btn:active { transform: scale(.92); } .mic-btn.live { background: var(--bad); animation: pulse 1.2s infinite; }
.said-card { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; animation: rise .35s var(--ease) both; } .said-card.good { border-color: var(--good); background: var(--good-soft); }
.said-score { display: flex; align-items: baseline; gap: 6px; } .said-score b { font: 600 1.6rem var(--display); } .said-score span, .said-heard { color: var(--muted); font-size: .85rem; }
.said-words { text-align: right; } .w { border-radius: 6px; padding: 0 3px; } .w.ok { color: var(--good); } .w.close { background: var(--accent-soft); color: var(--accent-ink); } .w.wrong { background: var(--bad-soft); color: var(--bad); text-decoration: underline wavy; text-underline-offset: 8px; } .w.missing { color: var(--bad); opacity: .55; text-decoration: line-through; }
.said-fix { display: grid; gap: 5px; font-size: .9rem; padding-left: 18px; list-style: disc; } .said-fix .tip { color: var(--accent-ink); }
.trace { position: relative; border-radius: var(--r); border: 2px dashed var(--line); background: var(--surface); overflow: hidden; touch-action: none; aspect-ratio: 16 / 9; }
.trace-ghost { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(5rem, 34vw, 11rem); line-height: 1; color: var(--line); pointer-events: none; padding-bottom: .15em; } .trace-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; } .trace-arrow { position: absolute; top: 8px; right: 12px; color: var(--accent); font-size: 1.3rem; font-weight: 700; }
.book-ex { display: grid; gap: 14px; } .book-pages, .scan-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.book-thumb, .scan { position: relative; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-1); background: var(--surface); transition: transform .2s var(--ease); } .book-thumb:hover, .scan:hover { transform: translateY(-2px); }
.book-thumb img, .scan img { width: 100%; aspect-ratio: .73; object-fit: cover; object-position: top; } .book-thumb span, .scan span { position: absolute; left: 8px; bottom: 8px; display: inline-flex; gap: 6px; align-items: center; background: rgba(20, 30, 30, .82); color: #fff; padding: 5px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.step.finish { text-align: center; justify-items: center; padding-top: 7vh; position: relative; gap: 10px; } .finish .ar { color: var(--accent-ink); line-height: 1.4; } .finish-mark { width: 84px; height: 84px; box-shadow: 0 0 0 10px var(--good-soft); margin-bottom: 8px; } .finish-mark .icon { width: 42px; height: 42px; }
.finish-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 10px 0; } .finish-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 16px; min-width: 96px; animation: rise .5s var(--ease) both; } .finish-stats div:nth-child(2) { animation-delay: .1s; } .finish-stats div:nth-child(3) { animation-delay: .2s; } .finish-stats b { display: block; font: 600 1.5rem var(--display); color: var(--brand); } .finish-stats span { font-size: .74rem; color: var(--muted); }
.confetti { position: absolute; top: 9vh; left: 50%; width: 0; height: 0; } .confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; background: hsl(calc(var(--k) * 47) 75% 58%); --dx: calc((var(--k) - 6.500) * 26px); animation: fall 1.4s var(--ease) both; animation-delay: calc(var(--k) * .025s); }
.missed { display: grid; gap: 8px; width: 100%; max-width: 440px; text-align: left; }

/* ---------- review ---------- */
.review-hero { display: grid; gap: 14px; background: linear-gradient(150deg, var(--accent-soft), var(--surface)); margin-bottom: 12px; }
.card-list { display: grid; gap: 8px; } .card-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 12px; } .card-row > div { flex: 1; min-width: 0; } .card-row .ar { line-height: 1.7; } .when { font-size: .76rem; color: var(--muted); white-space: nowrap; } .when.due { color: var(--accent-ink); font-weight: 600; }
.flash-stage { display: grid; place-items: center; min-height: 58dvh; perspective: 1200px; }
.flash { width: 100%; max-width: 440px; aspect-ratio: 4 / 5; max-height: 62dvh; cursor: pointer; } .flash-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .6s var(--ease); } .flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); display: grid; place-content: center; justify-items: center; gap: 8px; padding: 22px; text-align: center; overflow: hidden; }
.flash-face.back { transform: rotateY(180deg); } .flash-en, .quiz-en { font: 600 1.4rem/1.3 var(--display); } .quiz-en { text-align: center; padding: 18px 0; } .flash-hint { position: absolute; bottom: 16px; left: 0; right: 0; font-size: .8rem; color: var(--muted); }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; animation: rise .3s var(--ease) both; }
.grade { display: grid; gap: 1px; padding: 9px 2px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); transition: transform .15s var(--ease); min-width: 0; } .grade:active { transform: scale(.94); } .grade b { font-size: .88rem; } .grade small { font-size: .68rem; color: var(--muted); }
.grade.g0 { border-color: var(--bad); color: var(--bad); } .grade.g2 { border-color: var(--good); color: var(--good); } .grade.g3 { border-color: var(--brand); color: var(--brand); } .grade.g1 { border-color: var(--accent); color: var(--accent-ink); }
.player.quiz .prompt .ar.xl, .player.quiz .prompt { text-align: center; }

/* ---------- class finder ---------- */
.finder-grid { display: grid; gap: 12px; margin-top: 6px; } .finder { display: grid; gap: 10px; } .finder label { display: flex; align-items: center; gap: 8px; font-weight: 600; } .finder label .icon { color: var(--brand); } .finder-row { display: flex; gap: 8px; } .finder-row input { flex: 1; min-width: 0; font-size: 1.1rem; font-weight: 600; }
.finder-units { display: grid; gap: 8px; }
.finder-unit { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; } .finder-unit summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; } .finder-unit summary::-webkit-details-marker { display: none; } .finder-unit summary > div { flex: 1; display: grid; min-width: 0; } .finder-unit[open] summary .chev { transform: rotate(180deg); } .finder-unit .chev { transition: transform .25s var(--ease); }
.finder-lessons { padding: 0 14px 14px; display: grid; gap: 14px; } .finder-lesson { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.finder-lesson-head { display: flex; gap: 10px; align-items: center; color: inherit; } .finder-lesson-head > div { flex: 1; display: grid; min-width: 0; } .finder-lesson-head > .icon:first-child { color: var(--brand); } .chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- profile ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; } .profile-head > div { min-width: 0; } .profile-head p { overflow-wrap: anywhere; } .avatar { width: 60px; height: 60px; border-radius: 22px; background: var(--brand); color: #F6C760; display: grid; place-items: center; font: 600 1.6rem var(--display); flex: none; }
.settings { padding: 4px 16px; } .setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; flex-wrap: wrap; } .setting:last-child { border-bottom: 0; } .setting > div:first-child { flex: 1; min-width: 120px; display: grid; } .setting input:not([type="checkbox"]) { max-width: 200px; min-height: 40px; } .setting.link { color: var(--bad); }

/* ---------- sheets & page viewer ---------- */
.sheet { position: fixed; inset: 0; z-index: 80; background: rgba(15, 22, 22, .5); display: grid; align-items: end; animation: fade .25s both; } @keyframes fade { from { opacity: 0; } } @keyframes sheetUp { from { transform: translateY(100%); } }
.sheet.closing { opacity: 0; transition: opacity .22s; } .sheet.closing .sheet-panel { transform: translateY(40%); transition: transform .22s var(--ease); }
.sheet-panel { background: var(--bg); border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92dvh; display: grid; grid-template-rows: auto 1fr; width: 100%; max-width: 560px; margin: 0 auto; animation: sheetUp .38s var(--ease) both; box-shadow: var(--shadow-2); } .sheet-panel.wide { max-width: 860px; height: 96dvh; }
.sheet-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 18px 12px 8px 18px; min-height: 56px; } .sheet-grip { position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); } .sheet-head h3 { flex: 1; min-width: 0; }
.sheet-body { overflow-y: auto; padding: 4px 18px calc(22px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.pv-sheet .sheet-body { padding: 0; overflow: hidden; display: grid; } .pv { display: grid; grid-template-rows: 1fr auto; min-height: 0; }
.pv-scroll { overflow: auto; background: #3b3f3e; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; } .pv-img { width: 100%; height: auto; transition: opacity .2s; background: #fff; min-height: 200px; } .pv-img.loading { opacity: .4; } .pv-scroll.zoomed .pv-img { width: 220%; max-width: none; }
.pv-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); } .pv-page { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--muted); } .pv-num { width: 68px !important; min-height: 36px !important; padding: 4px 8px !important; text-align: center; font-weight: 700; }

/* ---------- wider screens ---------- */
@media (min-width: 380px) { :root { --gutter: 20px; } .nav-item { font-size: .7rem; } }
@media (min-width: 600px) {
  .finder-grid { grid-template-columns: 1fr 1fr; } .welcome-body { gap: 16px; }
  .sheet { align-items: center; padding: 24px; } .sheet-panel { border-radius: var(--r-lg); max-height: 88dvh; } .sheet-panel.wide { height: 92dvh; } .sheet-grip { display: none; }
  .vgrid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } .line { margin-left: 18%; } .line.b { margin-right: 18%; }
  .grades { max-width: 440px; margin: 0 auto; }
  .review-hero { grid-template-columns: 1fr auto; align-items: center; }
}
@media (min-width: 900px) {
  :root { --gutter: 32px; }
  body:not(.bare) .shell { display: grid; grid-template-columns: 92px 1fr; }
  .nav { position: sticky; top: 0; height: 100dvh; inset: auto; border-top: 0; border-right: 1px solid var(--line); padding: 18px 10px; display: flex; flex-direction: column; gap: 22px; align-items: center; backdrop-filter: none; background: var(--surface); }
  .nav .brand { display: inline-flex; } .nav .brand-text { display: none; }
  .nav-items { flex-direction: column; height: auto; width: 100%; gap: 4px; max-width: none; margin: 0; }
  .nav-item { padding: 11px 4px; border-radius: 14px; font-size: .72rem; flex: none; } .nav-item:hover { background: var(--surface-2); } .nav-item.active { background: var(--brand-soft); } .nav-item.active::before { display: none; }
  .badge { top: 6px; }
  .main { padding-bottom: 40px; } .page { padding-top: 36px; } #toast { bottom: 28px; }
  .home-grid { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 20px; } .today { flex-direction: column; text-align: center; } .week { justify-content: center; }
  .unit-list { grid-template-columns: 1fr 1fr; } .unit-row.test { grid-column: 1 / -1; }
  .welcome { padding: 48px; } .welcome-body { max-width: 980px; grid-template-columns: 1fr 1fr; column-gap: 56px; align-items: center; } .welcome-body > * { grid-column: 1; } .welcome-body .features { grid-column: 2; grid-row: 1 / span 6; background: var(--surface); padding: 26px; border-radius: var(--r-lg); box-shadow: var(--shadow-2); gap: 18px; } .features .icon { background: var(--brand-soft); box-shadow: none; }
  .player-body { padding-top: 20px; } .flash-stage { min-height: 64dvh; }
}
@media (min-width: 1200px) {
  body:not(.bare) .shell { grid-template-columns: 240px 1fr; }
  .nav { align-items: stretch; padding: 22px 14px; } .nav .brand { padding: 0 8px; } .nav .brand-text { display: grid; }
  .nav-item { display: flex; justify-content: flex-start; gap: 12px; padding: 11px 14px; font-size: .95rem; } .nav-item .icon { width: 22px; height: 22px; } .nav-item.active .icon { transform: none; }
  .badge { position: static; margin-left: auto; }
}
/* Very narrow screens: folded phones and cover displays */
@media (max-width: 340px) {
  :root { --gutter: 12px; } .card { padding: 14px; } .card.hero { padding: 16px; } .today { flex-direction: column; text-align: center; } .week { justify-content: center; }
  .line { margin-left: 4%; } .line.b { margin-right: 4%; } .match { gap: 6px; } .opt, .pair { padding: 8px 6px; } .ar.md { font-size: 1.25rem; }
  .btn.lg { padding: 12px 16px; } .onb-books { grid-template-columns: repeat(2, 1fr); } .unit-head { flex-direction: column-reverse; } .home-head { flex-direction: column; align-items: flex-start; }
  .grade b { font-size: .78rem; } .nav-item span:not(.icon) { font-size: .6rem; } .pv-bar .btn { padding: 6px 8px; }
}
/* Short landscape phones */
@media (max-height: 480px) and (orientation: landscape) { .flash { aspect-ratio: 16 / 9; } .step.intro, .step.finish { padding-top: 0; } }

/* Grid children must be allowed to shrink, or long Arabic lines widen the page */
.player, .step, .step-body, .step-head, .ex-item, .dlg, .speak, .onb, .onb-slide, .home-grid, .home-main, .home-side, .stack, .book-ex, .prompt { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .home-grid { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); } }
.line.b .icon-btn.play { background: var(--surface); }
.sheet-x { background: var(--surface-2); }

/* Lesson footer: back button on the left edge of the content column, main action fills the rest */
.player-foot > .btn.block, .player-foot > .btn.grow { flex: 1 1 0; min-width: 0; width: auto; }
.player-foot > .btn.icon-only { flex: none; width: 54px; height: 54px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
.player-foot > .btn { white-space: nowrap; }
@media (min-width: 600px) { .line { margin-left: 12%; } .line.b { margin-right: 12%; } .player-foot { padding-bottom: 18px; } }
@media (max-width: 340px) { .player-foot > .btn { white-space: normal; } .player-foot > .btn.icon-only { width: 48px; height: 48px; } }

/* ---------- basics ---------- */
.basics-body { display: grid; gap: 6px; }
.bgroup { margin-top: 14px; } .bgroup-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.words { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.word { position: relative; display: grid; gap: 1px; justify-items: center; text-align: center; padding: 14px 10px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s; }
.word:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); } .word:active { transform: scale(.97); } .word.is-playing { border-color: var(--brand); background: var(--brand-soft); }
.word .ar { line-height: 1.7; color: var(--brand); } .word .tr { font-size: .82rem; color: var(--muted); font-style: italic; } .word .en { font-weight: 600; font-size: .95rem; }
.wtag { margin-top: 6px; padding: 2px 9px; border-radius: 999px; font-size: .7rem; font-weight: 600; background: var(--accent-soft); color: var(--accent-ink); }
.word-play { position: absolute; top: 4px; right: 4px; opacity: .55; }
.tipbox { margin-top: 18px; display: grid; gap: 8px; background: var(--accent-soft); border-color: transparent; } .tip-ex .arline { background: var(--surface); border-radius: var(--r-sm); padding: 8px 12px; }
.bq { display: grid; gap: 12px; } .bq-q { font-weight: 600; } .bq-en { color: var(--brand); }
.bq-opts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.bq-opt { padding: 12px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); font: 500 1.35rem/1.6 var(--arabic); transition: all .2s; } .bq-opt:hover { border-color: var(--brand); }
.bq-opt.good { background: var(--good-soft); border-color: var(--good); } .bq-opt.bad { background: var(--bad-soft); border-color: var(--bad); }
.bq-foot { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; } .bq-says.ok { color: var(--good); } .bq-says.no { color: var(--bad); } .bq-says { font-weight: 600; }
.bq-done { display: grid; gap: 10px; justify-items: start; }

/* Role-play */
.rp { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); padding-top: 6px; }
.rp-cast { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.rp-role { display: grid; gap: 2px; justify-items: center; text-align: center; padding: 16px 10px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); transition: border-color .2s, transform .2s var(--spring); }
.rp-role:hover, .rp-role:focus-visible { border-color: var(--brand); transform: translateY(-2px); } .rp-role small, .rp-lines { color: var(--muted); font-size: .85rem; } .rp-role.again { background: var(--brand-soft); border-color: transparent; }
.rp-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-log { display: grid; gap: 10px; } .rp-line { cursor: default; } .rp-line.mine { border-color: var(--brand); }
.rp-stage { display: grid; gap: 10px; padding: 14px; background: var(--surface-2); border-radius: var(--r); } .rp-stage .tr, .rp-stage .en { text-align: left; }
.rp-turn { display: flex; align-items: center; gap: 8px; font-weight: 600; } .rp-turn .icon { width: 18px; height: 18px; }
.rp-done { display: grid; gap: 8px; justify-items: center; text-align: center; } .rp-done > .icon { width: 36px; height: 36px; color: var(--good); } .rp-done .rp-cast { width: 100%; }
.center { text-align: center; }

/* Pronoun reference and practice */
.basics-nav { display: grid; gap: 8px; margin-bottom: 18px; }
.basics-nav label { font-weight: 600; }
.basics-nav select { width: 100%; min-width: 0; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; }
.basics-note { display: grid; gap: 8px; margin-top: 10px; }
.basics-note p, .word-hint, .word-example, .bq-says { overflow-wrap: anywhere; }
.basics .words { align-items: stretch; }
.basics .word { cursor: default; padding: 0; align-content: start; min-width: 0; }
.basics .word:hover { transform: none; }
.word-trigger { display: grid; justify-items: center; gap: 5px; width: 100%; min-width: 0; min-height: 150px; padding: 16px 10px 12px; border: 0; border-radius: var(--r); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.word-trigger .ar { display: block; max-width: 100%; overflow-wrap: anywhere; }
.word-listen { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; color: var(--muted); font-size: .75rem; }
.word-listen .icon { width: 16px; height: 16px; }
.word-hint { width: 100%; padding: 8px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; text-align: start; }
.word-example { width: 100%; padding: 10px; border-top: 1px solid var(--line); text-align: start; }
.word-example .arline { align-items: start; flex-wrap: wrap; }
.word-example .arline-main { min-width: 0; }
.word-example .tr, .word-example .en { font-size: .8rem; }
.basics-practice { margin-top: 20px; min-width: 0; }
.bq-opt.bq-text { font: 500 1rem/1.5 var(--font); text-align: start; overflow-wrap: anywhere; }
.bq-opt:disabled { opacity: 1; cursor: default; color: var(--ink); }
.basics-next { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.basics-next .btn { white-space: normal; text-align: start; }

/* A small Basics memory summary and accessible, naturally sized review cards. */
.basics-memory { display: grid; gap: 10px; margin: 8px 0; }
.basics-memory .btn { justify-self: start; }
.basics-saved { font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.review .flash-stage { min-height: 0; width: 100%; max-width: 520px; margin: 0 auto; perspective: none; }
.review-flash { width: 100%; min-width: 0; min-height: min(330px, 47dvh); padding: 24px 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-2); text-align: center; }
.review-prompt { display: grid; gap: 20px; place-items: center; width: 100%; min-height: 240px; padding: 8px 0; border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.review-prompt .ar, .review-answer .ar { max-width: 100%; overflow-wrap: anywhere; }
.review-answer { display: grid; justify-items: center; gap: 14px; overflow-wrap: anywhere; }
.review-prompt .flash-en, .review-answer .flash-en { font-size: clamp(1.1rem, 4vw, 1.4rem); overflow-wrap: anywhere; }
.review-rating { display: grid; gap: 8px; width: 100%; text-align: center; }
.review-overview .card-row > div { overflow-wrap: anywhere; }
@media (max-width: 360px) {
  .review-overview .card-row { flex-wrap: wrap; }
  .review-overview .card-row > div { flex-basis: calc(100% - 90px); }
  .review .review-flash { padding: 18px 14px; }
  .review .grades { gap: 5px; }
}
@media (max-width: 240px) { .review .grades { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Basics, redesigned: overview hub + Learn / Practise section pages ---------- */
.bhero { display: grid; gap: 2px; margin-bottom: 4px; } .bhero h2 { color: #fff; }
.bhero-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: .84rem; color: rgba(255,255,255,.85); position: relative; z-index: 1; } .bhero-foot .progress { flex: 1; background: rgba(255,255,255,.2); } .bhero-foot .progress i { background: #F6C760; } .bhero-foot span { white-space: nowrap; }
.bpath { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.bcard { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); color: inherit; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.bcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--brand); } .bcard:active { transform: scale(.985); }
.bcard-n { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-weight: 700; flex: none; } .bcard-n .icon { width: 18px; height: 18px; }
.bcard.done .bcard-n { background: var(--good-soft); color: var(--good); }
.bcard-main { display: grid; gap: 1px; min-width: 0; } .bcard-main b { font-weight: 600; overflow-wrap: anywhere; } .bcard-main .muted { font-size: .84rem; overflow-wrap: anywhere; }
.bcard-side { display: grid; justify-items: end; gap: 0; min-width: 0; } .bcard-side .ar { color: var(--brand); line-height: 1.6; font-size: 1.1rem; white-space: nowrap; } .bcard-side small { color: var(--muted); font-size: .74rem; white-space: nowrap; } .bcard.done .bcard-side small { color: var(--good); font-weight: 600; }
.bcard > .icon { width: 16px; height: 16px; color: var(--muted); }
.btop { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 12px; } .btop > .btn { margin-left: -10px; }
.btop-step { display: flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; } .btop-step .icon-btn { width: 36px; height: 36px; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; border-radius: 50%; } .btop-step .icon-btn .icon { width: 16px; height: 16px; } .btop-step .icon-btn.off { opacity: .35; }
.bhead { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 6px 12px; margin-bottom: 16px; } .bhead > .muted { grid-column: 1 / -1; max-width: 62ch; } .bhead-ar { color: var(--brand); line-height: 1.5; } .bhead .eyebrow { margin-bottom: 4px; }
.bseg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; position: sticky; top: 8px; z-index: 5; padding: 4px; box-shadow: var(--shadow-1); scroll-margin-top: 12px; }
.bseg button { min-height: 42px; font-size: .95rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.seg-badge { padding: 1px 8px; border-radius: 999px; background: var(--good-soft); color: var(--good); font-size: .72rem; font-weight: 700; }
.bpanel { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); margin-top: 16px; animation: rise .3s var(--ease) both; } .bpanel[hidden] { display: none; }
.bnotes { display: grid; gap: 8px; }
.bnote { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.bnote summary { list-style: none; cursor: pointer; padding: 12px 40px 12px 14px; font-weight: 600; position: relative; } .bnote summary::-webkit-details-marker { display: none; }
.bnote summary::after, .wrow-ex summary::after { content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); transition: transform .2s; }
.bnote[open] summary::after, .wrow-ex[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.bnote-body { display: grid; gap: 8px; padding: 0 14px 14px; color: var(--ink); overflow-wrap: anywhere; } .bnote-body p { color: var(--muted); }
.basics .bgroup { margin-top: 4px; } .basics .bgroup-title { display: flex; align-items: center; gap: 8px; } .bgroup-title span { padding: 0 7px; border-radius: 999px; background: var(--surface-2); font-size: .7rem; letter-spacing: 0; }
.wrows { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.wrow { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; min-width: 0; align-self: start; }
.wrow-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 10px 14px 10px 10px; text-align: start; color: inherit; font: inherit; cursor: pointer; transition: background .2s; }
.wrow-main:hover { background: var(--surface-2); } .wrow-main.is-playing { background: var(--brand-soft); }
.wrow-play { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; } .wrow-play .icon { width: 17px; height: 17px; } .is-playing .wrow-play { background: var(--brand); color: var(--brand-ink); }
.wrow-mean { display: grid; gap: 3px; justify-items: start; min-width: 0; } .wrow-mean .en { font-weight: 600; overflow-wrap: anywhere; } .wrow-mean .wtag { margin: 0; text-align: start; }
.wrow-ar { display: grid; justify-items: end; min-width: 0; } .wrow-ar .ar { color: var(--brand); line-height: 1.6; } .wrow-ar .tr { font-size: .8rem; color: var(--muted); font-style: italic; }
.wrow-hint { padding: 0 14px 10px 58px; color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.wrow-ex { border-top: 1px dashed var(--line); } .wrow-ex summary { list-style: none; cursor: pointer; position: relative; padding: 7px 14px 7px 58px; font-size: .8rem; font-weight: 600; color: var(--muted); } .wrow-ex summary::-webkit-details-marker { display: none; } .wrow-ex summary::after { width: 6px; height: 6px; }
.wrow-ex .arline { padding: 2px 14px 12px 58px; } .wrow-ex .tr, .wrow-ex .en { font-size: .82rem; }
.bq-card { display: grid; gap: 10px; } .bq-card > h3 { margin-top: -6px; }
.basics .basics-next { display: flex; gap: 10px; margin: 26px 0 8px; } .basics .basics-next .btn { flex: 1 1 0; min-width: 0; justify-content: center; }
@media (min-width: 720px) { .bpath.two, .wrows { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bseg { max-width: 420px; } }
.bcard-ar { color: var(--brand); font-size: 1.05rem; line-height: 1.7; text-align: start; direction: rtl; justify-self: start; } .bcard { align-items: start; } .bcard-n, .bcard > .icon, .bcard-side { align-self: center; }
/* UI polish: four stats sit 2x2 on phones instead of leaving one orphaned; review rows read English left, Arabic right. */
.stats:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
@media (min-width: 440px) { .stats:has(> :nth-child(4)) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card-row > div { display: flex; flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: 10px; }
.card-row > div small { font-size: .9rem; color: var(--ink); text-align: start; overflow-wrap: anywhere; min-width: 0; } .card-row > div .ar { flex: none; color: var(--brand); }
.bseg { background: var(--surface-2); outline: 4px solid var(--bg); }
@media (min-width: 900px) { .bpath { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Basics memory charts (SVG) ---------- */
.ch { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); padding: 14px; }
.ch-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ch-pair { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); } .ch-solo { max-width: 480px; margin: 0 auto; width: 100%; }
.ch-svg { display: block; width: 100%; height: auto; overflow: visible; }
.ch-band { fill: var(--surface-2); } .ch-band.p1 { fill: var(--accent-soft); } .ch-band.p2 { fill: var(--brand-soft); }
.ch-head { font: 600 11px var(--font); letter-spacing: .06em; text-transform: uppercase; fill: var(--muted); }
.ch-row { font: 700 11.5px var(--font); fill: var(--ink); } .ch-sub { font: 500 9.5px var(--font); fill: var(--muted); }
.ch-node { cursor: pointer; outline: none; } .ch-node rect, .ch-node circle { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; transition: fill .2s, stroke .2s; }
.ch-node:hover rect, .ch-node:hover circle, .ch-node:focus-visible rect, .ch-node:focus-visible circle { stroke: var(--brand); stroke-width: 2; }
.ch-node.sel rect, .ch-node.sel circle { stroke: var(--brand); stroke-width: 2.2; } .ch-node.hub circle, .ch-node.hub rect { fill: var(--brand); stroke: var(--brand); }
.ch-ar { font: 500 19px var(--arabic); fill: var(--brand); } .ch-cap { font: 500 9.5px var(--font); fill: var(--muted); }
.ch-node.hub .ch-ar, .ch-node.hub .ch-cap { fill: var(--brand-ink); } .ch-node.hub .ch-ar { font-size: 24px; }
.ch-node.is-playing rect, .ch-node.is-playing circle { fill: var(--accent-soft); stroke: var(--accent); }
.ch-node.hub.is-playing .ch-ar, .ch-node.hub.is-playing .ch-cap { fill: var(--accent-ink); }
.no-tr .tr-cap .ch-cap { display: none; }
.ch-line { stroke: var(--line); stroke-width: 1.6; } .ch-line.on { stroke: var(--brand); stroke-width: 2; } .ch-line.dash { stroke-dasharray: 4 4; }
.ch-link { display: grid; gap: 6px; align-content: start; padding-top: 12px; border-top: 1px dashed var(--line); } .ch-title { font-size: .95rem; }
@media (min-width: 720px) { .ch-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } .ch-link { border-top: 0; border-left: 1px dashed var(--line); padding: 0 0 0 14px; } }
.ch-arrow { fill: var(--brand); } .ch-line.dash + .ch-arrow, .ch-line:not(.on) + .ch-arrow { fill: var(--muted); }
.ch-tag { font: 600 9px var(--font); fill: var(--muted); } .ch-tag.on { fill: var(--brand); }
.ch-core { fill: var(--brand); } .ch-core-ar { font: 600 30px var(--arabic); fill: var(--brand-ink); } .ch-core-cap { font: 500 9.5px var(--font); fill: var(--brand-ink); }
.ch-house { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }

/* ---------- Basics: stages, finish ticks, pronouns-at-a-glance table ---------- */
.bkey { margin: 2px 2px 0; } .basics .section-head { align-items: end; } .basics .section-head h2 { margin-top: 2px; }
.bticks { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.btick { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 999px; border: 1px dashed var(--line); font-size: .7rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.btick.on { border: 1px solid transparent; background: var(--good-soft); color: var(--good); } .btick .icon { width: 11px; height: 11px; stroke-width: 3; }
.bcard.glance { background: var(--brand-soft); border-color: transparent; box-shadow: none; align-items: center; } .bcard.glance .bcard-n { background: var(--surface); color: var(--brand); }
.basics-saved { display: grid; gap: 6px; } .basics-saved .bticks { margin-top: 0; }
.seg-badge.low { background: var(--accent-soft); color: var(--accent-ink); }
.gl-link { justify-self: start; }
.gl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); margin-bottom: 10px; -webkit-overflow-scrolling: touch; }
.gl { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; }
.gl th, .gl td { padding: 4px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.gl thead th { position: sticky; top: 0; background: var(--surface-2); padding: 8px 6px; font-size: .78rem; line-height: 1.25; z-index: 2; } .gl thead a { display: grid; color: var(--ink); font-weight: 700; } .gl thead small { font-weight: 500; color: var(--muted); font-size: .68rem; }
.gl .gl-who { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: start; padding: 6px 10px; font-size: .8rem; font-weight: 600; white-space: nowrap; border-right: 1px solid var(--line); min-width: 92px; } .gl thead .gl-who { z-index: 3; background: var(--surface-2); }
.gl tr.p1 .gl-who { box-shadow: inset 4px 0 0 var(--accent); } .gl tr.p2 .gl-who { box-shadow: inset 4px 0 0 var(--brand); } .gl tr.p3 .gl-who { box-shadow: inset 4px 0 0 var(--muted); }
.gl tr.p2 td { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); } .gl tbody tr:last-child > * { border-bottom: 0; }
.gl-cell { display: grid; justify-items: center; width: 100%; padding: 4px 6px; border-radius: 10px; color: inherit; font: inherit; cursor: pointer; transition: background .2s; }
.gl-cell:hover, .gl-cell:focus-visible { background: var(--surface-2); } .gl-cell.is-playing { background: var(--accent-soft); }
.gl-cell .ar { font: 500 1.15rem/1.7 var(--arabic); color: var(--brand); white-space: nowrap; } .gl-cell .tr { font-size: .68rem; font-style: italic; color: var(--muted); white-space: nowrap; }
.gl th { text-transform: none; letter-spacing: 0; } .gl .gl-who { min-width: 0; padding: 6px 8px 6px 10px; font-size: .78rem; }
