/* ════════════════════════════════════════════════════════════════
   «سباق الرقمية» — digital-race.js

   لغة الواجهة (طلب المستخدم ٢٠٢٦-١١-١٢): لعبة كارت مرسومة باليد —
   لوحات كريميّة بحدٍّ بنّيّ سميك وظلٍّ صلب تحتها، أزرار برتقاليّة،
   وعناوين بخطّ «لاله‌زار». لا زجاج داكن ولا نيون ولا تدرّج بنفسجيّ.

   ⚠ الألوان هنا خاصّة باللعبة ولا تتبع مظهر النظام فاتحًا أو داكنًا:
     اللعبة مشهدٌ واحد له هويّته، كملصق لعبةٍ على رفّ.
   ════════════════════════════════════════════════════════════════ */
.dr-hero, .dr-map, .dr-stage, .dr-roster, .dr-pick {
  --k-ink: #3b2314;        /* الحدّ والنصّ */
  --k-ink-2: #6b4a34;
  --k-cream: #fff4dc;      /* اللوحات */
  --k-paper: #ffe6b3;
  --k-orange: #f57a1f;
  --k-orange-d: #c9441c;
  --k-yellow: #ffc21a;
  --k-green: #3fa652;
  --k-green-d: #1f6a30;
  --k-red: #e2452f;
  --k-blue: #2f8fd6;
  --k-title: 'Lalezar', 'Readex Pro', var(--font);
}

/* ─── لوحة الإعداد ─────────────────────────────────────────────── */
.dr-hero {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: 26px; margin-bottom: var(--s4);
  padding: clamp(18px, 3.4vw, 34px); padding-inline-end: clamp(120px, 26vw, 300px);
  min-height: 230px; display: flex; align-items: center;
  border: 4px solid var(--k-ink); box-shadow: 0 8px 0 var(--k-ink);
  background: #ffb52e;
}
/* أشعّة شمس تدور ببطء خلف العنوان */
.dr-hero::before {
  content: ''; position: absolute; z-index: -1; inset: -60%;
  background: repeating-conic-gradient(from 0deg at 50% 50%, #ffc94a 0 12deg, #ffb52e 12deg 24deg);
  animation: dr-rays 60s linear infinite;
}
@keyframes dr-rays { to { transform: rotate(360deg); } }
.dr-hero-txt { position: relative; z-index: 2; max-width: 600px; }
.dr-hero h2 {
  margin: 8px 0 6px; font-family: var(--k-title); font-weight: 400; line-height: 1.1;
  font-size: clamp(44px, 7.2vw, 88px); color: #fff;
  -webkit-text-stroke: 10px var(--k-ink); paint-order: stroke fill;
  text-shadow: 0 7px 0 var(--k-ink);
}
.dr-hero p { margin: 0; color: var(--k-ink); font-weight: 700; font-size: var(--fs-sm); line-height: 1.7; max-width: 46ch; }
.dr-hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--k-red); color: #fff; font-weight: 800; font-size: var(--fs-xs);
  padding: 2px 14px; border-radius: 999px; border: 3px solid var(--k-ink); rotate: 2deg;
}
.dr-hero-tag svg { width: 16px; height: 16px; }
.dr-hero-boy {
  position: absolute; z-index: 1; inset-inline-end: clamp(6px, 3vw, 44px); bottom: -6px;
  height: 102%; width: auto; filter: drop-shadow(0 6px 0 rgba(59, 35, 20, .35));
}
@media (max-width: 640px) {
  .dr-hero { padding-inline-end: 110px; min-height: 200px; }
  .dr-hero-boy { height: 92%; inset-inline-end: -6px; }
}

.dr-opts {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4);
  margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--border);
}
.dr-opts label { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 700; cursor: pointer; }
.dr-opts input { width: 20px; height: 20px; accent-color: #f57a1f; }
.dr-opts .spacer { flex: 1; }
#drStart {
  background: #f57a1f; border: 3px solid #3b2314; color: #fff; box-shadow: 0 5px 0 #3b2314;
  font-family: 'Lalezar', var(--font); font-weight: 400; font-size: 26px; padding-inline: 30px; border-radius: 16px;
}
#drStart:hover { background: #ff8c33; transform: translateY(-1px); }
#drStart:active { transform: translateY(4px); box-shadow: 0 1px 0 #3b2314; }

.dr-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 14px 12px; padding-bottom: 6px; }
.dr-map-item {
  --c1: #74c043;
  position: relative; border-radius: 16px; padding: 10px 12px 12px; min-height: 104px;
  display: grid; gap: 2px; align-content: start;
  background: var(--k-cream); color: var(--k-ink);
  border: 3px solid var(--k-ink); box-shadow: 0 5px 0 var(--k-ink);
}
.dr-map-item > b {
  justify-self: start; min-width: 44px; height: 44px; padding-inline: 8px; border-radius: 12px;
  display: grid; place-items: center; margin-bottom: 4px;
  background: var(--c1); color: #fff; border: 3px solid var(--k-ink);
  font-family: var(--k-title); font-weight: 400; font-size: 28px; line-height: 1;
}
.dr-map-item > span { font-weight: 800; font-size: 16px; line-height: 1.35; }
.dr-map-item > small { font-size: 14px; color: var(--k-ink-2); font-weight: 700; }
[data-th=suburb]   { --c1: #5fb440; }
[data-th=city]     { --c1: #2f8fd6; }
[data-th=highway]  { --c1: #6b6259; }
[data-th=sunset]   { --c1: #e4572e; }
[data-th=desert]   { --c1: #e0a03a; }
[data-th=night]    { --c1: #1d5c68; }
[data-th=mountain] { --c1: #5f7d74; }
[data-th=nighthw]  { --c1: #17485a; }
[data-th=oasis]    { --c1: #12a5a0; }
[data-th=volcano]  { --c1: #b5321a; }

.dr-rules { margin: var(--s4) 0 0; padding-inline-start: 22px; color: var(--ink-muted); line-height: 1.9; }
.dr-honor-row.is-top { border-color: #f57a1f; }

/* ─── المشهد ───────────────────────────────────────────────────── */
.dr-stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 82vh;
  margin-inline: auto; overflow: hidden; border-radius: 22px;
  border: 4px solid var(--k-ink); box-shadow: 0 8px 0 var(--k-ink);
  background: #1f9fe0; color: var(--k-ink); user-select: none; -webkit-user-select: none;
  container-type: inline-size; touch-action: none;
  font-family: var(--font);
}
@media (max-width: 720px) { .dr-stage { aspect-ratio: auto; height: min(84vh, 680px); max-height: none; border-radius: 16px; } }
.dr-stage:fullscreen { aspect-ratio: auto; max-height: none; width: 100vw; height: 100vh; border-radius: 0; border: 0; box-shadow: none; }
.dr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.dr-hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; padding: clamp(8px, 1.5cqw, 16px); }
.dr-hud-top { display: flex; align-items: center; gap: clamp(6px, 1cqw, 12px); flex-wrap: wrap; }
.dr-hud-top .spacer { flex: 1; }
.dr-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--k-cream); border: 3px solid var(--k-ink); box-shadow: 0 4px 0 var(--k-ink);
  padding: 2px 14px; border-radius: 14px; min-height: clamp(38px, 4.6cqw, 48px);
  font-size: clamp(13px, 1.5cqw, 17px); font-weight: 800; color: var(--k-ink-2);
}
.dr-pill b { color: var(--k-ink); font-family: var(--k-title); font-weight: 400; font-size: clamp(22px, 2.8cqw, 32px); line-height: 1; padding-top: .12em; }
.dr-pill i { font-style: normal; color: var(--k-ink-2); }
.dr-pill-stage { background: var(--k-orange); color: #fff; }
.dr-pill-stage b, .dr-pill-stage i { color: #fff; }
.dr-pill-star { background: var(--k-ink); color: var(--k-yellow); }
.dr-pill-star b { color: #fff; }
.dr-pill-star svg { width: clamp(20px, 2.4cqw, 28px); height: clamp(20px, 2.4cqw, 28px); }
.dr-pill-star.pop { animation: dr-pulse .12s 2 alternate; }
.dr-name { max-width: 32cqw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--k-ink); }
@container (max-width: 620px) { .dr-name { display: none; } }

.dr-ibtn {
  pointer-events: auto; cursor: pointer; display: grid; place-items: center;
  width: clamp(40px, 4.6cqw, 48px); height: clamp(40px, 4.6cqw, 48px); border-radius: 14px;
  background: var(--k-cream); border: 3px solid var(--k-ink); box-shadow: 0 4px 0 var(--k-ink); color: var(--k-ink);
  transition: transform .1s, box-shadow .1s, background .1s;
}
.dr-ibtn:hover { background: var(--k-yellow); }
.dr-ibtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--k-ink); }
.dr-ibtn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.dr-ibtn svg { width: 20px; height: 20px; }
.dr-ibtn-x { background: var(--k-red); color: #fff; }
.dr-ibtn-x:hover { background: #f25a45; }

.dr-progress {
  position: relative; height: 16px; margin-top: 12px; border-radius: 999px;
  background: var(--k-ink); border: 3px solid var(--k-ink); direction: ltr;
}
.dr-progress i {
  display: block; height: 100%; width: 0; border-radius: 999px; transition: width .12s linear;
  background: repeating-linear-gradient(-45deg, #ffc21a 0 10px, #ffab12 10px 20px);
}
.dr-flag { position: absolute; inset-inline-end: -6px; top: -11px; color: #fff; filter: drop-shadow(0 2px 0 var(--k-ink)); }
.dr-flag svg { width: 22px; height: 22px; }

.dr-speed {
  width: fit-content; margin-top: 12px; margin-inline-start: auto;
  display: flex; align-items: baseline; gap: 6px; line-height: 1;
  background: var(--k-ink); color: #fff; padding: 4px 14px 2px; border-radius: 12px;
}
.dr-speed b { font-family: var(--k-title); font-weight: 400; font-size: clamp(24px, 3.2cqw, 38px); color: var(--k-yellow); }
.dr-speed span { font-size: 13px; font-weight: 700; }

.dr-near {
  position: absolute; top: 32%; left: 50%; translate: -50% 0; opacity: 0;
  font-family: var(--k-title); font-size: clamp(26px, 4cqw, 46px); color: var(--k-yellow);
  -webkit-text-stroke: 7px var(--k-ink); paint-order: stroke fill; white-space: nowrap;
}
.dr-near.on { animation: dr-near .9s ease-out; }
@keyframes dr-near { 0% { opacity: 0; scale: .7; } 20% { opacity: 1; scale: 1.08; } 100% { opacity: 0; translate: -50% -40px; } }

/* اللمس — المساحة كلّها تستقبل، والسهمان تلميحٌ بصريّ */
.dr-pads { position: absolute; inset: 22% 0 0 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-end; direction: ltr; padding: clamp(10px, 2cqw, 22px); }
.dr-pad {
  width: clamp(56px, 8cqw, 86px); height: clamp(56px, 8cqw, 86px); border-radius: 22px;
  display: grid; place-items: center; pointer-events: none;
  background: var(--k-orange); border: 3px solid var(--k-ink); box-shadow: 0 5px 0 var(--k-ink); color: #fff;
}
.dr-pad svg { width: 50%; height: 50%; }
@media (hover: hover) and (pointer: fine) { .dr-pad { opacity: .55; } }

/* ─── النوافذ فوق المشهد ───────────────────────────────────────── */
.dr-overlay, .dr-quit {
  position: absolute; inset: 0; z-index: 5; display: none;
  align-items: center; justify-content: center; padding: clamp(10px, 2.4cqw, 28px);
  background: rgba(59, 35, 20, .5); overflow: auto; direction: rtl;
  touch-action: pan-y;   /* المشهد يمنع السحب للقيادة — النافذة الطويلة تحتاجه لتُمرَّر */
}
.dr-overlay.on, .dr-quit { display: flex; }
.dr-quit { z-index: 8; background: rgba(59, 35, 20, .72); }
.dr-overlay:has(.dr-count) { background: rgba(59, 35, 20, .12); }

.dr-card {
  --c1: var(--k-orange);
  position: relative; width: min(100%, 800px); margin: auto;
  border-radius: 26px; padding: clamp(14px, 2.4cqw, 26px);
  background: var(--k-cream); border: 4px solid var(--k-ink); box-shadow: 0 8px 0 var(--k-ink);
  color: var(--k-ink);
  animation: dr-pop .32s cubic-bezier(.2, .9, .3, 1.25);
}
.dr-card-sm { width: min(100%, 520px); text-align: center; }
@keyframes dr-pop { from { opacity: 0; transform: translateY(18px) scale(.94); } }
.dr-card h3 { font-family: var(--k-title); font-weight: 400; color: var(--k-ink); margin: 0 0 6px; font-size: clamp(28px, 4cqw, 44px); line-height: 1.2; }
.dr-card p { color: var(--k-ink-2); margin: 0 0 10px; font-weight: 600; font-size: clamp(15px, 1.9cqw, 20px); line-height: 1.7; }

.dr-q-head { display: flex; align-items: center; gap: 14px; }
.dr-q-stage {
  flex: none; width: 68px; height: 68px; border-radius: 18px; display: grid; place-items: center; align-content: center;
  background: var(--c1); color: #fff; border: 3px solid var(--k-ink); box-shadow: 0 4px 0 var(--k-ink); line-height: 1; rotate: -3deg;
}
.dr-q-stage b { font-size: 36px; font-family: var(--k-title); font-weight: 400; }
.dr-q-stage i { font-style: normal; font-size: 12px; font-weight: 800; }
.dr-q-title { flex: 1; display: grid; min-width: 0; }
.dr-q-title b { font-family: var(--k-title); font-weight: 400; font-size: clamp(22px, 3cqw, 34px); line-height: 1.25; }
.dr-q-title small { color: var(--k-ink-2); font-weight: 700; font-size: clamp(13px, 1.6cqw, 17px); }
.dr-q-timer {
  flex: none; min-width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 4px solid var(--k-ink); font-size: 26px; font-family: var(--k-title); padding-top: .1em;
}
.dr-q-timer.is-low { background: var(--k-red); color: #fff; animation: dr-pulse .5s ease-in-out infinite alternate; }
@keyframes dr-pulse { to { transform: scale(1.1); } }
.dr-q-bar { height: 12px; border-radius: 999px; background: var(--k-ink); border: 3px solid var(--k-ink); margin-top: 12px; overflow: hidden; direction: ltr; }
.dr-q-bar i { display: block; height: 100%; width: 100%; border-radius: 999px; background: var(--k-green); transition: width 1s linear; }

.dr-q-body {
  display: flex; align-items: center; gap: 16px; margin: clamp(12px, 2cqw, 20px) 0;
  background: #fff; border: 3px solid var(--k-ink); border-radius: 18px; padding: clamp(12px, 1.8cqw, 20px);
}
.dr-q-body p { margin: 0; flex: 1; color: var(--k-ink); font-weight: 800; font-size: clamp(19px, 2.7cqw, 30px); line-height: 1.6; }
.dr-q-body .q-art { flex: none; }

.dr-q-choices { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.5cqw, 16px); padding-bottom: 5px; }
@container (max-width: 560px) { .dr-q-choices:not(.is-tf) { grid-template-columns: 1fr; } }
.dr-choice {
  --cc: var(--k-orange);
  font: inherit; cursor: pointer; text-align: start; color: var(--k-ink);
  display: flex; align-items: center; gap: 12px; min-height: 62px;
  padding: 8px 14px; border-radius: 16px;
  background: #fff; border: 3px solid var(--k-ink); box-shadow: 0 5px 0 var(--k-ink);
  font-size: clamp(16px, 2.1cqw, 23px); font-weight: 800; line-height: 1.5;
  transition: transform .1s, box-shadow .1s, background .1s;
}
.dr-choice:nth-child(2) { --cc: var(--k-blue); }
.dr-choice:nth-child(3) { --cc: var(--k-green); }
.dr-choice:nth-child(4) { --cc: var(--k-red); }
.dr-choice > span { flex: 1; display: inline-flex; align-items: center; gap: 8px; }
.dr-choice svg { width: 24px; height: 24px; }
.dr-choice:hover:not(:disabled) { background: var(--k-paper); transform: translateY(-2px); box-shadow: 0 7px 0 var(--k-ink); }
.dr-choice:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--k-ink); }
.dr-choice:focus-visible { outline: 4px solid var(--k-blue); outline-offset: 2px; }
.dr-choice:disabled { cursor: default; opacity: .5; }
.dr-choice-l {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--cc); color: #fff; border: 3px solid var(--k-ink); font-size: 19px;
}
.dr-choice.is-img { justify-content: center; }
.dr-q-choices.is-tf .dr-choice { justify-content: center; text-align: center; min-height: 76px; font-size: clamp(20px, 2.8cqw, 30px); }
.dr-q-choices.is-tf .dr-choice > span { justify-content: center; }
.dr-q-choices.is-tf .dr-choice:first-child { background: #dff3d6; }
.dr-q-choices.is-tf .dr-choice:last-child { background: #ffdcd3; }
.dr-choice.is-right { opacity: 1; background: var(--k-green) !important; color: #fff; animation: dr-pulse .3s 2 alternate; }
.dr-choice.is-wrong { opacity: 1; background: var(--k-red) !important; color: #fff; animation: dr-shake .4s; }
@keyframes dr-shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }
.dr-q-msg { min-height: 1.7em; margin: 12px 0 0 !important; text-align: center; font-weight: 800 !important; }
.dr-q-msg.ok { color: var(--k-green-d); }
.dr-q-msg.bad { color: var(--k-orange-d); }

.dr-count {
  font-family: var(--k-title); color: #fff; line-height: 1;
  font-size: clamp(110px, 26cqw, 280px);
  -webkit-text-stroke: clamp(14px, 2.6cqw, 28px) var(--k-ink); paint-order: stroke fill;
  text-shadow: 0 clamp(8px, 1.4cqw, 16px) 0 var(--k-ink);
  animation: dr-count .7s ease-out both;
}
.dr-count.is-go { color: var(--k-yellow); font-size: clamp(76px, 17cqw, 190px); rotate: -4deg; }
@keyframes dr-count { from { opacity: 0; transform: scale(2.2); } 30% { opacity: 1; transform: scale(1); } to { opacity: .95; transform: scale(.92); } }

.dr-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; padding-bottom: 5px; }
.dr-btn {
  font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  min-height: 54px; padding: 6px 26px; border-radius: 16px;
  background: #fff; border: 3px solid var(--k-ink); box-shadow: 0 5px 0 var(--k-ink); color: var(--k-ink);
  font-family: var(--k-title); font-size: clamp(20px, 2.5cqw, 27px);
  transition: transform .1s, box-shadow .1s, filter .1s;
}
.dr-btn:hover { filter: brightness(1.06); transform: translateY(-2px); box-shadow: 0 7px 0 var(--k-ink); }
.dr-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--k-ink); }
.dr-btn:focus-visible { outline: 4px solid var(--k-blue); outline-offset: 2px; }
.dr-btn-go { background: var(--k-orange); color: #fff; }
.dr-btn-danger { background: var(--k-red); color: #fff; }
.dr-btn svg { width: 22px; height: 22px; }

.dr-gain { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 14px; }
.dr-gain span { background: var(--k-yellow); border: 3px solid var(--k-ink); color: var(--k-ink); padding: 2px 18px; border-radius: 12px; font-family: var(--k-title); font-size: clamp(19px, 2.4cqw, 26px); }

/* بطاقتا النجاح والنهاية: الشخصيّة تقف بجانب النصّ */
.dr-with-boy { display: grid; grid-template-columns: auto 1fr; gap: clamp(8px, 2cqw, 22px); align-items: end; text-align: center; }
.dr-with-boy.dr-card-sm { width: min(100%, 680px); }
.dr-boy { height: clamp(150px, 30cqw, 330px); width: auto; align-self: end; margin-bottom: calc(-1 * clamp(14px, 2.4cqw, 26px)); filter: drop-shadow(0 4px 0 rgba(59, 35, 20, .25)); }
@container (max-width: 520px) { .dr-with-boy { grid-template-columns: 1fr; } .dr-boy { display: none; } }

.dr-end { width: min(100%, 780px); }
.dr-end.is-win { background: #fff0c2; }
.dr-end-sub { margin-bottom: 0 !important; }
.dr-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.dr-stats > div { background: #fff; border: 3px solid var(--k-ink); border-radius: 14px; padding: 8px 4px 6px; display: grid; gap: 2px; }
.dr-stats b { font-family: var(--k-title); font-weight: 400; font-size: clamp(28px, 4.2cqw, 46px); line-height: 1.05; color: var(--k-orange-d); }
.dr-stats b i { font-style: normal; font-size: .5em; color: var(--k-ink-2); }
.dr-stats span { font-size: clamp(12px, 1.5cqw, 16px); font-weight: 800; color: var(--k-ink-2); }
.dr-dots { display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; }
.dr-dots i {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-style: normal;
  background: #fff; border: 3px solid var(--k-ink); color: var(--k-ink-2); font-size: 14px; font-weight: 800;
}
.dr-dots i.on { background: var(--k-green); color: #fff; }
.dr-dots i.fail { background: var(--k-red); color: #fff; }
.dr-save { margin: 12px 0 0 !important; font-size: clamp(14px, 1.7cqw, 18px) !important; color: var(--k-green-d) !important; font-weight: 800 !important; }

/* الجوال: السؤال يملأ المشهد بلا تمرير ما أمكن */
@container (max-width: 560px) {
  .dr-q-stage { width: 54px; height: 54px; border-radius: 14px; }
  .dr-q-stage b { font-size: 28px; }
  .dr-q-timer { min-width: 50px; height: 50px; font-size: 22px; }
  .dr-q-body p { font-size: 18px; line-height: 1.55; }
  .dr-choice { min-height: 50px; padding: 6px 10px; font-size: 16px; }
  .dr-choice-l { width: 32px; height: 32px; font-size: 15px; border-radius: 10px; }
  .dr-stats { grid-template-columns: repeat(2, 1fr); }
  .dr-stats b { font-size: 26px; }
  .dr-dots i { width: 26px; height: 26px; font-size: 12px; border-width: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .dr-hero::before, .dr-card, .dr-count, .dr-choice, .dr-q-timer.is-low { animation: none !important; }
  .dr-choice, .dr-btn, .dr-ibtn { transition: none; }
}

/* ─── قائمة المتسابقين والاختيار ───────────────────────────────── */
.dr-roster { display: flex; flex-wrap: wrap; gap: 8px; }
.dr-name-chip {
  font: inherit; cursor: pointer; font-size: var(--fs-xs); font-weight: 800; line-height: 1.4;
  padding: 6px 14px; border-radius: 12px; color: var(--k-ink);
  background: var(--k-cream); border: 2.5px solid var(--k-ink); box-shadow: 0 3px 0 var(--k-ink);
  transition: transform .1s, box-shadow .1s;
}
.dr-name-chip:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 0 var(--k-ink); }
.dr-name-chip:focus-visible { outline: 3px solid var(--k-blue); outline-offset: 2px; }
.dr-name-chip i { font-style: normal; font-size: .82em; opacity: .85; margin-inline-start: 4px; }
.dr-name-chip.is-out { background: transparent; color: var(--ink-faint); border-style: dashed; border-color: var(--ink-faint); box-shadow: none; text-decoration: line-through; }
.dr-name-chip.is-played { background: #dff3d6; color: var(--k-green-d); border-color: var(--k-green-d); box-shadow: none; cursor: default; }
.dr-name-chip.is-skipped { background: transparent; color: var(--ink-faint); border-color: var(--ink-faint); box-shadow: none; cursor: default; }
.dr-name-chip.is-cur { background: var(--k-yellow); }

.dr-pick {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4);
  margin-top: var(--s4); padding: var(--s4); border-radius: 18px;
  background: var(--k-cream); border: 3px solid var(--k-ink); box-shadow: 0 5px 0 var(--k-ink); color: var(--k-ink);
}
.dr-pick.has { background: #ffe9a8; }
.dr-pick-who { flex: 1 1 220px; display: grid; min-width: 0; }
.dr-pick-who span { font-size: var(--fs-xs); font-weight: 700; color: var(--k-ink-2); }
.dr-pick-who b { font-family: var(--k-title); font-weight: 400; font-size: clamp(28px, 4vw, 44px); line-height: 1.25; overflow-wrap: anywhere; }
.dr-pick-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dr-pick-acts .select { width: auto; min-width: 170px; }
#drStart:disabled { opacity: .45; cursor: not-allowed; }

/* ─── السؤال فوق الطريق ────────────────────────────────────────── */
.dr-ask {
  width: min(100%, 860px); margin: clamp(8px, 1.2cqw, 14px) auto 0; direction: rtl;
  background: var(--k-cream); border: 4px solid var(--k-ink); box-shadow: 0 6px 0 var(--k-ink);
  border-radius: 20px; padding: clamp(8px, 1.3cqw, 14px) clamp(10px, 1.6cqw, 18px);
}
.dr-ask[hidden] { display: none !important; }
.dr-ask.on { animation: dr-drop .35s cubic-bezier(.2, .9, .3, 1.25); }
@keyframes dr-drop { from { opacity: 0; transform: translateY(-30px) scale(.96); } }
.dr-ask-head { display: flex; align-items: center; gap: 10px; }
.dr-ask-n {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; rotate: -4deg;
  background: var(--k-orange); color: #fff; border: 3px solid var(--k-ink);
  font-family: var(--k-title); font-size: 24px; line-height: 1;
}
.dr-ask-n b { font-weight: 400; padding-top: .12em; }
.dr-ask-verb { font-family: var(--k-title); font-size: clamp(17px, 2.2cqw, 24px); color: var(--k-orange-d); }
.dr-ask-body { display: flex; align-items: center; gap: 12px; margin: 6px 0 10px; }
.dr-ask-body p { margin: 0; flex: 1; color: var(--k-ink); font-weight: 800; font-size: clamp(17px, 2.5cqw, 28px); line-height: 1.5; }
/* الخيارات بترتيب الحارات: العمود الأيسر هو الحارة اليسرى */
.dr-ask-opts { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px; direction: ltr; }
.dr-ask-opt {
  direction: rtl; display: flex; align-items: center; gap: 8px; min-width: 0;
  background: #fff; border: 3px solid var(--k-ink); border-radius: 14px; padding: 4px 8px 4px 10px;
  font-weight: 800; font-size: clamp(14px, 1.9cqw, 21px); line-height: 1.35; color: var(--k-ink);
  border-bottom: 8px solid var(--cc);
}
.dr-ask-opt > b {
  flex: none; width: clamp(30px, 3.6cqw, 40px); height: clamp(30px, 3.6cqw, 40px); border-radius: 10px; display: grid; place-items: center;
  background: var(--cc); color: #fff; border: 2.5px solid var(--k-ink); font-size: clamp(16px, 2cqw, 22px);
}
.dr-ask-opt > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
@container (max-width: 560px) {
  .dr-ask-opt { flex-direction: column; text-align: center; padding: 4px; font-size: 13px; gap: 3px; }
  .dr-ask-body p { font-size: 16px; }
}

.dr-cheer {
  position: absolute; top: 34%; left: 50%; translate: -50% 0; opacity: 0; pointer-events: none;
  display: grid; justify-items: center; gap: 6px; white-space: nowrap;
}
.dr-cheer b {
  font-family: var(--k-title); font-weight: 400; font-size: clamp(44px, 9cqw, 104px); line-height: 1.1; color: #fff;
  -webkit-text-stroke: clamp(8px, 1.4cqw, 16px) var(--k-ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--k-ink);
}
.dr-cheer span {
  font-family: var(--k-title); font-size: clamp(20px, 3.2cqw, 36px); color: var(--k-ink);
  background: var(--k-yellow); border: 3px solid var(--k-ink); box-shadow: 0 4px 0 var(--k-ink); border-radius: 14px; padding: 0 18px;
}
.dr-cheer.on { animation: dr-cheer 2.2s ease-out; }
@keyframes dr-cheer { 0% { opacity: 0; scale: .5; rotate: -6deg; } 12% { opacity: 1; scale: 1.1; rotate: 2deg; } 20% { scale: 1; rotate: 0deg; } 80% { opacity: 1; } 100% { opacity: 0; translate: -50% -30px; } }

.dr-right { background: #dff3d6; border: 3px solid var(--k-green-d); border-radius: 12px; padding: 4px 12px; color: var(--k-green-d) !important; margin: 8px 0 0 !important; }
.dr-right b { color: var(--k-ink); }
@media (prefers-reduced-motion: reduce) { .dr-ask.on, .dr-cheer.on { animation-duration: .01s; } .dr-cheer.on { opacity: 1; } }

/* ─── النسخة الثالثة (٢٠٢٦-١١-١٣): فرصتان، قراءة ثم اختيار ─────── */
.dr-lives { gap: 4px; padding-inline: 10px; }
.dr-lives i { font-style: normal; color: var(--k-red); font-size: clamp(18px, 2.4cqw, 26px); line-height: 1; transition: opacity .3s, transform .3s; }
.dr-lives i.lost { opacity: .22; filter: grayscale(1); transform: scale(.8); }
.dr-lives.pop { animation: dr-shake .45s; }

/* عدّاد القراءة: شريطٌ يمتلئ في سبع ثوانٍ */
.dr-ask-read {
  margin-inline-start: auto; position: relative; overflow: hidden; flex: none;
  min-width: 128px; padding: 2px 14px; border-radius: 999px; text-align: center;
  background: #fff; border: 3px solid var(--k-ink); font-weight: 800; font-size: 14px; color: var(--k-ink);
}
.dr-ask-read i { position: absolute; inset: 0; background: var(--k-yellow); transform-origin: right; animation: dr-fill var(--t) linear forwards; }
.dr-ask-read b { position: relative; }
@keyframes dr-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* حين تظهر الإجابات يصغر السؤال إلى سطرٍ واحد ليفسح لها */
.dr-ask.is-min { padding-block: 6px; }
.dr-ask.is-min .dr-ask-head { display: none; }
.dr-ask.is-min .dr-ask-body { margin: 0; }
.dr-ask.is-min .dr-ask-body p { font-size: clamp(15px, 2cqw, 22px); }
.dr-ask.is-min .q-art { display: none; }

/* لافتات الإجابات: مرفوعة فوق الحارات، تتبع موضع كل حارة */
.dr-lanes { position: absolute; inset-inline: clamp(6px, 1.5cqw, 18px); top: 40%; height: 0; pointer-events: none; direction: ltr; }
.dr-lanes[hidden] { display: none; }
.dr-lanes.on .dr-lane { animation: dr-rise .45s cubic-bezier(.2, .9, .3, 1.3) both; }
.dr-lanes.on .dr-lane:nth-child(3) { animation-delay: .06s; }
.dr-lanes.on .dr-lane:nth-child(4) { animation-delay: .12s; }
.dr-lanes.on .dr-lane:nth-child(5) { animation-delay: .18s; }
@keyframes dr-rise { from { opacity: 0; transform: translate(-50%, 40px) scale(.7); } }
.dr-lane {
  position: absolute; left: 50%; top: 0; transform: translate(-50%, 0);
  width: calc(100% / var(--n, 4) - clamp(10px, 2cqw, 22px)); max-width: 260px; direction: rtl; text-align: center;
  display: grid; justify-items: center; gap: 4px; padding: 6px 8px 10px;
  background: #fff; color: var(--k-ink); border-radius: 16px;
  border: 4px solid var(--k-ink); border-bottom: 10px solid var(--cc); box-shadow: 0 6px 0 var(--k-ink);
  font-weight: 900; font-size: clamp(14px, 2.2cqw, 24px); line-height: 1.35;
  transition: left .08s linear, transform .15s, background .15s;
}
/* السارية: تربط اللافتة بحارتها على الطريق */
.dr-lane::after {
  content: ''; position: absolute; top: 100%; left: 50%; width: 8px; height: clamp(40px, 9cqw, 110px);
  translate: -50% 10px; background: var(--k-ink); border-radius: 0 0 4px 4px; z-index: -1;
}
.dr-lane > b {
  width: clamp(36px, 5cqw, 54px); height: clamp(36px, 5cqw, 54px); border-radius: 14px; display: grid; place-items: center; margin-top: -24px;
  background: var(--cc); color: #fff; border: 3px solid var(--k-ink); font-size: clamp(20px, 3cqw, 32px); line-height: 1;
}
.dr-lane > span { overflow-wrap: anywhere; }
.dr-lane .choice-img { max-height: clamp(44px, 8cqw, 76px); }
.dr-lane.is-on { transform: translate(-50%, -12px) scale(1.12); background: #fff6d6; z-index: 2; }
.dr-lane.is-on > b { box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--cc); }

.dr-ask.is-min { display: flex; align-items: center; gap: 10px; }
.dr-ask.is-min .dr-ask-body { flex: 1; }
.dr-lanes-clock {
  flex: none;
  display: flex; align-items: center; gap: 8px; direction: rtl;
  background: var(--k-ink); color: #fff; border-radius: 999px; padding: 2px 16px 2px 6px; font-weight: 800; font-size: 14px;
}
.dr-lanes-clock b {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--k-green); font-family: var(--k-title); font-weight: 400; font-size: 26px; padding-top: .12em;
}
.dr-lanes-clock.is-low b { background: var(--k-red); animation: dr-pulse .4s ease-in-out infinite alternate; }

.dr-cheer b.is-bad { color: #ffb4a6; }
@container (max-width: 560px) {
  .dr-lanes { top: 42%; }
  .dr-lane { padding: 4px 4px 8px; border-width: 3px; font-size: 13px; }
  .dr-lanes-clock span { display: none; }
  .dr-lanes-clock { padding: 2px; }
  .dr-lane > b { margin-top: -18px; }
}

/* رسالة النتيجة — مكان السؤال في الأعلى، ثانيتان */
.dr-ask.dr-verdict {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 16px;
  text-align: center; animation: dr-drop .3s cubic-bezier(.2, .9, .3, 1.25);
}
.dr-verdict > b { font-family: var(--k-title); font-weight: 400; font-size: clamp(28px, 4.4cqw, 48px); line-height: 1.2; }
.dr-verdict > span { font-weight: 800; font-size: clamp(15px, 2cqw, 22px); color: var(--k-ink); }
.dr-verdict.is-ok { background: #dff3d6; border-color: var(--k-green-d); box-shadow: 0 6px 0 var(--k-green-d); }
.dr-verdict.is-ok > b { color: var(--k-green-d); }
.dr-verdict.is-bad { background: #ffe0d8; border-color: var(--k-orange-d); box-shadow: 0 6px 0 var(--k-orange-d); }
.dr-verdict.is-bad > b { color: #b3261e; }

/* اسم الفائز كاملًا تحت «مبروك» */
.dr-winner {
  margin: 2px 0 6px !important; color: var(--k-ink) !important; overflow-wrap: anywhere;
  font-family: var(--k-title); font-size: clamp(30px, 5cqw, 54px) !important; line-height: 1.25 !important;
  background: var(--k-yellow); border: 4px solid var(--k-ink); box-shadow: 0 5px 0 var(--k-ink);
  border-radius: 16px; padding: 4px 18px; display: inline-block;
}
