/* ═══════════════════════════════════════════════════════════════════
   سين جيم — مُعاد التلوين على ثيم «خليّة الحروف» (الصفحة الرئيسية)
   نهاري (:root) كريمي + ليلي (:root.dark) أسود دافئ — نفس رموز الصفحة الرئيسية.
   التغيير مقصور على الألوان/الثيم فقط؛ كل المقاسات والتخطيط ومقاسات صور
   الغلافات بقيت كما هي حرفياً.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* ── ذهبي ── */
  --gold: #a8842c;
  --gold-bright: #e8d49a;
  --gold-soft: #cdb06a;
  --gold-deep: #8a6d24;
  --on-gold: #3a2c08;
  --bronze: #a06a34;

  /* ── الخلفية/الورق (الطبقة الوحيدة التي تنقلب في الليلي) ── */
  --bg-0: #f5f0e6;
  --paper-1: #efe6cf;
  --glow-1: #efe6cf88;
  --glow-2: #e9ddc288;

  --ink: #2d2a21;
  --ink-dim: #7c7361;

  /* ── الأسطح — بطاقات كريمية ── */
  --card: #fffdf8;
  --card-2: #fbf6ec;
  --card-line: #e2d6bb;
  --inset: #f4eddf;
  --inset-line: #e7dcc4;
  --inset-hover: #ece2cf;
  --field: #fffef9;
  --surface-1: var(--card);
  --surface-2: var(--inset);

  --hairline: #a8842c29;
  --hairline-2: #a8842c4d;
  --line: var(--hairline);
  --line-2: var(--hairline-2);
  --accent-wash: #a8842c14;
  --accent-wash-2: #a8842c26;

  --header-bg: #fbf6ecd9;

  --card-grad: linear-gradient(160deg, var(--card), var(--card-2));
  --card-grad-soft: linear-gradient(160deg, var(--card-2), var(--card));
  --gold-grad: linear-gradient(135deg, var(--gold-bright), var(--gold));

  /* ── الفريقان (أخضر صنوبري / أحمر فوّة — نفس فريقَي الرئيسية) ── */
  --t1: #235c46;
  --t1-deep: #18402f;
  --t1-glow: #2f7d52;
  --on-green: #f2fbf7;
  --t1-wash: #e4ece8;
  --t1-line: #235c4638;
  --t2: #9e4234;
  --t2-deep: #74301f;
  --t2-glow: #b8503f;
  --on-clay: #fdf3ec;
  --t2-wash: #f3e3df;
  --t2-line: #9e423438;

  --danger: #c0392b;
  --clay-wash: var(--t2-wash);
  --clay-line: var(--t2-line);
  --scrim: #2b261cd9;

  /* ── ظلال دافئة (بنيّة، لا رماديّة، في النهاري) ── */
  --shadow-card: 0 12px 30px #5b4a1f1f;
  --shadow-pop: 0 24px 60px -18px #5b4a1f4d;
  --shadow-gold: 0 10px 26px -8px #a8842c66;
  --shadow-gold-lg: 0 18px 40px -10px #a8842c80;

  --font-display: 'Alexandria', 'Alexandria Fallback', sans-serif;
  --font-body: 'Cairo', 'Cairo Fallback', sans-serif;

  /* شطف الخلية السداسية العريضة (هوية «خليّة») */
  --hex-wide: polygon(11% 0, 89% 0, 100% 50%, 89% 100%, 11% 100%, 0 50%);
  --hex-tall: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

/* ── الثيم الليلي: خلفية سوداء دافئة + أسطح داكنة + إشراق طفيف للهوية ── */
:root.dark {
  --gold: #d6b15a;
  --gold-bright: #e8d49a;
  --gold-soft: #e6cd8f;
  --gold-deep: #c49a3f;
  --bronze: #c98a52;

  --bg-0: #16130e;
  --paper-1: #211c14;
  --glow-1: #3a311fcc;
  --glow-2: #2a241890;

  --ink: #f3ead6;
  --ink-dim: #bdb091;

  --card: #272219;
  --card-2: #211c15;
  --card-line: #473f2e;
  --inset: #332d22;
  --inset-line: #4a4233;
  --inset-hover: #3d3629;
  --field: #332d22;

  --hairline: #d6b15a2e;
  --hairline-2: #d6b15a54;
  --accent-wash: #d6b15a1f;
  --accent-wash-2: #d6b15a30;

  --header-bg: #211c14e0;

  --t1: #3f8f72;
  --t1-deep: #245c46;
  --t1-glow: #7fe0b8;
  --t1-wash: #22382f;
  --t1-line: #3f8f7250;
  --t2: #c25c49;
  --t2-deep: #8f3e2e;
  --t2-glow: #f0a878;
  --t2-wash: #3a241f;
  --t2-line: #c25c4950;

  --scrim: #0d0b07e0;

  --shadow-card: 0 12px 30px #00000047;
  --shadow-pop: 0 24px 60px -18px #00000073;
  --shadow-gold: 0 10px 26px -8px #d6b15a4d;
  --shadow-gold-lg: 0 18px 40px -10px #d6b15a66;
}

/* ───────────────────────── الأساس ───────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  /* خلفية الصفحة الرئيسية نفسها: تدرّج ورقي + توهّجان عنبريّان (أعلى-يمين، أسفل-يسار) */
  background:
    radial-gradient(900px 440px at 85% -10%, var(--glow-1), transparent 60%),
    radial-gradient(760px 420px at 8% 110%, var(--glow-2), transparent 58%),
    linear-gradient(180deg, var(--paper-1), var(--bg-0) 70%);
  background-attachment: fixed;
  transition: color .35s ease;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-wash-2); }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); }

/* نقشة قرص العسل — نفس نقشة الرئيسية (توهّج ذهبي خفيف يتلاشى للأسفل) */
.bg-hex {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .42;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='56'%20height='100'%3E%3Cpath%20d='M28%2066L0%2050L0%2016L28%200L56%2016L56%2050L28%2066L28%20100'%20fill='none'%20stroke='%23a8842c'%20stroke-opacity='0.12'%20stroke-width='1.3'/%3E%3Cpath%20d='M28%200L28%2034L0%2050L0%2084L28%20100L56%2084L56%2050L28%2034'%20fill='none'%20stroke='%23845a2a'%20stroke-opacity='0.13'%20stroke-width='1.3'/%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, .85), transparent 70%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .85), transparent 70%);
}
main { position: relative; z-index: 1; }

:focus-visible {
  outline: 2.5px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ───────────────────────── الشريط العلوي ───────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--card-line);
  transition: background .35s ease, border-color .35s ease;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 22px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-name {
  font-family: var(--font-display); font-weight: 800; font-size: 21px; letter-spacing: -.4px;
  background: linear-gradient(120deg, var(--gold), var(--gold-soft));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-name em { font-style: normal; font-weight: 600; }

.game-title {
  flex: 1; text-align: center; min-width: 0;
  font-family: var(--font-display); font-weight: 800; font-size: 24px; letter-spacing: -.3px;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

/* زرّ تبديل الثيم (نهار/ليل) — نفس زرّ الرئيسية */
.theme-toggle {
  width: 42px; height: 42px; border-radius: 999px; flex: 0 0 auto;
  border: 1px solid var(--line-2); background: var(--inset); color: var(--gold);
  display: grid; place-items: center; cursor: pointer;
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.3), background .2s, border-color .2s;
}
.theme-toggle:hover { background: var(--inset-hover); transform: rotate(-20deg); }
.theme-toggle span { display: grid; place-items: center; line-height: 0; }
.theme-toggle svg { display: block; }

/* مؤشّر الدور — سداسية بلون الفريق صاحب الدور، والضغط يبدّله */
.turn-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 18px 9px 14px; border: none; cursor: pointer;
  border-radius: 999px;
  font-family: var(--font-display); font-weight: 700; font-size: 14.5px;
  color: var(--on-green); transition: transform .2s, filter .2s;
}
.turn-pill.t1 { background: linear-gradient(135deg, var(--t1), var(--t1-deep)); }
.turn-pill.t2 { background: linear-gradient(135deg, var(--t2), var(--t2-deep)); color: var(--on-clay); }
.turn-pill:hover { transform: translateY(-1px); filter: brightness(1.08); }
.turn-pill .swap-ic { display: grid; place-items: center; opacity: .85; }

/* ───────────────────────── الأزرار ───────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px; border-radius: 999px; border: none; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  transition: transform .18s cubic-bezier(.2, .9, .3, 1.3), box-shadow .15s ease-out, background .15s ease-out, border-color .15s ease-out;
}
.btn-ic { display: grid; place-items: center; }
.btn-gold {
  background: var(--gold-grad); color: var(--on-gold);
  box-shadow: var(--shadow-gold), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.btn-gold:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold-lg), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.btn-gold:disabled {
  background: var(--inset); color: var(--ink-dim);
  box-shadow: none; cursor: not-allowed; opacity: .7;
}
.btn-ghost {
  background: var(--inset); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.btn-ghost:hover { background: var(--accent-wash-2); box-shadow: inset 0 0 0 1px var(--gold); }
.btn-danger { background: var(--clay-wash); color: var(--danger); box-shadow: inset 0 0 0 1px var(--clay-line); }
.btn-danger:hover { background: var(--clay-line); }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-xl { padding: 17px 46px; font-size: 19px; }

/* إظهار/إخفاء عناصر الشريط حسب الطور */
body[data-phase="setup"] .turn-pill,
body[data-phase="setup"] .game-title,
body[data-phase="setup"] #btn-end,
body[data-phase="result"] .turn-pill,
body[data-phase="result"] #btn-end { display: none; }
body[data-phase="setup"] .topbar-inner { justify-content: space-between; }
body[data-phase="setup"] .team-strip,
body[data-phase="result"] .team-strip { display: none; }
/* طورا اللعب: الصفحة عمود بارتفاع الشاشة تماماً — main يتمدد ويتمرّر داخلياً عند الضيق فقط،
   وشريط الفريقين عنصر تدفّق أسفل العمود ثابت الظهور دائماً */
body[data-phase="board"], body[data-phase="question"] {
  height: 100dvh; overflow: hidden; display: flex; flex-direction: column;
}
body[data-phase="board"] main, body[data-phase="question"] main {
  flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column;
}

/* ═══════════════════════ الشاشة 1: اختيار المجالات ═══════════════════════ */
.setup-hero { text-align: center; padding: 42px 20px 8px; }
.setup-hero h1 {
  margin: 0 0 10px; font-weight: 800; font-size: clamp(30px, 4.4vw, 46px); letter-spacing: -.8px;
  color: var(--ink);
}
.setup-hero p { margin: 0; color: var(--ink-dim); font-size: 17.5px; }
.setup-hero strong { color: var(--gold); font-weight: 700; }

.setup-layout {
  max-width: 1280px; margin: 26px auto 0; padding: 0 22px;
  display: flex; gap: 22px; align-items: flex-start;
}

/* ── شريط المختارات (لاصق يمين) ── */
.picks-rail {
  position: sticky; top: 76px; flex: 0 0 188px;
  padding: 14px; border-radius: 22px;
  background: var(--card-grad); border: 1px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.picks-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-display); font-weight: 700; font-size: 14.5px; margin-bottom: 12px;
  color: var(--ink);
}
.picks-count { color: var(--gold); font-size: 15px; letter-spacing: 1px; }
.picks-list {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.picks-list::-webkit-scrollbar { height: 6px; }
.picks-list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
.picks-list::-webkit-scrollbar-track { background: transparent; }
.pick-slot {
  position: relative; height: 64px; border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1.5px var(--line);
  background: var(--inset);
}
.pick-slot.empty::before {
  content: attr(data-n);
  font-family: var(--font-display); font-weight: 800; font-size: 19px; color: var(--ink-dim); opacity: .5;
}
.pick-slot.filled { box-shadow: inset 0 0 0 1.5px var(--line-2); }
.pick-mini { display: flex; align-items: center; gap: 10px; width: 100%; height: 100%; padding: 0 10px; }
.pick-mini .mini-art {
  flex: none; height: 46px; aspect-ratio: 56 / 75; border-radius: 9px; position: relative; overflow: hidden;
  background: #d9e6f3;
  box-shadow: inset 0 0 0 1px rgba(29, 26, 22, .25);
}
.pick-mini .mini-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pick-mini .mini-name {
  flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 700; font-size: 12.5px;
  line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  color: var(--ink);
}
.pick-remove {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center;
  background: var(--clay-wash); color: var(--danger);
  transition: background .15s ease-out, transform .15s ease-out;
}
.pick-remove:hover { background: var(--clay-line); transform: scale(1.1); }

/* ── مساحة المجالات ── */
.cats-area { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 34px; }
.cat-section h2 {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 16px; font-weight: 800; font-size: 22px; letter-spacing: -.3px;
  color: var(--ink);
}
.cat-section h2 .sec-ic { color: var(--gold); display: grid; place-items: center; }
.cat-section h2 .sec-count { font-family: var(--font-body); font-weight: 600; font-size: 13.5px; color: var(--ink-dim); }
.cat-section.newest h2 { color: var(--gold); }
.cats-grid {
  /* بطاقات أكبر (طلب المستخدم): ~205px على الشاشات الواسعة، وتنكمش بتناسب على الضيقة */
  display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 15.5vw, 208px), 1fr));
  gap: 18px;
}

/* بطاقة مجال */
.cat-card {
  position: relative; border: none; padding: 0; cursor: pointer; text-align: inherit;
  border-radius: 18px;
  background: var(--card-grad); box-shadow: inset 0 0 0 1px var(--line);
  display: flex; flex-direction: column;
  transition: transform .18s cubic-bezier(.2, .9, .3, 1.3);
}
/* إشعاع hover مرسوم مسبقاً (نمط F3): ::after يحمل الظلال كلّها بـopacity:0 ويُكشَف
   بـopacity فقط (مركَّب على GPU ⇒ يبدأ في الإطار الأول حتى على Gecko بشاشة كثيفة) —
   كان box-shadow انتقالياً يُعاد رسمه كلَّ إطار. أُزيل overflow:hidden كي لا يُقصّ
   التوهّج الخارجي (آمن: اللوح والاسم والبادج يقصّون أنفسهم بزواياهم الخاصة). */
.cat-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-pop), 0 0 30px -12px var(--gold);
  opacity: 0; transition: opacity .18s ease-out;
}
/* ترقية طبقة الإشعاع عند دخول المؤشّر الشبكة (قبل بلوغ أي بطاقة بعشرات الميلي‑ثوانٍ)
   بدل will-change دائم على 34 طبقة يستنزف ذاكرة GPU للأجهزة الضعيفة */
.cats-grid:hover .cat-card::after { will-change: opacity; }
.cat-card:hover:not(.locked) { transform: translateY(-4px); }
.cat-card:hover:not(.locked)::after { opacity: 1; }
/* لوح صورة المجال — نسبته 56:75 تطابق ملفات الصور تماماً ⇒ cover يعرضها
   كاملة بلا قصّ ولا فراغ (البطاقة يشتقّ ارتفاعها من اللوح + شريط الاسم) */
.cat-art {
  aspect-ratio: 56 / 75; margin: 8px 8px 0; border-radius: 12px; position: relative; overflow: hidden;
  background: #d9e6f3;
  box-shadow: inset 0 0 0 1px rgba(29, 26, 22, .25);
}
.cat-art svg, .cat-art img,
.block-art .art-ic img, .pick-mini .mini-art img {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover;
}
/* جولة 20 (مُصلَح أداءً): هيكل وميض «أثناء التحميل فقط» — الشريط ::before يتحرّك
   بـtransform (مركَّب على GPU) بدل background-position (كان يُعاد رسمه كلَّ إطار)،
   ويُطفأ نهائياً بـ.img-done فور اكتمال الصورة. كان الأنيميشن لا-نهائياً يعمل للأبد
   مغطّىً بالصورة فيُغرِق أنبوب رسم فايرفوكس على الشاشات الكثيفة — وهذا كان سبب
   تأخّر إشعاع البطاقات (قِيس: صفر إطارات لثوانٍ في Gecko، و60fps فور إيقافه). */
.cat-art, .block-art .art-ic, .pick-mini .mini-art { background-color: #e3ebf4; }
.cat-art::before, .block-art .art-ic::before, .pick-mini .mini-art::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -120%; width: 120%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .55) 50%, rgba(255, 255, 255, 0) 70%);
  animation: sj-shimmer 1.3s ease-in-out infinite;
  pointer-events: none;
}
/* نهاية الهيكل: بنفس تخصّص قواعد الشريط أعلاه أو أعلى (درس تخصّص .loaded أدناه) */
.cat-art.img-done::before, .block-art .art-ic.img-done::before,
.pick-mini .mini-art.img-done::before { content: none; }
.cat-art img[data-art], .block-art .art-ic img[data-art], .pick-mini .mini-art img[data-art] {
  opacity: 0; transition: opacity .4s ease;
}
img[data-art].loaded { opacity: 1; }
/* إصلاح تخصّص: قاعدة الحاوية (.block-art .art-ic / .pick-mini .mini-art = 0,3,1) كانت تغلب .loaded
   (0,2,1) فتبقى أغلفة اللوحة والمختارات غير ظاهرة (opacity:0). نرفع تخصّص حالة الظهور لتظهر الصورة. */
.block-art .art-ic img[data-art].loaded,
.pick-mini .mini-art img[data-art].loaded { opacity: 1; }
@keyframes sj-shimmer { from { transform: translateX(0); } to { transform: translateX(200%); } }
@media (prefers-reduced-motion: reduce) {
  .cat-art::before, .block-art .art-ic::before, .pick-mini .mini-art::before { animation: none; }
  img[data-art] { transition: none; }
}
.cat-name {
  margin: 8px; padding: 9px 6px; border-radius: 10px; text-align: center;
  background: var(--gold-grad); color: var(--on-gold);
  font-family: var(--font-display); font-weight: 700; font-size: 14px; line-height: 1.3;
}
.cat-card .sel-badge {
  position: absolute; top: 14px; inset-inline-start: 14px; width: 27px; height: 27px;
  border-radius: 50%; display: none; place-items: center;
  background: var(--gold-grad); color: var(--on-gold);
  box-shadow: var(--shadow-gold);
}
.cat-card.sel { box-shadow: inset 0 0 0 2.5px var(--gold), 0 0 34px -10px var(--gold); }
.cat-card.sel .sel-badge { display: grid; }
.cat-card.locked { filter: grayscale(.9); opacity: .38; cursor: not-allowed; }

/* ═══════════════════════ الشاشة 2: معلومات الفرق ═══════════════════════ */
.teams-section { padding: 60px 22px 80px; }
.teams-card {
  max-width: 780px; margin: 0 auto; padding: 40px clamp(22px, 5vw, 52px) 44px;
  border-radius: 30px; text-align: center;
  background: var(--card-grad); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-pop);
}
.teams-heading { margin: 0 0 26px; font-weight: 800; font-size: 28px; letter-spacing: -.4px; color: var(--ink); }

.field-block { text-align: start; }
.field-block label {
  display: block; margin-bottom: 7px;
  font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--ink-dim);
}
.field {
  width: 100%; padding: 13px 16px; border-radius: 14px;
  background: var(--field); border: 1px solid var(--inset-line);
  color: var(--ink); font-family: var(--font-body); font-weight: 600; font-size: 16px;
  transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
.field::placeholder { color: var(--ink-dim); opacity: .55; }
.field:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--accent-wash-2); }
.field-t1:focus { border-color: var(--t1); box-shadow: 0 0 0 3px var(--t1-line); }
.field-t2:focus { border-color: var(--t2); box-shadow: 0 0 0 3px var(--t2-line); }
.field-game { max-width: 380px; margin: 0 auto 24px; }

.teams-grid {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: end; margin-bottom: 30px;
}
.vs-hex {
  width: 52px; height: 58px; margin-bottom: 2px; clip-path: var(--hex-tall);
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--gold-bright), var(--gold)); color: var(--on-gold);
  font-family: var(--font-display); font-weight: 800; font-size: 16px; letter-spacing: 1px;
}

.helps-intro { margin-bottom: 32px; }
.helps-intro h3 {
  margin: 0 0 14px; font-weight: 700; font-size: 17px; color: var(--ink);
  display: flex; flex-direction: column; gap: 3px;
}
.helps-intro h3 span { font-family: var(--font-body); font-weight: 500; font-size: 13px; color: var(--ink-dim); }
.helps-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.help-card {
  padding: 16px 10px 14px; border-radius: 16px;
  background: var(--card-grad-soft); box-shadow: inset 0 0 0 1px var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 9px;
}
.help-card .help-ic {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--gold);
}
.help-card .help-name { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink); }
.help-card .help-desc { font-size: 12px; color: var(--ink-dim); line-height: 1.6; }

.start-hint { margin: 14px 0 0; font-size: 13.5px; color: var(--ink-dim); }
.start-hint.ready { color: var(--t1-glow); }

/* ═══════════════════════ الشاشة 3: اللوحة (تملأ الشاشة بالضبط) ═══════════════════════ */
#view-board { flex: 1; display: flex; min-height: 0; }
#view-board[hidden] { display: none; }
.board-grid {
  flex: 1; min-height: 0; width: 100%; max-width: 1560px; margin: 0 auto;
  padding: clamp(10px, 1.6vh, 18px) 20px clamp(12px, 1.8vh, 20px);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr);
  gap: clamp(10px, 1.6vh, 18px);
}
.cat-block {
  min-height: 0; min-width: 0;
  /* صفر فجوة: أعمدة الأرقام تلامس حافتي الصورة تماماً (كتلة واحدة ملحومة) */
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 0; align-items: stretch;
  padding: clamp(10px, 1.4vh, 16px); border-radius: 22px;
  background: var(--card-grad-soft); border: 1px solid var(--line);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.vals-col {
  display: flex; flex-direction: column; justify-content: center;
  gap: clamp(6px, 1vh, 10px); min-width: 0; min-height: 0; height: 100%;
}
.block-art {
  /* قيادة بالعرض (المشتق من ارتفاع صفّ اللوحة عبر vh، بسقف يعادل 250px السابقة):
     لوح الصورة 56:75 بالضبط = نسبة الملفات ⇒ عرض كامل بلا قصّ ولا فراغ.
     (قيادة بالارتفاع مستحيلة: العرض المنقول من نسبة الابن لا يغذّي قياس الحاوية في flex) */
  align-self: center;
  /* الصورة أبرز عنصر في البطاقة — السقف رُفع 205→240 (محسوب: يبقى ضمن ارتفاع الصف حتى 1080) */
  width: clamp(96px, 37vh - 104px, 240px);
  border-radius: 13px; overflow: hidden;
  display: flex; flex-direction: column; position: relative;
  background: #d9e6f3;
  box-shadow: inset 0 0 0 1px rgba(29, 26, 22, .25);
}
.block-art .art-ic { aspect-ratio: 56 / 75; position: relative; overflow: hidden; }
.block-art .art-ic svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.block-art .art-name {
  padding: 6px 4px; text-align: center;
  background: var(--gold-grad); color: var(--on-gold);
  font-family: var(--font-display); font-weight: 700; font-size: 12px; line-height: 1.25;
}

/* زر القيمة — كبسولة نظيفة (أُلغي الشكل السداسي)؛ عنصر ثانوي لا ينافس الصورة */
.hexcell {
  position: relative; border: none; cursor: pointer;
  flex: 1 1 0; min-height: 30px; max-height: 58px; width: 100%; border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--hairline);
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(14px, .7vw + .6vh, 19px); letter-spacing: .5px;
  color: var(--gold);
  transition: background .15s ease-out, color .15s ease-out, transform .15s ease-out, box-shadow .15s ease-out;
}
.hexcell:hover:not(:disabled) {
  background: var(--inset-hover); color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold), 0 0 20px -10px var(--gold);
  transform: translateY(-1px);
}
.hexcell:focus-visible { outline: none; box-shadow: inset 0 0 0 2.5px var(--gold); }
/* لحام الكبسولة بالصورة: الطرف المواجه لها مستوٍ (RTL: العمود الأول يمين الصورة والأخير يسارها) */
.cat-block .vals-col:first-child .hexcell { border-radius: 0 999px 999px 0; }
.cat-block .vals-col:last-child .hexcell { border-radius: 999px 0 0 999px; }
.hexcell:disabled { cursor: default; }
/* سؤال محسوم: باهت، مع خيط بلون الفريق الآخذ */
.hexcell.taken { opacity: .4; color: var(--ink-dim); background: var(--inset); }
.hexcell.taken-t1 { box-shadow: inset 0 0 0 1.5px var(--t1); }
.hexcell.taken-t2 { box-shadow: inset 0 0 0 1.5px var(--t2); }
.hexcell.taken-none { box-shadow: inset 0 0 0 1.5px var(--line); }

/* ═══════════════════════ شريط الفريقين ═══════════════════════ */
.team-strip {
  flex-shrink: 0;
  display: flex; align-items: stretch; justify-content: space-between; gap: 14px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: var(--header-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--card-line);
}
.strip-brand {
  align-self: center; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-family: var(--font-display); font-weight: 800; font-size: 13px; opacity: 1;
}
.strip-brand span {
  background: linear-gradient(120deg, var(--gold), var(--gold-soft));
  -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: -.3px;
}
/* لوحا الفريقين: سطح داكن موحّد بلا ألوان فريق — صاحب الدور يتميّز بلمسة accent فقط */
.team-panel {
  flex: 0 1 430px; min-width: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; border-radius: 16px;
  background: var(--surface-1); border: 1px solid var(--hairline);
  transition: box-shadow .25s, border-color .25s;
}
.team-panel.team-2 { flex-direction: row-reverse; text-align: end; }
.team-panel.turn {
  border-color: var(--gold);
  box-shadow: 0 0 24px -10px var(--gold);
}

.team-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.team-name {
  font-family: var(--font-display); font-weight: 700; font-size: 15.5px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px;
}
.team-tag { font-size: 11px; color: var(--ink-dim); }

.score-box { display: flex; align-items: center; gap: 8px; }
.score-val {
  min-width: 74px; text-align: center; color: var(--gold);
  font-family: var(--font-display); font-weight: 800; font-size: 27px; line-height: 1;
}
.score-btn {
  width: 27px; height: 27px; border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center;
  background: var(--inset); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink);
  transition: background .15s ease-out, transform .15s ease-out;
}
.score-btn:hover { background: var(--accent-wash-2); transform: scale(1.12); }

.helps-row { display: flex; gap: 8px; flex: 0 0 auto; }
.help-dot {
  position: relative; width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center;
  background: var(--inset); box-shadow: inset 0 0 0 1.5px var(--line-2); color: var(--ink);
  transition: background .15s ease-out, color .15s ease-out, transform .15s ease-out, opacity .15s ease-out;
}
.help-dot:hover:not(.used) { background: var(--accent-wash-2); color: var(--gold); transform: translateY(-2px); }
.help-dot.used { opacity: .28; cursor: default; }
.help-dot.used::after {
  content: ""; position: absolute; inset: 8px; pointer-events: none;
  background: linear-gradient(45deg, transparent 46%, currentColor 46%, currentColor 54%, transparent 54%);
  border-radius: 50%;
}

/* ═══════════════════════ الشاشة 4: السؤال ═══════════════════════ */
#view-question { flex: 1; display: flex; min-height: 0; }
#view-question[hidden] { display: none; }
.q-wrap { margin: auto; width: 100%; max-width: 1080px; padding: 44px 24px 46px; }
.q-frame {
  position: relative; border-radius: 30px; border: 2px solid var(--gold);
  background: var(--card-grad);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-pop), 0 0 60px -28px var(--gold);
  padding: 66px clamp(22px, 5vw, 56px) 74px;
  min-height: min(430px, 56vh);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

/* المؤقّت — يعتلي منتصف الإطار */
.q-timer {
  position: absolute; top: -27px; inset-inline: 0; margin: auto; width: max-content;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px;
  background: var(--inset);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-card);
}
.q-timer .time {
  min-width: 86px; text-align: center; direction: ltr; color: var(--ink);
  font-family: var(--font-display); font-weight: 800; font-size: 23px; letter-spacing: 1px;
}
.q-timer .time.running { color: var(--gold); }
.timer-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center;
  background: var(--accent-wash); color: var(--gold);
  transition: background .15s ease-out, transform .15s ease-out;
}
.timer-btn:hover { background: var(--accent-wash-2); transform: scale(1.08); }

/* شارة قيمة السؤال — كتف الإطار الأيمن */
.q-value {
  position: absolute; top: -19px; inset-inline-start: 34px;
  padding: 8px 18px; clip-path: var(--hex-wide);
  background: var(--inset); box-shadow: inset 0 0 0 1.5px var(--line-2);
  font-family: var(--font-display); font-weight: 800; font-size: 16px; color: var(--gold);
}
/* شارة المجال — أسفل يمين */
.q-cat {
  position: absolute; bottom: -18px; inset-inline-start: 34px;
  padding: 8px 20px; border-radius: 12px;
  background: var(--gold-grad); color: var(--on-gold);
  font-family: var(--font-display); font-weight: 700; font-size: 14.5px;
  box-shadow: var(--shadow-gold);
}
/* زر الإجابة — أسفل يسار */
.q-answer-btn { position: absolute; bottom: -25px; inset-inline-end: 34px; }

.q-text {
  margin: 0; text-align: center; max-width: 780px; color: var(--ink);
  font-family: var(--font-body); font-weight: 700; font-size: clamp(21px, 3vw, 30px); line-height: 1.75;
}
.q-notes {
  position: absolute; top: 16px; inset-inline-end: 20px;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.q-help-note {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--gold);
}
/* صورة السؤال/الإجابة: حاوية تكيّفية تلتفّ على الصورة — الصغيرة بحجمها الطبيعي
   موسّطة (لا نفخ ولا ضبابية)، والكبيرة تُصغَّر لتُحتوى (contain — صفر تمطيط)،
   وwidth/height على <img> تحجز المساحة قبل التحميل (لا قفزات تخطيط).
   السقف مقيّد بالشاشة كي لا يدفع زرّي الإطار خلف شريط الفريقين. */
.q-image {
  width: fit-content; max-width: 82%;
  margin: 26px auto 0; border-radius: 16px; overflow: hidden;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
}
/* رسالة فشل تحميل الكتالوج (لا شبكة/خادم) — مكان شبكة المجالات */
.load-error {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 46px 18px; text-align: center; color: var(--ink-dim);
  font-weight: 600; border: 1px dashed var(--line-2); border-radius: 16px;
}

/* الصورة الحقيقية من الخادم (WebP مقصوصة وقت الرفع): أبعاد طبيعية حتى السقف فقط */
.q-image.has-img img {
  width: auto; height: auto;
  max-width: 100%; max-height: min(270px, 32vh);
  object-fit: contain; display: block; border-radius: inherit;
}
/* حجم عرض مخصّص لكل سؤال (طبقة عرض فوق تطبيع sharp): صندوق بنسبة الصورة نفسها
   (--sjar) مضروباً بعامل المؤلّف (--sjimg) — contain بلا أي تمطيط، وأقصى العامل
   1 يساوي السقف الآمن الحالي نفسه فلا تتداخل الصورة مع النص/المؤقّت/الشارة أبداً. */
.q-image.has-img.sized {
  width: auto;
  height: calc(min(270px, 32vh) * var(--sjimg, 1));
  aspect-ratio: var(--sjar, auto);
  max-width: calc(82% * var(--sjimg, 1));
}
.q-image.has-img.sized img {
  width: 100%; height: 100%;
  max-width: none; max-height: none;
  object-fit: contain;
}

/* زر مقطع السؤال الصوتي (يظهر وقت السؤال فقط) */
.q-audio-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 22px auto 0; padding: 10px 24px;
  border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--accent-wash); color: var(--gold);
  font: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.q-audio-btn:hover { background: var(--accent-wash-2); }
.q-audio-btn.playing { border-color: var(--gold); background: var(--accent-wash-2); }

/* حالة الإجابة */
.q-answer-label {
  font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink-dim);
  margin: 0 0 12px;
}
.q-answer-text {
  margin: 0; text-align: center; max-width: 760px;
  font-family: var(--font-display); font-weight: 800; font-size: clamp(26px, 4vw, 42px); line-height: 1.5;
  background: linear-gradient(120deg, var(--gold-soft), var(--gold) 55%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.award-block { margin-top: 38px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.award-title { font-size: 14.5px; color: var(--ink-dim); font-weight: 600; }
.award-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn-award-t1 {
  background: linear-gradient(135deg, var(--t1), var(--t1-deep)); color: var(--on-green);
  box-shadow: 0 10px 24px -8px var(--t1-deep);
}
.btn-award-t1:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -8px var(--t1-deep); }
.btn-award-t2 {
  background: linear-gradient(135deg, var(--t2), var(--t2-deep)); color: var(--on-clay);
  box-shadow: 0 10px 24px -8px var(--t2-deep);
}
.btn-award-t2:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -8px var(--t2-deep); }

/* ═══════════════════════ الشاشة 5: النتيجة ═══════════════════════ */
.result-card {
  max-width: 640px; margin: 70px auto; padding: 52px clamp(24px, 6vw, 60px);
  border-radius: 32px; text-align: center;
  background: var(--card-grad); border: 1px solid var(--line-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-pop), 0 0 70px -26px var(--gold);
}
.result-trophy {
  width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 24px;
  display: grid; place-items: center;
  background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--gold);
}
.result-kicker { margin: 0 0 6px; font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink-dim); }
.result-winner { margin: 0 0 26px; font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 5vw, 44px); letter-spacing: -.6px; color: var(--ink); }
.result-winner.w1 { color: var(--t1-glow); }
.result-winner.w2 { color: var(--t2-glow); }
.result-winner.tie {
  background: linear-gradient(120deg, var(--gold-soft), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.result-scores { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 36px; flex-wrap: wrap; }
.result-team { padding: 14px 22px; border-radius: 18px; min-width: 150px; }
.result-team.rt1 { background: linear-gradient(165deg, var(--t1-wash), transparent); border: 1px solid var(--t1-line); }
.result-team.rt2 { background: linear-gradient(165deg, var(--t2-wash), transparent); border: 1px solid var(--t2-line); }
.result-team .rt-name { font-family: var(--font-display); font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.result-team.rt1 .rt-name { color: var(--t1-glow); }
.result-team.rt2 .rt-name { color: var(--t2-glow); }
.result-team .rt-score { font-family: var(--font-display); font-weight: 800; font-size: 34px; line-height: 1; color: var(--ink); }
.result-vs { font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--ink-dim); }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ═══════════════════════ حوار التأكيد ═══════════════════════ */
.dlg-scrim {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: var(--scrim); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
/* ‏display:grid أعلاه يتغلّب على سمة hidden — إعادة الإخفاء صراحةً */
.dlg-scrim[hidden] { display: none; }
.dlg {
  width: min(420px, 100%); padding: 26px 24px 20px; border-radius: 22px;
  background: var(--card-grad);
  border: 1px solid var(--card-line); box-shadow: var(--shadow-pop);
}
.dlg p { margin: 0 0 20px; font-size: 16.5px; font-weight: 600; line-height: 1.8; text-align: center; color: var(--ink); }
.dlg-actions { display: flex; gap: 10px; justify-content: center; }

/* ═══════════════════════ تكبير صورة السؤال/الإجابة ═══════════════════════ */
.q-image.has-img { cursor: zoom-in; }
.imgzoom {
  position: fixed; inset: 0; z-index: 110;
  display: flex; align-items: center; justify-content: center; padding: 12px;
  /* حجاب داكن رخيص شبه مصمت («لا يظهر شيء آخر») — لا backdrop-filter إطلاقاً (درس F1) */
  background: rgba(14, 10, 6, .96);
  cursor: zoom-out;
  opacity: 0; transition: opacity .15s ease-out;
}
.imgzoom.open { opacity: 1; }
.imgzoom[hidden] { display: none; }
.imgzoom-pic {
  max-width: 96vw;
  max-height: 90vh; max-height: 92dvh;
  width: auto; height: auto; object-fit: contain; border-radius: 12px;
  /* حركة الدخول FLIP تضبط transform سطريّاً — transform/opacity فقط (مركَّبة) */
  transition: transform .18s cubic-bezier(.2, 0, 0, 1);
  will-change: transform;
}
.imgzoom-close {
  position: fixed; top: 14px; inset-inline-end: 14px;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--inset); color: var(--ink); font-size: 19px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.imgzoom-close:hover { background: var(--inset-hover); }
/* المؤقّت الحيّ نفسه (نفس العقدة التي تحدّثها نبضة العدّ) يُرفع فوق الحجاب — لا نسخة.
   مصيدتا أَسْرٍ تُفكّان أثناء التكبير فقط (فحص elementFromPoint كشفهما):
   1) backdrop-filter على إطار السؤال = كتلة احتواء تأسر position:fixed لأحفاده —
      يُعطَّل مؤقتاً (الإطار مغطّى بالحجاب أصلاً، صفر أثر مرئي).
   2) ‏main ذو z-index:1 = سياق تراصّ يحبس z-index المؤقّت تحت الحجاب (110 على body) —
      يصير auto مؤقتاً (يبقى فوق bg-hex بترتيب المستند، لا تغيّر بصرياً). */
body.qzoom .q-frame { backdrop-filter: none; -webkit-backdrop-filter: none; }
body.qzoom main { z-index: auto; }
body.qzoom .q-timer { position: fixed; top: 14px; z-index: 111; }
/* مكافئ F1 دفاعاً عميقاً: أي هيكل تحميل ما زال يومض خلف الحجاب يتجمّد أثناء التكبير */
body.qzoom .cat-art::before, body.qzoom .block-art .art-ic::before,
body.qzoom .pick-mini .mini-art::before { animation-play-state: paused; }

/* ═══════════════════════ متجاوب ═══════════════════════ */
@media (max-width: 1100px) {
  .board-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(3, 1fr); }
  /* ثلاثة صفوف بدل صفّين ⇒ حصة الصف من الارتفاع أصغر — نفس اشتقاق عرض اللوح مُعايَراً */
  .block-art { width: clamp(96px, 25vh - 92px, 240px); }
}
@media (max-width: 900px) {
  /* شريط المختارات يتحوّل شريطاً أفقياً لاصقاً أعلى المحتوى */
  .setup-layout { flex-direction: column; align-items: stretch; }
  .picks-rail {
    position: sticky; top: 62px; z-index: 30; flex: none; width: 100%;
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  }
  .picks-head { margin-bottom: 0; flex: 0 0 auto; flex-direction: column; gap: 2px; align-items: flex-start; }
  .picks-list { flex-direction: row; flex: 1; min-width: 0; overflow-x: auto; gap: 8px; padding-bottom: 2px; }
  .pick-slot { flex: 0 0 118px; height: 52px; }
  .pick-mini { padding: 0 7px; gap: 7px; }
  .pick-mini .mini-art { height: 36px; }
  .pick-mini .mini-name { font-size: 11px; -webkit-line-clamp: 2; }
  .teams-grid { grid-template-columns: 1fr; gap: 14px; }
  .vs-hex { margin: 0 auto; }
  .helps-cards { grid-template-columns: 1fr; }
  .game-title { font-size: 18px; }
  .turn-pill { font-size: 12.5px; padding: 8px 14px 8px 11px; }
  /* الشريط السفلي: لا يتّسع صفّان متجاوران تحت 900 ⇒ فريق فوق فريق */
  .team-strip { flex-direction: column; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .strip-brand { display: none; }
  .team-panel { flex: none; width: 100%; padding: 8px 12px; }
}
@media (max-width: 720px) {
  /* الجوال الطولي: 36 خلية لا تُقرأ بلا تمرير — تكديس يتمرّر داخل main والشريط ظاهر دائماً */
  .board-grid { grid-template-columns: 1fr; grid-template-rows: none; gap: 13px; }
  .cat-block { grid-template-columns: 1fr; justify-items: center; gap: 12px; }
  .cat-block .block-art { height: auto; width: 132px; min-height: 0; order: -1; }
  .vals-col { flex-direction: row; width: 100%; height: auto; }
  /* الأعمدة تصير صفوفاً أفقية تحت الصورة ⇒ لا لحام جانبي — كبسولة كاملة */
  .vals-col .hexcell, .cat-block .vals-col:first-child .hexcell,
  .cat-block .vals-col:last-child .hexcell { flex: 1; min-height: 44px; max-height: 54px; border-radius: 999px; }
  .score-val { min-width: 58px; font-size: 22px; }
  .help-dot { width: 34px; height: 34px; }
  .team-name { max-width: 130px; font-size: 13.5px; }
  .q-wrap { padding: 40px 14px 44px; }
  .q-frame { padding: 56px 18px 70px; min-height: 340px; }
  .q-value { inset-inline-start: 18px; }
  .q-cat { inset-inline-start: 18px; font-size: 13px; padding: 7px 14px; }
  .q-answer-btn { inset-inline-end: 18px; }
  .topbar-inner { padding: 10px 12px; gap: 9px; }
  .brand-name { display: none; }
  #btn-end { padding: 8px 11px; font-size: 12.5px; }
  #btn-exit { padding: 8px 11px; font-size: 12.5px; }
}

/* ═══════════════════════ تفضيلات الحركة ═══════════════════════ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ═══════════════════ إشعار عابر (رصيد الجولات بعد البدء — 4-ب) ═══════════════════ */
/* position:fixed على body مباشرة (مرساه المنفذ لا تدفّق الصفحة) — لا مساس بقواعد التجاوب/القصّ */
.sj-notice {
  position: fixed; inset-inline: 0; bottom: calc(18px + env(safe-area-inset-bottom));
  margin-inline: auto; width: max-content; max-width: 88vw;
  background: var(--card, #2c2233); color: var(--ink, #f7ecdc);
  border: 1px solid var(--gold, #f2b337); border-radius: 999px;
  padding: 10px 22px; font-weight: 700; font-size: 14px; text-align: center;
  z-index: 90; box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(10px);
  transition: opacity .25s, transform .25s; pointer-events: none;
}
.sj-notice.show { opacity: 1; transform: translateY(0); }

/* ═══════════════════ جولة 24: «وقت لكل فريق» + المساعدات المحروسة ═══════════════════ */
/* كتلة الإعداد: مفتاح تبديل والعنوان بجانبه (سطر واحد — ج27) + حقلا وقتَي الدور (60/30 افتراضاً) */
.timer-setup {
  margin: 22px 0 26px; padding: 16px 18px; border-radius: 16px;
  background: var(--inset); border: 1px solid var(--hairline);
}
.timer-head { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.timer-head input { position: absolute; opacity: 0; pointer-events: none; }
.timer-track {
  flex: 0 0 auto; width: 44px; height: 24px; border-radius: 999px; position: relative;
  background: var(--surface-1); box-shadow: inset 0 0 0 1.5px var(--line-2);
  transition: background .2s ease-out;
}
.timer-track::after { /* المقبض — transform فقط (دروس F) */
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--ink-dim);
  transition: transform .2s ease-out, background .2s ease-out;
}
.timer-head input:checked + .timer-track { background: var(--accent-wash-2); box-shadow: inset 0 0 0 1.5px var(--gold); }
.timer-head input:checked + .timer-track::after { transform: translateX(-20px); background: var(--gold); }
.timer-head input:focus-visible + .timer-track { outline: 2.5px solid var(--gold); outline-offset: 2px; }
/* العنوان بجانب المفتاح مباشرةً بخط أكبر قليلاً (ج27: حُذف السطر الشارح) — قياس عنوان «وسائل المساعدة» نفسه */
.timer-title { font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--ink); }
.timer-fields { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.timer-fields .tf-block { flex: 1 1 150px; display: flex; flex-direction: column; gap: 6px; }
.timer-fields label { font-size: 13px; font-weight: 700; color: var(--ink-dim); }
.timer-fields input { direction: ltr; text-align: center; font-family: var(--font-display); font-weight: 800; }

/* مؤقّت السؤال في وضع العدّ التنازلي: اسم الفريق بلونه، ودرجة إنذار تحت 10 ثوانٍ */
.q-timer.countdown .tm-team {
  max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 13.5px;
}
.q-timer.countdown.tm-t1 .tm-team { background: var(--t1-wash); color: var(--t1-glow); box-shadow: inset 0 0 0 1px var(--t1-line); }
.q-timer.countdown.tm-t2 .tm-team { background: var(--t2-wash); color: var(--t2-glow); box-shadow: inset 0 0 0 1px var(--t2-line); }
.q-timer.countdown.tm-t1 .time.running { color: var(--t1-glow); }
.q-timer.countdown.tm-t2 .time.running { color: var(--t2-glow); }
.q-timer.countdown.low .time { color: var(--danger); animation: tickPulse 1s ease-in-out infinite; }
@keyframes tickPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } } /* transform فقط */

/* نقاط المساعدات: غير صاحب الدور معتَّم، والمسلَّحة للسؤال (دبل/جاوبين) بحلقة ذهبيّة */
.help-dot.na { opacity: .45; }
.help-dot.armed { box-shadow: inset 0 0 0 2px var(--gold); color: var(--gold); background: var(--accent-wash-2); }

/* رسالة انتهاء وقت الفريق + نافذة الاتصال بصديق — على أساس .dlg بدخول transform/opacity */
#texp .dlg, #cf .dlg { text-align: center; animation: dlgPop .22s ease-out; }
@keyframes dlgPop { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
.texp-ic, .cf-ic {
  width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-wash); color: var(--gold); box-shadow: inset 0 0 0 1.5px var(--line-2);
}
#texp h3, #cf h3 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 800; font-size: 21px; color: var(--ink); }
#texp p, #cf .cf-team { margin: 0 0 18px; font-size: 15.5px; font-weight: 600; line-height: 1.8; color: var(--ink-dim); }
.texp-team { font-family: var(--font-display); }
.texp-team.t1 { color: var(--t1-glow); }
.texp-team.t2 { color: var(--t2-glow); }
.cf-clock {
  direction: ltr; margin: 0 auto 18px; width: max-content;
  font-family: var(--font-display); font-weight: 800; font-size: 44px; letter-spacing: 2px; color: var(--gold);
}
.cf-clock.low { color: var(--danger); animation: tickPulse 1s ease-in-out infinite; }
.cf-clock.done { color: var(--ink-dim); }
