/* ────────────────────────────────────────────────────────────
 * multiplayer.css — كل ما هو جديد في النسخة المتعددة
 * يعتمد على متغيّرات original.css (--gold, --card, --deep …)
 * فتبقى الهوية البصرية واحدة تماماً.
 * ──────────────────────────────────────────────────────────── */

/* ── قاعدة التخطيط الجديدة ──────────────────────────────────
 * الأصل كان يستخدم min-height:100vh + تمرير.
 * هنا: كل شاشة = صندوق بارتفاع الشاشة بالضبط، والمحتوى يتقلّص
 * ليملأها بلا تمرير — عمودياً وأفقياً على السواء.
 * ──────────────────────────────────────────────────────────── */
.mp-screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: calc(10px + env(safe-area-inset-top)) 14px
           calc(10px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  overflow: hidden;
  transition: bottom .18s ease;
}
.mp-screen.active { display: flex; animation: screenIn .26s cubic-bezier(.22, .61, .36, 1); }
@media (prefers-reduced-motion: reduce) { .mp-screen.active { animation: none; } }
/* لوحة المفاتيح مفتوحة (iOS): تنكمش الشاشة فوقها فيظهر الحقل/الزرّ المخفيّ.
   المناطق القابلة للتمرير تتكفّل بالباقي، ولا حاجة لهامشٍ سفليٍّ حينها. */
:root.kbd-open .mp-screen {
  bottom: var(--kbd, 0);
  padding-bottom: 8px;
}
/* نفس المبدأ للأوراق المستقلّة (ليست .mp-screen): الدردشة وأوراق .inst
   (الدعوة/النجدة/التأكيد) تنكمش فوق كيبورد iOS فيظهر الحقل/زرّ الإرسال. */
:root.kbd-open .chat-sheet { bottom: var(--kbd, 0); }
:root.kbd-open .inst { bottom: var(--kbd, 0); }

/* المنطقة المرنة: تأخذ ما تبقّى وتُمرّر داخلياً فقط عند الضرورة القصوى */
.mp-flex { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.mp-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ── شاشة الدخول ────────────────────────────────────────────── */
/* شاشة الدخول تُمرَّر إن لم يتّسع المحتوى (لوحة المفاتيح مفتوحة أو شاشة
   قصيرة/أفقيّة) — فلا يختفي زرّ «دخول» خلف لوحة المفاتيح فيتعذّر الدخول.
   الهوامش التلقائية تتوسّط عند الاتّساع وتؤول إلى صفرٍ عند الفيض (بلا قصّ). */
#screen-auth { overflow-y: auto; }
.auth-wrap {
  margin: auto;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.auth-logo { font-size: clamp(34px, 9vh, 60px); line-height: 1; }
.auth-title {
  font-family: 'Amiri', serif;
  font-size: clamp(24px, 5vh, 38px);
  font-weight: 700;
  color: var(--gold);
}
.auth-sub { font-size: 13px; color: var(--text-dim); }

.pin-boxes { display: flex; gap: 10px; justify-content: center; direction: ltr; }
.pin-box {
  width: 52px; height: 60px;
  border-radius: 14px;
  background: var(--dark);
  border: 2px solid rgba(201,151,42,.3);
  color: var(--gold);
  font-size: 26px; font-weight: 900;
  text-align: center;
  transition: border-color .15s, transform .1s;
}
.pin-box:focus {
  outline: none;
  border-color: var(--gold);
  transform: scale(1.06);
  box-shadow: 0 0 0 3px rgba(201,151,42,.18);
}
.pin-boxes.shake { animation: shakeX .4s; }

.auth-tabs { display: flex; gap: 8px; }
.auth-tab {
  flex: 1;
  padding: 11px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid rgba(201,151,42,.25);
  color: var(--text-dim);
  font-family: inherit; font-weight: 700; font-size: 14px;
  cursor: pointer;
}
.auth-tab.on { background: rgba(201,151,42,.2); border-color: var(--gold); color: var(--gold-light); }
.auth-err { min-height: 20px; font-size: 13px; font-weight: 700; color: var(--no-tx); }

/* ── شاشة اللوبي ────────────────────────────────────────────── */
.room-code-box {
  background: linear-gradient(145deg, var(--card), var(--card2));
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  flex-shrink: 0;
}
.room-code {
  font-family: 'Amiri', serif;
  font-size: clamp(32px, 8vh, 54px);
  font-weight: 900;
  color: var(--gold-light);
  letter-spacing: 10px;
  direction: ltr;
  text-shadow: 0 2px 20px rgba(201,151,42,.4);
}
.room-hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.lobby-players {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-content: flex-start; justify-content: center;
  padding: 4px;
}
.lp-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(201,151,42,.1);
  border: 1.5px solid rgba(201,151,42,.35);
  border-radius: 30px;
  padding: 7px 14px 7px 9px;
  animation: chipPop .3s cubic-bezier(.34,1.56,.64,1);
}
.lp-chip.host { border-color: var(--gold); background: rgba(201,151,42,.2); }
.lp-chip.off  { opacity: .45; filter: grayscale(.7); }
.lp-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 14px; color: #fff; flex-shrink: 0;
}
.lp-avatar.male   { background: rgba(59,130,206,.95); }
.lp-avatar.female { background: rgba(199,125,174,.98); }
.lp-name { font-weight: 700; font-size: 14px; color: var(--text); white-space: nowrap; }
.lp-tag  { font-size: 10px; color: var(--gold); }

/* ── حالة الاتصال ───────────────────────────────────────────── */
#conn-dot {
  position: fixed;
  top: calc(6px + env(safe-area-inset-top));
  inset-inline-start: 8px;
  z-index: 500;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green-light);
  transition: background .3s;
  pointer-events: none;
}
#conn-dot.off  { background: var(--crimson-light); animation: qhudPulse .8s infinite; }
#conn-dot.wait { background: var(--gold); animation: qhudPulse 1.2s infinite; }

/* ── وضع القراءة فقط (لست صاحب الدور) ──────────────────────── */
.readonly .opt,
.readonly .vbtn,
.readonly .water-opt {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(.35);
}
.spectator-banner {
  background: rgba(184,134,11,.12);
  border: 1px dashed rgba(184,134,11,.45);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-light);
  flex-shrink: 0;
}

/* ── لوحة النقاط الحية ──────────────────────────────────────── */
.live-scores { display: flex; gap: 6px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.live-scores::-webkit-scrollbar { display: none; }
.ls-chip {
  flex-shrink: 0;
  background: var(--dark);
  border: 1px solid rgba(201,151,42,.25);
  border-radius: 8px;
  padding: 4px 11px;
  font-size: 12px;
  white-space: nowrap;
}
.ls-chip b { color: var(--gold); font-weight: 900; }
.ls-chip.you { border-color: var(--gold); background: rgba(201,151,42,.15); }
.ls-chip.actor { border-color: var(--green-light); }

/* ── قائمة الألعاب ──────────────────────────────────────────── */
.game-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  align-content: start;
}
.game-tile {
  background: linear-gradient(160deg, var(--card), var(--card2));
  border: 1px solid rgba(201,151,42,.25);
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: transform .12s, border-color .2s;
}
.game-tile:active { transform: scale(.97); border-color: var(--gold); }
.game-tile.locked { opacity: .4; pointer-events: none; }
/* جماعيّةٌ معطّلةٌ في اللعب الفرديّ: باهتةٌ لكن تبقى قابلةً للنقر (تُظهر رسالةً لطيفة) */
.game-tile.needs-players { position: relative; }
.game-tile.needs-players .gt-ico { filter: grayscale(.45) opacity(.75); }
.game-tile.needs-players .gt-name { color: var(--text-dim); }
.game-tile.needs-players .gt-desc { color: var(--gold-dim); font-weight: 700; }
.game-tile .gt-badge {
  position: absolute; top: 7px; inset-inline-start: 7px;
  background: rgba(201,151,42,.92); color: #2a1d04;
  font-weight: 800; font-size: 10px; border-radius: 999px; padding: 2px 7px;
  font-variant-numeric: tabular-nums; box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.gt-ico  { font-size: 32px; }
.gt-name { font-weight: 800; font-size: 14px; margin-top: 6px; color: var(--text); }
.gt-desc { font-size: 11px; color: var(--text-dim); margin-top: 3px; line-height: 1.5; }

/* ── السجل ──────────────────────────────────────────────────── */
.hist-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid rgba(184,134,11,.18);
  border-radius: 12px;
  padding: 10px 12px;
}
.hist-ico  { font-size: 22px; flex-shrink: 0; }
.hist-main { flex: 1; min-width: 0; }
.hist-title{ font-weight: 700; font-size: 14px; color: var(--text); }
.hist-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.hist-pts  { font-weight: 900; color: var(--gold); flex-shrink: 0; }
.hist-pts.win { color: var(--green-light); }

/* ── الوضع الأفقي: نفس فلسفة الشريط الجانبي في ملفك ────────── */
@media (orientation: landscape) and (min-height: 320px) {
  .auth-wrap { max-width: 420px; }

  /* اللوبي: الرمز يميناً واللاعبون يساراً — بلا تمرير.
     ‹›  المحدّد المباشر ضروري: بطاقة اللاعبين نفسها تحمل class="mp-flex"
     أيضاً، فلو استعملنا نسَباً غير مباشر لتحوّلت هي أيضاً إلى شبكة
     وانضغطت رقائق اللاعبين في شريط ضيّق. */
  #screen-lobby > .mp-flex {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 12px 18px;
    align-content: stretch;
  }
  #screen-lobby .lobby-left  { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
  #screen-lobby .lobby-right { min-height: 0; display: flex; flex-direction: column; }

  /* اللعب: السؤال يميناً والخيارات شبكة يساراً */
  #screen-play .play-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
    align-items: start;
  }
  #screen-play .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  #screen-play .q-text { font-size: clamp(16px, 3.4vh, 28px); }
  #screen-play .opt    { font-size: clamp(13px, 2.2vh, 19px); padding: clamp(8px, 1.6vh, 16px); }

  .game-list { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* الأفقي القصير (جوال مقلوب): تقليص أشد */
@media (orientation: landscape) and (max-height: 430px) {
  .auth-logo  { font-size: 30px; }
  .auth-title { font-size: 22px; }
  .auth-sub   { display: none; }
  .pin-box    { width: 44px; height: 48px; font-size: 22px; }
  .room-code  { font-size: 30px; letter-spacing: 6px; }
  .gt-desc    { display: none; }
}

/* ── تثبيت التطبيق ──────────────────────────────────────────── */
.inst {
  /* فوق شريط الاختبار (z500) وزرّ النجدة (z720) — حوارٌ نمطيٌّ يعلو كلّ شيء.
     كان z420 فيظهر شريط الاختبار فوق خلفيّة الحوار (game-setup/qr). */
  position: fixed; inset: 0; z-index: 730;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center;
  /* نراعي المنطقة الآمنة السفلى على iOS كي لا يلامس الصندوق مؤشّر الهوم */
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  animation: fadeIn .25s;
}
.inst.mp-hidden { display: none; }
.inst-box {
  background: var(--card); border: 1px solid rgba(201,151,42,.4);
  border-radius: 20px; padding: 20px 18px;
  width: 100%; max-width: 360px; text-align: center;
  box-shadow: 0 16px 48px var(--shadow);
  animation: newsIn .35s cubic-bezier(.2,.9,.3,1.3);
  max-height: 100%; overflow-y: auto;
}
.inst-icon { line-height: 0; margin-bottom: 12px; }
.inst-icon img { width: 76px; height: 76px; border-radius: 17px; box-shadow: 0 6px 20px var(--shadow); }
.inst-title {
  font-family: 'Amiri', serif; font-size: 20px; font-weight: 700;
  color: var(--gold); margin-bottom: 5px;
}
.inst-sub { font-size: 12.5px; color: var(--text-dim); line-height: 1.6; margin-bottom: 14px; }

.inst-ios { text-align: start; margin-bottom: 14px; }
.inst-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-dim);
  padding: 9px 11px; margin-bottom: 7px;
  background: var(--dark); border-radius: 11px;
  border: 1px solid rgba(201,151,42,.16);
}
.inst-step > span:first-child {
  flex-shrink: 0; width: 21px; height: 21px; border-radius: 50%;
  background: var(--gold); color: #fff;
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.inst-step b { color: var(--text); }
.ios-ico { font-size: 14px; }

.inst-btns { display: flex; flex-direction: column; gap: 8px; }
.inst-row { display: flex; gap: 8px; }
.inst-row .btn { flex: 1; font-size: 12.5px; padding: 10px; }
/* رسالة حوار التأكيد */
.confirm-msg { font-size: 15px; color: var(--text); line-height: 1.7; margin-bottom: 18px; white-space: pre-line; font-weight: 600; }
#confirm-sheet .inst-row .btn { font-size: 14px; padding: 13px; }
/* شرح اللعبة */
.intro-icon { font-size: 44px; line-height: 1; margin-bottom: 8px; }
/* لافتة «لعبةٌ عائليّة» داخل لوح الشرح */
.intro-note {
  background: linear-gradient(180deg, rgba(201,151,42,.15), rgba(201,151,42,.05));
  border: 1px solid rgba(201,151,42,.38); border-radius: 13px;
  padding: 13px 14px; margin: 2px 0 16px; text-align: center;
  font-size: 13.5px; line-height: 1.75; color: var(--text);
}
.intro-note b { color: var(--gold); }
.intro-note .in-badge {
  display: block; font-weight: 800; font-size: 13px; color: var(--gold);
  margin-bottom: 6px;
}
.intro-note .in-dim { color: var(--text-dim); font-size: 12px; }

.intro-lines { list-style: none; padding: 0; margin: 4px 0 18px; text-align: start; }
.intro-lines li {
  position: relative; padding: 6px 26px 6px 4px; font-size: 14.5px;
  color: var(--text); line-height: 1.6; font-weight: 600;
}
.intro-lines li::before { content: '◆'; position: absolute; right: 6px; color: var(--gold); font-size: 11px; top: 9px; }

@media (orientation: landscape) and (max-height: 480px) {
  .inst-box { max-width: 440px; padding: 14px; }
  .inst-icon img { width: 52px; height: 52px; }
  .inst-title { font-size: 17px; }
  .inst-sub { margin-bottom: 9px; }
  .inst-step { padding: 6px 9px; margin-bottom: 5px; }
}

/* ── تاريخ الميلاد ──────────────────────────────────────────── */
.bd-field { margin-block-end: 8px; }
.bd-label {
  display: block; font-size: 11.5px; color: var(--text-dim);
  font-weight: 700; margin-block-end: 4px; text-align: start;
}
.bd-note { font-size: 10.5px; color: var(--text-dim); opacity: .8; margin-block-start: 4px; text-align: start; }
/* حقل التاريخ في iOS يخرج عن الهوية بلا هذا */
input[type="date"] {
  font-family: inherit; text-align: start;
  min-height: 44px; -webkit-appearance: none; appearance: none;
}
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.5) sepia(1) saturate(4) hue-rotate(5deg); }

/* ── ما الجديد ──────────────────────────────────────────────── */
/**
 * شعار خفيف لا يحجب شيئاً ولا يوقف اللعب: يهبط من الأعلى، ويُخفى
 * بضغطة واحدة على ✕ فلا يعود حتى التحديث التالي.
 */
.news-bar {
  position: fixed; z-index: 350;
  inset-block-start: calc(8px + env(safe-area-inset-top));
  inset-inline: 10px;
  max-width: 520px; margin-inline: auto;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px;
  border: 1px solid rgba(201,151,42,.5); border-radius: 15px;
  background: var(--card);
  box-shadow: 0 8px 30px var(--shadow);
  animation: newsIn .38s cubic-bezier(.2,.9,.3,1.3);
}
.news-bar.mp-hidden { display: none; }
.news-bar.out { animation: newsOut .25s forwards; }

@keyframes newsIn  { from { opacity: 0; transform: translateY(-18px) } to { opacity: 1; transform: none } }
@keyframes newsOut { to   { opacity: 0; transform: translateY(-14px) } }

.news-spark { font-size: 18px; line-height: 1.2; flex-shrink: 0; animation: sparkle 2.4s ease-in-out infinite; }
@keyframes sparkle { 0%,100% { transform: none; opacity: 1 } 50% { transform: scale(1.18) rotate(9deg); opacity: .82 } }

.news-body { flex: 1; min-width: 0; }
.news-title {
  font-family: 'Amiri', serif; font-size: 15px; font-weight: 700;
  color: var(--gold); margin-block-end: 3px;
}
.news-items { font-size: 12px; color: var(--text-dim); line-height: 1.65; }
.news-items div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.news-x {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--dark); border: 1px solid rgba(201,151,42,.3);
  color: var(--text-dim); font-size: 12px; cursor: pointer;
  line-height: 1; display: grid; place-items: center;
}
.news-x:active { transform: scale(.9); }

/* النقطة على زر ✨ — العلامة المميّزة أن هناك جديداً */
#btn-news { position: relative; }
.news-dot {
  position: absolute; inset-block-start: 3px; inset-inline-end: 3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--crimson); border: 1.5px solid var(--card);
  animation: pulseDot 1.9s ease-in-out infinite;
}
.news-dot.mp-hidden { display: none; }
@keyframes pulseDot {
  0%,100% { transform: scale(1);   opacity: 1 }
  50%     { transform: scale(1.35); opacity: .65 }
}

@media (prefers-reduced-motion: reduce) {
  .news-bar, .news-spark, .news-dot { animation: none; }
}

@media (orientation: landscape) and (max-height: 480px) {
  .news-items div:nth-child(n+3) { display: none; }  /* سطران يكفيان في الوضع الأفقي */
}

/* ── الأفاتارات ─────────────────────────────────────────────── */
.av { display: block; border-radius: 50%; }

.av-btn {
  background: none; border: 3px solid transparent; border-radius: 50%;
  padding: 0; cursor: pointer; line-height: 0;
  transition: transform .12s, border-color .15s;
}
.av-btn:active { transform: scale(.92); }
.av-btn.on {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,151,42,.28);
  transform: scale(1.06);
}

/* الزر الكبير في شاشة الدخول */
.av-pick {
  margin: 0 auto; position: relative;
  border: 3px solid rgba(201,151,42,.45); border-radius: 50%;
  background: none; padding: 0; cursor: pointer; line-height: 0;
  transition: transform .12s, border-color .2s;
}
.av-pick:active { transform: scale(.95); }
.av-pick::after {
  content: '✏️';
  position: absolute; inset-block-end: -2px; inset-inline-end: -2px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold); color: #fff;
  font-size: 12px; line-height: 26px; text-align: center;
  box-shadow: 0 2px 8px var(--shadow);
}

/* لوح الاختيار */
.av-sheet {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column;
  padding: calc(10px + env(safe-area-inset-top)) 12px
           calc(10px + env(safe-area-inset-bottom));
  animation: fadeIn .2s;
}
.av-sheet.mp-hidden { display: none; }
.av-sheet-box {
  background: var(--card); border: 1px solid rgba(201,151,42,.35);
  border-radius: 20px; margin: auto; width: 100%; max-width: 620px;
  max-height: 100%; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 14px 44px var(--shadow);
}
.av-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 13px 16px; flex-shrink: 0;
  border-bottom: 1px solid rgba(201,151,42,.2);
}
.av-sheet-head h3 {
  font-family: 'Amiri', serif; font-size: 19px; color: var(--gold); font-weight: 700;
}
.av-tabs {
  display: flex; gap: 7px; padding: 10px 14px; flex-shrink: 0;
  overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid rgba(201,151,42,.14);
}
.av-tabs::-webkit-scrollbar { display: none; }
.av-tab {
  white-space: nowrap; flex-shrink: 0;
  background: var(--dark); border: 1px solid rgba(201,151,42,.25);
  border-radius: 20px; padding: 7px 13px;
  color: var(--text-dim); font-family: inherit; font-size: 12.5px;
  font-weight: 700; cursor: pointer;
}
.av-tab.on { background: var(--gold); color: #fff; border-color: var(--gold); }
.av-grid {
  flex: 1; min-height: 0; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 10px; padding: 14px; align-content: start;
}

/* الأفاتار داخل قائمة اللاعبين */
.lp-chip .av { width: 30px; height: 30px; }
.ls-chip .av { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }

@media (orientation: landscape) and (max-height: 480px) {
  .av-grid { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 7px; padding: 10px; }
  .av-sheet-box { max-width: 90vw; }
}

/* ── مساعدات ────────────────────────────────────────────────── */
.mp-hidden { display: none !important; }
.mp-row { display: flex; gap: 9px; }
.mp-row > * { flex: 1; }
.mp-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-shrink: 0; margin-bottom: 8px;
}
.mp-head h2 {
  font-family: 'Amiri', serif;
  font-size: clamp(18px, 3.6vh, 26px);
  color: var(--gold);
  font-weight: 700;
}

/* ════════ مسير النور ════════ */

/* ── الطريق ─────────────────────────────────────────────────── */
.road {
  flex-shrink: 0; display: flex; flex-direction: column; gap: 7px;
  padding: 10px; margin-bottom: 8px;
  background: var(--card); border: 1px solid rgba(201,151,42,.28);
  border-radius: 15px;
  max-height: 34vh; overflow-y: auto;
}

.lane { display: flex; align-items: center; gap: 8px; }
.lane-name {
  flex: 0 0 68px; font-size: 11.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/**
 * الطريق اتجاهه ثابت: النجف يساراً ← الحرم يميناً، مهما كانت لغة
 * الصفحة. لذا نستعمل left/right الفيزيائيتين لا inset-inline-*:
 * المنطقية تنقلب في صفحة RTL فيمشي الموكب في اتجاه ويمتلئ الشريط
 * في الاتجاه المعاكس — وهو ما حدث فعلاً.
 */
.lane-track {
  flex: 1; position: relative; height: 24px;
  direction: ltr;                     /* يحمي المحتوى من انقلاب الصفحة */
  background: linear-gradient(90deg, rgba(201,151,42,.10), rgba(201,151,42,.05));
  border-radius: 12px; border: 1px solid rgba(201,151,42,.18);
  overflow: visible;                  /* الشعار يعلو الحافة قليلاً */
}
/* علامة الحرم في نهاية الطريق — يميناً دائماً */
.lane-track::after {
  content: '🕌';
  position: absolute; right: 3px; top: 50%;
  transform: translateY(-50%);
  font-size: 11px; opacity: .5; pointer-events: none;
}
.lane-fill {
  position: absolute; top: 0; bottom: 0; left: 0;   /* ينمو يميناً */
  border-radius: 12px; transition: width .5s cubic-bezier(.2,.8,.3,1);
  opacity: .35;
}
/* شعار المشترك يمشي على الطريق — left لأن الطريق يبدأ من اليسار */
.lane-walker {
  position: absolute; top: 50%; left: 0;
  transform: translate(-50%, -50%);
  transition: left .55s cubic-bezier(.2,.8,.3,1);
  line-height: 0; z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.45));
}
.lane-walker svg, .lane-walker .team-emblem {
  display: block; border-radius: 50%;
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1.5px rgba(201,151,42,.5);
}
.team-emblem {
  width: 24px; height: 24px; display: grid; place-items: center;
  font-size: 12px; color: #fff; font-weight: 900;
}
/* وصل الحرم — هالة ذهبية */
.lane-walker.arrived svg, .lane-walker.arrived .team-emblem {
  box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(201,151,42,.85);
  animation: arrivedPulse 1.4s ease-in-out infinite;
}
@keyframes arrivedPulse {
  0%,100% { transform: scale(1) }
  50%     { transform: scale(1.12) }
}
.lane-pos {
  flex: 0 0 34px; text-align: center;
  font-size: 11px; font-weight: 900; color: var(--gold);
}
.lane.is-turn .lane-name { color: var(--gold); }
.lane.is-turn .lane-track {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,151,42,.22);
}
.lane-badges { flex: 0 0 auto; display: flex; gap: 2px; font-size: 11px; }

.road-legend {
  display: flex; justify-content: space-between;
  font-size: 9.5px; color: var(--text-dim); opacity: .8;
  padding: 0 76px 0 40px;
}

/* ── اليد ───────────────────────────────────────────────────── */
.hand-wrap { flex: 1; min-height: 0; display: flex; align-items: flex-end; overflow: hidden; }
.hand {
  display: flex; gap: 7px; width: 100%;
  overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: none;
}
.hand::-webkit-scrollbar { display: none; }

.play-card {
  flex: 0 0 78px; height: 108px;
  border-radius: 12px; border: 2px solid rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; cursor: pointer; position: relative;
  transition: transform .14s, box-shadow .14s;
  box-shadow: 0 3px 10px var(--shadow);
  user-select: none;
}
.play-card:active { transform: scale(.95); }
.play-card.on {
  transform: translateY(-10px) scale(1.04);
  box-shadow: 0 10px 22px rgba(0,0,0,.4), 0 0 0 3px var(--gold);
  z-index: 2;
}
.play-card.dim { opacity: .45; filter: grayscale(.5); cursor: not-allowed; }
.card-ico  { font-size: 24px; line-height: 1; }
.card-name { font-size: 11px; font-weight: 800; text-align: center; padding: 0 3px; }
.card-n {
  position: absolute; inset-block-start: 4px; inset-inline-start: 6px;
  font-size: 15px; font-weight: 900; opacity: .9;
}

/* ألوان الكروت — كل نوع يُعرف من لونه قبل قراءته */
.c-amber  { background: linear-gradient(160deg,#F0C46A,#C9972A); color:#3B2606 }
.c-green  { background: linear-gradient(160deg,#7ED9A0,#2F8F5B); color:#04301B }
.c-blue   { background: linear-gradient(160deg,#7EC5F0,#2F6F9F); color:#04243B }
.c-orange { background: linear-gradient(160deg,#F0A06A,#C25A22); color:#3B1A06 }
.c-purple { background: linear-gradient(160deg,#C4A0F0,#7B4FC2); color:#241040 }
.c-gold   { background: linear-gradient(160deg,#FFE9A8,#D4A017); color:#3B2606 }
.c-indigo { background: linear-gradient(160deg,#9FB0F0,#4356B8); color:#0C1440 }

/* ── التحدّي والملاحظات ─────────────────────────────────────── */
.mas-challenge {
  flex-shrink: 0; background: var(--card);
  border: 1px solid rgba(67,86,184,.5); border-radius: 14px;
  padding: 10px; margin-bottom: 8px;
}
.mas-challenge.mp-hidden { display: none; }
.mas-timer {
  position: relative; height: 20px; border-radius: 999px; overflow: hidden;
  background: rgba(0,0,0,.22); margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center;
}
.mas-timer.mp-hidden { display: none; }
.mas-timer > span {
  position: absolute; inset-inline-start: 0; top: 0; height: 100%;
  background: linear-gradient(90deg, var(--green-light), var(--gold));
  transition: width .9s linear; z-index: 0;
}
.mas-timer.low > span { background: var(--crimson-light); }
.mas-timer > b { position: relative; z-index: 1; font-size: 12px; font-weight: 800; color: #fff; }
.mas-q {
  font-family: 'Amiri', serif; font-size: 15px;
  text-align: center; margin-bottom: 8px; color: var(--text);
}
.mas-note {
  flex-shrink: 0; min-height: 20px; text-align: center;
  font-size: 12px; color: var(--text-dim); padding: 2px 0;
}
.mas-actions { flex-shrink: 0; }
.mas-hint {
  text-align: center; font-size: 11px;
  color: var(--text-dim); min-height: 15px; margin-top: 3px;
}

/* اختيار الهدف */
.lane.targetable .lane-track { cursor: pointer; border-color: #E07B54; }
.lane.targetable:active .lane-track { transform: scale(.98); }

/* ── القواعد ────────────────────────────────────────────────── */
.rules-body { padding: 14px; overflow-y: auto; font-size: 13px; line-height: 1.75; }
.rules-body h4 { color: var(--gold); font-family:'Amiri',serif; font-size: 16px; margin: 12px 0 5px }
.rules-body h4:first-child { margin-top: 0 }
.rules-body p, .rules-body li { color: var(--text-dim); }
.rules-body ol { padding-inline-start: 18px; }
/**
 * صف الكرت في شاشة المعلومات: الكرت نفسه بجانب شرحه لا أيقونة
 * مجرّدة — فيتعرّف عليه اللاعب في يده فوراً بلا ترجمة ذهنية.
 */
.rule-card {
  display: flex; align-items: center; gap: 11px;
  padding: 9px; margin-bottom: 7px; border-radius: 12px;
  background: var(--dark); border: 1px solid rgba(201,151,42,.15);
}
.rule-txt b { color: var(--text); font-size: 13.5px; display: block; margin-bottom: 2px }
.rule-txt div { font-size: 11.5px; color: var(--text-dim); line-height: 1.6 }

/* نسخة مصغّرة من الكرت — نفس مكوّن اليد بالضبط */
.play-card.mini {
  flex: 0 0 52px; height: 72px; border-radius: 9px;
  cursor: default; box-shadow: 0 2px 7px var(--shadow);
}
.play-card.mini:active { transform: none }
.play-card.mini .card-ico  { font-size: 17px }
.play-card.mini .card-name { font-size: 8.5px }
.play-card.mini .card-n    { font-size: 11px; inset-block-start: 3px; inset-inline-start: 4px }

/* ── تلميح زر المعلومات ─────────────────────────────────────── */
.info-btn { position: relative; }
/* نبضة خفيفة تلفت النظر للزر ما دام التلميح ظاهراً */
.info-btn.pulse { animation: infoPulse 1.6s ease-in-out infinite; }
@keyframes infoPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(201,151,42,.55) }
  50%     { box-shadow: 0 0 0 7px rgba(201,151,42,0) }
}

.coach {
  position: fixed; z-index: 460;
  max-width: 232px;
  display: flex; align-items: flex-start; gap: 7px;
  padding: 9px 10px;
  background: var(--card);
  border: 1px solid var(--gold);
  border-radius: 12px;
  box-shadow: 0 10px 30px var(--shadow);
  animation: coachIn .3s cubic-bezier(.2,.9,.3,1.4);
}
.coach.mp-hidden { display: none; }
.coach.out { animation: fadeOut .2s forwards; }
@keyframes coachIn {
  from { opacity: 0; transform: translateY(-8px) scale(.94) }
  to   { opacity: 1; transform: none }
}
@keyframes fadeOut { to { opacity: 0 } }

/* السهم يشير لزر المعلومات — موضعه يُضبط من JS حسب مكان الزر */
.coach-arrow {
  position: absolute; inset-block-start: -6px;
  width: 11px; height: 11px;
  background: var(--card);
  border-inline-start: 1px solid var(--gold);
  border-block-start: 1px solid var(--gold);
  transform: rotate(45deg);
}
.coach-body { flex: 1; min-width: 0; }
.coach-body b { color: var(--gold); font-size: 12.5px; display: block; }
.coach-body div { font-size: 11px; color: var(--text-dim); margin-top: 2px; line-height: 1.5 }
.coach-x {
  flex-shrink: 0; background: none; border: 0; cursor: pointer;
  color: var(--text-dim); font-size: 11px; line-height: 1; padding: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .coach, .info-btn.pulse { animation: none; }
}

/* ── الوضع الأفقي: لا تمرير ─────────────────────────────────── */
@media (orientation: landscape) and (max-height: 520px) {
  .road { max-height: 30vh; padding: 7px; gap: 5px; }
  .lane-track { height: 18px; }
  .play-card { flex: 0 0 62px; height: 84px; }
  .card-ico { font-size: 19px }
  .card-name { font-size: 9.5px }
  .mas-q { font-size: 13px; margin-bottom: 5px }
  .mas-challenge { padding: 7px }
}

/* ── زرّا الترويسة معاً ─────────────────────────────────────── */
.head-btns { display: flex; gap: 6px; flex-shrink: 0; }

/* دوران أثناء التحديث — دليل بصري أن شيئاً يحدث */
.tb-btn.spinning { animation: spin360 .7s linear infinite; pointer-events: none; }
@keyframes spin360 { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) { .tb-btn.spinning { animation: none; opacity: .5 } }

/* ════════ المؤثّرات البصرية (fx.js) ════════ */
/* كلّها pointer-events:none — المؤثّر لا يمنع اللعب أبداً */

.fx-shake { animation: fxShake .4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes fxShake {
  10%,90% { transform: translate(calc(var(--shake) * -.3), 0) }
  20%,80% { transform: translate(calc(var(--shake) * .5), 0) }
  30%,50%,70% { transform: translate(calc(var(--shake) * -1), 0) }
  40%,60% { transform: translate(var(--shake), 0) }
}

.fx-flash {
  position: fixed; inset: 0; z-index: 900; pointer-events: none;
  animation: fxFlash .32s ease-out forwards;
}
@keyframes fxFlash { from { opacity: .9 } to { opacity: 0 } }

/* عاصفة رملية تعبر الشاشة */
.fx-sand {
  position: fixed; inset: 0; z-index: 890; pointer-events: none;
  background:
    repeating-linear-gradient(115deg,
      rgba(214,178,110,.00) 0px, rgba(214,178,110,.16) 2px,
      rgba(214,178,110,.00) 5px, rgba(196,150,80,.13) 8px);
  animation: fxSand 1.5s ease-out forwards;
}
@keyframes fxSand {
  0%   { opacity: 0; transform: translateX(-40%) skewX(-8deg) }
  25%  { opacity: 1 }
  100% { opacity: 0; transform: translateX(40%) skewX(-8deg) }
}

.fx-particle {
  position: fixed; z-index: 910; pointer-events: none;
  font-size: 18px; line-height: 1;
  animation: fxParticle .85s cubic-bezier(.2,.7,.4,1) forwards;
}
@keyframes fxParticle {
  0%   { opacity: 1; transform: translate(-50%,-50%) scale(.4) }
  60%  { opacity: 1 }
  100% { opacity: 0;
         transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.15) rotate(140deg) }
}

.fx-banner {
  position: fixed; z-index: 920; pointer-events: none;
  inset-block-start: 34%; inset-inline: 0;
  text-align: center;
  font-family: 'Amiri', serif; font-weight: 700;
  font-size: clamp(30px, 9vw, 58px);
  color: var(--gold);
  text-shadow: 0 3px 22px rgba(0,0,0,.75), 0 0 44px currentColor;
  animation: fxBanner 1.4s cubic-bezier(.2,.9,.3,1) forwards;
}
.fx-banner.fx-danger { color: #FF6B4A }
.fx-banner.fx-warn   { color: #FFD75E }
.fx-banner.fx-good   { color: #6EE7A0 }
@keyframes fxBanner {
  0%   { opacity: 0; transform: scale(.5) rotate(-6deg) }
  18%  { opacity: 1; transform: scale(1.12) rotate(1deg) }
  30%  { transform: scale(1) rotate(0) }
  78%  { opacity: 1; transform: scale(1) }
  100% { opacity: 0; transform: scale(1.35) }
}

/* من يحترم تقليل الحركة: نُبقي الصوت ونُلغي الاهتزاز والعواصف */
@media (prefers-reduced-motion: reduce) {
  .fx-shake, .fx-sand, .fx-particle { animation: none !important; opacity: 0 !important; }
  .fx-banner { animation: fxBannerCalm 1.2s ease forwards }
  @keyframes fxBannerCalm { 0%,80% { opacity: 1 } 100% { opacity: 0 } }
}

/* ════════ طريق القوافل ════════ */

/* ── الطاولة ────────────────────────────────────────────────── */
.qaw-table {
  flex: 1; min-height: 0; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px; align-content: start; padding: 2px;
}
.qaw-seat {
  background: var(--card); border: 1.5px solid rgba(201,151,42,.22);
  border-radius: 13px; padding: 8px;
  display: flex; align-items: center; gap: 8px;
  transition: border-color .2s, transform .15s, opacity .3s;
  position: relative;
}
.qaw-seat.turn {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,151,42,.25), 0 4px 16px var(--shadow);
}
.qaw-seat.out { opacity: .38; filter: grayscale(1); }
.qaw-seat.me  { background: rgba(201,151,42,.09); }
/* الهدف القابل للاختيار — واضح أنه قابل للنقر */
.qaw-seat.targetable {
  border-color: #E07B54; cursor: pointer;
  animation: targetPulse 1.2s ease-in-out infinite;
}
@keyframes targetPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(224,123,84,.5) }
  50%     { box-shadow: 0 0 0 6px rgba(224,123,84,0) }
}
.qaw-seat.targetable:active { transform: scale(.96); }

.qaw-av { flex-shrink: 0; line-height: 0; }
.qaw-av svg { border-radius: 50%; border: 1.5px solid rgba(201,151,42,.4); }
.qaw-info { flex: 1; min-width: 0; }
.qaw-name {
  font-size: 12px; font-weight: 800; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qaw-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.qaw-coins { font-size: 11px; font-weight: 900; color: var(--gold); }
.qaw-backs { display: flex; gap: 2px; }
/* ظهر الورقة — سرّ لا يُقرأ */
.qaw-back {
  width: 13px; height: 18px; border-radius: 3px;
  background: linear-gradient(135deg, #8A6216, #C9972A);
  border: 1px solid rgba(0,0,0,.3);
}
.qaw-back.lost {
  background: none; border-style: dashed;
  border-color: rgba(255,255,255,.2);
}
.qaw-rev { display: flex; gap: 2px; font-size: 10px; opacity: .85; }

/* ── ما يجري الآن ───────────────────────────────────────────── */
.qaw-stage {
  flex-shrink: 0; margin: 6px 0;
  background: var(--card); border: 1px solid rgba(201,151,42,.35);
  border-radius: 12px; padding: 9px;
}
.qaw-stage.mp-hidden { display: none; }
.qaw-claim {
  text-align: center; font-size: 13.5px; font-weight: 700;
  color: var(--text); margin-bottom: 7px; line-height: 1.5;
}
.qaw-claim b { color: var(--gold); }

.qaw-log {
  flex-shrink: 0; height: 30px; overflow: hidden;
  font-size: 10.5px; color: var(--text-dim);
  line-height: 1.45; text-align: center;
}

/* ── يدك ────────────────────────────────────────────────────── */
.qaw-hand-wrap {
  flex-shrink: 0; display: flex; align-items: center; gap: 9px;
  padding: 7px 0;
}
.qaw-gold {
  flex-shrink: 0; font-size: 14px; font-weight: 900; color: var(--gold);
  background: var(--dark); border: 1px solid rgba(201,151,42,.3);
  border-radius: 9px; padding: 7px 9px;
  transition: transform .2s;
}
.qaw-gold.bump { animation: goldBump .45s cubic-bezier(.34,1.56,.64,1); }
@keyframes goldBump { 50% { transform: scale(1.32); color: #FFE9A8 } }

.qaw-hand { flex: 1; display: flex; gap: 6px; justify-content: center; }
.qaw-card {
  flex: 0 0 66px; height: 92px; border-radius: 10px;
  border: 2px solid rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; box-shadow: 0 3px 10px var(--shadow);
  transition: transform .14s;
  position: relative;
}
.qaw-card.pick { cursor: pointer; }
.qaw-card.pick:active { transform: scale(.95); }
.qaw-card.on {
  transform: translateY(-8px);
  box-shadow: 0 10px 20px rgba(0,0,0,.4), 0 0 0 3px var(--gold);
}
.qaw-card.dead { opacity: .35; filter: grayscale(1); }
.qaw-card-ico  { font-size: 22px; line-height: 1 }
.qaw-card-name { font-size: 10px; font-weight: 800; text-align: center }
.qaw-card-tag  { font-size: 8px; opacity: .8; text-align: center; padding: 0 3px }

/* ألوان الأدوار */
.r-gold    { background: linear-gradient(160deg,#FFE9A8,#C9972A); color:#3B2606 }
.r-crimson { background: linear-gradient(160deg,#F09A8A,#9E2318); color:#3B0A06 }
.r-purple  { background: linear-gradient(160deg,#C4A0F0,#7B4FC2); color:#241040 }
.r-blue    { background: linear-gradient(160deg,#7EC5F0,#2F6F9F); color:#04243B }
.r-green   { background: linear-gradient(160deg,#7ED9A0,#2F8F5B); color:#04301B }

/* ── الأزرار ────────────────────────────────────────────────── */
.qaw-actions {
  flex-shrink: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
}
.qaw-btn {
  flex: 1 1 auto; min-width: 82px;
  background: var(--card); border: 1.5px solid rgba(201,151,42,.3);
  border-radius: 10px; padding: 9px 8px;
  color: var(--text); font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: transform .1s, border-color .15s;
}
.qaw-btn:active { transform: scale(.96) }
.qaw-btn:disabled { opacity: .35; cursor: not-allowed }
.qaw-btn.hot { border-color: var(--gold); background: rgba(201,151,42,.18); color: var(--gold-light) }
.qaw-btn.danger { border-color: #E0553A; color: #FF8A6E }
.qaw-btn.safe { border-color: rgba(110,231,160,.5); color: #6EE7A0 }

/* شارة الشاهد */
.witness-box {
  flex-shrink: 0; background: rgba(123,79,194,.12);
  border: 1px dashed rgba(160,120,230,.5); border-radius: 11px;
  padding: 8px; margin-bottom: 6px; font-size: 11px;
}
.witness-box b { color: #C4A0F0 }
.witness-row { display: flex; justify-content: space-between; padding: 2px 0 }

/* ── أفقي: بلا تمرير ───────────────────────────────────────── */
@media (orientation: landscape) and (max-height: 520px) {
  .qaw-card { flex: 0 0 54px; height: 74px }
  .qaw-card-ico { font-size: 17px }
  .qaw-card-name { font-size: 8.5px }
  .qaw-card-tag { display: none }
  .qaw-seat { padding: 6px }
  .qaw-log { height: 16px }
  .qaw-table { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px }
}

/* ════════ ترتيب الرئيسية واللوبي (عمودي + أفقي) ════════ */

/* ── الرئيسية: بطل علوي + أفعال، يملآن الشاشة بلا فراغ ضائع ── */
.home-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  justify-content: safe center;   /* يتوسّط إن اتّسع، ويمرّر بلا قصٍّ إن طال */
  overflow-y: auto; scrollbar-width: none;
  gap: clamp(14px, 3.4vh, 30px);
  width: 100%; max-width: 460px; margin: 0 auto;
}
/* لا تنكمش الأقسام تحت ارتفاع محتواها — وإلا فاضت الإحصاءات من بطاقة
   الترحيب وتراكبت مع زرّ الإنشاء على الشاشات القصيرة. الجسم يمرّر بدلها. */
.home-body > * { flex-shrink: 0; }
.home-body::-webkit-scrollbar { display: none; }
/* ── بطاقة الترحيب + إحصاءاتي ──────────────────────────────── */
.home-welcome {
  text-align: center; padding: clamp(16px, 3vh, 22px) 16px;
  display: flex; flex-direction: column; gap: clamp(12px, 2.4vh, 18px);
  background: linear-gradient(160deg, var(--card), var(--card2));
}
.hw-top { display: flex; flex-direction: column; align-items: center; }
.home-logo {   /* شعارُ «المنتظِرون» (فجرُ العالَم) بدل شمعة الهويّة القديمة — بلا حركةٍ لا نهائيّة */
  width: clamp(44px, 10vh, 88px); height: auto; aspect-ratio: 1; border-radius: 22%; display: block; margin-inline: auto;
  filter: drop-shadow(0 6px 18px rgba(201,151,42,.35));
}
.hw-tag {
  margin-top: 8px; font-family: 'Amiri', serif;
  font-size: clamp(15px, 2.4vh, 20px); color: var(--text-dim);
}
.home-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.hstat {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: rgba(201,151,42,.08); border: 1px solid rgba(201,151,42,.16);
  border-radius: 12px; padding: 10px 4px;
}
.hstat-n {
  font-size: clamp(17px, 2.8vh, 23px); font-weight: 900; color: var(--gold-light);
  line-height: 1;
}
.hstat-l { font-size: 11px; color: var(--text-soft, var(--text-dim)); font-weight: 700; white-space: nowrap; }

.home-actions { display: flex; flex-direction: column; gap: 12px; }
/* أزرار الرئيسية أكبر قليلاً — أهداف لمس مريحة */
.home-actions .btn-gold { font-size: clamp(16px, 2.3vh, 19px); padding: clamp(14px, 2vh, 18px); }
.home-cta { box-shadow: 0 6px 20px rgba(201,151,42,.28); }

/* ── أقسام الرئيسيّة: عناوينٌ واضحةٌ تُرتّب الصفحة ──────────── */
.home-sec { display: flex; flex-direction: column; gap: 10px; }
.home-sec-h {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 13.5px; color: var(--gold-light);
  letter-spacing: .01em; margin: 4px 2px 0;
}
.home-sec-h .hs-ic { font-size: 16px; }
/* فاصلٌ لطيفٌ بين الأقسام */
.home-sec + .home-sec, .home-actions > .home-live { margin-top: 6px; }

/* بطاقةُ إجراءٍ كبيرةٌ (كلّ الألعاب) — بنفس لغة بانر الخريطة */
.home-tile {
  display: flex; align-items: center; gap: 12px; width: 100%;
  text-align: start; cursor: pointer; font-family: inherit; color: var(--text);
  background: linear-gradient(155deg, var(--card), var(--card2));
  border: 1px solid rgba(201,151,42,.22); border-radius: 16px; padding: 14px;
  transition: transform .12s, border-color .2s;
}
.home-tile:active { transform: scale(.99); }
.home-tile:hover { border-color: var(--gold); }
.home-tile .ht-ic { font-size: 28px; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.home-tile .ht-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.home-tile .ht-t { font-weight: 800; font-size: 15px; color: var(--gold-light); }
.home-tile .ht-s { font-size: 11.5px; color: var(--text-dim); line-height: 1.5; }
.home-tile .ht-go { flex: none; color: var(--gold); font-weight: 800; font-size: 16px; }

/* ── عرض الألعاب: شريطٌ أفقيّ للاكتشاف ────────────────────── */
.home-games-h {
  display: flex; align-items: baseline; gap: 8px;
  font-weight: 800; font-size: 14px; color: var(--gold-light); margin-bottom: 2px;
}
.hg-hint { font-size: 11px; font-weight: 600; color: var(--text-dim); }
.home-games-row {
  display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none;
  padding: 2px 0 4px; scroll-snap-type: x proximity;
}
.home-games-row::-webkit-scrollbar { display: none; }
.hg-tile {
  flex: 0 0 auto; width: 82px; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: linear-gradient(155deg, var(--card), var(--card2));
  border: 1px solid rgba(201,151,42,.2); border-radius: 14px;
  padding: 12px 6px; cursor: pointer; font-family: inherit;
  transition: transform .15s, border-color .15s;
}
.hg-tile:active { transform: scale(.94); }
.hg-tile:hover { border-color: var(--gold); }
.hg-ico { font-size: 30px; line-height: 1; }
.hg-name { font-size: 11px; font-weight: 700; color: var(--text); text-align: center; line-height: 1.3; }
.hg-refresh {
  margin-inline-start: auto; background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--text-dim); border-radius: 10px;
  min-width: 44px; min-height: 44px; display: inline-grid; place-items: center;
}
.hg-refresh:active { transform: rotate(90deg); }

/* رأس الرئيسية: التحيّة تُقصّ بدل أن تدفع الأزرار، وقائمة «⋯» تجمع الثانويّة */
.home-hello { flex: 1; min-width: 0; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hmenu-wrap { position: relative; }
.hmenu {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 60;
  background: var(--card); border: 1px solid var(--hair, rgba(201,151,42,.25));
  border-radius: 14px; padding: 6px; min-width: 190px;
  box-shadow: 0 10px 30px var(--shadow); display: flex; flex-direction: column; gap: 2px;
}
.hmenu-item {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: var(--text); font-size: 14px; font-weight: 600; text-align: start;
  padding: 8px 12px; border-radius: 10px; width: 100%;
}
.hmenu-item:hover, .hmenu-item:active { background: var(--gold-tint, rgba(201,151,42,.12)); }
.hmi-ico { font-size: 18px; width: 22px; text-align: center; }

/* ── غرفٌ تلعب الآن: قائمة اكتشافٍ مع «دخول» ────────────────── */
.home-live { display: flex; flex-direction: column; gap: 6px; }
.live-list { display: flex; flex-direction: column; gap: 8px; }
.live-row {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(155deg, var(--card), var(--card2));
  border: 1px solid rgba(201,151,42,.22); border-radius: 12px; padding: 8px 10px;
}
.live-ico { font-size: 24px; line-height: 1; flex: 0 0 auto; }
.live-mid { flex: 1; min-width: 0; }
.live-name { font-weight: 800; font-size: 13.5px; color: var(--text); }
.live-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-join { flex: 0 0 auto; min-height: 44px; padding: 8px 16px; }

/* ── ورقة طلبات الانضمام (المضيف) ─────────────────────────── */
.jr-note { font-size: 12px; color: var(--text-dim); line-height: 1.7; margin: 2px 0 12px; }
.jr-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.jr-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid rgba(201,151,42,.18);
  border-radius: 12px; padding: 8px 10px;
}
.jr-av { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; }
.jr-av svg { width: 100%; height: 100%; display: block; }
.jr-name { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; text-align: start;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.jr-yes, .jr-no {
  width: 44px; height: 44px; border-radius: 10px; border: none; cursor: pointer;
  font-size: 18px; display: grid; place-items: center;
}
.jr-yes { background: rgba(110,231,160,.16); }
.jr-no  { background: rgba(232,90,90,.16); }
.jr-empty { font-size: 13px; color: var(--text-dim); text-align: center; padding: 14px 8px; }
.jr-modes-h { font-size: 12px; font-weight: 700; color: var(--gold-light); text-align: start; margin: 2px 0 6px; }
.jr-modes { display: flex; gap: 8px; margin-bottom: 12px; }
.jr-mode {
  flex: 1; background: var(--card); border: 1px solid rgba(201,151,42,.22);
  border-radius: 10px; padding: 9px 4px; cursor: pointer; font-family: inherit;
  color: var(--text-dim); font-size: 12px; font-weight: 700;
}
.jr-mode.on { background: rgba(201,151,42,.18); border-color: var(--gold); color: var(--gold-light); }

/* ── دعوة العائلة: قائمة اختيار المدعوّين ─────────────────── */
.inv-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.inv-count { font-size: 12.5px; font-weight: 800; color: var(--gold-light); font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 44vh; overflow-y: auto; margin-bottom: 4px;
}
.inv-row {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--card); border: 1px solid rgba(201,151,42,.16);
  border-radius: 12px; padding: 8px 12px;
}
.inv-row:has(.inv-cb:checked) { border-color: var(--gold); background: rgba(201,151,42,.08); }
.inv-cb { width: 22px; height: 22px; accent-color: var(--gold); flex: 0 0 auto; cursor: pointer; }

/* شارة عدد الطلبات على زرّ رأس اللوبي */
.jm-badge {
  position: absolute; top: -3px; inset-inline-end: -3px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: #e85a5a; color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center; line-height: 1;
}
#lobby-joinmode { position: relative; }

/* الأفقي القصير: البطاقة تُصفّ بجانب الأفعال، والإحصاء ٢×٢ */
@media (orientation: landscape) and (max-height: 520px) {
  .home-body { flex-direction: row; align-items: center; gap: 22px; max-width: 760px; }
  .home-welcome { flex: 0 0 42%; gap: 12px; }
  .home-logo { width: clamp(36px, 16vh, 64px); }
  .home-stats { grid-template-columns: 1fr 1fr; }
  .home-actions { flex: 1; }
}

/* ── اللوبي عمودي: قائمة اللاعبين تكبر لتملأ الفراغ ──────── */
#screen-lobby .lobby-right {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
}
#screen-lobby .lobby-right > .card {
  flex: 1 1 auto; min-height: 0;
}
/* الرقائق تلتفّ لأسطر متعددة داخل المساحة بدل صفّ واحد مزدحم */
#screen-lobby .lobby-players {
  align-content: flex-start;
}
#screen-lobby .lp-chip { max-width: 100%; }
#screen-lobby .lp-name {
  overflow: hidden; text-overflow: ellipsis; max-width: 42vw;
}

/* ── اللوبي أفقي: احتواء الرقائق داخل بطاقتها (كانت تفيض) ── */
@media (orientation: landscape) and (min-height: 320px) {
  /* الشبكة نفسها يجب أن تقبل الانكماش وإلا فاض عمودها الطويل */
  #screen-lobby .mp-flex { min-height: 0; }
  #screen-lobby .lobby-right > .card { min-height: 0; overflow: hidden; }
}

/* ── بطاقة الانضمام بغرفة (متينة على أضيق الشاشات) ─────────── */
.join-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.join-row { display: flex; gap: 8px; align-items: stretch; }

/**
 * الحقل يتقلّص بلا فيض: min-width:0 يسمح لعنصر flex أن يصغر دون
 * أدنى مقاس محتواه. المباعدة نسبية (em) لا ثابتة (px) فلا تُخرج
 * الرمز عن صندوقه في الشاشات الضيّقة أو العمود الأفقي الضيّق.
 */
.join-input {
  flex: 1 1 auto; min-width: 0;
  text-align: center; text-transform: uppercase;
  font-size: clamp(17px, 5vw, 21px); font-weight: 900;
  letter-spacing: 0.22em;
  /* text-indent يعوّض المسافة الزائدة بعد آخر حرف من letter-spacing،
     فيبقى الرمز متوسّطاً بلا فيض داخلي حتى في أضيق حقل */
  text-indent: 0.22em;
  padding-inline: 4px;
}
/* النائب قصير وبلا مباعدة، فلا يفيض مهما ضاق الحقل */
.join-input::placeholder { letter-spacing: normal; font-weight: 700; font-size: 15px; }

/* الزر بحجم نصّه لا بعرض ثابت — لا يزاحم الحقل ولا يفيض */
.join-btn {
  flex: 0 0 auto; width: auto;
  min-width: 86px; white-space: nowrap;
  padding-inline: 16px; font-size: 15px;
}

/* ── قائمة مشتركي المباراة داخل السجل (تُفتح بالنقر) ───────── */
.hist-item { margin-bottom: 8px; }
.hist-item .hist-row { margin-bottom: 0; cursor: pointer; user-select: none; }

/* الإشارة أنه قابل للفتح — خفيفة لا تزحم */
.hist-see { color: var(--gold); font-weight: 700; white-space: nowrap; }
.hist-chev { display: inline-block; transition: transform .25s; font-size: 9px; }
.hist-row.open .hist-chev { transform: rotate(180deg); }

/**
 * تفتح بسلاسة عبر grid-rows بدل max-height المرتجل: يعطي حركة
 * دقيقة مهما كان عدد اللاعبين. mp-hidden يطويها تماماً.
 */
.hist-players {
  display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows .28s ease;
  margin-top: 4px;
}
.hist-players > * { overflow: hidden; min-height: 0; }
.hist-players.mp-hidden { grid-template-rows: 0fr; margin-top: 0; display: grid; }

.hp-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px;
  font-size: 13px;
  border-inline-start: 2px solid transparent;
}
.hp-row:not(:last-child) { border-bottom: 1px solid rgba(201,151,42,.09); }
.hp-row.me {
  background: rgba(201,151,42,.09);
  border-inline-start-color: var(--gold);
  border-radius: 0 6px 6px 0;
}
.hp-rank {
  flex: 0 0 26px; text-align: center; font-weight: 900;
  font-size: 13px; color: var(--text-dim);
}
.hp-name {
  flex: 1; min-width: 0; color: var(--text); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hp-you {
  font-size: 10px; font-weight: 700; color: var(--gold);
  background: rgba(201,151,42,.16); border-radius: 20px;
  padding: 1px 7px; margin-inline-start: 4px;
}
.hp-pts { flex: 0 0 auto; font-weight: 900; color: var(--gold); font-size: 14px; }

/* ════════ لوحة الإدارة ════════ */
.admin-tabs {
  display: flex; gap: 6px; flex-shrink: 0; margin-bottom: 10px;
  overflow-x: auto; scrollbar-width: none;
  max-height: 60px; opacity: 1;
  transition: max-height .28s ease, opacity .2s ease, margin-bottom .28s ease;
}
.admin-tabs::-webkit-scrollbar { display: none; }
/* إخفاءٌ ذكيّ عند التمرير للأسفل — يمنح المحتوى مساحةً أكبر */
#screen-admin.tabs-hidden .admin-tabs {
  max-height: 0; opacity: 0; margin-bottom: 0; pointer-events: none;
}
.admin-tab {
  flex: 1 0 auto; white-space: nowrap;
  background: var(--card); border: 1px solid rgba(201,151,42,.25);
  border-radius: 10px; padding: 8px 12px;
  color: var(--text-dim); font-family: inherit; font-size: 12.5px; font-weight: 700;
  cursor: pointer;
}
.admin-tab.on { background: rgba(201,151,42,.18); border-color: var(--gold); color: var(--gold-light); }

/* بطاقات الأرقام */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.stat-box {
  background: var(--card); border: 1px solid rgba(201,151,42,.2);
  border-radius: 12px; padding: 12px 8px; text-align: center;
}
.stat-num { font-size: 22px; font-weight: 900; color: var(--gold); }
.stat-lbl { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

/* صف مفتاح ميزة */
.flag-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid rgba(201,151,42,.18);
  border-radius: 12px; padding: 11px 13px; margin-bottom: 8px;
}
.flag-info { flex: 1; min-width: 0; }
.flag-name { font-weight: 800; font-size: 14px; color: var(--text); }
.flag-desc { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.55; }
.flag-state { font-size: 10.5px; margin-top: 4px; font-weight: 700; }
.flag-state.on  { color: var(--green-light); }
.flag-state.off { color: var(--text-dim); }

/* مفتاح تبديل */
.toggle {
  flex: 0 0 auto; width: 50px; height: 28px; border-radius: 20px;
  background: var(--dark); border: 1px solid rgba(201,151,42,.3);
  position: relative; cursor: pointer; transition: background .2s;
}
.toggle.on { background: var(--gold); border-color: var(--gold); }
.toggle::after {
  content: ''; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: inset-inline-start .2s;
}
.toggle.on::after { inset-inline-start: 24px; }

/* مراجعة سؤال داخل الإدارة */
.aq {
  background: var(--card); border: 1px solid rgba(201,151,42,.16);
  border-radius: 11px; padding: 10px 12px; margin-bottom: 7px;
}
.aq-q { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.aq-q .aq-n { color: var(--text-dim); font-weight: 400; }
.aq-lvl { font-size: 10px; color: var(--gold); font-weight: 700; }
.aq-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.aq-o { font-size: 11.5px; padding: 4px 8px; border-radius: 6px; background: var(--dark); color: var(--text-dim); }
.aq-o.right { background: rgba(110,231,160,.15); color: #8ff0bb; font-weight: 700; }
.aq-o.right::before { content: '✓ '; }
.aq mark, .aq-o mark {
  background: rgba(201,151,42,.42); color: #fff; border-radius: 3px; padding: 0 1px;
}

/* ══ تبويب الأسئلة التفاعليّ: شريط بحثٍ ورقاقات مستوياتٍ لاصقة ══ */
.q-toolbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--deep); padding: 2px 0 8px; margin: -2px 0 0;
}
.q-search-wrap { position: relative; margin-bottom: 8px; }
.q-search-ico {
  position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%);
  font-size: 14px; opacity: .7; pointer-events: none;
}
.q-search {
  width: 100%; box-sizing: border-box;
  background: var(--card); border: 1px solid rgba(201,151,42,.3);
  border-radius: 12px; padding: 11px 38px 11px 38px;
  color: var(--text); font-family: inherit; font-size: 14px;
}
.q-search:focus { outline: none; border-color: var(--gold); }
.q-clear {
  position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: none; color: var(--text-dim);
  font-size: 13px; cursor: pointer; display: grid; place-items: center;
}
.q-chips {
  display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none;
  padding-bottom: 2px;
}
.q-chips::-webkit-scrollbar { display: none; }
.q-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid rgba(201,151,42,.22);
  border-radius: 999px; padding: 7px 12px;
  color: var(--text-dim); font-family: inherit; font-size: 12.5px; font-weight: 700;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.q-chip-n {
  background: rgba(255,255,255,.08); color: var(--text-dim);
  border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 800;
  min-width: 20px; text-align: center;
}
.q-chip.on { background: rgba(201,151,42,.18); border-color: var(--gold); color: var(--gold-light); }
.q-chip.on .q-chip-n { background: var(--gold); color: #221803; }
.q-count { font-size: 12px; color: var(--text-dim); padding: 2px 2px 10px; }
.q-count b { color: var(--gold-light); }

/* صف لاعب */
.au-row {
  display: flex; align-items: center; gap: 9px;
  background: var(--card); border: 1px solid rgba(201,151,42,.14);
  border-radius: 10px; padding: 8px 11px; margin-bottom: 6px;
}
.au-name { flex: 1; min-width: 0; font-weight: 700; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.au-meta { font-size: 10.5px; color: var(--text-dim); }
.au-pts { font-weight: 900; color: var(--gold); font-size: 14px; flex-shrink: 0; }

.admin-sec-title { color: var(--gold); font-weight: 800; font-size: 13px; margin: 14px 2px 8px; }

/* ── لوحة موحّدة تجمع كل قسم في بطاقة متناسقة ─────────────── */
.admin-hero {
  background: linear-gradient(160deg, rgba(201,151,42,.16), rgba(201,151,42,.03));
  border: 1px solid rgba(201,151,42,.28); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 12px;
}
.admin-hero-badge { color: var(--gold-light); font-weight: 800; font-size: 16px; }
.admin-hero-sub { color: var(--text-dim); font-size: 12px; margin-top: 4px; line-height: 1.6; }

.admin-panel {
  background: var(--card2); border: 1px solid rgba(201,151,42,.18);
  border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.admin-panel-h { color: var(--gold); font-weight: 800; font-size: 14px; margin-bottom: 10px; }
.panel-note { font-size: 12px; color: var(--text-dim); line-height: 1.7; margin-bottom: 10px; }

/* آخر نشر — تاريخ ووقت الإصدار الحالي */
.deploy-row {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px;
}
.deploy-when { font-size: 15px; font-weight: 800; color: var(--text); }
.deploy-ago {
  font-size: 12px; font-weight: 700; color: var(--gold);
  background: rgba(201,151,42,.12); border-radius: 999px; padding: 2px 10px;
}
.deploy-commit { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.deploy-commit code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(255,255,255,.06); border-radius: 6px; padding: 1px 6px;
  direction: ltr; display: inline-block;
}

/* صفّ مصغّر داخل اللوحة (معاينة الميزات) */
.mini-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 2px; border-bottom: 1px solid rgba(201,151,42,.1);
}
.mini-row:last-of-type { border-bottom: none; }
.mini-name { font-weight: 700; font-size: 13px; color: var(--text); }

.btn-sm { padding: 8px 12px; font-size: 12.5px; margin-top: 10px; }
.btn-danger {
  background: rgba(139,26,26,.16); color: #E9807A;
  border: 1px solid rgba(139,26,26,.6);
}

/* صندوق رقم قابل للضغط */
.stat-box.stat-link {
  cursor: pointer; font-family: inherit;
  transition: border-color .15s, background .15s;
}
.stat-box.stat-link:hover { border-color: var(--gold); background: rgba(201,151,42,.12); }
.stat-box.stat-link .stat-lbl { color: var(--gold-dim); }

/* صفّ اللاعب الغنيّ بالتفاصيل */
.au-rank {
  flex-shrink: 0; width: 24px; text-align: center;
  font-weight: 800; font-size: 13px; color: var(--text-dim);
}
.au-av { flex-shrink: 0; width: 40px; height: 40px; line-height: 0; }
.au-av svg, .au-av img { width: 40px; height: 40px; border-radius: 50%; }
.au-info { flex: 1; min-width: 0; }
.au-g { color: var(--text-dim); font-weight: 400; }
.au-meta2 { font-size: 10px; color: var(--text-soft); margin-top: 2px; }
.au-pts { text-align: center; line-height: 1.1; }
.au-pts span { display: block; font-size: 9px; color: var(--text-dim); font-weight: 400; }

/* ── إعداد ما قبل اللعب الديناميكي (اللوبي) ───────────────── */
/* لوحةٌ عامّةٌ (class="card") بأنماطها الخاصّة — كرت اللعب صار .play-card
   فلم يعد يتصادم معها، ونُبقي هذه الأنماط لأنها تصميمُ اللوحة. */
#lobby-host-tools {
  display: block; height: auto; flex: 0 0 auto; overflow: visible;
  padding: 14px; text-align: start;
  background: var(--card2); border: 1px solid rgba(201,151,42,.2);
}
.setup-field { margin-bottom: 14px; }
.setup-field:last-child { margin-bottom: 0; }
.setup-label { font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 7px; }
.setup-field .chips { justify-content: flex-start; }
.setup-field .counter { justify-content: flex-start; gap: 16px; margin: 2px 0 0; }
.setup-field .counter .val { font-size: 24px; min-width: 40px; }
.setup-field .counter button { width: 34px; height: 34px; font-size: 20px; }
.setup-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ── تحديد وحذف اللاعبين (الإدارة) ────────────────────────── */
.del-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(139,26,26,.15); border: 1px solid rgba(139,26,26,.5);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 10px;
  font-size: 13px; color: var(--text);
}
.del-bar b { color: var(--gold); }
.au-check { flex-shrink: 0; display: flex; align-items: center; }
.au-cb { width: 20px; height: 20px; accent-color: var(--crimson-light); cursor: pointer; }

@media (orientation: landscape) and (max-height: 480px) {
  .aq-opts { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

/* الوضع الأفقي: قنّاص الأرقام والسلايدر وشرح اللعبة — نضغط الرأسي ونسمح بالتمرير */
@media (orientation: landscape) and (max-height: 520px) {
  .sniper-hero { padding: 4px; margin-bottom: 4px; }
  .sniper-clock-row { margin-bottom: 4px; }
  .sniper-clock-row b { font-size: 22px; }
  .sniper-myturn { padding: 8px 12px; margin-bottom: 8px; }
  .num-slider-val { font-size: 28px; margin-bottom: 0; }
  .ruler { height: 56px; margin: 0 0 8px; }
  .ruler-needle { height: 28px; }
  .intro-icon { font-size: 30px; margin-bottom: 2px; }
  .intro-lines { margin: 2px 0 10px; }
  .intro-lines li { padding-top: 3px; padding-bottom: 3px; font-size: 13px; }
}

/* ═══════════════════════════════════════════════════════════════
 * تجاوب موحّد: جوال · تابلت · كمبيوتر  ×  طولي · أفقي
 * ───────────────────────────────────────────────────────────────
 * CSS أصلي حديث فقط — بلا أي مكتبة. الأدوات:
 *   • dvh (مضبوطة أصلاً في .mp-screen) → ارتفاع صحيح على الجوال
 *   • clamp() + vmin → عناصر سائلة تكبر مع حجم الشاشة
 *   • @media بالعرض والاتجاه → تخطيط لكل فئة جهاز
 *   • grid auto-fill/minmax → أعمدة تتكيّف تلقائياً
 * الفلسفة: الشاشة صندوق بارتفاع الجهاز؛ على الأجهزة الأكبر يتوسّط
 * المحتوى ويكبر ليملأ المساحة بدل أن يتعلّق بالأعلى ضيّقاً.
 * ═══════════════════════════════════════════════════════════════ */

/* ── تابلت فأكبر (≥ 700px) ─────────────────────────────────── */
@media (min-width: 700px) {
  /* قائمة الألعاب: بطاقات أكبر، متوسّطة عمودياً، بعرض مسقوف أنيق */
  .game-list {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    align-content: center;        /* تملأ الارتفاع بدل التعلّق بالأعلى */
    max-width: 1080px;
    margin-inline: auto;
    width: 100%;
  }
  .game-tile { padding: clamp(16px, 2.4vmin, 28px) 12px; border-radius: 20px; }
  .gt-ico  { font-size: clamp(34px, 5.2vmin, 54px); }
  .gt-name { font-size: clamp(15px, 2.1vmin, 21px); margin-top: 8px; }
  .gt-desc { font-size: clamp(11px, 1.5vmin, 14px); }

  /* المحتوى المتوسّط (رئيسية/سجل/متصدرون) بعرض مريح لا يتمدّد قبيحاً */
  .home-body { max-width: 760px; margin-inline: auto; }
  .mp-head h2 { font-size: clamp(18px, 2.6vmin, 26px); }
}

/* ── كمبيوتر (≥ 1024px) ────────────────────────────────────── */
@media (min-width: 1024px) {
  .game-list { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
  .home-body { max-width: 900px; }

  /* الرئيسية: بطاقة الترحيب والأفعال جنباً إلى جنب لاستغلال العرض */
  .home-body { flex-direction: row; align-items: center; gap: 40px; }
  .home-welcome { flex: 0 0 42%; }
  .home-actions { flex: 1; max-width: 480px; }
}

/* ── شاشات واسعة جداً: سقف عرض للّوبي واللعب كي لا يتمزّق التخطيط ── */
@media (min-width: 1280px) {
  #screen-lobby > .mp-flex,
  #screen-play  > .mp-flex { max-width: 1200px; margin-inline: auto; width: 100%; }
}

/* ── 🎭 مسابقة التمثيل ─────────────────────────────────────── */
.act-stage {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  overflow-y: auto;   /* شاشةٌ قصيرة/أفقيّة ⇒ يُمرَّر بدل أن يفيض ويتراكب مع الأزرار */
  gap: clamp(10px, 2.5vmin, 22px); text-align: center; padding: clamp(10px, 3vmin, 30px);
}
.act-cat {
  font-size: clamp(13px, 2vmin, 18px); font-weight: 800; color: var(--gold-dim);
  background: rgba(201,151,42,.12); border: 1px solid rgba(201,151,42,.3);
  padding: 6px 16px; border-radius: 999px;
}
.act-word {
  font-family: 'Amiri', serif; font-weight: 900; line-height: 1.15;
  font-size: clamp(30px, 9vmin, 84px); color: var(--gold-light);
  text-shadow: 0 3px 24px rgba(201,151,42,.35);
  max-width: 95%; word-wrap: break-word;
}
.act-sub { font-size: clamp(14px, 2.6vmin, 22px); color: var(--text-dim); line-height: 1.6; }
.act-stage.reveal .act-word { color: var(--gold); animation: qhudPulse .5s ease; }

/* ── الكلمة المحظورة (طابو) ── */
.taboo-card {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  overflow-y: auto;
  gap: clamp(8px, 2vmin, 18px); text-align: center; padding: clamp(10px, 3vmin, 28px);
}
.taboo-cat {
  font-size: clamp(13px, 2vmin, 18px); font-weight: 800; color: var(--gold-dim);
  background: rgba(201,151,42,.12); border: 1px solid rgba(201,151,42,.3);
  padding: 6px 16px; border-radius: 999px;
}
.taboo-word {
  font-family: 'Amiri', serif; font-weight: 900; line-height: 1.15;
  font-size: clamp(28px, 8vmin, 76px); color: var(--gold-light);
  text-shadow: 0 3px 24px rgba(201,151,42,.35);
  max-width: 95%; word-wrap: break-word;
}
.taboo-card.reveal .taboo-word { color: var(--gold); animation: qhudPulse .5s ease; }
/* قائمة الممنوعات — تحذيرٌ أحمر واضح */
.taboo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.taboo-list li {
  font-size: clamp(13px, 2.2vmin, 19px); font-weight: 800; color: #ffd7d0;
  background: rgba(178,34,34,.22); border: 1px solid rgba(224,123,84,.5);
  padding: 5px 14px; border-radius: 999px; text-decoration: line-through;
}
.taboo-sub { font-size: clamp(14px, 2.6vmin, 22px); color: var(--text-dim); line-height: 1.6; }

@media (min-width: 700px) {
  #screen-taboo > .taboo-card,
  #screen-taboo > .timer-wrap,
  #screen-taboo > .act-actions,
  #screen-taboo > .live-scores,
  #screen-taboo > .turn-banner { max-width: 900px; margin-inline: auto; width: 100%; }
}

/* ── همسة المجلس ── */
.hamsa-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px; padding: clamp(8px, 2.5vmin, 20px);
}
.hamsa-pass { display: flex; flex-direction: column; gap: 12px; }
.hamsa-label { font-size: clamp(13px, 2vmin, 17px); font-weight: 800; color: var(--gold-dim); }
.hamsa-recv {
  font-family: 'Amiri', serif; font-size: clamp(20px, 4.6vmin, 34px); line-height: 1.5;
  color: var(--gold-light); background: rgba(201,151,42,.1);
  border: 1px solid rgba(201,151,42,.3); border-radius: 14px; padding: clamp(12px, 3vmin, 22px);
  text-align: center; word-wrap: break-word;
}
.hamsa-input {
  width: 100%; box-sizing: border-box; resize: none;
  font-family: inherit; font-size: clamp(16px, 3vmin, 22px); line-height: 1.6;
  color: var(--text); background: rgba(255,255,255,.05);
  border: 1.5px solid rgba(201,151,42,.4); border-radius: 12px; padding: 12px 14px;
}
.hamsa-input:focus { outline: none; border-color: var(--gold); }
#hamsa-send { font-size: clamp(15px, 2.4vmin, 20px); padding: clamp(12px, 2vmin, 16px); }

.hamsa-wait { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.hamsa-big { font-size: clamp(48px, 16vmin, 110px); animation: qhudPulse 1.6s ease-in-out infinite; }
.hamsa-wait-txt { font-size: clamp(16px, 3vmin, 24px); line-height: 1.7; }
.hamsa-dim, .hamsa-wait-txt .hamsa-dim { color: var(--text-dim); font-size: .82em; }

.hamsa-reveal { display: flex; flex-direction: column; gap: 6px; }
.hamsa-orig, .hamsa-step {
  border-radius: 12px; padding: clamp(9px, 2vmin, 14px); border: 1px solid rgba(255,255,255,.08);
}
.hamsa-orig { background: rgba(201,151,42,.14); border-color: rgba(201,151,42,.4); }
.hamsa-orig-label { font-size: 12px; font-weight: 800; color: var(--gold-dim); margin-bottom: 4px; }
.hamsa-orig-text { font-family: 'Amiri', serif; font-size: clamp(17px, 3.4vmin, 26px); color: var(--gold-light); line-height: 1.5; }
.hamsa-step { background: rgba(255,255,255,.04); }
.hamsa-step-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 3px; }
.hamsa-step-name { font-weight: 800; font-size: clamp(13px, 2.2vmin, 17px); }
.hamsa-step-pts { font-size: clamp(11px, 1.9vmin, 14px); color: var(--gold-dim); white-space: nowrap; }
.hamsa-step-text { font-size: clamp(15px, 3vmin, 22px); line-height: 1.5; word-wrap: break-word; }
.hamsa-arrow { text-align: center; color: var(--text-dim); font-size: 16px; line-height: 1; }
.hamsa-final {
  margin-top: 6px; text-align: center; font-weight: 800; border-radius: 12px;
  padding: clamp(10px, 2.4vmin, 16px); font-size: clamp(14px, 2.6vmin, 20px);
}
.hamsa-final.good { background: rgba(82,183,136,.18); border: 1px solid rgba(82,183,136,.5); color: #b8f0d4; }
.hamsa-final.bad { background: rgba(224,123,84,.16); border: 1px solid rgba(224,123,84,.45); color: #ffd7c8; }

@media (min-width: 700px) {
  #screen-hamsa > .hamsa-body,
  #screen-hamsa > .timer-wrap,
  #screen-hamsa > .act-actions,
  #screen-hamsa > .turn-banner { max-width: 900px; margin-inline: auto; width: 100%; }
}

/* ── مزاد المعرفة ── */
.mazad-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: clamp(8px, 2.5vmin, 18px); text-align: center; }
.mazad-cat {
  font-family: 'Amiri', serif; font-weight: 900; font-size: clamp(22px, 5.4vmin, 42px);
  color: var(--gold-light); text-shadow: 0 3px 20px rgba(201,151,42,.3); line-height: 1.3;
}
.mazad-hint { font-size: clamp(13px, 2.2vmin, 18px); color: var(--text-dim); }

/* المزايدة */
.mazad-bid { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 8px; }
.mazad-bid-label { font-size: clamp(15px, 2.8vmin, 22px); font-weight: 800; }
.mazad-stepper { display: flex; align-items: center; gap: 18px; }
.mazad-step {
  width: clamp(48px, 11vmin, 64px); height: clamp(48px, 11vmin, 64px); border-radius: 50%;
  font-size: clamp(24px, 5vmin, 34px); font-weight: 900; cursor: pointer;
  background: rgba(201,151,42,.16); color: var(--gold-light); border: 1.5px solid rgba(201,151,42,.5);
}
.mazad-step:disabled { opacity: .4; cursor: default; }
.mazad-num {
  font-family: 'Amiri', serif; font-weight: 900; font-size: clamp(44px, 12vmin, 84px);
  color: var(--gold); min-width: clamp(60px, 16vmin, 110px);
}
#mazad-bidbtn { font-size: clamp(16px, 2.6vmin, 22px); padding: clamp(12px, 2vmin, 18px) 32px; }
.mazad-bidders { font-size: clamp(13px, 2.2vmin, 17px); color: var(--text-dim); }

/* الإثبات */
.mazad-prove { display: flex; flex-direction: column; gap: 12px; }
.mazad-prove-head { font-size: clamp(16px, 3vmin, 24px); line-height: 1.5; }
.mazad-chips, .mazad-answers { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.mz-chip {
  font-size: clamp(13px, 2.2vmin, 18px); font-weight: 700; padding: 5px 12px; border-radius: 999px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
}
.mz-chip.ok { background: rgba(82,183,136,.2); border-color: rgba(82,183,136,.5); color: #b8f0d4; }
.mz-chip.no { background: rgba(178,34,34,.18); border-color: rgba(224,123,84,.45); color: #ffd3c8; }
.mz-chip.miss { background: rgba(201,151,42,.12); border-color: rgba(201,151,42,.35); color: var(--gold-dim); }
.mazad-name-row { display: flex; gap: 8px; }
.mazad-input {
  flex: 1; box-sizing: border-box; font-family: inherit; font-size: clamp(16px, 3vmin, 22px);
  color: var(--text); background: rgba(255,255,255,.05);
  border: 1.5px solid rgba(201,151,42,.4); border-radius: 12px; padding: 12px 14px; text-align: center;
}
.mazad-input:focus { outline: none; border-color: var(--gold); }
#mazad-namebtn { padding-inline: 20px; }

/* الكشف */
.mazad-reveal { display: flex; flex-direction: column; gap: 10px; }
.mazad-verdict { font-weight: 800; border-radius: 12px; padding: clamp(11px, 2.6vmin, 18px); font-size: clamp(15px, 2.8vmin, 22px); line-height: 1.5; }
.mazad-verdict.good { background: rgba(82,183,136,.18); border: 1px solid rgba(82,183,136,.5); color: #b8f0d4; }
.mazad-verdict.bad { background: rgba(224,123,84,.16); border: 1px solid rgba(224,123,84,.45); color: #ffd7c8; }
.mazad-missed-label { font-size: 13px; font-weight: 800; color: var(--text-dim); margin-top: 4px; }

@media (min-width: 700px) {
  #screen-mazad > .mazad-body,
  #screen-mazad > .timer-wrap,
  #screen-mazad > .act-actions,
  #screen-mazad > .live-scores,
  #screen-mazad > .turn-banner { max-width: 900px; margin-inline: auto; width: 100%; }
}

/* ── لعبة الحركات المضحكة ── */
.poses-stage {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  gap: clamp(10px, 2.6vmin, 22px); text-align: center; padding: clamp(10px, 3vmin, 26px);
}
.poses-emoji { font-size: clamp(56px, 18vmin, 130px); line-height: 1; animation: qhudPulse 2s ease-in-out infinite; }
.poses-move {
  font-family: 'Amiri', serif; font-weight: 900; line-height: 1.25;
  font-size: clamp(24px, 6.4vmin, 54px); color: var(--gold-light);
  text-shadow: 0 3px 22px rgba(201,151,42,.32); max-width: 95%; word-wrap: break-word;
}
.poses-sub { font-size: clamp(14px, 2.6vmin, 22px); color: var(--text-dim); line-height: 1.6; }

.poses-vote { display: flex; gap: clamp(8px, 2.4vmin, 18px); flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.poses-vbtn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
  font-size: clamp(30px, 7vmin, 48px);
  background: rgba(255,255,255,.05); border: 1.5px solid rgba(201,151,42,.35);
  border-radius: 16px; padding: clamp(10px, 2.4vmin, 16px) clamp(14px, 3.4vmin, 26px);
  transition: transform .12s ease, background .12s ease;
}
.poses-vbtn span { font-size: clamp(11px, 1.9vmin, 15px); font-weight: 700; color: var(--text-dim); }
.poses-vbtn:hover { transform: translateY(-2px); }
.poses-vbtn.picked { background: rgba(201,151,42,.22); border-color: var(--gold); }
.poses-vbtn:disabled { opacity: .55; cursor: default; transform: none; }

/* شريط توزيع الأصوات */
.poses-result { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 8px; }
.poses-avg { font-weight: 800; font-size: clamp(14px, 2.6vmin, 20px); color: var(--gold-dim); margin-bottom: 2px; }
.poses-rrow { display: flex; align-items: center; gap: 10px; }
.poses-remoji { font-size: clamp(20px, 4vmin, 28px); width: 1.4em; }
.poses-rbar { flex: 1; height: 14px; background: rgba(255,255,255,.07); border-radius: 999px; overflow: hidden; }
.poses-rfill { height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); border-radius: 999px; transition: width .4s ease; }
.poses-rnum { min-width: 1.6em; text-align: center; font-weight: 800; color: var(--text-dim); }

@media (min-width: 700px) {
  #screen-poses > .poses-stage,
  #screen-poses > .timer-wrap,
  #screen-poses > .act-actions,
  #screen-poses > .live-scores,
  #screen-poses > .turn-banner { max-width: 900px; margin-inline: auto; width: 100%; }
}

.act-actions { display: flex; gap: 10px; margin-top: 10px; flex-shrink: 0; }
.act-actions .btn { flex: 1; font-size: clamp(15px, 2.4vmin, 20px); padding: clamp(12px, 2vmin, 18px); }

/* تابلت/كمبيوتر: مسرح أوسع وأكبر لاستغلال المساحة */
@media (min-width: 700px) {
  #screen-acting > .act-stage,
  #screen-acting > .timer-wrap,
  #screen-acting > .act-actions,
  #screen-acting > .live-scores,
  #screen-acting > .turn-banner { max-width: 900px; margin-inline: auto; width: 100%; }
  .act-actions .btn { flex: 0 1 260px; }
}

/* ── 🧪 وضع الاختبار: شريط تبديل المقاعد ───────────────────── */
.test-bar {
  position: fixed; inset-inline: 0; top: 0; z-index: 500;
  display: flex; align-items: center; gap: 8px;
  padding: calc(5px + env(safe-area-inset-top)) 10px 6px;
  background: linear-gradient(180deg, rgba(139,26,26,.97), rgba(139,26,26,.8));
  border-bottom: 1px solid rgba(232,184,75,.55);
  overflow-x: auto; scrollbar-width: none;
}
.test-bar::-webkit-scrollbar { display: none; }
.test-bar-tag { flex-shrink: 0; font-size: 11px; font-weight: 800; color: #FFE9B0; white-space: nowrap; }
.test-seats { display: flex; gap: 6px; }
.test-seat {
  flex-shrink: 0; white-space: nowrap; cursor: pointer;
  background: rgba(0,0,0,.3); border: 1px solid rgba(232,184,75,.4);
  color: #F7EFD9; font-family: inherit; font-size: 12px; font-weight: 700;
  padding: 5px 12px; border-radius: 999px;
}
.test-seat.on { background: var(--gold); color: #2A0710; border-color: var(--gold); }
/* نزيح محتوى كل شاشة أسفل الشريط الثابت */
body.kb-test .mp-screen { padding-top: calc(48px + env(safe-area-inset-top)); }

/* مفتاح وضع الاختبار على الرئيسية */
.test-toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid rgba(201,151,42,.3);
  font-weight: 700; font-size: 14px; color: var(--gold-light);
}

.join-qr-hint { font-size: 11px; color: var(--text-dim); line-height: 1.6; margin-top: 8px; text-align: center; }

/* ── 🔍 قنّاص الأرقام ───────────────────────────────────────── */
.sniper-hero { text-align: center; padding: 14px 10px; margin-bottom: 12px; }
.sniper-clock-row { text-align: center; font-size: 15px; color: var(--text-dim); margin-bottom: 10px; }
.sniper-clock-row b { font-size: 30px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.sniper-myturn {
  background: var(--card); border: 1px solid rgba(201,151,42,.35); border-radius: 16px;
  padding: 14px; margin-bottom: 12px;
}
.sniper-myturn.mp-hidden { display: none; }
.sniper-target { font-size: 16px; text-align: center; color: var(--text); margin-bottom: 6px; }
.sniper-target b { color: var(--gold-light); }
.sniper-range { text-align: center; font-size: 14px; color: var(--text-dim); margin-bottom: 6px; }
.sniper-range b { color: var(--green-light); font-size: 18px; font-weight: 800; }
/* ── مسطرة الأرقام (على طراز ساعة أبل): تُظهر كل الأرقام وتُسحب ── */
.num-slider-val {
  text-align: center; font-size: 46px; font-weight: 800; color: var(--gold-light);
  font-variant-numeric: tabular-nums; line-height: 1.1; margin-bottom: 2px;
}
.ruler { position: relative; height: 70px; margin: 2px 0 14px; }
.ruler-track {
  --tickw: 22px;
  display: flex; align-items: flex-end; height: 100%;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  direction: ltr; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding: 0 calc(50% - var(--tickw) / 2) 6px;   /* يسمح بتوسيط الطرفين */
  overscroll-behavior-x: contain;
}
.ruler-track::-webkit-scrollbar { display: none; }
.ruler-tick {
  flex: 0 0 var(--tickw); scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%;
}
.ruler-tick .bar { width: 2px; height: 14px; background: rgba(201,151,42,.4); border-radius: 2px; }
.ruler-tick.major .bar { height: 26px; width: 2.5px; background: var(--gold); }
.ruler-tick .lbl {
  font-size: 11px; height: 14px; margin-top: 4px; color: var(--text-dim);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.ruler-needle {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 3px; height: 34px; background: var(--crimson-light); border-radius: 2px;
  z-index: 3; pointer-events: none; box-shadow: 0 0 8px rgba(233,128,122,.7);
}
.ruler-needle::before {
  content: ''; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--crimson-light);
}
.ruler.disabled { opacity: .5; pointer-events: none; }
.btn-wide { width: 100%; }

.sniper-feedback { text-align: center; font-size: 15px; font-weight: 800; min-height: 22px; margin-bottom: 8px; }
.sniper-feedback.up { color: var(--gold); }
.sniper-feedback.down { color: var(--crimson-light); }
.sniper-board-title { font-size: 12px; color: var(--text-dim); margin: 6px 2px; font-weight: 700; }
.sniper-board { display: flex; flex-direction: column; gap: 5px; }
.sniper-pp {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 11px; border-radius: 10px; background: var(--card);
  border: 1px solid rgba(201,151,42,.18); font-size: 13px;
}
.sniper-pp.done { border-color: rgba(82,183,136,.5); }
.sniper-pp-name { font-weight: 700; color: var(--text); }
.sniper-pp-prog { font-weight: 700; color: var(--gold-light); }
.sniper-results-list { display: flex; flex-direction: column; gap: 8px; }
.sniper-res { background: var(--card); border: 1px solid rgba(201,151,42,.25); border-radius: 12px; padding: 10px 12px; }
.sniper-res-head { display: flex; align-items: center; gap: 8px; }
.sniper-res-rank { font-size: 18px; }
.sniper-res-name { flex: 1; font-weight: 800; font-size: 14px; color: var(--text); }
.sniper-res-pts { font-weight: 800; color: var(--gold-light); }
.sniper-res-meta { font-size: 12px; color: var(--text-dim); margin-top: 5px; line-height: 1.6; }
.sniper-res-meta b { color: var(--text); }
.sniper-res-targets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.sniper-tg { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.18); color: var(--text-dim); }
.sniper-tg.miss { color: var(--crimson-light); }

/* ── جوائزُ وإحصائيات النهاية (طرائف) ── */
.sniper-awards { margin-bottom: 14px; }
.sniper-awards-title { font-size: 12.5px; color: var(--gold-light); font-weight: 800; margin: 0 2px 8px; }
.sniper-awards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.award-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 11px 8px; border-radius: 14px; cursor: pointer; text-align: center;
  background: var(--card); border: 1px solid rgba(201,151,42,.3);
  transition: transform .1s, border-color .15s;
}
.award-card:active { transform: scale(.96); }
.award-card:hover { border-color: rgba(201,151,42,.6); }
.award-ic { font-size: 26px; line-height: 1; }
.award-tt { font-size: 12.5px; font-weight: 800; color: var(--text); }
.award-win { font-size: 11.5px; font-weight: 700; color: var(--gold-light); line-height: 1.4; }
/* تفاصيل الجائزة (نافذة) */
.award-detail { text-align: start; margin: 6px 0 16px; max-height: 46vh; overflow-y: auto; }
.award-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 6px;
  border-bottom: 1px solid rgba(201,151,42,.14);
}
.award-row:last-child { border-bottom: none; }
.award-row-rank { width: 26px; text-align: center; font-size: 15px; font-weight: 800; color: var(--gold-light); }
.award-row-name { flex: 1; font-weight: 700; font-size: 14px; color: var(--text); }
.award-row-val { font-weight: 800; font-size: 13.5px; color: var(--green-light); }

/* ── ⚡ الأسرع ──────────────────────────────────────────────── */
.speed-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--gold-light); margin-bottom: 6px; }
.speed-top .muted { font-weight: 600; font-size: 12px; }
/* المنطقة المرنة تأخذ ما بقي وتدفع أزرار الأسفل إلى القاع */
.speed-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.speed-q {
  font-family: 'Amiri', serif; font-size: 24px; text-align: center; color: var(--text);
  padding: 18px 12px; line-height: 1.6; flex-shrink: 0;
  background: var(--card); border-radius: 14px; border: 1px solid rgba(201,151,42,.25);
}
/* وضع «سطر واحد»: نمنع الالتفاف ونضبط الحجم بالسكربت ليبقى السؤال/المعادلة كاملاً */
.speed-q.fit { white-space: nowrap; overflow: hidden; }
/* المعادلة تُقرأ يساراً→يميناً كما كُتبت — نمنع «؟» العربيّة من قلبها */
.speed-eq { font-family: inherit; font-weight: 800; letter-spacing: 1px; direction: ltr; unicode-bidi: isolate-override; display: inline-block; }
.speed-mcq.mp-hidden, .speed-typed.mp-hidden { display: none; }
.speed-opt.picked { border-color: var(--gold); background: rgba(232,184,75,.18); }
.speed-typed { display: flex; }
.speed-typed .inp { margin: 0; width: 100%; text-align: center; font-size: 26px; font-weight: 800; direction: ltr; padding: 14px; }
.speed-wait { text-align: center; font-size: 13px; color: var(--green-light); padding: 14px; font-weight: 700; }
.speed-wait.mp-hidden { display: none; }
.speed-reveal.mp-hidden { display: none; }
.speed-correct { text-align: center; font-size: 15px; color: var(--text); margin: 8px 0 10px; }
.speed-correct b { color: var(--green-light); }
.speed-results { display: flex; flex-direction: column; gap: 5px; }
.speed-res {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
  padding: 7px 11px; border-radius: 10px; background: var(--card);
  border: 1px solid rgba(201,151,42,.18);
}
.speed-res.ok { border-color: rgba(82,183,136,.5); }
.speed-res.no { opacity: .75; }
.speed-res-name { font-weight: 700; font-size: 13.5px; color: var(--text); text-align: start; }
.speed-res-ans { font-size: 13px; color: var(--text-dim); direction: ltr; unicode-bidi: plaintext; }
.speed-res-pts { font-weight: 800; font-size: 13px; color: var(--gold-light); white-space: nowrap; }
.speed-res.no .speed-res-pts { color: var(--crimson-light); }
/* شريط الأزرار الثابت في أسفل الشاشة */
.speed-actions { margin-top: 10px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.speed-actions .btn { width: 100%; }
#speed-send { font-size: 17px; padding: 15px; }

.review-q { text-align: start; padding: 8px 0; border-top: 1px solid rgba(201,151,42,.15); }
.review-q:first-child { border-top: none; }
.review-qt { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.6; margin-bottom: 5px; }
.review-correct { color: var(--green-light); font-size: 12px; font-weight: 700; margin-inline-start: 4px; }
.review-ans { display: flex; flex-wrap: wrap; gap: 5px; }
.review-a { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.18); color: var(--text-dim); }
.review-a.ok { color: var(--green-light); }
.review-a b { direction: ltr; unicode-bidi: plaintext; }

/* ── 📵 الصامد ──────────────────────────────────────────────── */
.sumud-hero {
  flex-shrink: 0; text-align: center; padding: 18px 14px 16px; margin-bottom: 10px;
  border-radius: 18px; border: 1px solid rgba(82,183,136,.4);
  background: radial-gradient(circle at 50% 0%, rgba(82,183,136,.14), var(--card));
}
.sumud-hero.out { border-color: rgba(178,34,34,.5); background: radial-gradient(circle at 50% 0%, rgba(178,34,34,.16), var(--card)); }
.sumud-emoji { font-size: 44px; line-height: 1; margin-bottom: 8px; animation: freezeBob 2.4s ease-in-out infinite; }
.sumud-headline { font-size: 20px; font-weight: 800; color: var(--gold-light); margin-bottom: 4px; }
.sumud-sub { font-size: 12.5px; color: var(--text-dim); line-height: 1.6; margin-bottom: 12px; }
.sumud-clock {
  font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text); letter-spacing: 2px; line-height: 1;
}
.sumud-count { font-size: 13px; color: var(--text-dim); margin-top: 6px; }
.sumud-count b { color: var(--green-light); font-size: 16px; }
.sumud-players { display: flex; flex-direction: column; gap: 7px; }
.sumud-p {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 12px;
  border: 1px solid rgba(201,151,42,.2); background: var(--card);
}
.sumud-p.in { border-color: rgba(82,183,136,.45); }
.sumud-p.out { opacity: .6; }
.sumud-av { flex-shrink: 0; }
.sumud-name { flex: 1; font-weight: 700; font-size: 14px; color: var(--text); }
.sumud-badge { font-size: 12px; font-weight: 700; }
.sumud-p.in .sumud-badge { color: var(--green-light); }
.sumud-p.out .sumud-badge { color: var(--crimson-light); }

/* ── 📷 رمز QR للدخول ───────────────────────────────────────── */
.qr-frame {
  background: #fff; border-radius: 16px; padding: 12px; margin: 4px auto 12px;
  width: min(260px, 72vw); aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 18px var(--shadow);
}
.qr-frame svg { width: 100%; height: 100%; display: block; }
.qr-code-line { font-size: 14px; color: var(--text-dim); margin-bottom: 12px; }
.qr-code-line b { color: var(--gold-light); letter-spacing: 3px; font-size: 20px; font-weight: 800; }

/* ── 🆘 زرّ النجدة ──────────────────────────────────────────── */
.rescue-fab {
  position: fixed; z-index: 720;
  top: calc(10px + env(safe-area-inset-top)); inset-inline-end: 10px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid rgba(232,184,75,.6);
  background: linear-gradient(160deg, #8B1A1A, #5e1010);
  color: #fff; font-size: 19px; line-height: 1; cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.rescue-fab:active { transform: scale(.9); }
.rescue-fab.frozen { animation: qhudPulse 1s infinite; border-color: #7ec8ff; }
/* في وضع الاختبار الشريط يعلو الشاشة — نُنزل الزرّ تحته */
/* في وضع الاختبار: شريط الاختبار (~٤٨px) يدفع الرأس للأسفل، فننزل زرّ
   النجدة تحت الرأس كاملاً (٤٨ شريط + ٤٤ رأس + هامش) فلا يركب زرّ الدردشة. */
body.kb-test .rescue-fab { top: calc(104px + env(safe-area-inset-top)); }
/* على شاشة الإدارة يطفو الزرّ فوق التبويبات/شريط البحث في الركن نفسه —
   نُخفيه هناك (أفعال النجدة متاحة أصلاً من داخل الغرفة/اللوبي). */
body:has(#screen-admin.active) .rescue-fab { display: none; }

/* حين يظهر زرّ النجدة (للمدير في غرفة): نُفرّغ ركنه العلويّ الأيسر من
   المحتوى التفاعليّ فلا يحجبه — للمدير وحده دون التأثير على بقيّة اللاعبين. */
body.rescue-on #screen-games .mp-scroll { padding-block-start: 52px; }
body.rescue-on #screen-play .live-scores,
body.rescue-on #screen-acting .live-scores,
body.rescue-on #screen-speed .speed-top { padding-inline-end: 52px; }
/* الزرّ يطفو في ركن الرأس (inline-end) فيحجب أزرار الرأس (تحديث/معلومات)
   في مسير/قوافل وسواها — نُزيحها عنه في كلّ شاشات اللعب حين يظهر الزرّ. */
body.rescue-on .mp-head .head-btns { padding-inline-end: 46px; }

.rescue-lbl { display: block; text-align: start; font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 4px; }
.rescue-report-h { text-align: start; font-size: 11.5px; font-weight: 700; color: var(--gold-light); margin: 6px 0 4px; }
.rescue-report {
  text-align: start; direction: ltr; unicode-bidi: plaintext;
  background: rgba(0,0,0,.28); border: 1px solid rgba(201,151,42,.28);
  border-radius: 10px; padding: 9px 11px; margin: 0 0 4px;
  font-size: 11px; line-height: 1.6; color: var(--text);
  max-height: 190px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.rescue-players { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; max-height: 168px; overflow: auto; }
.rescue-player {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.22); border: 1px solid rgba(201,151,42,.22);
  border-radius: 10px; padding: 6px 10px;
}
.rescue-player .rp-name { flex: 1; text-align: start; font-size: 13px; font-weight: 700; color: var(--text); }
.rescue-player .rp-tag { font-size: 10.5px; color: var(--text-dim); }
.rescue-player .rp-off { color: var(--crimson-light); }
.rescue-player .rp-del {
  flex-shrink: 0; cursor: pointer; font-family: inherit; font-weight: 800; font-size: 11.5px;
  background: rgba(139,26,26,.28); border: 1px solid rgba(232,184,75,.4); color: #FFE9B0;
  padding: 4px 10px; border-radius: 999px;
}
.rescue-player .rp-del:disabled { opacity: .4; }

.rescue-frozen-badge {
  display: inline-block; font-weight: 800; font-size: 14px; color: #cfe8ff;
  background: rgba(60,120,190,.22); border: 1px solid rgba(120,180,240,.5);
  padding: 5px 14px; border-radius: 999px; margin-bottom: 8px;
}
.rescue-return { font-size: 13px; font-weight: 700; color: var(--gold-light); margin-bottom: 10px; }
.rescue-return b { color: var(--text); }

/* لوحة المدير تعلو لوحة التوقّف كي لا تُحجب عنه */
#rescue-sheet { z-index: 740; }

/* ── لوحة التوقّف لكل اللاعبين ──────────────────────────────── */
.freeze-overlay {
  position: fixed; inset: 0; z-index: 700;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(6,10,20,.72); backdrop-filter: blur(6px);
}
.freeze-overlay.mp-hidden { display: none; }
.freeze-card {
  max-width: 360px; text-align: center;
  background: var(--card); border: 1px solid rgba(120,180,240,.4);
  border-radius: 18px; padding: 26px 22px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.freeze-emoji { font-size: 46px; line-height: 1; margin-bottom: 10px; animation: freezeBob 2s ease-in-out infinite; }
.freeze-title { font-size: 20px; font-weight: 800; color: var(--gold-light); margin-bottom: 8px; }
.freeze-msg { font-size: 13.5px; color: var(--text-dim); line-height: 1.7; margin-bottom: 16px; }
.freeze-spinner { display: flex; gap: 6px; justify-content: center; }
.freeze-spinner span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--gold);
  animation: freezeDot 1.2s ease-in-out infinite;
}
.freeze-spinner span:nth-child(2) { animation-delay: .2s; }
.freeze-spinner span:nth-child(3) { animation-delay: .4s; }
@keyframes freezeBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes freezeDot { 0%,100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.2); } }

/* ── قائمة الفرق في الإدارة ─────────────────────────────────── */
.tm-date { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.tm-team {
  border: 1px solid rgba(201,151,42,.22); border-radius: 10px;
  padding: 8px 10px; margin-bottom: 6px; background: rgba(0,0,0,.14);
}
.tm-team.won { border-color: rgba(232,184,75,.6); background: rgba(232,184,75,.08); }
.tm-team-head { display: flex; align-items: center; justify-content: space-between; }
.tm-team-name { font-weight: 800; font-size: 13.5px; color: var(--text); }
.tm-team-score { font-weight: 800; font-size: 15px; color: var(--gold-light); }
.tm-members { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tm-mem {
  font-size: 11.5px; color: var(--text-dim);
  background: rgba(0,0,0,.2); border-radius: 999px; padding: 2px 9px;
}
.tm-agg { display: flex; flex-direction: column; gap: 4px; }
.tm-agg-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 2px; }
.tm-agg-name { color: var(--text); font-weight: 700; }
.tm-agg-num { color: var(--gold-light); font-weight: 700; }

/* ── قائمة مهام المدير ──────────────────────────────────────── */
.task-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px; margin-bottom: 8px;
  background: var(--card); border: 1px solid rgba(201,151,42,.25); border-radius: 12px;
}
.task-row.done { opacity: .55; }
.task-check {
  flex-shrink: 0; width: 22px; height: 22px; margin-top: 1px; cursor: pointer;
  border-radius: 6px; border: 1.5px solid var(--gold); background: transparent;
  display: flex; align-items: center; justify-content: center; font-size: 14px; color: #2A0710;
}
.task-check.on { background: var(--gold); }
.task-main { flex: 1; min-width: 0; text-align: start; }
.task-text { font-size: 13.5px; font-weight: 700; color: var(--text); line-height: 1.5; }
.task-row.done .task-text { text-decoration: line-through; }
.task-note { font-size: 11.5px; color: var(--text-dim); line-height: 1.6; margin-top: 4px; white-space: pre-wrap; }
.task-date { font-size: 10.5px; color: var(--text-dim); margin-top: 4px; opacity: .8; }
.task-del {
  flex-shrink: 0; background: transparent; border: none; cursor: pointer;
  color: var(--crimson-light); font-size: 15px; padding: 2px 4px;
}
.task-add { display: flex; gap: 6px; margin-bottom: 14px; }
.task-add .inp { margin: 0; }

/* ═══════════════════════════════════════════════════════════════
 * تحسينات تجربة الاستخدام (طولي + أفقي) — مراجعة شاملة
 * الجذر: .mp-screen مقصوصة (overflow:hidden)؛ فالشاشات كثيفة المحتوى
 * تُقصّ أزرارها بدل أن تُمرَّر. نجعل المناطق المزدحمة قابلة للتمرير.
 * ═══════════════════════════════════════════════════════════════ */

/* المسابقة: السؤال + الخيارات تُمرَّر طولياً فلا يُقصّ الخيار الرابع */
#screen-play .play-grid { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* مسير النور: صندوق التحدّي يُمرَّر داخلياً فلا تُقصّ خيارات الإجابة */
.mas-challenge { overflow-y: auto; max-height: 46vh; }

/* قنّاص الأرقام: أطواره أغلفةٌ عاديّة تكسر سلسلة flex فلا تُمرَّر —
   نُصلح السلسلة فتُمرَّر النتيجة والسباق طولياً (لا تُقصّ الأزرار) */
#sniper-pick, #sniper-race { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
#sniper-results { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#sniper-results > .sniper-hero, #sniper-results > .btn { flex-shrink: 0; }

/* زرّ النجدة (للمدير): كان يركب أزرار رأس الشاشة — وفي اللوبي كان يلتصق
   بزرّ الدردشة. ننزله تحت شريط الرأس كاملاً (٤٤px زرّ + ٨px هامش) بفجوةٍ واضحة. */
.rescue-fab { top: calc(72px + env(safe-area-inset-top)); }

/* أهدافُ لمسٍ ≥ ٤٤px على الأزرار الأكثر استعمالاً */
.tb-btn { width: 44px; height: 44px; }
.qaw-btn { min-height: 44px; }
.setup-field .counter button { width: 40px; height: 40px; }

/* سجلّ القوافل: قصٌّ لطيفٌ بثلاث نقاط بدل بترٍ في منتصف الكلمة */
.qaw-log { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* أزرار الرابط/الرمز في اللوبي: ارتفاعٌ مريح */
#btn-copy, #btn-qr { padding: 12px 9px; }

/* رفعُ الكرت المختار في مسير النور لا يُقصّ من أعلى اليد */
.hand { padding-top: 12px; }

/* ── الوضع الأفقي: شاشاتٌ كانت بلا تهيئة ── */
@media (orientation: landscape) and (max-height: 520px) {
  /* شاشة النتيجة: نُصغّر الكأس والاسم فلا يبتلعان المنصّة */
  #screen-over .trophy { font-size: 44px; }
  #screen-over .winner-name { font-size: 26px; }
  #screen-over .mp-flex { gap: 4px; }
  /* الصامد: بطلٌ أصغر ليتّسع اللاعبون */
  .sumud-hero { padding: 6px 12px; margin-bottom: 6px; }
  .sumud-emoji { font-size: 30px; margin-bottom: 4px; }
  .sumud-headline { font-size: 16px; }
  .sumud-clock { font-size: 28px; }
  .sumud-sub { display: none; }
  /* مسير النور: خيارات التحدّي عمودان، والطريق يفسح المجال */
  .road { max-height: 22vh; }
  .mas-challenge .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .mas-challenge .opt { padding: 8px; font-size: 12.5px; }
  /* القوافل: أرضيّة للطاولة كي تبقى مقروءة، وسطرٌ واحد للسجلّ */
  .qaw-table { min-height: 96px; }
  .qaw-log { -webkit-line-clamp: 1; }
}

/* ═══════════════════════════════════════════════════════════════
 * دردشة الغرفة — واجهةٌ احترافيّة (فقاعات، أفاتار، أسماء، وقت)
 * ═══════════════════════════════════════════════════════════════ */
.chat-btn { position: relative; }
.chat-badge {
  position: absolute; top: -2px; inset-inline-start: -2px; min-width: 18px; height: 18px;
  padding: 0 4px; border-radius: 999px; background: var(--crimson, #8B1A1A); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--deep); font-variant-numeric: tabular-nums;
}
.chat-badge.mp-hidden { display: none; }

.chat-sheet {
  position: fixed; inset: 0; z-index: 760; display: flex; flex-direction: column;
  justify-content: flex-end; background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn .2s;
}
.chat-sheet.mp-hidden { display: none; }
.chat-panel {
  display: flex; flex-direction: column; height: 88vh; height: 88dvh;
  background: var(--card); border-top-left-radius: 22px; border-top-right-radius: 22px;
  border: 1px solid rgba(201,151,42,.35); border-bottom: none;
  box-shadow: 0 -12px 40px rgba(0,0,0,.5); overflow: hidden;
  animation: chatUp .28s cubic-bezier(.2,.9,.3,1.1);
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes chatUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  padding: 12px 14px; border-bottom: 1px solid rgba(201,151,42,.2);
}
.chat-title { font-weight: 800; font-size: 16px; color: var(--gold-light); }

.chat-msgs { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.chat-empty { margin: auto; color: var(--text-dim); font-size: 13.5px; text-align: center; }

/* كل رسالة صفٌّ بعرضٍ كامل، ونُوجّه الفقاعة بـ justify-content فلا تفيض */
.cm { display: flex; gap: 8px; width: 100%; }
.cm.them { justify-content: flex-start; }              /* اليمين في RTL */
.cm.me { justify-content: flex-end; }                   /* اليسار في RTL */
.cm.sys { justify-content: center; }
/* رسالة نظام (انضمّ/غادر) */
.cm.sys .cm-bubble {
  background: rgba(201,151,42,.12); color: var(--text-dim); font-size: 12px;
  padding: 4px 12px; border-radius: 999px; font-weight: 600; max-width: 90%; text-align: center;
}
.cm-av { flex-shrink: 0; align-self: flex-end; }
.cm-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 75%; }
.cm-name { font-size: 11.5px; font-weight: 800; color: var(--gold-light); padding: 0 4px; }
.cm-bubble {
  padding: 8px 12px; border-radius: 15px; font-size: 14.5px; line-height: 1.5;
  word-break: break-word; overflow-wrap: anywhere; white-space: pre-wrap;
}
.cm.them .cm-bubble { background: var(--card); border: 1px solid rgba(201,151,42,.2); color: var(--text); border-bottom-right-radius: 5px; }
.cm.me   .cm-bubble { background: linear-gradient(160deg, var(--gold), var(--gold-light)); color: #2a1c05; border-bottom-left-radius: 5px; font-weight: 600; }
.cm-time { font-size: 10px; color: var(--text-dim); padding: 0 4px; align-self: flex-end; }
.cm.me .cm-time { align-self: flex-start; }

.chat-quick { display: flex; gap: 6px; padding: 8px 12px 0; flex-shrink: 0; overflow-x: auto; scrollbar-width: none; }
.chat-quick::-webkit-scrollbar { display: none; }
.chat-quick button {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer;
  background: var(--card); border: 1px solid rgba(201,151,42,.25); transition: transform .1s;
}
.chat-quick button:active { transform: scale(.88); }

.chat-inputbar { display: flex; gap: 8px; align-items: center; padding: 10px 12px; flex-shrink: 0; }
.chat-input {
  flex: 1; margin: 0; padding: 12px 16px; border-radius: 999px; font-size: 16px;
  background: var(--card); border: 1px solid rgba(201,151,42,.3); color: var(--text);
}
.chat-input:focus { outline: none; border-color: var(--gold); }
.chat-send {
  flex-shrink: 0; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  background: linear-gradient(160deg, var(--gold), var(--gold-light)); color: #2a1c05;
  font-size: 19px; border: none; display: flex; align-items: center; justify-content: center;
  transform: scaleX(-1); /* السهم يشير لجهة الإرسال في RTL */ transition: transform .1s;
}
.chat-send:active { transform: scaleX(-1) scale(.9); }

@media (orientation: landscape) and (max-height: 520px) {
  .chat-panel { height: 96vh; height: 96dvh; }
  .chat-quick { display: none; }
}

/* ════════ القائمة السفليّة الديناميكيّة ════════
   تنقّلٌ في متناول الإبهام — تظهر في شاشات المحور فقط (body.nav-on)،
   وتنزلق خارج الشاشة أثناء اللعب. مؤشّرٌ ذهبيٌّ يُبرز القسم الحاليّ. */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 400;
  display: flex;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid rgba(201,151,42,.28);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateY(115%);
  transition: transform .26s cubic-bezier(.4, 0, .2, 1);
  pointer-events: none;
}
body.nav-on .bottom-nav { transform: none; pointer-events: auto; }
.bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: 0; cursor: pointer; padding: 9px 2px 7px;
  min-height: 52px; color: var(--text-dim);
  font-family: inherit; font-weight: 700; font-size: 10.5px;
  position: relative; -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.bn-lbl { white-space: nowrap; }   /* خمسُ وجهاتٍ الآن — لا نكسر الكلمة */
.bn-ic { font-size: 21px; line-height: 1; transition: transform .16s ease; }
.bn-item.on { color: var(--gold-light); }
.bn-item.on .bn-ic { transform: translateY(-1px) scale(1.07); }
.bn-item:active .bn-ic { transform: scale(.88); }
.bn-item.on::before {
  content: ''; position: absolute; top: 0; left: 24%; right: 24%; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
}
.bn-item:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; border-radius: 10px; }

/* المحتوى يترك مساحةً للقائمة في شاشات المحور فلا يُحجب خلفها */
body.nav-on .mp-screen { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }

@media (min-width: 700px) {
  .bottom-nav { max-width: 560px; margin-inline: auto; border-radius: 18px 18px 0 0;
    border-inline: 1px solid rgba(201,151,42,.2); }
}
@media (prefers-reduced-motion: reduce) {
  .bottom-nav { transition: none; }
}

/* ════════════════ ملفّي ════════════════ */
.prof-hero {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 14px 20px; text-align: center;
  background: linear-gradient(180deg, var(--card2), transparent);
  border: 1px solid rgba(201,151,42,.16); border-radius: var(--radius);
  margin-bottom: 16px;
}
.prof-av {
  width: 84px; height: 84px; border-radius: 50%; padding: 0; cursor: pointer;
  background: var(--card); border: 2px solid var(--gold-dim);
  box-shadow: 0 6px 18px var(--shadow); overflow: hidden;
  display: grid; place-items: center;
}
.prof-av svg, .prof-av img { width: 100%; height: 100%; }
.prof-name { margin: 2px 0 0; font-size: 20px; font-weight: 800; color: var(--text); }
.prof-sub  { margin: 0; font-size: 12px; color: var(--text-dim); letter-spacing: .02em; }
.prof-edit { margin-top: 6px; font-size: 13px; padding: 7px 16px; }

.prof-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px;
}
@media (max-width: 360px) { .prof-stats { grid-template-columns: repeat(2, 1fr); } }
.ps-tile {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--card); border: 1px solid rgba(201,151,42,.16);
  border-radius: var(--radius-sm); padding: 14px 8px; min-width: 0;
}
.ps-ico { font-size: 20px; }
.ps-val { font-size: 22px; font-weight: 900; color: var(--gold);
          font-variant-numeric: tabular-nums; line-height: 1.1; }
.ps-lbl { font-size: 11px; color: var(--text-dim); text-align: center; }

.prof-sec { margin: 0 2px 10px; font-size: 15px; font-weight: 700; color: var(--text); }
.prof-badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pb {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border-radius: var(--radius-sm); padding: 14px 10px; text-align: center;
  border: 1px solid rgba(201,151,42,.16);
}
.pb.on  { background: linear-gradient(180deg, rgba(201,151,42,.16), var(--card)); }
.pb.off { background: var(--card); opacity: .62; }
.pb-ico  { font-size: 26px; filter: saturate(1); }
.pb.off .pb-ico { filter: grayscale(1) opacity(.7); }
.pb-name { font-size: 13px; font-weight: 800; color: var(--text); }
.pb-hint { font-size: 10.5px; color: var(--text-dim); line-height: 1.35; }
.pb.on .pb-hint { color: var(--gold-dim); font-weight: 700; }

/* ════════════════ ترتيب الأحداث ════════════════ */
.ev-title { font-size: 16px; font-weight: 800; color: var(--text); text-align: center;
  margin: 2px 0 14px; text-wrap: balance; }
.ev-items { display: flex; flex-direction: column; gap: 10px; }
.ev-card {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--card); border: 1.5px solid rgba(201,151,42,.18);
  border-radius: 14px; padding: 14px 14px; cursor: pointer; text-align: start;
  transition: transform .1s, border-color .15s, background .15s;
}
.ev-card:active { transform: scale(.985); }
.ev-card:disabled { cursor: default; opacity: .9; }
.ev-card.picked { border-color: var(--gold); background: linear-gradient(180deg, rgba(201,151,42,.14), var(--card)); }
.ev-badge {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 900; font-size: 15px;
  background: rgba(201,151,42,.14); color: var(--gold);
  border: 1.5px solid rgba(201,151,42,.3); font-variant-numeric: tabular-nums;
}
.ev-card.picked .ev-badge { background: var(--gold); color: #2a1d04; border-color: var(--gold); }
.ev-text { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; color: var(--text); }

.ev-result { display: flex; flex-direction: column; gap: 8px; }
.ev-rhead { font-weight: 800; font-size: 15px; color: var(--text); text-align: center; }
.ev-rhead.ok { color: var(--green-light, #3FB27F); }
.ev-rwho { font-size: 12px; color: var(--text-dim); margin: 4px 0 2px; }
.ev-rrow {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid rgba(201,151,42,.14);
  border-radius: 11px; padding: 9px 12px;
}
.ev-rrow.good { border-color: rgba(63,178,127,.5); }
.ev-rrow.bad  { border-color: rgba(224,106,90,.45); }
.ev-rnum { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 12px; background: rgba(201,151,42,.14); color: var(--gold); font-variant-numeric: tabular-nums; }
.ev-rtext { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; color: var(--text); }
.ev-rmark { flex: none; font-weight: 900; }
.ev-rrow.good .ev-rmark { color: var(--green-light, #3FB27F); }
.ev-rrow.bad .ev-rmark { color: #E06A5A; }

/* ════════════════ صِل الشخصيّة ════════════════ */
.mt-board { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; }
.mt-board .mt-col { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.mt-left, .mt-right {
  width: 100%; border-radius: 12px; padding: 12px 11px; cursor: pointer;
  border: 1.5px solid rgba(201,151,42,.18); background: var(--card);
  font-weight: 700; font-size: 14px; color: var(--text); text-align: start;
  transition: transform .1s, border-color .15s, background .15s;
}
.mt-left { display: flex; flex-direction: column; gap: 3px; align-items: stretch; }
.mt-left:active, .mt-right:active { transform: scale(.98); }
.mt-left.sel { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,151,42,.25); }
.mt-left.done { background: linear-gradient(180deg, rgba(201,151,42,.12), var(--card)); }
.mt-ltext { min-width: 0; }
.mt-link { font-size: 12px; font-weight: 800; color: var(--gold); }
.mt-left.done .mt-link { color: var(--gold); }
.mt-right.used { opacity: .4; }
.mt-right:disabled { cursor: default; }
/* نسقٌ بسيطٌ لصفوف الكشف الخاصّة بالمطابقة (تشارك ev-rrow) */
.ev-rrow .mt-rl { font-weight: 700; color: var(--text); flex: 1; min-width: 0; }
.ev-rrow .mt-arrow { color: var(--text-dim); flex: none; }
.ev-rrow .mt-rr { font-weight: 800; color: var(--gold); flex: 1; min-width: 0; text-align: start; }

/* ════════════════ عائلة كربلاء (Feud) ════════════════ */
.fd-q { font-size: 16px; font-weight: 800; color: var(--text); text-align: center; margin: 2px 0 10px; text-wrap: balance; }
.fd-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.fd-strikes { display: flex; gap: 6px; }
.fd-x { font-size: 18px; color: rgba(224,106,90,.25); transition: color .2s, transform .2s; }
.fd-x.on { color: #E06A5A; transform: scale(1.12); }
.fd-pts { font-weight: 800; color: var(--gold); font-size: 14px; }
.fd-board { display: flex; flex-direction: column; gap: 8px; }
.fd-slot {
  display: flex; align-items: center; gap: 10px;
  border-radius: 12px; padding: 13px; border: 1.5px solid rgba(201,151,42,.28);
  background: var(--card2); transition: background .2s, border-color .2s;
}
.fd-slot.blank { background: linear-gradient(180deg, rgba(201,151,42,.07), var(--card2)); }
.fd-slot.blank .fd-atext { color: var(--gold-dim); letter-spacing: 4px; font-size: 20px; }
.fd-slot.found { border-color: rgba(201,151,42,.55); background: linear-gradient(180deg, rgba(201,151,42,.16), var(--card)); }
.fd-slot.shown { opacity: .7; }        /* كُشِفت في النهاية دون أن يجدها */
.fd-rank { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 13px; background: rgba(201,151,42,.14); color: var(--gold); font-variant-numeric: tabular-nums; }
.fd-atext { flex: 1; min-width: 0; font-weight: 800; font-size: 15px; color: var(--text); }
.fd-apts { flex: none; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.fd-inputrow { display: flex; gap: 8px; margin-top: 8px; }
.fd-inputrow .inp { flex: 1; min-width: 0; }
.fd-inputrow .btn { width: auto; flex: none; padding-inline: 22px; }
.fd-result { display: flex; flex-direction: column; gap: 8px; }

/* ════════════════ سقاية العطاشى (تعاونيّة) ════════════════ */
.wt-meterwrap { display: flex; align-items: center; gap: 14px; margin: 10px 0 14px; }
.wt-meter {
  position: relative; width: 56px; height: 150px; flex: none;
  border: 2px solid rgba(90,160,220,.5); border-radius: 0 0 14px 14px;
  background: rgba(90,160,220,.06); overflow: hidden;
}
.wt-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0%;
  background: linear-gradient(180deg, #5BAEE0, #2E7BB8);
  transition: height .5s cubic-bezier(.22,.61,.36,1);
}
.wt-meter-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 900; font-size: 14px; color: var(--text); text-shadow: 0 1px 3px rgba(0,0,0,.6);
  font-variant-numeric: tabular-nums;
}
.wt-cups { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 7px; align-content: center; }
.wt-cup { font-size: 26px; filter: grayscale(.6) opacity(.5); transition: filter .3s, transform .3s; }
.wt-cup.full { filter: none; transform: scale(1.05); }
.wt-stage { text-align: center; }
.wt-role { font-weight: 800; color: var(--gold); margin-bottom: 12px; font-size: 15px; }
.wt-card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1.5px solid rgba(201,151,42,.3); border-radius: 16px; padding: 22px 16px;
}
.wt-card .wt-q { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 12px; text-wrap: balance; }
.wt-card .wt-a { font-size: 15px; color: var(--text-dim); }
.wt-card .wt-a b { color: var(--gold); font-size: 17px; }
.wt-result { text-align: center; padding: 20px 10px; }
.wt-win { font-size: 24px; font-weight: 900; color: #5BAEE0; }
.wt-lose { font-size: 22px; font-weight: 900; color: var(--gold); }
.wt-result .wt-sub { margin-top: 8px; color: var(--text-dim); font-weight: 700; }
