/* =============================================================================
   crowns.css — «تيجان». نفس عائلة البوابة (قاعدة داكنة، أزرار بحافة، Baloo) بلونها
   المميّز: الوردي القاني. اللوحة مناطق بألوان فاتحة كقطع اللعب على طاولة ليلية،
   وحدود المناطق خطوط داكنة سميكة — فالمنطقة تُقرأ بالحدّ لا باللون وحده.
   ========================================================================== */
:root {
  --panel: #2a1230;
  --panel-2: #3b1a42;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #fb7185;
  --accent-2: #e11d48;
  --text: #fff1f3;
  --dim: #d4a9b6;
  --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, 113, 133, .26) 0%, transparent 60%), radial-gradient(130% 100% at 50% 110%, #34122f 0%, #140812 60%); user-select: none; }
::selection { background: rgba(251, 113, 133, .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, #fda4af, var(--accent-2)); color: #3b0613; box-shadow: 0 5px 0 #881337, inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn-primary:active { box-shadow: 0 2px 0 #881337; }
.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(118px, 26vw, 170px); margin: 0 auto 4px; }
.logo-emblem { width: 100%; height: auto; 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: #fff1f3; text-shadow: 0 4px 0 #4c0519, 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: 3px; }
.lvl:active { transform: translateY(3px); }
.lvl .num { font-size: 27px; font-weight: 800; line-height: 1.1; }
.lvl .lvl-stars { display: flex; gap: 2px; height: 14px; color: rgba(255, 255, 255, .18); }
.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 { opacity: 0; }
.lvl.locked::after { content: ""; position: absolute; top: 50%; left: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; opacity: .85;
  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='%23f5d0d8'/%3E%3Cpath d='M8 10.5V8a4 4 0 0 1 8 0v2.5' fill='none' stroke='%23f5d0d8' stroke-width='2.4'/%3E%3Ccircle cx='12' cy='16' r='1.7' fill='%232a1230'/%3E%3C/svg%3E") center/contain no-repeat; }
.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; }

/* ---------- القائمة: لغز اليوم ---------- */
.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; }

/* ---------- الإعدادات: طريقة اللعب ---------- */
.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); }

/* ---------- اللعب ---------- */
#game { justify-content: flex-start; gap: 10px; padding-left: 10px; padding-right: 10px; }
.game-bar { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 560px; }
.game-title { flex: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.game-title span { font-weight: 800; font-size: 19px; }
.game-title small { color: var(--dim); font-size: 12.5px; font-weight: 700; }
.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-ic.fill { fill: currentColor; stroke: none; }
.crowns-pill { color: var(--gold); }

/* اللوحة: مناطق بألوان فاتحة؛ كل خانة ترسم حدّها العلوي والأيسر فقط (حدّ مشترك واحد لا اثنان).
   الحدّ بين منطقتين سميك وداكن، وداخل المنطقة رفيع. */
.board-wrap { position: relative; flex: none; }
.board { --size: min(94vw, 560px, calc(100dvh - 290px - var(--coach-h, 0px))); --n: 6; width: var(--size); height: var(--size); display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-template-rows: repeat(var(--n), minmax(0, 1fr));
  background: #1d0b1f; border: 3px solid #1d0b1f; border-radius: 14px; overflow: hidden; direction: ltr;
  box-shadow: 0 0 0 3px rgba(251, 113, 133, .55), 0 16px 40px rgba(0, 0, 0, .5); touch-action: none; }
.cell { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; overflow: hidden; cursor: pointer; background: var(--c);
  border-top: var(--bt, 1px) solid var(--btc, rgba(29, 11, 31, .22)); border-left: var(--bl, 1px) solid var(--blc, rgba(29, 11, 31, .22)); }
.cell.t-edge { --bt: 3px; --btc: #1d0b1f; }
.cell.l-edge { --bl: 3px; --blc: #1d0b1f; }
.cell.top { --bt: 0px; }
.cell.left { --bl: 0px; }
.cell .ic { width: 62%; height: 62%; color: #2a1430; pointer-events: none; }
.cell.x .ic { width: 30%; height: 30%; fill: none; stroke: rgba(42, 20, 48, .55); stroke-width: 3.4; stroke-linecap: round; }
.cell.crown .ic { filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .4)); animation: pop .22s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }
.cell.bad { background-image: repeating-linear-gradient(135deg, rgba(225, 29, 72, .42) 0 5px, transparent 5px 10px); }
.cell.bad.crown .ic { color: #be123c; }
.cell.cursor { box-shadow: inset 0 0 0 3px #fff; }
.cell.hint { animation: hint 1.1s ease 2; }
/* المدرّب (المراحل 1–3) */
#game.coaching { --coach-h: 64px; }
.coach { width: min(100% - 24px, 560px); margin: 2px auto 6px; padding: 8px 12px; border-radius: 12px; text-align: center;
  font-size: 14px; font-weight: 700; line-height: 1.55; color: var(--text); background: rgba(251, 113, 133, .12);
  border: 1px solid rgba(251, 113, 133, .45); }
.coach[hidden] { display: none; }
.cell.c-src { box-shadow: inset 0 0 0 3px #7c3aed; }
.cell.c-yes { box-shadow: inset 0 0 0 4px #15803d; animation: coach 1.4s ease-in-out infinite; }
.cell.c-no { box-shadow: inset 0 0 0 4px #e11d48; animation: coach 1.4s ease-in-out infinite; }
@keyframes coach { 50% { filter: brightness(.86); } }
@keyframes hint { 50% { filter: brightness(1.2) saturate(1.5); box-shadow: inset 0 0 0 4px #fff; } }
.board.won .cell { animation: won .7s ease both; animation-delay: calc(var(--d) * 22ms); }
@keyframes won { 40% { filter: brightness(1.3); transform: scale(.92); } }
@media (hover: hover) and (pointer: fine) { .cell:hover { filter: brightness(1.07); } }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-weight: 800; }
.loading[hidden] { display: none; }

.tools { display: flex; gap: 10px; width: 100%; max-width: 560px; justify-content: center; }
.tool { flex: 1; 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); border-radius: 14px; padding: 11px 8px; cursor: pointer; }
.tool:active { transform: translateY(2px); }
.tool:disabled { opacity: .4; cursor: default; }
.tool .cost { color: var(--gold); font-variant-numeric: tabular-nums; }
.rule-line { color: var(--dim); font-size: 13px; font-weight: 700; text-align: center; }

/* ---------- نتيجة لغز اليوم ---------- */
.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: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 20; background: rgba(30, 8, 22, .94); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; font-weight: 800; }

/* ---------- النوافذ ---------- */
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(14, 3, 10, .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: #fff1f3; }
.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: 560px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 5px; }
.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) { .tools .tool { padding: 6px; } .rule-line { display: none; } }
@media (prefers-reduced-motion: reduce) { .cell, .cell .ic, .board.won .cell, .result-stars i { transition: none; animation: none !important; } }
/* على الجوال: الشريط أعلى، واللوحة في وسط المساحة، والأدوات أسفلها قرب الإبهام */
.board-wrap { margin-block: auto; }
.rule-line { margin-bottom: max(6px, 2vh); }

.guide-link { display: inline-block; margin-top: 14px; color: var(--dim); font-weight: 700; font-size: 15px; text-underline-offset: 4px; }

/* شاشة كبيرة (آيباد، كمبيوتر): المجموعة كلها في الوسط بلا فراغ، واللوحة تكبر حتى ٨٢٠ */
@media (min-width: 600px) and (min-height: 760px) {
  #game { --gsize: min(94vw, 820px, calc(100dvh - 290px - var(--coach-h, 0px))); justify-content: safe center; gap: 14px; }
  .board { --size: var(--gsize); }
  .board-wrap { margin-block: 0; }
  .rule-line { margin-bottom: 0; }
  .game-bar, .race, .tools { max-width: max(var(--gsize), 460px); }
}

/* ---------- إيقاف مؤقت: اللوحة تختفي والوقت يتجمّد ---------- */
.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 .board-wrap { visibility: hidden; }

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

/* ---------- التاج قطعة مرسومة (icons/art/ui-crown.webp) ---------- */
.cell.crown img.ic { width: 82%; height: 82%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.cell.bad.crown img.ic { filter: drop-shadow(0 0 5px #be123c) saturate(.55); }
.crowns-pill .pill-ic { color: var(--gold); }
