/* فزعة — تعلّم الإنكليزي (ألوان وهوية فزعة) */
:root {
  --brand: #1D3DCC;
  --brand-2: #345CE6;
  --brand-dark: #162EA0;
  --brand-soft: #EEF1FD;
  --brand-line: #C9D3F7;
  --coral: #F86152;
  --coral-dark: #D94435;
  --coral-soft: #FEEFED;
  --ok: #12A066;
  --ok-dark: #0C7C4E;
  --ok-soft: #E6F7EF;
  --navy: #101828;
  --ink: #1E252B;
  --muted: #5B6676;
  --line: #DAE2EC;
  --bg: #F5F7FC;
  --card: #FFFFFF;
  --gold: #F5A524;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --shadow: 0 4px 20px rgba(16, 24, 40, .07);
  --font: 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; font-size: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--brand); }
img { max-width: 100%; }
.en { direction: ltr; unicode-bidi: isolate; font-family: var(--font); }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; border-radius: 6px; }

.app {
  max-width: 780px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px));
}
.boot { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); text-align: center; }

/* ---------- الشريط العلوي ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 10px; background: #fff; flex: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand b { font-size: 17px; font-weight: 800; }
.brand small { font-size: 11px; font-weight: 700; color: var(--coral-dark); background: var(--coral-soft); border-radius: 99px; padding: 1px 8px; align-self: flex-start; margin-top: 2px; }
.top-link { font-size: 14px; font-weight: 700; text-decoration: none; color: var(--brand); padding: 8px 12px; border-radius: 99px; background: var(--brand-soft); white-space: nowrap; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 46px; padding: 10px 18px; border: 0; border-radius: var(--r);
  font-weight: 800; font-size: 16px; text-decoration: none; line-height: 1.3;
  transition: transform .06s ease, box-shadow .06s ease, background .15s ease;
}
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn-lg { min-height: 54px; font-size: 17px; width: 100%; }
.btn-main { background: var(--brand); color: #fff; box-shadow: 0 3px 0 var(--brand-dark); }
.btn-main:active:not(:disabled) { box-shadow: 0 1px 0 var(--brand-dark); }
.btn-main:disabled { background: #C5CCDA; box-shadow: 0 3px 0 #AEB6C6; color: #fff; }
.btn-white { background: #fff; color: var(--brand); box-shadow: 0 3px 0 rgba(10, 20, 80, .35); }
.btn-coral { background: var(--coral); color: #fff; box-shadow: 0 3px 0 var(--coral-dark); }
.btn-ok { background: var(--ok); color: #fff; box-shadow: 0 3px 0 var(--ok-dark); }
.btn-ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.btn-ghost.danger { color: var(--coral-dark); border-color: #F6C9C3; }
.link { background: none; border: 0; padding: 8px; color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: underline; }
.link.center { display: block; margin: 10px auto 0; }

/* ---------- الواجهة الرئيسية ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--r-lg); padding: 22px 18px 18px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%); box-shadow: var(--shadow);
}
.hero::before { content: ''; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: var(--coral); opacity: .9; top: -90px; left: -60px; }
.hero::after { content: ''; position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 18px solid rgba(255, 255, 255, .12); bottom: -50px; left: 40px; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 24px; font-weight: 900; line-height: 1.35; max-width: 16em; text-wrap: balance; }
.hero p { margin-top: 6px; font-size: 15px; opacity: .92; max-width: 34em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.stat { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); border-radius: var(--r); padding: 10px 6px; text-align: center; min-width: 0; }
.stat b { display: block; font-size: 19px; font-weight: 900; line-height: 1.3; white-space: nowrap; }
.stat b i { font-style: normal; font-size: 13px; opacity: .75; font-weight: 700; }
.stat span { font-size: 12px; opacity: .9; }
.hero-next { display: block; text-align: center; margin-top: 8px; font-size: 13px; opacity: .9; }
.hero-done { background: rgba(255, 255, 255, .16); border-radius: var(--r); padding: 12px; text-align: center; font-weight: 800; margin-bottom: 10px; }

.pick { font-size: 17px; font-weight: 900; color: var(--navy); margin: 20px 0 0; }
.lv-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 12px; }
.lv-tab {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 4px; min-width: 0;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); line-height: 1.3;
}
.lv-tab .lv-ico { font-size: 20px; }
.lv-tab b { font-size: 15px; font-weight: 800; }
.lv-tab small { font-size: 11px; color: var(--muted); direction: ltr; }
.lv-tab.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 3px 0 var(--brand); color: var(--brand-dark); }

.lv-head { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.lv-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lv-head h2 { font-size: 19px; font-weight: 900; color: var(--navy); }
.lv-head p { font-size: 14px; color: var(--muted); margin: 4px 0 10px; }
.badge { font-size: 13px; font-weight: 800; padding: 2px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok-dark); }
.bar { display: block; height: 10px; background: #E6EAF3; border-radius: 99px; overflow: hidden; direction: rtl; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); border-radius: 99px; transition: width .35s ease; min-width: 0; }
.bar.sm { height: 6px; margin-top: 6px; }

.lock-box { margin-top: 12px; background: var(--coral-soft); border: 1px solid #F9CFC9; border-radius: var(--r); padding: 14px; }
.lock-box b { font-size: 16px; color: var(--coral-dark); }
.lock-box p { font-size: 14px; margin: 4px 0 12px; color: var(--ink); }

.units { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
.unit {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: right; padding: 12px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); box-shadow: 0 3px 0 var(--line);
  transition: transform .06s ease, border-color .15s ease;
}
.unit:not(.locked):hover { border-color: var(--brand-line); }
.unit:active { transform: translateY(2px); }
.u-ico { flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.u-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.u-txt b { font-size: 16px; font-weight: 800; color: var(--navy); line-height: 1.4; }
.u-txt small { font-size: 12.5px; color: var(--muted); }
.u-st { flex: none; font-size: 14px; font-weight: 800; color: var(--brand); min-width: 30px; text-align: center; }
.tick { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; background: var(--ok); color: #fff; align-items: center; justify-content: center; font-size: 15px; }
.unit.done .u-ico { background: var(--ok-soft); }
.unit.done .bar i { background: var(--ok); }
.unit.locked { background: #F1F3F8; box-shadow: none; }
.unit.locked .u-ico { filter: grayscale(1); opacity: .6; }
.unit.locked .u-txt b, .unit.locked .u-txt small { color: #8A93A3; }

.exam-card, .review-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 14px; border-radius: var(--r); border: 1.5px solid var(--brand-line); background: var(--brand-soft);
}
.exam-card > div, .review-card > div { flex: 1 1 220px; min-width: 0; }
.exam-card b, .review-card b { font-size: 16px; font-weight: 800; color: var(--navy); }
.exam-card p, .review-card p { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.exam-card.passed { background: var(--ok-soft); border-color: #BDE8D2; }
.review-card { background: var(--coral-soft); border-color: #F9CFC9; }
.exam-card .btn, .review-card .btn { flex: 0 0 auto; }

.settings { margin-top: 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 14px 12px; }
.settings h3 { font-size: 15px; font-weight: 800; color: var(--muted); padding: 10px 0 4px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; background: none; border: 0; border-top: 1px solid #EEF1F6; padding: 12px 0; text-align: right; font-weight: 700; font-size: 15px; min-height: 48px; }
.set-row em { font-style: normal; font-size: 11.5px; font-weight: 800; background: var(--coral-soft); color: var(--coral-dark); border-radius: 99px; padding: 1px 8px; margin-inline-start: 6px; white-space: nowrap; }
.set-row.danger { color: var(--coral-dark); }
.sw { flex: none; width: 44px; height: 26px; border-radius: 99px; background: #CBD2DF; position: relative; transition: background .15s ease; }
.sw::after { content: ''; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s ease; }
.sw.on { background: var(--brand); }
.sw.on::after { transform: translateX(-18px); }
.note { font-size: 12.5px; color: var(--muted); padding-top: 6px; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; font-size: 14px; color: var(--muted); }
.foot a { font-weight: 800; text-decoration: none; }

/* ---------- صفحة الوحدة ---------- */
.back { display: inline-block; font-weight: 800; font-size: 14px; text-decoration: none; padding: 6px 0; margin-bottom: 4px; }
.u-hero { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-radius: var(--r-lg); padding: 18px; }
.big-ico { flex: none; width: 64px; height: 64px; border-radius: 18px; background: rgba(255, 255, 255, .18); display: flex; align-items: center; justify-content: center; font-size: 32px; }
.u-hero small { font-size: 13px; opacity: .9; }
.u-hero h1 { font-size: 23px; font-weight: 900; line-height: 1.35; }
.tip { margin-top: 12px; background: #FFF8E8; border: 1px solid #F6DFA8; border-radius: var(--r); padding: 12px 14px; }
.tip b { font-size: 14px; color: #8A5A00; }
.tip p { font-size: 15px; margin-top: 2px; unicode-bidi: plaintext; text-align: right; }
.steps { display: grid; gap: 10px; margin-top: 14px; }
.step {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: right; padding: 12px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); box-shadow: 0 3px 0 var(--line);
}
.step:active { transform: translateY(2px); }
.s-n { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.s-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.s-t b { font-size: 16px; font-weight: 800; color: var(--navy); }
.s-t small { font-size: 13px; color: var(--muted); }
.s-st { flex: none; }
.go { background: var(--brand); color: #fff; font-weight: 800; font-size: 14px; border-radius: 99px; padding: 6px 14px; }
.step.done .s-n { background: var(--ok); }
.step.locked { background: #F1F3F8; box-shadow: none; }
.step.locked .s-n { background: #B6BDCB; }
.step.locked .s-t b, .step.locked .s-t small { color: #8A93A3; }
.stars { display: inline-flex; gap: 1px; direction: ltr; }
.star { color: #D5DAE4; font-size: 20px; line-height: 1; }
.star.on { color: var(--gold); }
.sec { font-size: 18px; font-weight: 900; color: var(--navy); margin: 22px 0 10px; }
.words { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.words li { direction: ltr; display: flex; align-items: flex-start; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.w-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.w-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.w-top b { font-size: 17px; font-weight: 800; color: var(--brand-dark); }
.w-top span { font-size: 15px; font-weight: 700; }
.w-top span { direction: rtl; }
.words small { font-size: 13.5px; color: var(--muted); }
.words small.en { text-align: left; }
.words small.w-ar { direction: rtl; text-align: right; }
.spk {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--brand-soft); font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.spk:active { transform: scale(.94); }
.spk.lg { width: 48px; height: 48px; font-size: 22px; }
.spk.xl { width: 96px; height: 96px; font-size: 44px; background: var(--brand); box-shadow: 0 5px 0 var(--brand-dark); }

/* ---------- شاشة التمرين ---------- */
.app.playing { max-width: none; padding: 0; background: var(--card); }
.player { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.p-top { display: flex; align-items: center; gap: 10px; padding: 12px max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px)); padding-top: max(12px, env(safe-area-inset-top, 0px)); }
.p-x { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #EEF1F6; color: var(--muted); font-size: 16px; font-weight: 900; }
.p-bar { flex: 1; height: 12px; }
.p-count { flex: none; font-size: 13px; font-weight: 800; color: var(--muted); direction: ltr; min-width: 38px; text-align: center; }
.p-title { padding: 0 16px; font-size: 13px; color: var(--muted); font-weight: 700; text-align: center; }
.p-title em { font-style: normal; color: var(--coral-dark); }
.p-body { flex: 1; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 18px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.q-label { font-size: 18px; font-weight: 900; color: var(--navy); line-height: 1.5; }
.q-big { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; background: var(--brand-soft); border: 1.5px solid var(--brand-line); border-radius: var(--r-lg); padding: 22px 14px; text-align: center; }
.q-big b { font-size: 28px; font-weight: 900; color: var(--brand-dark); line-height: 1.4; overflow-wrap: anywhere; }
.q-listen { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 10px 0 4px; }
.q-listen b { font-size: 24px; font-weight: 900; color: var(--brand-dark); }
.q-sent { background: var(--brand-soft); border: 1.5px solid var(--brand-line); border-radius: var(--r-lg); padding: 16px 14px; }
.q-sent p { font-size: 20px; font-weight: 800; color: var(--navy); line-height: 1.7; overflow-wrap: anywhere; }
.q-sent p.en { text-align: left; }
.q-sent small { display: block; font-size: 14.5px; color: var(--muted); margin-top: 6px; }
.blank { display: inline-block; width: 74px; height: 1.2em; border-bottom: 3px solid var(--brand); vertical-align: -2px; margin: 0 2px; }
mark { background: none; padding: 0 2px; border-radius: 4px; font-weight: 900; }
mark.ok { color: var(--ok-dark); background: var(--ok-soft); }
mark.fix { color: var(--coral-dark); background: var(--coral-soft); }

.card-new { background: var(--card); border: 1.5px solid var(--brand-line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.cn-en { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 26px 14px 8px; }
.cn-en b { font-size: 32px; font-weight: 900; color: var(--brand-dark); line-height: 1.3; overflow-wrap: anywhere; text-align: center; }
.cn-ar { text-align: center; font-size: 22px; font-weight: 800; color: var(--navy); padding: 0 14px 20px; }
.cn-ex { background: var(--brand-soft); padding: 14px; border-top: 1px dashed var(--brand-line); }
.cn-ex-row { display: flex; align-items: center; gap: 10px; direction: ltr; }
.cn-ex-row span { font-size: 17px; font-weight: 700; color: var(--navy); min-width: 0; overflow-wrap: anywhere; }
.cn-ex small { display: block; font-size: 15px; color: var(--muted); margin-top: 6px; }

.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 14px; text-align: right;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r); box-shadow: 0 3px 0 var(--line);
  font-size: 17px; font-weight: 700; color: var(--navy); transition: transform .06s ease, border-color .12s ease, background .12s ease;
}
.opt.en { direction: ltr; text-align: left; }
.opt span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt kbd { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--line); color: var(--muted); font: 800 13px/1 var(--font); display: inline-flex; align-items: center; justify-content: center; direction: ltr; }
.opt:not(:disabled):hover { border-color: var(--brand-line); background: var(--brand-soft); }
.opt:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.opt.ok { border-color: var(--ok); background: var(--ok-soft); box-shadow: 0 3px 0 var(--ok); color: var(--ok-dark); }
.opt.ok kbd { border-color: var(--ok); color: var(--ok-dark); }
.opt.bad { border-color: var(--coral); background: var(--coral-soft); box-shadow: 0 3px 0 var(--coral); color: var(--coral-dark); }
.opt.bad kbd { border-color: var(--coral); color: var(--coral-dark); }
.opt.dim { opacity: .55; }

.arr-line { min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border: 2px dashed var(--brand-line); border-radius: var(--r); background: #FAFBFF; }
.arr-line.ok { border-color: var(--ok); border-style: solid; background: var(--ok-soft); }
.arr-line.bad { border-color: var(--coral); border-style: solid; background: var(--coral-soft); }
.arr-hint { font-size: 14px; color: #8A93A3; direction: rtl; margin: 0 auto; }
.arr-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding-top: 4px; }
.tile { min-height: 44px; padding: 8px 14px; background: var(--card); border: 2px solid var(--line); border-radius: var(--r); box-shadow: 0 3px 0 var(--line); font-size: 17px; font-weight: 700; color: var(--navy); }
.tile:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.tile.used { background: #E9ECF3; color: transparent; box-shadow: none; border-color: #E9ECF3; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; direction: ltr; }
.m-col { display: grid; gap: 10px; align-content: start; min-width: 0; }
.m-col:not(.en) { direction: rtl; }
.m-btn { min-height: 56px; padding: 8px 8px; width: 100%; background: var(--card); border: 2px solid var(--line); border-radius: var(--r); box-shadow: 0 3px 0 var(--line); font-size: 16px; font-weight: 700; color: var(--navy); line-height: 1.35; overflow-wrap: anywhere; text-align: center; }
.m-btn.sel { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 3px 0 var(--brand); color: var(--brand-dark); }
.m-btn.ok { border-color: #BDE8D2; background: var(--ok-soft); box-shadow: none; color: var(--ok-dark); opacity: .75; }
.m-btn.bad { border-color: var(--coral); background: var(--coral-soft); box-shadow: 0 3px 0 var(--coral); color: var(--coral-dark); animation: shake .35s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.type-in { width: 100%; min-height: 56px; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--r); font: 700 20px/1.4 var(--font); color: var(--navy); background: #fff; text-align: left; }
.type-in:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.type-in.ok { border-color: var(--ok); background: var(--ok-soft); }
.type-in.bad { border-color: var(--coral); background: var(--coral-soft); }
.type-in::placeholder { color: #A9B1C0; font-weight: 500; }

.p-foot {
  position: sticky; bottom: 0; z-index: 5; background: var(--card); border-top: 1.5px solid var(--line);
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 10px;
}
.p-foot.ok { background: var(--ok-soft); border-top-color: #BDE8D2; }
.p-foot.bad { background: var(--coral-soft); border-top-color: #F9CFC9; }
.p-foot.ghost { align-items: center; min-height: 64px; justify-content: center; }
.hint { font-size: 14px; color: #8A93A3; font-weight: 700; }
.fb { display: flex; flex-direction: column; gap: 2px; }
.fb b { font-size: 18px; font-weight: 900; }
.fb span { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.p-foot.ok .fb { color: var(--ok-dark); }
.p-foot.bad .fb { color: var(--coral-dark); }

/* ---------- أسئلة الجداول (الإكسل) ---------- */
.xl-wrap { direction: ltr; overflow-x: auto; border: 1.5px solid #B9C4D6; border-radius: var(--r); background: #fff; max-width: 100%; }
.xl { border-collapse: collapse; width: 100%; font-size: 16px; font-weight: 700; color: var(--navy); }
.xl th { background: #EEF1F6; color: var(--muted); font-size: 13px; font-weight: 800; padding: 6px 8px; border: 1px solid #D5DCE8; text-align: center; min-width: 34px; }
.xl thead th { border-top: 0; }
.xl th:first-child { border-left: 0; width: 34px; }
.xl td { padding: 9px 10px; border: 1px solid #D5DCE8; min-width: 64px; text-align: left; unicode-bidi: plaintext; white-space: nowrap; }
.xl td.num { text-align: right; direction: ltr; }
.xl tr > :last-child { border-right: 0; }
.xl tbody tr:last-child > * { border-bottom: 0; }
.xl-fx { direction: ltr; display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px solid var(--brand-line); border-radius: var(--r); padding: 10px 12px; min-width: 0; }
.xl-fx i { flex: none; font-style: italic; font-weight: 800; color: var(--muted); font-family: Georgia, 'Times New Roman', serif; }
.xl-fx code { font-family: Consolas, 'Courier New', monospace; font-size: 17px; font-weight: 700; color: var(--brand-dark); overflow-wrap: anywhere; min-width: 0; }

/* ---------- النتيجة ---------- */
.result { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; padding: 28px max(16px, env(safe-area-inset-right, 0px)) 28px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.r-emoji { font-size: 64px; line-height: 1.1; }
.result h1 { font-size: 24px; font-weight: 900; color: var(--navy); line-height: 1.4; text-wrap: balance; }
.r-sub { color: var(--muted); font-size: 15.5px; }
.r-stars .star { font-size: 44px; }
.r-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin: 10px 0; }
.r-stats div { background: var(--brand-soft); border: 1.5px solid var(--brand-line); border-radius: var(--r); padding: 12px 4px; min-width: 0; }
.r-stats b { display: block; font-size: 22px; font-weight: 900; color: var(--brand-dark); direction: ltr; white-space: nowrap; }
.r-stats span { font-size: 13px; color: var(--muted); font-weight: 700; }
.r-btns { display: grid; gap: 10px; width: 100%; margin-top: 6px; }

/* ---------- نافذة التأكيد والتنبيه ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(16, 24, 40, .55); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.md-box { width: 100%; max-width: 420px; background: #fff; border-radius: var(--r-lg); padding: 20px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); margin-bottom: env(safe-area-inset-bottom, 0px); }
.md-box h3 { font-size: 19px; font-weight: 900; color: var(--navy); }
.md-box p { color: var(--muted); margin: 6px 0 16px; font-size: 15px; }
.md-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast { position: fixed; z-index: 60; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translate(-50%, 20px); max-width: calc(100vw - 32px); background: var(--navy); color: #fff; font-family: var(--font); font-size: 14.5px; font-weight: 700; padding: 10px 16px; border-radius: 99px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- الشاشات الأكبر ---------- */
@media (min-width: 640px) {
  .hero { padding: 30px 28px 24px; }
  .hero h1 { font-size: 30px; }
  .hero .btn-lg { width: auto; min-width: 280px; }
  .hero-next { text-align: right; }
  .units { grid-template-columns: 1fr 1fr; }
  .modal { align-items: center; }
  .q-label { font-size: 20px; }
  .opts { grid-template-columns: 1fr 1fr; }
  .p-foot { border-radius: var(--r-lg) var(--r-lg) 0 0; border: 1.5px solid var(--line); border-bottom: 0; }
  .player { padding-top: 12px; }
}
@media (max-width: 359px) {
  .hero h1 { font-size: 21px; }
  .q-big b { font-size: 24px; }
  .cn-en b { font-size: 27px; }
  .m-btn { font-size: 14.5px; }
  .stat b { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
