/* =============================================================================
   seek.css — «عين الصقر». نفس عائلة البوابة (قاعدة داكنة، أزرار بحافة، Baloo) بلونها
   المميّز: العنبري. المشهد لوحة canvas تملأ المساحة بين الشريط وقائمة المطلوب؛ القائمة بطاقات
   صغيرة بصورة الغرض وعدده، قرب الإبهام.
   ========================================================================== */
:root {
  --panel: #2a1a10;
  --panel-2: #3a2416;
  --line: rgba(255, 236, 214, 0.1);
  --accent: #fb923c;
  --accent-2: #ea580c;
  --text: #fff4ea;
  --dim: #d3b9a3;
  --good: #34d399;
  --bad: #ff5d6c;
  --gold: #ffd166;
  --font: "Baloo Bhaijaan 2", "Segoe UI", Tahoma, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
html, body { height: 100%; font-family: var(--font); color: var(--text); overflow: hidden; }
body { background: radial-gradient(90% 60% at 50% -10%, rgba(251, 146, 60, .24) 0%, transparent 60%), radial-gradient(130% 100% at 50% 110%, #2a160b 0%, #0e0704 60%); user-select: none; }
::selection { background: rgba(251, 146, 60, .35); }
button, a, [role="button"] { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
[hidden], .party-card.hidden { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ui-ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.st-ic { width: 19px; height: 19px; flex: none; }
.pill-ic { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

#app { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); }
.screen.hidden { display: none; }
#party, #levels, #free { justify-content: flex-start; overflow-y: auto; overscroll-behavior: contain; }
#menu, #settings { justify-content: safe center; overflow-y: auto; overscroll-behavior: contain; }

/* ---------- أزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: inherit; font-size: 18px; font-weight: 800; color: var(--text); cursor: pointer;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 14px 22px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .08); transition: transform .07s ease, filter .15s ease;
}
@media (hover: hover) and (pointer: fine) { .btn:hover { filter: brightness(1.12); } }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .32); }
.btn-primary { background: linear-gradient(180deg, #fdba74, var(--accent-2)); color: #3a1300; box-shadow: 0 5px 0 #9a3412, inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-primary:active { box-shadow: 0 2px 0 #9a3412; }
.btn.big { font-size: 21px; padding: 16px 28px; }
.btn-ghost { background: rgba(255, 255, 255, .06); box-shadow: none; }
.btn.small { align-self: center; font-size: 15px; padding: 8px 14px; border-radius: 13px; }
.btn.small .ui-ic { width: 18px; height: 18px; }
.btn.danger { background: linear-gradient(180deg, #e0453a, #b5342b); box-shadow: 0 5px 0 #7c231c; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { font-size: 26px; font-weight: 800; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); color: var(--text); width: 46px; height: 46px; border-radius: 15px; cursor: pointer; line-height: 1; flex: none; font-family: inherit; }
.icon-btn:active { transform: translateY(2px); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- القائمة ---------- */
.hub-link { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 3; display: inline-flex; align-items: center; gap: 7px;
  color: var(--dim); text-decoration: none; font-weight: 800; font-size: 15px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 13px; padding: 8px 14px; }
.hub-mark { width: 20px; height: 20px; flex: none; }
@media (hover: hover) and (pointer: fine) { .hub-link:hover { color: var(--text); } }
.menu-card { text-align: center; max-width: 460px; width: 100%; }
.emblem-wrap { width: clamp(124px, 28vw, 178px); aspect-ratio: 1; margin: 0 auto 4px; }
.emblem-wrap img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .5)); }
.title { font-size: clamp(46px, 11vw, 76px); font-weight: 800; line-height: 1.15; color: #fff4ea; text-shadow: 0 4px 0 #6b2a07, 0 10px 26px rgba(0, 0, 0, .45); }
.tagline { color: var(--dim); font-size: clamp(15px, 3.6vw, 18px); margin: 2px auto 22px; max-width: 30ch; text-wrap: balance; }
.menu-buttons { display: flex; flex-direction: column; gap: 12px; }
.menu-stats { display: flex; justify-content: center; gap: 22px; margin-top: 20px; color: var(--gold); font-weight: 800; font-size: 18px; }
.menu-stats span, .bar-right { display: inline-flex; align-items: center; gap: 6px; direction: ltr; unicode-bidi: isolate; }
.menu-stats b, .bar-right b, .pill b { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- الأشرطة والمراحل ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 820px; margin-bottom: 12px; gap: 12px; }
.bar h2 { font-size: 26px; font-weight: 800; }
.bar-right { min-width: 46px; color: var(--gold); font-weight: 800; }
.hint-line { color: var(--dim); margin-bottom: 14px; font-size: 15px; }
.tier-legend { display: flex; gap: 8px; margin-bottom: 12px; font-size: 12px; font-weight: 800; }
.tl { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim); }
.tl::before { content: "●"; color: var(--tier); margin-inline-end: 5px; }
.easy { --tier: #34d399; } .medium { --tier: #60a5fa; } .hard { --tier: #fb923c; } .expert { --tier: #f472b6; }
.levels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px; width: 100%; max-width: 820px; padding: 6px; align-content: start; grid-auto-rows: max-content; }
.lvl { position: relative; aspect-ratio: 1; border-radius: 20px; cursor: pointer; color: var(--text); font-family: inherit;
  border: 1px solid color-mix(in srgb, var(--tier) 35%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--tier) 16%, var(--panel-2)), var(--panel));
  box-shadow: 0 4px 0 rgba(0, 0, 0, .3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; overflow: hidden; }
.lvl:active { transform: translateY(3px); }
.lvl .num { font-size: 25px; font-weight: 800; line-height: 1.05; position: relative; }
.lvl .lvl-theme { font-size: 11px; font-weight: 700; color: var(--dim); line-height: 1.1; position: relative; }
.lvl::before { content: ""; position: absolute; inset: 0; background: var(--bg) center/cover; opacity: .38; }
.lvl::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,10,4,.15), rgba(20,10,4,.75)); }
.lvl > * { z-index: 1; }
.lvl .lvl-stars { display: flex; gap: 2px; height: 14px; color: rgba(255, 255, 255, .18); position: relative; }
.lvl .lvl-stars svg { width: 13px; height: 13px; }
.lvl .lvl-stars svg.on { color: var(--gold); }
.lvl.locked { filter: grayscale(.8) brightness(.55); cursor: not-allowed; }
.lvl.locked .num, .lvl.locked .lvl-stars, .lvl.locked .lvl-theme { opacity: 0; }
.lvl.locked::after { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4.5' y='10.5' width='15' height='11' rx='3' fill='%23f3dcc8'/%3E%3Cpath d='M8 10.5V8a4 4 0 0 1 8 0v2.5' fill='none' stroke='%23f3dcc8' stroke-width='2.4'/%3E%3Ccircle cx='12' cy='16' r='1.7' fill='%232a1a10'/%3E%3C/svg%3E") center/26px no-repeat, rgba(20,10,4,.6); }
.lvl.current { outline: 3px solid var(--tier); outline-offset: 1px; }
.tier-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 460px; }
.tier-pick .btn { flex-direction: column; gap: 2px; padding: 18px 10px; border-color: color-mix(in srgb, var(--tier) 45%, var(--line)); }
.tier-pick .btn small { color: var(--dim); font-size: 13px; font-weight: 700; }

/* ---------- الإعدادات ---------- */
.settings-body { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 14px; }
.settings-body .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 15px 18px; font-weight: 700; cursor: pointer; }
.row-label { display: inline-flex; align-items: center; gap: 9px; }
.settings-body input[type=checkbox] { -webkit-appearance: none; appearance: none; flex: none; position: relative; cursor: pointer; width: 52px; height: 30px; border-radius: 20px; background: rgba(255, 255, 255, .14); transition: background .2s; }
.settings-body input[type=checkbox]::before { content: ""; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); transition: transform .2s cubic-bezier(.22, 1, .36, 1); }
.settings-body input[type=checkbox]:checked { background: var(--accent-2); }
.settings-body input[type=checkbox]:checked::before { transform: translateX(-22px); }
.note { color: var(--dim); font-size: 13.5px; text-align: center; line-height: 1.6; }
.how { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 18px; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.how h3 { font-size: 17px; }
.how p { color: var(--dim); font-size: 14.5px; line-height: 1.7; }
.how b { color: var(--text); }

/* ---------- القائمة: لغز اليوم ---------- */
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-row .btn { padding: 13px 10px; font-size: 17px; }
.btn-daily { justify-content: flex-start; text-align: start; gap: 12px; background: linear-gradient(180deg, #ffe08a, #f5a524); color: #3d2300; box-shadow: 0 5px 0 #9a5b00, inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn-daily:active { box-shadow: 0 2px 0 #9a5b00; }
.btn-daily .daily-txt { flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.btn-daily small { font-size: 13.5px; font-weight: 700; opacity: .8; }
.btn-daily.done { background: linear-gradient(180deg, var(--panel-2), var(--panel)); color: var(--text); box-shadow: 0 5px 0 rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .08); border-color: rgba(255, 209, 102, .4); }
.streak { display: inline-flex; align-items: center; gap: 3px; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, .16); font-size: 17px; direction: ltr; unicode-bidi: isolate; }
.streak svg { width: 17px; height: 17px; color: #e8590c; }
.btn-daily.done .streak svg { color: #ff922b; }

/* ---------- اللعب ---------- */
#game { justify-content: flex-start; gap: 8px; padding-left: 8px; padding-right: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.game-bar { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 1100px; flex: none; }
.game-title { flex: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.2; min-width: 0; }
.game-title span { font-weight: 800; font-size: 19px; }
.game-title small { color: var(--dim); font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pills { display: flex; flex-direction: column; gap: 4px; min-width: 74px; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-weight: 800; font-size: 13.5px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); direction: ltr; }
.pill.bad { color: #ffb3bb; }
.pill.bad.hot { color: #fff; background: #e5484d; border-color: transparent; }

/* المشهد: canvas يملأ المساحة؛ اللمس كله لنا (لا تمرير ولا تكبير للصفحة) */
.stage { position: relative; flex: 1 1 auto; min-height: 0; width: 100%; max-width: 1100px; border-radius: 18px; overflow: hidden;
  background: radial-gradient(100% 80% at 50% 40%, #24150b, #120a05); box-shadow: inset 0 0 0 1px var(--line); }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.stage.locked #view { cursor: wait; }
.zoom { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.zoom button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; cursor: pointer; color: var(--text);
  background: rgba(20, 11, 5, .72); border: 1px solid rgba(255, 236, 214, .16); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.zoom button:active { transform: scale(.94); }
.zoom button:disabled { opacity: .35; }
.zoom .ui-ic { width: 20px; height: 20px; }
.loading { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; color: var(--dim); font-weight: 800; z-index: 3; background: rgba(14, 7, 4, .55); }
.loading[hidden] { display: none; }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.calm { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; padding: 12px 18px; border-radius: 16px; font-weight: 800; font-size: 17px;
  background: rgba(14, 7, 4, .86); border: 1px solid rgba(255, 93, 108, .5); color: #ffd0d5; white-space: nowrap; animation: pop .25s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.7); opacity: 0; } }

/* قائمة المطلوب: بطاقة لكل نوع — صورة الغرض وعدده الباقي */
.tray-wrap { display: flex; gap: 8px; width: 100%; max-width: 1100px; align-items: stretch; flex: none; }
.tray { flex: 1; display: grid; grid-template-columns: repeat(var(--k, 4), minmax(0, 1fr)); gap: 6px; }
.chip { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 6px 2px 4px; min-width: 0;
  border-radius: 16px; cursor: pointer; font-family: inherit; color: var(--text);
  background: linear-gradient(180deg, #fff3e2, #f0d9bd); border: 0; box-shadow: 0 4px 0 #8a5a33, inset 0 -2px 0 rgba(120, 70, 30, .18); }
.chip img { width: min(54px, 100%); aspect-ratio: 1; object-fit: cover; display: block; border-radius: 11px; box-shadow: 0 0 0 2px #fff, 0 2px 5px rgba(60, 30, 5, .4); pointer-events: none; margin-bottom: 3px; }
.chip .cnt { position: absolute; top: -6px; inset-inline-start: -4px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent-2); color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 2px 0 #7c2d12, 0 0 0 2px #fff3e2; line-height: 1; }
.chip .nm { font-size: 11.5px; font-weight: 800; color: #5a3416; line-height: 1.15; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; }
.tray.two { row-gap: 10px; }
.tray.two .chip { flex-direction: row; gap: 5px; padding: 4px 5px; justify-content: flex-start; border-radius: 13px; }
.tray.two .chip img { width: 34px; margin: 0; border-radius: 8px; flex: none; }
.tray.two .chip .nm { font-size: 11px; white-space: normal; text-align: start; line-height: 1.1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tray.two .chip .cnt { min-width: 22px; height: 22px; font-size: 13px; top: -7px; }
.chip.done { background: linear-gradient(180deg, #4b3a2c, #3a2b20); box-shadow: 0 4px 0 #22170f; }
.chip.done img { opacity: .4; filter: grayscale(.6); }
.chip.done .nm { color: var(--dim); }
.chip.done .cnt { background: var(--good); color: #053b2a; box-shadow: 0 2px 0 #0b6e4f, 0 0 0 2px #3a2b20; }
.chip.bump { animation: bump .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump { 35% { transform: scale(1.14) rotate(-3deg); } }
.hint-btn { flex: 0 0 auto; flex-direction: column; gap: 2px; padding: 6px 12px; border-radius: 16px; }
.tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit; font-size: 15px; font-weight: 800; color: var(--text);
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); cursor: pointer; }
.tool:active { transform: translateY(2px); }
.tool:disabled { opacity: .4; cursor: default; }
.tool .cost { color: var(--gold); font-variant-numeric: tabular-nums; font-size: 14px; }
.rule-line { color: var(--dim); font-size: 12.5px; font-weight: 700; text-align: center; flex: none; }
.fly { position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none; will-change: transform; border-radius: 50%; box-shadow: 0 0 0 3px #ffd166, 0 0 22px 6px rgba(255, 209, 102, .55), 0 8px 18px rgba(0, 0, 0, .5); }

/* ---------- نتيجة لغز اليوم ---------- */
.result-daily { display: flex; flex-direction: column; align-items: center; margin-bottom: 4px; }
.result-daily[hidden] { display: none; }
.big-streak { display: inline-flex; align-items: center; gap: 4px; font-size: 44px; font-weight: 800; color: #ffb347; line-height: 1; direction: ltr; }
.big-streak svg { width: 42px; height: 42px; color: #ff6b1a; }
.result-daily p { color: var(--dim); font-weight: 700; font-size: 14px; }
.overlay .next-note { margin: 12px 0 0; }

.toast { position: fixed; bottom: calc(max(8px, env(safe-area-inset-bottom)) + 104px); left: 50%; transform: translateX(-50%); z-index: 20; background: rgba(14, 7, 4, .94); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; font-weight: 800; max-width: 92vw; text-align: center; }

/* ---------- النوافذ ---------- */
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(8, 4, 2, .62); backdrop-filter: blur(3px); padding: 16px; }
.overlay.hidden { display: none; }
.overlay-card { width: 100%; max-width: 400px; text-align: center; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 24px; padding: 26px 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
.overlay-card h2 { font-size: 28px; margin-bottom: 10px; }
.result-stars { display: flex; justify-content: center; gap: 6px; height: 58px; color: var(--gold); }
.result-stars i { display: inline-block; opacity: .18; filter: grayscale(1); transform: scale(.6); transition: transform .35s cubic-bezier(.2, 1.6, .4, 1), opacity .3s, filter .3s; }
.result-stars i.on { opacity: 1; filter: none; transform: scale(1); }
.rs-ic { width: 48px; height: 48px; }
.result-rows { display: flex; justify-content: center; gap: 22px; margin: 6px 0 18px; }
.result-rows div { display: flex; flex-direction: column; }
.result-rows span { color: var(--dim); font-size: 13px; font-weight: 700; }
.result-rows b { font-size: 20px; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.overlay-buttons { display: flex; flex-direction: column; gap: 10px; }
.overlay .note { margin-bottom: 16px; }

/* ---------- تحدٍّ مع الأصدقاء ---------- */
.party-body { width: 100%; max-width: 460px; }
.party-card { display: flex; flex-direction: column; gap: 14px; text-align: center; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 22px; padding: 20px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: start; font-weight: 800; font-size: 14px; color: var(--dim); }
.field input, .field select, .join-row input { font-family: inherit; font-size: 18px; font-weight: 700; color: var(--text); min-width: 0; background: rgba(0, 0, 0, .28); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; user-select: text; }
.field select option { color: #111; }
.or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 13px; font-weight: 700; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; text-align: center; letter-spacing: .3em; direction: ltr; font-size: 22px; font-variant-numeric: tabular-nums; }
.code-label { color: var(--dim); font-weight: 800; font-size: 14px; }
.room-code { font-size: 54px; font-weight: 800; line-height: 1; letter-spacing: .12em; direction: ltr; font-variant-numeric: tabular-nums; color: #fff4ea; }
.players { list-style: none; display: flex; flex-direction: column; gap: 6px; text-align: start; }
.players li { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); font-weight: 800; }
.players li small { color: var(--dim); font-weight: 700; }
.players li.away { opacity: .45; }
.players .crown { width: 18px; height: 18px; color: var(--gold); flex: none; }
.players .dot { width: 9px; height: 9px; margin: 0 4.5px; border-radius: 50%; background: var(--good); flex: none; }
.race { width: 100%; max-width: 1100px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 5px; flex: none; }
.race.hidden { display: none; }
.racer { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px; }
.racer.me { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.racer.away, .racer.out { opacity: .5; }
.racer .rn { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.racer .rb { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.racer .rb i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.racer.won .rb i { background: var(--gold); }
.racer b { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.ranking { list-style: none; counter-reset: rk; display: flex; flex-direction: column; gap: 6px; margin: 6px 0 16px; text-align: start; }
.ranking li { counter-increment: rk; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); font-weight: 800; }
.ranking li::before { content: counter(rk); width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .1); font-size: 13px; }
.ranking li:first-child::before { background: var(--gold); color: #3a2a00; }
.ranking li.me { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); }
.ranking li span { flex: 1; }
.ranking li b { color: var(--dim); font-variant-numeric: tabular-nums; }

@media (max-height: 700px) { .rule-line { display: none; } .chip .nm { display: none; } .chip img { width: min(44px, 100%); } }
@media (min-width: 900px) { .chip img { width: 60px; } .chip .nm { font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { .chip, .result-stars i, .calm { transition: none; animation: none !important; } }

/* شاشة عريضة (كمبيوتر، آيباد أفقي): المشهد بنسبة الصورة نفسها وبأقصى حجم يتّسع له الارتفاع — لا شرائط فارغة،
   والشريط والقائمة بعرضه، والمجموعة في الوسط. (الطولية تبقى كما هي: المشهد يملأ الارتفاع ويُسحب جانبياً) */
@media (min-width: 880px) and (min-aspect-ratio: 6/5) {
  #game { --sw: min(100vw - 16px, (100dvh - 200px) * 1.983); justify-content: safe center; }
  .stage { flex: none; width: var(--sw); max-width: none; aspect-ratio: 1600 / 807; }
  .game-bar, .race, .tray-wrap { max-width: var(--sw); }
}

/* ---------- إيقاف مؤقت: اللوحة تختفي والوقت يتجمّد ---------- */
.pause-btn { display: grid; place-items: center; }
.pause-btn[hidden] { display: none; }
.pause-big { width: 54px; height: 54px; fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linejoin: round; margin-bottom: 6px; }
.pause-time { color: var(--dim); font-weight: 700; margin-bottom: 18px; }
.pause-time b { color: var(--text); direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
#game.paused .stage, #game.paused .tray { visibility: hidden; }

/* ---------- خلفية مرسومة (bg.webp) ----------
   لوحة داكنة خلف كل الشاشات وفوقها تعتيم يبقي النص مقروءاً؛ شاشة اللعب تعتّمها أكثر كي لا تزاحم اللوحة.
   الصورة مربّعة وتفاصيلها على الأطراف: الجوال يرى أعلاها وأسفلها، والشاشة العريضة جانبيها. */
body {
  background:
    radial-gradient(90% 60% at 50% -10%, rgba(251, 146, 60, .2) 0%, transparent 60%),
    linear-gradient(180deg, rgba(14, 7, 4, .46) 0%, rgba(14, 7, 4, .8) 100%),
    url("bg.webp?v=1") center / cover no-repeat rgb(14, 7, 4);
}
#game { background: rgba(14, 7, 4, .64); }
