@font-face { font-family: 'Thmanyah'; src: url(fonts/thmanyahsans-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Thmanyah'; src: url(fonts/thmanyahsans-Bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Thmanyah'; src: url(fonts/thmanyahsans-Black.woff2) format('woff2'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'ThmanyahDisplay'; src: url(fonts/thmanyahserifdisplay-Bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'ThmanyahDisplay'; src: url(fonts/thmanyahserifdisplay-Black.woff2) format('woff2'); font-weight: 900; font-display: swap; }

:root {
  --green: #1B7A3E;
  --green-2: #23964d;
  --gold: #B8892E;
  --gold-2: #d4a447;
  --ink: #2a2115;
  --ink-soft: #5d4f3a;
  --glass: rgba(255, 250, 240, .72);
  --glass-line: rgba(255, 255, 255, .7);
  --opt: rgba(255, 255, 255, .85);
  --ok: #1B7A3E;
  --bad: #b3402e;
  --bg: #e9d6b4;
  --bg-img: url(bg/desert.jpg);
  --shadow: 0 10px 30px rgba(80, 50, 10, .18);
  --r: 20px;
  --fs: 17px;
  --t1: #1B7A3E; --t2: #B8892E;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f5ead6; --ink-soft: #cdbb9b;
    --glass: rgba(25, 20, 14, .66); --glass-line: rgba(255, 255, 255, .12);
    --opt: rgba(45, 37, 26, .9);
    --bg: #1a140d; --bg-img: url(bg/desert-dark.jpg);
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --ok: #2fae5c; --bad: #e0634d;
    --t1: #4cd282; --t2: #f0c165;
  }
}
:root[data-theme="dark"] {
  --ink: #f5ead6; --ink-soft: #cdbb9b;
  --glass: rgba(25, 20, 14, .66); --glass-line: rgba(255, 255, 255, .12);
  --opt: rgba(45, 37, 26, .9);
  --bg: #1a140d; --bg-img: url(bg/desert-dark.jpg);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --ok: #2fae5c; --bad: #e0634d;
  --t1: #4cd282; --t2: #f0c165;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Thmanyah', system-ui, sans-serif;
  font-size: var(--fs);
  line-height: 1.6;
  overflow-x: hidden;
}
.bg {
  position: fixed; inset: 0; z-index: -1;
  background: var(--bg-img) center / cover no-repeat;
}
#app {
  max-width: 560px; margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  min-height: 100dvh;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* ─── الشاشات ─── */
.screen { display: none; animation: in .35s ease; }
.screen.active { display: block; }
@keyframes in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ─── زجاج ─── */
.glass {
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow);
}
.card { border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.center { text-align: center; }

/* ─── العناوين ─── */
.hero { text-align: center; padding: 18px 0 10px; }
.badge {
  display: inline-block; padding: 4px 14px; border-radius: 99px;
  background: var(--glass); border: 1px solid var(--glass-line);
  font-weight: 700; font-size: 14px; margin-bottom: 8px;
}
.title {
  font-family: 'ThmanyahDisplay', 'Thmanyah', serif; font-weight: 900;
  font-size: clamp(32px, 9vw, 46px); line-height: 1.25; margin: 4px 0;
  background: linear-gradient(90deg, var(--t1), var(--t2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.title.sm { font-size: 30px; text-align: center; }
.sub { color: var(--ink-soft); margin: 4px 0 10px; text-align: center; }
.lbl { font-weight: 700; margin-bottom: 8px; }

.input {
  width: 100%; padding: 12px 14px; border-radius: 14px; font: inherit;
  border: 1px solid var(--glass-line); background: var(--opt); color: var(--ink);
}
.input:focus { outline: 2px solid var(--gold); }

/* ─── الشخصيات ─── */
.av {
  --s: 64px; width: var(--s); height: var(--s); flex: none; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #f3dfae, var(--gold) 70%, #8a6420);
  border: 3px solid var(--gold); box-shadow: 0 4px 14px rgba(80, 50, 10, .25);
  display: grid; place-items: center; overflow: hidden; font-size: calc(var(--s) * .5); line-height: 1;
}
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.sm { --s: 40px; border-width: 2px; }
.av.xl { --s: 132px; border-width: 4px; margin: 8px auto 4px; box-shadow: 0 0 0 6px rgba(184, 137, 46, .18), 0 10px 26px rgba(80, 50, 10, .3); }
.me { display: flex; gap: 12px; align-items: center; }
.me-av .av { --s: 76px; }
.me-in { flex: 1; min-width: 0; }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.avbtn { border: none; background: none; padding: 0; display: grid; justify-items: center; gap: 4px; font-size: 11px; line-height: 1.3; font-weight: 700; color: var(--ink-soft); }
.avbtn .av { --s: min(52px, 12.5vw); border-color: transparent; transition: transform .15s, border-color .15s; }
.avbtn.on .av { border-color: var(--green); transform: scale(1.08); box-shadow: 0 0 0 3px rgba(27, 122, 62, .25); }
.avbtn.on { color: var(--ink); }
.cert-role { font-weight: 900; color: var(--gold); margin-bottom: 2px; }
.player .av { --s: 44px; border-width: 2px; cursor: pointer; }
.player .avpick { border: none; background: none; padding: 0; }
.row .av { --s: 34px; border-width: 2px; display: inline-grid; vertical-align: middle; margin-inline-end: 6px; }

/* ─── الأعمار ─── */
.ages { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.age {
  border: 2px solid transparent; border-radius: 16px; padding: 12px 8px;
  background: var(--opt); text-align: center; transition: transform .15s, border-color .15s;
}
.age:active { transform: scale(.97); }
.age .ico { font-size: 30px; display: block; }
.age b { display: block; font-size: 18px; }
.age small { color: var(--ink-soft); font-size: 13px; }
.age.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 137, 46, .2); }

/* ─── الشرايح ─── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px; border-radius: 99px; border: 1px solid var(--glass-line);
  background: var(--opt); font-size: 15px;
}
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }
.chip.lock { opacity: .55; }

/* ─── الأزرار ─── */
.modes { display: grid; gap: 10px; margin: 6px 0 14px; }
.btn {
  border: none; border-radius: 16px; padding: 12px 16px; font-weight: 700;
  transition: transform .12s, filter .12s;
}
.btn:active { transform: scale(.97); }
.btn.big { font-size: 19px; padding: 15px; width: 100%; }
.btn.primary { background: linear-gradient(135deg, var(--green), var(--green-2)); color: #fff; box-shadow: 0 6px 18px rgba(27, 122, 62, .35); }
.btn.gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #fff; box-shadow: 0 6px 18px rgba(184, 137, 46, .35); }
.btn.ghost { background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tag { font-size: 13px; background: var(--gold); color: #fff; border-radius: 99px; padding: 1px 8px; margin-inline-start: 6px; }
.tag:empty { display: none; }
.foot { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px; color: var(--ink-soft); font-size: 15px; }
.link { background: none; border: none; color: var(--ink-soft); text-decoration: underline; }
.back { background: none; border: none; font-weight: 700; padding: 6px 0; color: var(--ink); }

/* ─── اللاعبين ─── */
.player { display: flex; gap: 8px; margin-bottom: 8px; }
.player .input { flex: 1; }
.player .del { border: none; background: var(--opt); border-radius: 12px; width: 44px; }
.player { align-items: center; }

/* ─── اللعب ─── */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--glass-line); background: var(--glass); flex: none; }
.progress { flex: 1; height: 10px; border-radius: 99px; background: var(--glass); overflow: hidden; border: 1px solid var(--glass-line); }
.bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--gold)); transition: width .4s; }
.score { font-weight: 900; font-size: 20px; min-width: 52px; text-align: center; background: var(--glass); border-radius: 12px; padding: 2px 8px; border: 1px solid var(--glass-line); }

.status { display: flex; align-items: center; justify-content: space-between; min-height: 56px; margin-bottom: 8px; }
.cups { display: flex; gap: 4px; font-size: 26px; }
.cups span { transition: opacity .3s, transform .3s, filter .3s; }
.cups .broken { opacity: .25; filter: grayscale(1); transform: rotate(-30deg) scale(.85); }
.streak { font-weight: 900; color: var(--gold); font-size: 18px; }
.dalla-wrap { display: flex; align-items: center; gap: 4px; font-weight: 900; }
.dalla { width: 54px; height: 54px; }
.dalla-body { fill: var(--opt); }
.dalla-fill { fill: var(--gold); transition: y 1s linear, height 1s linear; }
.dalla-line { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dalla-wrap.low .dalla { animation: shake .4s infinite; }
.dalla-wrap.low { color: var(--bad); }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }

.qcard { text-align: center; padding: 22px 16px; }
.qmeta { font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; }
.q { font-size: 23px; font-weight: 900; margin: 0; line-height: 1.5; }

.options { display: grid; gap: 10px; margin-bottom: 14px; }
.opt {
  border: 2px solid var(--glass-line); border-radius: 16px; padding: 14px 16px;
  background: var(--opt); font-size: 19px; font-weight: 700; text-align: right;
  box-shadow: var(--shadow); transition: transform .12s, background .2s, border-color .2s;
  display: flex; align-items: center; gap: 10px;
}
.opt .k { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(184, 137, 46, .18); font-size: 15px; }
.opt:active { transform: scale(.98); }
.opt.ok { background: var(--ok); color: #fff; border-color: var(--ok); animation: pop .35s; }
.opt.bad { background: var(--bad); color: #fff; border-color: var(--bad); animation: nope .35s; }
.opt.dim { opacity: .45; }
.opt:disabled { cursor: default; }
@keyframes pop { 50% { transform: scale(1.04); } }
@keyframes nope { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.feedback { display: none; text-align: center; }
.feedback.show { display: block; animation: in .3s ease; }
.fb-title { font-size: 22px; font-weight: 900; margin-bottom: 6px; }
.fb-x { margin: 0 0 6px; }
.fb-s { font-size: 13px; color: var(--ink-soft); margin: 0 0 12px; }

.report { display: block; margin: -4px auto 12px; font-size: 14px; }
.fb-form .chips label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.fb-form .chips input { accent-color: var(--green); }
.fb-ref { font-size: 14px; color: var(--ink-soft); background: var(--opt); border-radius: 12px; padding: 6px 10px; margin: 8px 0 0; }

.btn.exam { background: var(--glass); border: 2px solid var(--gold); color: var(--ink); }
.grade-line { margin-top: 6px; font-weight: 700; color: var(--gold); font-size: 15px; }
.count { text-align: center; font-weight: 700; margin: 0 0 8px; color: var(--ink); }

.btn.install { background: linear-gradient(135deg, #2a2115, #4a3a22); color: #f0c165; border: 2px solid var(--gold); }
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(20, 14, 6, .72); display: grid; align-items: end; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.sheet[hidden] { display: none; }
.sheet-box { max-width: 520px; margin: 0 auto; width: 100%; animation: in .3s ease; background: var(--opt); }
.sheet-box .sub { color: var(--ink-soft); }
.sheet-box h3 { margin: 0 0 4px; font-size: 22px; }
.sheet-box ol { margin: 6px 0 14px; padding-inline-start: 22px; display: grid; gap: 8px; font-size: 18px; }

/* ─── سناب تحت الصفحة ─── */
.snapfoot { display: flex; align-items: center; gap: 12px; margin: 14px auto 6px; padding: 10px 16px; border-radius: 18px; text-decoration: none; color: var(--ink); max-width: 340px; }
.snapfoot:active { transform: scale(.98); }
.snaplogo { width: 44px; height: 44px; flex: none; }
.snaptxt { display: grid; line-height: 1.35; }
.snaptxt b { font-size: 17px; }
.snaptxt small { font-size: 14px; color: var(--ink-soft); direction: ltr; text-align: right; }

/* ─── عن اللعبة ─── */
.about h3 { margin: 0 0 6px; font-size: 19px; }
.about p { margin: 0 0 8px; }
.about ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.about .note { font-size: 14px; color: var(--ink-soft); margin-top: 8px; }
.maker { font-family: 'ThmanyahDisplay', serif; font-weight: 900; font-size: 30px; margin: 0 0 10px; color: var(--gold); }
.snap { display: block; text-decoration: none; text-align: center; background: #FFFC00; color: #111; box-shadow: 0 6px 18px rgba(0, 0, 0, .15); }

/* ─── تمرير ─── */
.pass { margin-top: 18vh; padding: 30px 16px; }
.pass-icon { font-size: 60px; animation: wob 1.6s infinite; }
@keyframes wob { 50% { transform: rotate(12deg); } }

/* ─── الشهادة ─── */
.cert { text-align: center; border: 2px solid var(--gold); position: relative; padding: 24px 16px; }
.cert::before { content: ''; position: absolute; inset: 6px; border: 1px dashed var(--gold); border-radius: 15px; pointer-events: none; }
.cert-top { font-weight: 900; color: var(--gold); letter-spacing: 1px; }
.cert-school { font-family: 'ThmanyahDisplay', serif; font-weight: 700; font-size: 20px; margin-bottom: 6px; }
.rank { display: inline-block; font-size: 26px; font-weight: 900; color: #fff; background: linear-gradient(135deg, var(--green), var(--gold)); padding: 6px 20px; border-radius: 99px; margin: 2px 0 8px; }
.cert-score { font-weight: 700; margin-bottom: 10px; }
.grades { display: grid; gap: 6px; text-align: right; margin: 0 auto; max-width: 340px; }
.grade { display: flex; justify-content: space-between; padding: 6px 12px; border-radius: 12px; background: var(--opt); font-size: 15px; }
.grade b { color: var(--green); }
.grade b.low { color: var(--bad); }
.cert-date { color: var(--ink-soft); font-size: 13px; margin-top: 10px; }

/* ─── المجلس ─── */
.row { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--opt); margin-bottom: 8px; font-weight: 700; }
.row.first { background: linear-gradient(135deg, var(--green), var(--gold)); color: #fff; font-size: 20px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 40px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px;
  font-weight: 700; transition: .3s; pointer-events: none; z-index: 9; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ═════ طابع كل عمر ═════ */

/* 🐣 شبل: ألوان مرحة، أزرار كبيرة */
body.age-k { --r: 28px; --fs: 19px; }
body.age-k .q { font-size: 27px; }
body.age-k .opt { font-size: 24px; padding: 20px; border-radius: 26px; justify-content: center; text-align: center; }
body.age-k .opt .k { display: none; }
body.age-k .opt:nth-child(1):not(.ok):not(.bad) { background: #fde68a; color: #4a3500; }
body.age-k .opt:nth-child(2):not(.ok):not(.bad) { background: #bfdbfe; color: #10305e; }
body.age-k .qcard::before { content: '🐪'; display: block; font-size: 44px; animation: hop 1.2s infinite; }
@keyframes hop { 50% { transform: translateY(-8px); } }
body.age-k .title { background: linear-gradient(90deg, #e07a1f, var(--green)); -webkit-background-clip: text; background-clip: text; }

/* 🔥 طالب: حماس */
body.age-t .streak { animation: pulse .8s infinite; }
@keyframes pulse { 50% { transform: scale(1.15); } }

/* 👴 مجلس الشيوخ: خط كبير وهدوء */
body.age-e { --fs: 20px; }
body.age-e .q { font-size: 27px; }
body.age-e .opt { font-size: 22px; padding: 18px; }
body.age-e .screen { animation-duration: .6s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
