@font-face { font-family: 'Vazirmatn'; src: url('/fonts/Vazirmatn[wght].woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --ink: #0a1b21; --ink2: #0f272f; --panel: #133440; --panel2: #1a4452;
  --ivory: #f4ead2; --ivory2: #cfc4a8; --mute: #8fa6a8;
  --saffron: #eab04a; --saffron2: #c98a21; --turq: #3cc4b0; --turq2: #1e8f82; --red: #e0604f; --green: #5fcf8a;
  --line: rgba(244, 234, 210, .11);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--ivory); overscroll-behavior: none; }
body {
  font-family: 'Vazirmatn', system-ui, sans-serif; font-size: 15px; line-height: 1.6; font-feature-settings: 'ss01';
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(60, 196, 176, .13), transparent 60%),
    radial-gradient(700px 480px at 0% 110%, rgba(234, 176, 74, .09), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M22 3 41 22 22 41 3 22Z' fill='none' stroke='%23f4ead2' stroke-opacity='.035'/%3E%3Cpath d='M22 13 31 22 22 31 13 22Z' fill='none' stroke='%233cc4b0' stroke-opacity='.05'/%3E%3C/svg%3E"),
    var(--ink);
  user-select: none; -webkit-user-select: none; overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--turq); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }

#app { height: 100dvh; position: relative; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; padding: max(14px, env(safe-area-inset-top)) 16px calc(16px + var(--safe-b)); animation: scr .28s ease-out; }
@keyframes scr { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- shared bits ---------- */
.av { position: relative; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none; background: linear-gradient(145deg, var(--turq2), var(--panel)); display: grid; place-items: center; box-shadow: 0 0 0 2px rgba(244, 234, 210, .2); }
.av b { font-weight: 800; font-size: 18px; } .av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av.sm { width: 34px; height: 34px; } .av.sm b { font-size: 14px; } .av.lg { width: 76px; height: 76px; } .av.lg b { font-size: 30px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 14px; font-weight: 700; background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); transition: transform .12s, filter .12s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, #f3c15f, var(--saffron2)); color: #2a1a08; box-shadow: 0 6px 18px rgba(234, 176, 74, .28), inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn.turq { background: linear-gradient(180deg, #4fd6c2, var(--turq2)); color: #06251f; }
.btn.danger { background: rgba(224, 96, 79, .16); color: #ffb3a8; box-shadow: inset 0 0 0 1px rgba(224, 96, 79, .4); }
.btn.block { width: 100%; } .btn[disabled] { opacity: .5; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; background: rgba(244, 234, 210, .09); font-size: 13px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(95, 207, 138, .2); }
.muted { color: var(--mute); } .center { text-align: center; }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 44px; }
.topbar h2 { font-size: 20px; font-weight: 800; flex: 1; }
.back { width: 44px; height: 44px; border-radius: 50%; background: rgba(244, 234, 210, .08); display: grid; place-items: center; }
.back svg { width: 22px; height: 22px; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card { background: linear-gradient(180deg, rgba(26, 68, 82, .75), rgba(19, 52, 64, .75)); border-radius: 20px; padding: 16px; box-shadow: inset 0 0 0 1px var(--line); }

/* toasts, network bar, modals */
#toasts { position: fixed; top: max(12px, env(safe-area-inset-top)); inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 90; pointer-events: none; }
.toast { background: #23596a; color: var(--ivory); padding: 10px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); opacity: 0; transform: translateY(-10px); transition: .25s; max-width: 90vw; text-align: center; }
.toast.in { opacity: 1; transform: none; }
#netbar { position: fixed; bottom: calc(10px + var(--safe-b)); inset-inline: 16px; background: #7a2e25; padding: 9px 14px; border-radius: 12px; text-align: center; z-index: 95; font-weight: 600; }
.modal-back { position: fixed; inset: 0; background: rgba(3, 12, 15, .7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; z-index: 80; opacity: 0; transition: opacity .2s; }
.modal-back.in { opacity: 1; }
.modal { width: min(380px, 100%); background: linear-gradient(180deg, #1c4b59, #11303b); border-radius: 24px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(244, 234, 210, .16); transform: scale(.94); transition: transform .22s cubic-bezier(.2, 1.3, .4, 1); }
.modal-back.in .modal { transform: none; }
.modal h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; } .modal p { color: var(--ivory2); }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; } .modal-actions .btn { flex: 1; padding: 0 10px; }

/* ---------- splash / gate / states ---------- */
.splash { align-items: center; justify-content: center; gap: 18px; text-align: center; }
.logo { width: 92px; height: 92px; animation: spin 14s linear infinite; filter: drop-shadow(0 6px 22px rgba(234, 176, 74, .3)); }
@keyframes spin { to { transform: rotate(360deg); } }
.splash h1 { font-size: 30px; font-weight: 800; }
.gate-list { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.gate-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: rgba(244, 234, 210, .06); }
.gate-item .t { flex: 1; font-weight: 700; } .gate-item .ok { color: var(--green); font-weight: 800; }
.gate-item a { }

/* ---------- home ---------- */
.home-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.home-head h1 { font-size: 28px; font-weight: 800; line-height: 1.2; flex: 1; }
.me-chip { display: flex; align-items: center; gap: 9px; padding: 5px 6px 5px 14px; border-radius: 999px; background: rgba(244, 234, 210, .08); box-shadow: inset 0 0 0 1px var(--line); }
.me-chip small { color: var(--saffron); font-weight: 800; font-size: 14px; }
.banner { display: block; width: 100%; text-align: start; padding: 11px 14px; border-radius: 14px; margin-bottom: 14px; background: linear-gradient(90deg, rgba(234, 176, 74, .2), rgba(60, 196, 176, .14)); box-shadow: inset 0 0 0 1px rgba(234, 176, 74, .35); font-weight: 600; }
.tiles { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.tile { position: relative; display: flex; align-items: stretch; min-height: 138px; border-radius: 24px; overflow: hidden; text-align: start; box-shadow: inset 0 0 0 1px rgba(244, 234, 210, .16), 0 10px 28px rgba(0, 0, 0, .3); transition: transform .15s; }
.tile:active { transform: scale(.985); }
.tile .tx { flex: 1; padding: 18px 20px; display: flex; flex-direction: column; justify-content: center; gap: 4px; position: relative; z-index: 1; }
.tile h3 { font-size: 24px; font-weight: 800; } .tile p { color: var(--ivory2); font-size: 14px; }
.tile .art { width: 46%; flex: none; display: grid; place-items: center; }
.tile .art svg { width: 100%; height: 100%; }
.tile.bg1 { background: linear-gradient(135deg, #1f6b6d, #12384a 70%); }
.tile.bg2 { background: linear-gradient(135deg, #5b3a63, #2a1f45 70%); filter: saturate(.75); }
.tile.soon { cursor: default; }
.tile .tag { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; }
.tile .live { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--ivory2); }
.nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.nav button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0 8px; border-radius: 16px; background: rgba(244, 234, 210, .07); font-size: 12.5px; font-weight: 600; color: var(--ivory2); }
.nav button svg { color: var(--saffron); }

/* ---------- lobby ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 5px; border-radius: 18px; background: rgba(0, 0, 0, .28); margin: 6px 0 4px; }
.seg button { padding: 12px 0; border-radius: 13px; font-weight: 700; color: var(--ivory2); display: flex; flex-direction: column; align-items: center; line-height: 1.3; }
.seg button b { font-size: 22px; font-weight: 800; } .seg button small { font-size: 12px; opacity: .8; }
.seg button.on { background: linear-gradient(180deg, #f3c15f, var(--saffron2)); color: #2a1a08; box-shadow: 0 4px 14px rgba(234, 176, 74, .3); }
.modes { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.mode { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 22px; text-align: start; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.mode.find { background: linear-gradient(135deg, #7a58e0, #4630a5); } .mode.invite { background: linear-gradient(135deg, #2aa56c, #176b48); }
.mode.ai { background: linear-gradient(135deg, #2f8fb3, #1b4f75); } .mode.ai .ic { font-size: 28px; }
.mode .ic { width: 52px; height: 52px; border-radius: 16px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; flex: none; }
.mode .ic svg { width: 28px; height: 28px; } .mode h3 { font-size: 18px; font-weight: 800; } .mode p { font-size: 13.5px; opacity: .85; }
.hint { margin-top: 14px; font-size: 13.5px; color: var(--mute); padding: 0 4px; }
.searching { position: fixed; inset: 0; z-index: 60; background: rgba(6, 20, 25, .94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; animation: scr .25s; }
.searching .big { font-size: 22px; font-weight: 800; } .searching .time { font-size: 40px; font-weight: 800; color: var(--saffron); font-variant-numeric: tabular-nums; }
.dice-pair { display: flex; gap: 14px; margin-bottom: 8px; }
.dice-pair .die { animation: bob 1.1s ease-in-out infinite; } .dice-pair .die:nth-child(2) { animation-delay: -.55s; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(8deg); } }
.code { font-size: 40px; font-weight: 800; letter-spacing: .22em; padding-inline-start: .22em; color: var(--saffron); direction: ltr; text-align: center; margin: 6px 0; font-variant-numeric: tabular-nums; }
.linkbox { direction: ltr; text-align: left; font-size: 12.5px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, .3); color: var(--ivory2); word-break: break-all; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; } .stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- lists: leaderboard / profile / help / settings ---------- */
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: rgba(244, 234, 210, .05); }
.lb-row.me { background: rgba(234, 176, 74, .14); box-shadow: inset 0 0 0 1px rgba(234, 176, 74, .45); }
.lb-row .rk { width: 28px; text-align: center; font-weight: 800; color: var(--ivory2); }
.lb-row:nth-child(1) .rk { color: #ffd76a; font-size: 18px; } .lb-row:nth-child(2) .rk { color: #dfe6ea; font-size: 17px; } .lb-row:nth-child(3) .rk { color: #e2a373; font-size: 16px; }
.lb-row .nm { flex: 1; min-width: 0; } .lb-row .nm b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .lb-row .nm small { color: var(--mute); }
.lb-row .rt { font-weight: 800; color: var(--saffron); font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.stat { padding: 12px 6px; border-radius: 16px; background: rgba(244, 234, 210, .06); text-align: center; } .stat b { display: block; font-size: 22px; font-weight: 800; } .stat span { font-size: 12.5px; color: var(--mute); }
.hist { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(244, 234, 210, .05); margin-bottom: 8px; }
.hist .res { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; flex: none; }
.hist .res.w { background: rgba(95, 207, 138, .2); color: var(--green); } .hist .res.l { background: rgba(224, 96, 79, .2); color: #ff9c8f; }
.hist .d { flex: 1; min-width: 0; } .hist .d small { color: var(--mute); display: block; }
.delta.pos { color: var(--green); } .delta.neg { color: #ff9c8f; } .delta { font-weight: 800; direction: ltr; unicode-bidi: embed; }
.help h3 { font-size: 17px; font-weight: 800; margin: 18px 0 6px; color: var(--saffron); } .help p, .help li { color: var(--ivory2); } .help ul { margin: 6px 0; padding-inline-start: 20px; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: rgba(244, 234, 210, .06); margin-bottom: 10px; }
.set-row .t { flex: 1; } .set-row .t b { display: block; } .set-row .t small { color: var(--mute); }
.switch { width: 52px; height: 30px; border-radius: 999px; background: rgba(0, 0, 0, .4); position: relative; flex: none; transition: background .2s; box-shadow: inset 0 0 0 1px var(--line); }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--ivory); transition: inset-inline-start .2s; }
.switch.on { background: var(--turq2); } .switch.on::after { inset-inline-start: 25px; }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.theme { padding: 8px; border-radius: 16px; background: rgba(244, 234, 210, .06); text-align: center; font-weight: 700; font-size: 13px; }
.theme.on { box-shadow: 0 0 0 2px var(--saffron); } .theme i { display: block; height: 42px; border-radius: 10px; margin-bottom: 6px; }
.empty { text-align: center; padding: 36px 10px; color: var(--mute); }

/* ---------- game ---------- */
.game { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 8px calc(8px + var(--safe-b)); animation: scr .3s; }
.pcard { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 18px; background: linear-gradient(180deg, rgba(26, 68, 82, .9), rgba(17, 48, 59, .9)); box-shadow: inset 0 0 0 1px var(--line); position: relative; transition: box-shadow .25s, opacity .25s; opacity: .78; }
.pcard.active { opacity: 1; box-shadow: inset 0 0 0 2px var(--saffron), 0 0 26px rgba(234, 176, 74, .22); }
.pcard.offline .av { filter: grayscale(1); } .pcard.offline::after { content: 'آفلاین'; position: absolute; top: -9px; inset-inline-start: 56px; background: var(--red); font-size: 11.5px; font-weight: 800; padding: 1px 9px; border-radius: 999px; }
.pcard .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pcard .nm { font-weight: 800; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.pcard .sub { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--mute); }
.pcard .col { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .35); } .pcard .col.w { background: radial-gradient(circle at 35% 30%, #fff, #d8ccae); } .pcard .col.b { background: radial-gradient(circle at 35% 30%, #5c544e, #120e0b); }
.offbar { display: flex; gap: 2px; } .offbar i { width: 5px; height: 11px; border-radius: 2px; background: rgba(244, 234, 210, .15); } .offbar i.on { background: var(--saffron); }
.pcard .nums { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 84px; }
.score { font-size: 22px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; } .score small { font-size: 13px; color: var(--mute); font-weight: 600; }
.clock { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; color: var(--ivory2); }
.pcard.active .clock { color: var(--ivory); } .clock.low { color: #ff8a7a; animation: blink 1s steps(2) infinite; } @keyframes blink { 50% { opacity: .55; } }
.bar { position: absolute; inset-inline: 14px; bottom: 0; height: 3px; border-radius: 3px; background: rgba(0, 0, 0, .3); overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--p, 100%); background: linear-gradient(90deg, var(--turq), var(--saffron)); transform-origin: right; } .bar.low i { background: var(--red); }
.board-wrap { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.board-host { position: relative; width: min(100%, calc(100dvh - 292px - var(--safe-b))); aspect-ratio: 1; min-width: 280px; filter: drop-shadow(0 14px 30px rgba(0, 0, 0, .55)); }
.board-svg { width: 100%; height: 100%; display: block; touch-action: manipulation; }
.ck { transition: transform .32s cubic-bezier(.3, .8, .3, 1), opacity .3s; pointer-events: none; } .ck.nomove { transition: none; } .ck.leaving { opacity: 0; }
.cnt { font: 800 19px 'Vazirmatn'; paint-order: stroke; } .ck.w .cnt { fill: #4d3a1b; } .ck.b .cnt { fill: #f4ead2; }
.hl { pointer-events: none; } .hits rect { cursor: pointer; }
.dest-tri { fill: rgba(255, 210, 122, .15); stroke: var(--glow); stroke-width: 2; stroke-dasharray: 7 6; animation: march 1.2s linear infinite; } @keyframes march { to { stroke-dashoffset: -26; } }
.dest-dot { fill: rgba(255, 210, 122, .35); stroke: var(--glow); stroke-width: 2.5; animation: pulse 1s ease-in-out infinite; }
.ring-movable { fill: none; stroke: var(--glow); stroke-width: 2.5; stroke-opacity: .6; animation: pulse 1.3s ease-in-out infinite; }
.ring-selected { fill: none; stroke: var(--glow); stroke-width: 4; } .ring-glow { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.dice-layer { position: absolute; inset: 0; margin: auto; width: min(100%, calc(100dvh - 292px - var(--safe-b))); min-width: 280px; aspect-ratio: 1; pointer-events: none; }
.dice-spot { position: absolute; top: 50%; left: 74%; transform: translate(-50%, -50%); display: flex; gap: 10px; align-items: center; justify-content: center; pointer-events: none; width: 44%; flex-wrap: wrap; }
.die { width: 52px; height: 52px; border-radius: 14px; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 8px; gap: 1px; background: linear-gradient(145deg, #fffaf0, #d9cdb0); box-shadow: 0 5px 12px rgba(0, 0, 0, .5), inset 0 -3px 0 rgba(120, 96, 50, .25), inset 0 2px 0 #fff; direction: ltr; }
.die.b { background: linear-gradient(145deg, #4a423c, #17120f); box-shadow: 0 5px 12px rgba(0, 0, 0, .55), inset 0 -3px 0 rgba(0, 0, 0, .5), inset 0 2px 0 rgba(255, 255, 255, .18); }
.die i { border-radius: 50%; background: transparent; margin: 1px; } .die i.p { background: #2a1a0e; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .5); } .die.b i.p { background: #f4ead2; box-shadow: none; }
.die.used { opacity: .32; transform: scale(.88); transition: .25s; } .die.shake { animation: shake .13s linear infinite; } .die.land { animation: land .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes shake { 0% { transform: rotate(-14deg) translate(-4px, 2px); } 50% { transform: rotate(12deg) translate(4px, -3px); } 100% { transform: rotate(-14deg) translate(-4px, 2px); } }
@keyframes land { from { transform: scale(1.35) rotate(18deg); } to { transform: none; } }
.roll-btn { pointer-events: auto; padding: 14px 26px; border-radius: 18px; font-weight: 800; font-size: 17px; background: linear-gradient(180deg, #f3c15f, var(--saffron2)); color: #2a1a08; box-shadow: 0 8px 22px rgba(234, 176, 74, .45), inset 0 1px 0 rgba(255, 255, 255, .5); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); } }
.overlay { position: absolute; inset: 0; margin: auto; display: grid; place-items: center; z-index: 5; pointer-events: none; }
.ovcard { pointer-events: auto; width: min(86%, 330px); padding: 20px 18px; border-radius: 22px; background: rgba(8, 30, 36, .92); box-shadow: 0 16px 50px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(234, 176, 74, .45); text-align: center; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); backdrop-filter: blur(3px); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.ovcard h3 { font-size: 20px; font-weight: 800; color: var(--saffron); margin-bottom: 4px; } .ovcard p { color: var(--ivory2); }
.open-dice { display: flex; justify-content: center; gap: 26px; margin: 14px 0 6px; } .open-dice > div { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; } .open-dice .win .die { box-shadow: 0 0 0 3px var(--turq), 0 0 22px rgba(60, 196, 176, .6); }
.mars { display: inline-block; margin: 8px 0 2px; padding: 3px 14px; border-radius: 999px; background: linear-gradient(90deg, #e0604f, #eab04a); color: #2a1208; font-weight: 800; }
.tools { display: flex; gap: 8px; } .tools button { flex: 1; min-height: 46px; border-radius: 14px; background: rgba(244, 234, 210, .08); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tools button[hidden] { display: none; } .tools .off { background: linear-gradient(180deg, #4fd6c2, var(--turq2)); color: #06251f; flex: 2; animation: breathe 1.2s ease-in-out infinite; }
.oppnote { text-align: center; font-size: 12.5px; color: #ffb3a8; margin-top: -2px; }
.emo-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 6; }
.emo { position: absolute; font-size: 44px; animation: emo 2.2s ease-out forwards; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); } @keyframes emo { 0% { transform: scale(.4); opacity: 0; } 15% { transform: scale(1.2); opacity: 1; } 100% { transform: translateY(-80px) scale(1); opacity: 0; } }
.emo-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; } .emo-grid button { font-size: 30px; padding: 8px 0; border-radius: 14px; background: rgba(244, 234, 210, .08); }
.result-top { text-align: center; } .result-top .big { font-size: 34px; font-weight: 800; } .result-top .big.win { color: var(--saffron); } .result-top .big.lose { color: #ff9c8f; }
.rate { display: flex; justify-content: center; align-items: baseline; gap: 10px; margin: 14px 0 2px; } .rate b { font-size: 32px; font-weight: 800; }
@media (max-height: 640px) { .pcard .av { width: 36px; height: 36px; } .die { width: 44px; height: 44px; } }
@media (prefers-reduced-motion: reduce) { *, ::before, ::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; } }
.tools .done { background: linear-gradient(180deg, #f6c66a, #d8932a); color: #2a1706; flex: 2; animation: breathe 1.2s ease-in-out infinite; }
.dhint { position: absolute; inset-inline: 0; top: calc(100% + 6px); text-align: center; font-size: 12.5px; color: #f6d78f; white-space: nowrap; pointer-events: none; }
.die.pick { pointer-events: auto; cursor: pointer; outline: 2px dashed rgba(246, 198, 106, .75); outline-offset: 3px; transition: transform .15s, outline-color .15s; }
.die.pick:active { transform: scale(.94); }
.die.picked { outline: 3px solid #f6c66a; outline-offset: 3px; transform: translateY(-4px) scale(1.08); box-shadow: 0 0 18px rgba(246, 198, 106, .8), 0 8px 14px rgba(0, 0, 0, .5); }
.watchers { position: absolute; top: 8px; inset-inline-end: 8px; padding: 4px 10px; border-radius: 999px; background: rgba(10, 27, 33, .72); border: 1px solid rgba(246, 198, 106, .35); color: #f6d78f; font-size: 13px; font-weight: 700; pointer-events: none; backdrop-filter: blur(6px); }
.watchers[hidden] { display: none; }
.tools .leave { background: rgba(214, 90, 70, .22); }

/* ================= Hokm ================= */
.suit-row { font-size: 46px; letter-spacing: .15em; direction: ltr; color: var(--saffron); }
.ttable { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 14px 0; direction: ltr; }
.trow { display: flex; align-items: center; gap: 12px; width: 100%; justify-content: center; }
.tfelt { flex: 0 0 90px; height: 90px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #1d6a5c, #0f4038); border: 2px solid rgba(234,176,74,.5); font-size: 20px; color: var(--ivory2); }
.tseat { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 104px; padding: 10px 6px; border-radius: 16px; background: rgba(0,0,0,.28); border: 1.5px dashed var(--line); direction: rtl; }
.tseat.taken { border-style: solid; background: var(--panel); }
.tseat.mine { border-color: var(--saffron); }
.tseat:disabled { opacity: 1; cursor: default; }
.tseat b { font-size: 13px; max-width: 94px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tseat small { color: var(--mute); font-size: 11px; }
.tseat.s0, .tseat.s2 { box-shadow: inset 0 -3px 0 var(--turq2); }
.tseat.s1, .tseat.s3 { box-shadow: inset 0 -3px 0 var(--saffron2); }
.empty-av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); font-size: 20px; color: var(--mute); }

.hk { --cw: min(60px, 15vw); position: absolute; inset: 0; display: flex; flex-direction: column; padding: max(8px, env(safe-area-inset-top)) 10px calc(8px + var(--safe-b)); gap: 6px; background: linear-gradient(180deg, #0e1f1c, #0a1613); animation: scr .3s; overflow: hidden; }
.hk-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hk-exit, .hk-share { padding: 8px 16px; border-radius: 14px; background: linear-gradient(180deg, #3a2a1e, #22170f); border: 1.5px solid #8a6a33; color: var(--ivory); font-weight: 700; font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.hk-share[hidden] { display: none; }
.hk-mid { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hk-sub { font-size: 11px; color: var(--ivory2); }
.hk-score { display: flex; align-items: center; gap: 12px; padding: 4px 18px; border-radius: 18px; background: #0b1d1b; border: 1.5px solid #8a6a33; box-shadow: inset 0 0 10px rgba(0,0,0,.6); }
.hk-score .t { display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.hk-score small { font-size: 11px; color: var(--ivory2); } .hk-score b { font-size: 22px; font-variant-numeric: tabular-nums; }
.hk-score .me b { color: var(--turq); } .hk-score span { color: var(--mute); }
.hk-right { display: flex; gap: 6px; align-items: center; }
.hk-trump { display: flex; align-items: center; gap: 6px; padding: 6px 16px; border-radius: 14px; background: linear-gradient(180deg, #3a2a1e, #22170f); border: 1.5px solid #c9a24a; box-shadow: 0 2px 8px rgba(0,0,0,.5); line-height: 1; }
.hk-trump small { font-size: 14px; font-weight: 800; color: var(--saffron); } .hk-trump b { font-size: 24px; color: #f5f0e0; }
.hk-trump.on.red b { color: #ff6a5b; }

/* wooden-framed felt table */
.hk-table { position: relative; flex: 1; min-height: 0; margin: 14px 0 0; direction: ltr; border-radius: 28px; padding: 9px; background: linear-gradient(135deg, #6b4524, #3c2410 40%, #5a3a1b 70%, #2e1b0b); box-shadow: 0 8px 22px rgba(0,0,0,.65), inset 0 0 0 1.5px rgba(246,198,106,.35); }
.hk-table::before { content: ''; position: absolute; inset: 9px; border-radius: 20px; background: radial-gradient(ellipse at 50% 45%, #1f7a57 0%, #14573f 55%, #0c3a2a 100%); box-shadow: inset 0 0 28px rgba(0,0,0,.7), inset 0 0 0 1px rgba(0,0,0,.4); }
.hk-table::after { content: '♠ ♥ ♣ ♦'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 54px; letter-spacing: .3em; color: rgba(255,255,255,.045); pointer-events: none; white-space: nowrap; }

.seat { position: absolute; display: flex; align-items: center; gap: 6px; z-index: 3; --av: 56px; }
.seat .badge { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0; direction: rtl; }
.seat .ring { position: relative; width: calc(var(--av) + 10px); height: calc(var(--av) + 10px); border-radius: 50%; padding: 4px; display: grid; place-items: center; background: conic-gradient(#ffd166 var(--p, 0%), #c9a24a55 0); box-shadow: 0 0 0 2px #2a1a0a, 0 4px 12px rgba(0,0,0,.6); }
.seat .ring::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: linear-gradient(135deg, #f6d27a, #8a5a12); }
.seat.ally .ring::before { background: linear-gradient(135deg, #7be3d2, #1e8f82); }
.seat.active .ring { box-shadow: 0 0 0 2px #2a1a0a, 0 0 18px 4px rgba(255,209,102,.75); animation: pulse 1.2s infinite; }
.seat .ring.low { background: conic-gradient(#ff6a5b var(--p, 0%), #ff6a5b33 0); }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px #2a1a0a, 0 0 26px 8px rgba(255,209,102,.5); } }
.seat .avw { position: relative; z-index: 1; border-radius: 50%; overflow: hidden; display: grid; width: var(--av); height: var(--av); border: 2px solid #1a1007; }
.seat .avw .av { width: 100%; height: 100%; }
.seat.offline .ring { filter: grayscale(1); opacity: .6; }
.seat .plate { margin-top: -9px; z-index: 2; padding: 1px 12px 2px; min-width: 70px; text-align: center; border-radius: 10px; background: linear-gradient(180deg, #1c3731, #0b1b18); border: 1.5px solid #8a6a33; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.seat.hakem .plate { border-color: #ffd166; background: linear-gradient(180deg, #4a3510, #1f1606); }
.seat .nm { font-size: 12px; font-weight: 800; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .cnt { position: absolute; z-index: 3; right: -16px; top: -2px; min-width: 30px; padding: 1px 5px; border-radius: 10px; background: #0b1b18; border: 1.5px solid #c9a24a; text-align: center; line-height: 1.05; box-shadow: 0 2px 5px rgba(0,0,0,.6); }
.seat .cnt b { display: block; font-size: 14px; color: #ffd166; } .seat .cnt small { display: block; font-size: 9px; color: var(--ivory2); }
.seat .crown { position: absolute; z-index: 4; top: -16px; left: 50%; transform: translateX(-50%) rotate(-8deg); font-size: 22px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.seat .crown[hidden] { display: none; }
.tbar { display: none; }
.tbar.wide { display: block; position: static; margin-top: 10px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.tbar i { display: block; height: 100%; width: 0; background: #3cc4b0; }
.tbar.low i { background: var(--red); }
.seat.t { top: 12px; left: 50%; transform: translateX(-50%); flex-direction: column; gap: 3px; }
.seat.l { left: 4px; top: 53%; transform: translateY(-50%); flex-direction: column; gap: 4px; --av: 50px; }
.seat.r { right: 4px; top: 53%; transform: translateY(-50%); flex-direction: column; gap: 4px; --av: 50px; }
.seat.b { margin-top: 10px; position: static; flex-direction: column; justify-content: center; --av: 44px; }
.seat .backs { display: flex; height: 34px; }
.seat.l .plate, .seat.r .plate { min-width: 60px; } .seat.l .nm, .seat.r .nm { max-width: 66px; }
.seat .pile { display: none; }

/* cards */
.pk { position: relative; width: var(--cw); height: calc(var(--cw) * 1.45); border-radius: calc(var(--cw) * .12); background: linear-gradient(160deg, #fffdf5, #f1e8d0); color: #1d1b26; box-shadow: 0 2px 7px rgba(0,0,0,.5), inset 0 0 0 1px rgba(150,120,50,.35); flex: 0 0 auto; direction: ltr; font-family: 'Georgia', 'Times New Roman', serif; overflow: hidden; }
.pk.red { color: #c0281f; }
.pk .cn { position: absolute; top: 3%; left: 6%; display: flex; flex-direction: column; align-items: center; line-height: .95; z-index: 2; }
.pk .cn:last-child { top: auto; left: auto; right: 6%; bottom: 3%; transform: rotate(180deg); }
.pk .cn b { font-size: calc(var(--cw) * .3); font-weight: 800; } .pk .cn i { font-style: normal; font-size: calc(var(--cw) * .27); }
.pk .pips { position: absolute; left: 22%; right: 22%; top: 13%; bottom: 13%; }
.pk .pip { position: absolute; font-style: normal; font-size: calc(var(--cw) * .3); transform: translate(-50%, -50%); line-height: 1; }
.pk .pip.f { transform: translate(-50%, -50%) rotate(180deg); }
.pk .pips.ace { display: grid; place-items: center; left: 0; right: 0; top: 0; bottom: 0; }
.pk .pip.big { position: static; transform: none; font-size: calc(var(--cw) * .85); }
.pk .art { position: absolute; left: 20%; right: 20%; top: 10%; bottom: 10%; }
.pk .art svg { width: 100%; height: 100%; display: block; }
.pk .art .ap { position: absolute; right: 2px; top: 1px; font-style: normal; font-size: calc(var(--cw) * .2); }
.pk.back { background: radial-gradient(circle at 50% 50%, #234a8a 0%, #14285a 70%); border: calc(var(--cw) * .09) solid #f3ead2; box-shadow: 0 2px 6px rgba(0,0,0,.55); }
.pk.back::after { content: ''; position: absolute; inset: 12%; border-radius: 4px; border: 1px solid rgba(246,210,122,.6); background: repeating-linear-gradient(45deg, transparent 0 4px, rgba(246,210,122,.22) 4px 5px), repeating-linear-gradient(-45deg, transparent 0 4px, rgba(246,210,122,.22) 4px 5px); }
.pk.back.mini { --cw: 24px; margin-inline-start: -15px; }
.pk.back.mini:first-child { margin-inline-start: 0; }
.pk.back.sm { --cw: 18px; }

.hk-center { --cw: min(60px, 16vw); position: absolute; left: 50%; top: 56%; width: calc(var(--cw) * 2.8); height: calc(var(--cw) * 3); transform: translate(-50%, -50%); z-index: 6; }
.hk-center .pk { position: absolute; left: 50%; top: 50%; margin: 0; transition: translate .4s ease, opacity .4s ease, scale .4s ease; }
.hk-center .pk[data-pos='b'] { transform: translate(-50%, 2%) rotate(var(--rot)); z-index: 4; }
.hk-center .pk[data-pos='t'] { transform: translate(-50%, -76%) rotate(var(--rot)); z-index: 1; }
.hk-center .pk[data-pos='l'] { transform: translate(-96%, -50%) rotate(var(--rot)); z-index: 2; }
.hk-center .pk[data-pos='r'] { transform: translate(-4%, -50%) rotate(var(--rot)); z-index: 3; }
.hk-center .pk.play { animation: fly .34s cubic-bezier(.2, .8, .3, 1); }
.hk-center .from-b { --fx: 0px; --fy: 220px; } .hk-center .from-t { --fx: 0px; --fy: -200px; } .hk-center .from-l { --fx: -190px; --fy: 0px; } .hk-center .from-r { --fx: 190px; --fy: 0px; }
@keyframes fly { from { translate: var(--fx) var(--fy); opacity: .2; scale: 1.2; } to { translate: 0 0; opacity: 1; scale: 1; } }
.hk-center .pk.sweeping { opacity: 0; scale: .45; }
.hk-center .pk.sweeping.to-b { translate: 0 260px; } .hk-center .pk.sweeping.to-t { translate: 0 -260px; } .hk-center .pk.sweeping.to-l { translate: -260px 0; } .hk-center .pk.sweeping.to-r { translate: 260px 0; }

.hk-status { text-align: center; font-size: 14px; font-weight: 700; padding: 4px 12px; color: var(--ivory2); }
.hk-status.mine { margin: 0 auto; padding: 6px 22px; border-radius: 14px; background: linear-gradient(180deg, #f6d27a, #c9962c); color: #2b1b00; box-shadow: 0 2px 10px rgba(201,150,44,.5); }
.hk-hand { position: relative; height: calc(var(--cw) * 1.45 + 30px); display: flex; justify-content: center; align-items: flex-end; direction: ltr; padding-bottom: 6px; touch-action: none; }
.hk-hand[hidden] { display: none; }
.hk-hand .hc { margin-inline-start: calc(var(--cw) * -.54); transform-origin: 50% 170%; transform: rotate(calc(var(--d) * 2.4deg)) translateY(calc(var(--d) * var(--d) * .7px)); transition: transform .18s, filter .2s; cursor: pointer; }
.hk-hand .hc:first-child { margin-inline-start: 0; }
.hk-hand .hc.dim { filter: brightness(.62) saturate(.7); }
.hk-hand .hc.legal { box-shadow: 0 0 0 2px rgba(255,209,102,.85), 0 3px 9px rgba(0,0,0,.5); }
.hk-hand .hc.sel { transform: translateY(-26px) scale(1.07); z-index: 5; }
.hk-hand .hc.nope { animation: nope .3s; }
.hk-hand .hc.dragging { transition: none; z-index: 9; }
.hk-hand.dealing .hc { animation: dealin .5s backwards; }
@keyframes nope { 30% { translate: -5px 0; } 70% { translate: 5px 0; } }
@keyframes dealin { from { opacity: 0; translate: 0 -80px; } }

.hk-overlay { position: absolute; inset: 0; display: grid; place-items: center; z-index: 6; pointer-events: none; direction: rtl; }
.hk-overlay .ovc { pointer-events: auto; padding: 16px 20px; border-radius: 20px; background: rgba(8, 20, 17, .94); border: 1.5px solid #8a6a33; text-align: center; max-width: 94%; animation: scr .25s; }
.hk-overlay h3 { font-size: 18px; margin-bottom: 4px; }
.hk-overlay .suits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; direction: ltr; }
.hk-overlay .suit { display: flex; flex-direction: column; align-items: center; padding: 10px 10px; border-radius: 14px; background: linear-gradient(160deg, #fffdf5, #f1e8d0); color: #1d1b26; box-shadow: inset 0 0 0 1px #c9a24a; }
.hk-overlay .suit.red { color: #c0281f; } .hk-overlay .suit b { font-size: 32px; line-height: 1.1; } .hk-overlay .suit small { font-size: 11px; }
.hk-overlay .ace-cards { display: flex; gap: 8px; justify-content: center; margin: 10px 0; direction: ltr; }
.hk-overlay .ace-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 52px; }
.hk-overlay .ace-slot small { font-size: 10px; color: var(--ivory2); max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hk-overlay .ace-slot .pk { --cw: 44px; margin-top: -42px; animation: dealin .3s; } .hk-overlay .ace-slot .pk:first-of-type { margin-top: 0; }
.hk-overlay .ace-slot.won .pk:last-child { box-shadow: 0 0 0 3px #ffd166; }
.hk-overlay .round .kind { font-size: 28px; font-weight: 800; color: var(--saffron); }
.hk-overlay .round.good { border-color: var(--green); }
.hk-overlay .round .tr { display: flex; gap: 16px; justify-content: center; margin: 6px 0; font-size: 13px; }
.hk-watch { font-size: 12px; }
.seat.l .pk.back.mini, .seat.r .pk.back.mini { margin-inline-start: -19px; } .seat.l .pk.back.mini:first-child, .seat.r .pk.back.mini:first-child { margin-inline-start: 0; }
