/* حرب النرد — pro look 2026-10-31: violet game table + glossy dice (cartoon), green casino felt (classic). Own identity. */
:root { --ink: #fff; --muted: #d8ccff; --card: rgba(30, 14, 70, .82); --line: rgba(255, 255, 255, .16); --gold: #ffcf4a; --gold2: #f29a12; --red: #ff3b4e; --ok: #35d07f; --pad: #fff; --padink: #2a1460; }
body:not(.kids) { --card: rgba(6, 34, 24, .84); --muted: #b9dccb; --gold: #e8c46a; --gold2: #b8862b; --pad: #f3efe2; --padink: #0b3a2a; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { background: #1c0b45; }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: "Baloo Bhaijaan 2", system-ui, sans-serif; overflow-x: hidden; }
body:not(.kids) { background: #072a1d; }
.table-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: #1c0b45 url(/assets/dicewar/bg_kids.webp?v=1) center / cover no-repeat; }
body:not(.kids) .table-bg { background: #072a1d url(/assets/dicewar/bg_classic.webp?v=1) center / cover no-repeat; }
.page { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
[hidden] { display: none !important; }

.topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.icon { width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, .35); font-size: 20px; }
.theme-switch { display: flex; gap: 6px; justify-content: center; margin: 8px 0 10px; }
.theme-switch button { border: 1px solid var(--line); background: rgba(0, 0, 0, .35); border-radius: 999px; padding: 4px 14px; font-weight: 800; font-size: 14px; }
.theme-switch button[aria-pressed="true"] { background: linear-gradient(var(--gold), var(--gold2)); color: #3a1d00; border-color: transparent; }

.card { border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, .35); padding: 14px; margin-top: 12px; }
.hero { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 24px; background: linear-gradient(135deg, rgba(255, 207, 74, .22), rgba(255, 59, 78, .18)), var(--card); border: 1px solid rgba(255, 207, 74, .45); box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }
.hero-art { width: 76px; height: 82px; object-fit: contain; flex: none; transform: rotate(-10deg); filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .45)); }
.hero h1 { margin: 0; font-size: 34px; line-height: 1.15; color: var(--gold); text-shadow: 0 3px 0 #5a2a00; }
.hero p { margin: 2px 0 0; color: var(--muted); font-size: 15px; font-weight: 600; }
[data-host-card] { margin-top: 10px; }

.add-form { display: flex; gap: 8px; }
.add-form input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 14px; border: 2px solid transparent; background: #fff; color: #1d0f45; }
.add-form input:focus { outline: none; border-color: var(--gold); }
.add-form button { border: 0; border-radius: 14px; padding: 0 14px; font-weight: 800; background: linear-gradient(var(--gold), var(--gold2)); color: #3a1d00; white-space: nowrap; box-shadow: 0 4px 0 #8a4a00; }
.rows { display: grid; gap: 6px; margin: 12px 0; }
.rows .empty { text-align: center; color: var(--muted); padding: 18px 0; }
.tr { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 14px; background: rgba(255, 255, 255, .08); }
.tr.new { animation: pop .35s ease-out; }
.tr .num { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; font-weight: 800; background: var(--pc); color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); }
.tr .nm { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr .pts { color: var(--gold); font-weight: 800; font-size: 14px; }
.tr .del { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255, 59, 78, .9); color: #fff; font-size: 18px; line-height: 1; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

.target { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 14px; background: rgba(0, 0, 0, .25); font-weight: 800; }
.target-pick { display: flex; gap: 5px; }
.target-pick button { min-width: 44px; border: 1px solid var(--line); background: rgba(255, 255, 255, .1); border-radius: 11px; padding: 4px 8px; font-weight: 800; }
.target-pick button[aria-pressed="true"] { background: linear-gradient(var(--gold), var(--gold2)); color: #3a1d00; border-color: transparent; }
.status { text-align: center; font-weight: 800; color: var(--gold); margin: 10px 0 0; }

.btn { display: block; width: 100%; margin-top: 10px; border: 0; border-radius: 18px; padding: 13px; font-weight: 800; font-size: 19px; }
.btn-main { background: linear-gradient(#ff5d6c, #e01f3a); color: #fff; box-shadow: 0 5px 0 #8c0f22; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
body:not(.kids) .btn-main { background: linear-gradient(#e8c46a, #b8862b); color: #2a1a00; box-shadow: 0 5px 0 #6b4b10; text-shadow: none; }
.btn-main:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 #8c0f22; }
.btn-ghost { background: rgba(255, 255, 255, .1); border: 1px solid var(--line); }

/* turn card + 3D die */
.turn { position: relative; display: flex; align-items: center; gap: 8px; }
.turn.bump { animation: bump .35s ease-out; }
@keyframes bump { 40% { transform: scale(1.03); } }
.nav { width: 38px; height: 54px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .1); font-size: 16px; }
.turn-mid { flex: 1; min-width: 0; text-align: center; }
.turn-mid small { color: var(--muted); font-weight: 800; }
.turn-mid h2 { margin: 0; font-size: 28px; line-height: 1.25; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 0 14px var(--pc, #fff); }
.turn-score { font-weight: 800; color: var(--muted); }
.turn-score b { font-size: 24px; color: var(--gold); }
.bar { height: 10px; border-radius: 99px; background: rgba(0, 0, 0, .35); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--red)); transition: width .5s; }
.round-tag { color: var(--gold); }
.die-box { position: relative; width: 62px; height: 62px; flex: none; }
.die { position: absolute; inset: 0; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 10px; border-radius: 15px; background: radial-gradient(circle at 30% 25%, #fff, #e6e0f5 72%); box-shadow: inset 0 -6px 0 rgba(42, 20, 96, .18), inset 0 0 0 2px rgba(0, 0, 0, .06), 0 6px 12px rgba(0, 0, 0, .4); transform: rotate(-8deg); }
.die .pip { width: 11px; height: 11px; border-radius: 50%; place-self: center; background: #2a1460; box-shadow: inset 0 2px 2px rgba(0, 0, 0, .55); visibility: hidden; }
.die .pip.on { visibility: visible; }
.die[data-n="1"] .pip.on { width: 16px; height: 16px; background: var(--red); }
body:not(.kids) .die { background: radial-gradient(circle at 30% 25%, #fffdf4, #eae2c9 72%); }
.die-box.land { animation: hop 1s ease-out; }
@keyframes hop { 0% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-24px) rotate(-200deg); } 60% { transform: translateY(0) rotate(-340deg); } 75% { transform: translateY(-6px) rotate(-355deg); } 100% { transform: translateY(0) rotate(-360deg); } }
.die-num { position: absolute; bottom: -8px; left: -8px; min-width: 28px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-weight: 800; text-align: center; font-size: 15px; box-shadow: 0 3px 0 #8c0f22; }
.die-num:empty { display: none; }
.float { position: absolute; top: 4px; left: 50%; font-size: 30px; font-weight: 800; color: var(--gold); text-shadow: 0 3px 0 #5a2a00; animation: up 1s ease-out forwards; pointer-events: none; }
@keyframes up { to { transform: translate(-50%, -46px); opacity: 0; } }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { position: relative; flex: none; display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: 14px; }
.chip.now { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 207, 74, .35); }
.chip .cn { font-weight: 800; border-inline-start: 4px solid var(--pc); padding-inline-start: 6px; }
.chip b { color: var(--gold); }
.chip i { position: absolute; top: -10px; left: 6px; font-style: normal; font-weight: 800; color: var(--ok); font-size: 13px; }
.chip.hit { animation: pop .4s; }

.pad-card { padding: 12px; }
.screen { position: relative; height: 62px; display: grid; place-items: center; border-radius: 16px; background: rgba(0, 0, 0, .4); border: 1px solid var(--line); }
.screen #hint { color: var(--muted); font-weight: 800; }
.screen #hint.done { color: var(--ok); }
.screen #entry { font-size: 38px; color: var(--gold); line-height: 1; }
.screen #okHint { position: absolute; bottom: 2px; font-size: 12px; color: var(--muted); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.pad button { height: 56px; border: 0; border-radius: 16px; background: var(--pad); color: var(--padink); font-size: 26px; font-weight: 800; box-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
.pad button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.pad .k-del { background: rgba(255, 255, 255, .18); color: #fff; }
.pad .k-ok { background: linear-gradient(#4ee08f, #1fae62); color: #fff; }
.pad .k-ok.ready { animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 0 0 6px rgba(78, 224, 143, .35); } }

.tools { display: flex; gap: 6px; margin-top: 12px; }
.tools button { flex: 1; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 9px 4px; font-weight: 800; font-size: 14px; }

/* race lanes */
.board-title { margin: 0 0 8px; font-size: 19px; }
.board { display: grid; gap: 7px; }
.br { display: grid; grid-template-columns: 28px minmax(54px, 26%) 1fr 34px; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 14px; background: rgba(255, 255, 255, .06); }
.br.now { background: rgba(255, 207, 74, .16); }
.br .rk { text-align: center; font-weight: 800; }
.br .bn { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br b { color: var(--gold); text-align: center; }
.lane { position: relative; height: 22px; border-radius: 99px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .12) 0 8px, transparent 8px 16px), rgba(0, 0, 0, .3); }
.lane::after { content: "🏁"; position: absolute; left: -4px; top: 50%; transform: translateY(-50%); font-size: 15px; }
.lane .trail { position: absolute; right: 0; top: 0; bottom: 0; width: var(--at); border-radius: 99px; background: var(--pc); opacity: .55; transition: width .6s; }
.lane .tok { position: absolute; top: 50%; right: var(--at); width: 22px; height: 22px; margin-right: -11px; transform: translateY(-50%) rotate(12deg); border-radius: 6px; background: var(--pc); border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .4); transition: right .6s; }

.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(10, 4, 30, .82); }
.modal { position: relative; width: min(440px, 100%); max-height: 92vh; overflow: auto; padding: 18px 16px; border-radius: 24px; background: #2a1460; border: 1px solid var(--line); text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
body:not(.kids) .modal { background: #0b3a2a; }
.modal h2 { margin: 0 0 6px; color: var(--gold); }
.modal ol { text-align: right; padding-right: 20px; line-height: 1.7; }
.win { overflow: hidden; }
.win .cup { width: 130px; height: 150px; object-fit: contain; display: block; margin: 0 auto; position: relative; z-index: 1; animation: pop .5s; }
.win small { color: var(--muted); font-weight: 800; position: relative; z-index: 1; }
.win h2 { font-size: 32px; position: relative; z-index: 1; }
.podium { display: flex; gap: 6px; justify-content: center; position: relative; z-index: 1; }
.pod { flex: 1; min-width: 0; padding: 8px 4px; border-radius: 14px; background: rgba(255, 255, 255, .08); display: flex; flex-direction: column; }
.pod b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod small { color: var(--gold); }
#confetti { position: absolute; inset: 0; pointer-events: none; }
#confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; background: var(--c); animation: fall var(--d) linear var(--delay) infinite; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
.sinan-credit { text-align: center; margin-top: 18px; color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.sinan-credit b { color: var(--gold); }
@media (max-width: 380px) { .hero h1 { font-size: 28px; } .hero-art { width: 60px; height: 66px; } .turn-mid h2 { font-size: 23px; } }
