﻿:root { --navy: #0b1b3f; --navy2: #132a5c; --yellow: #ffc527; --ink: #0b1b3f; --muted: #6b7a99; --card: #fff; --bg: #eef2fa; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Poppins, 'Noto Sans Devanagari', system-ui, sans-serif; background: var(--bg); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; -webkit-tap-highlight-color: transparent; }
.np { font-family: 'Noto Sans Devanagari', Poppins, sans-serif; }
.hidden { display: none !important; }
.top { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; position: sticky; top: 0; z-index: 5; }
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 18px; }
.brand img { width: 30px; height: 30px; }
.brand b { color: var(--yellow); }
.top-right { display: flex; align-items: center; gap: 8px; }
.chip { background: var(--navy2); border: 1px solid #2c4a8a; padding: 4px 10px; border-radius: 99px; font-weight: 600; letter-spacing: 2px; font-size: 14px; cursor: pointer; }
.icon-btn { background: var(--navy2); color: #fff; border: 0; width: 34px; height: 34px; border-radius: 10px; font-size: 16px; cursor: pointer; }
main { flex: 1; width: 100%; max-width: 620px; margin: 0 auto; padding: 14px; }
.card { background: var(--card); border-radius: 18px; padding: 22px; box-shadow: 0 6px 24px rgba(11, 27, 63, .08); }
h1 { margin: 0 0 4px; font-size: 30px; font-weight: 800; }
.sub { margin: 0 0 18px; color: var(--muted); }
.lbl { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
input { width: 100%; font: inherit; font-size: 17px; padding: 12px 14px; border: 2px solid #d9e0ee; border-radius: 12px; outline: none; background: #fff; color: var(--ink); }
input:focus { border-color: var(--navy2); }
.code-in { text-transform: uppercase; letter-spacing: 4px; font-weight: 600; text-align: center; }
.btn { font: inherit; font-weight: 600; font-size: 15px; padding: 11px 16px; border-radius: 12px; border: 2px solid var(--navy); background: #fff; color: var(--navy); cursor: pointer; text-decoration: none; text-align: center; white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: var(--navy); }
.btn.big { width: 100%; font-size: 18px; padding: 14px; margin-top: 14px; }
.btn.wa { border-color: #25d366; color: #128c4b; }
.row { display: flex; gap: 10px; align-items: stretch; }
.row input { flex: 1; }
.or { text-align: center; color: var(--muted); margin: 20px 0 12px; font-size: 13px; position: relative; }
.or::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid #e3e8f2; }
.or span { background: #fff; padding: 0 10px; position: relative; }
.rules { margin-top: 20px; color: #3b4a6b; font-size: 14px; }
.rules summary { cursor: pointer; font-weight: 600; }
.rules li { margin: 6px 0; }
.code-big { font-size: 46px; font-weight: 800; letter-spacing: 10px; text-align: center; color: var(--navy); margin-bottom: 12px; }
.share { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
h3 { margin: 6px 0 10px; font-size: 16px; }
.plist { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.plist li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: #f4f6fb; font-weight: 600; }
.dot { width: 18px; height: 18px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .55); }
.plist .tag { font-size: 12px; color: var(--muted); font-weight: 500; }
.plist .kick { margin-left: auto; border: 0; background: none; color: #c62828; font-size: 18px; cursor: pointer; }
#hostCtl .btn { flex: 1; }
.muted { color: var(--muted); text-align: center; }

#game { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.board-wrap { position: relative; width: 100%; max-width: min(560px, calc(100vh - 250px)); min-width: 280px; }
#board { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 18px rgba(11, 27, 63, .18)); }
.tok { transition: transform .22s cubic-bezier(.3,1.2,.5,1); cursor: default; will-change: transform; }
.tok.legal { cursor: pointer; }
.tok .ring { opacity: 0; }
.tok.legal .ring { animation: pulse .8s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .25; transform: scale(1); } to { opacity: 1; transform: scale(1.35); } }
.hud { display: flex; align-items: center; gap: 14px; width: 100%; background: #fff; border-radius: 16px; padding: 10px 14px; box-shadow: 0 4px 16px rgba(11, 27, 63, .07); }
.dice-box { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1; min-width: 40px; z-index: 2; pointer-events: none; transition: left .5s cubic-bezier(.3, 1.25, .5, 1), top .5s cubic-bezier(.3, 1.25, .5, 1); }
.dice-box.can { pointer-events: auto; }
.dice { width: 100%; height: 100%; border-radius: 22%; background: #fff; border: 3px solid #ccc; padding: 12%; box-shadow: 0 3px 0 rgba(0, 0, 0, .15); user-select: none; }
.dice.can { cursor: pointer; animation: bob .7s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-5px) rotate(-4deg); } }
.dice.rolling { animation: spin .3s cubic-bezier(.4,.1,.6,.9) infinite; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.pips { display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); width: 100%; height: 100%; }
.pips i { width: 62%; height: 62%; border-radius: 50%; background: var(--navy); align-self: center; justify-self: center; visibility: hidden; }
.pips i.on { visibility: visible; }
.hud-text { flex: 1; min-width: 0; }
.status { font-weight: 700; font-size: 17px; }
.timer { color: var(--muted); font-size: 13px; min-height: 18px; }
.pbar { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; width: 100%; justify-content: center; }
.pbar li { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; background: #fff; font-size: 13px; font-weight: 600; border: 2px solid transparent; }
.pbar li.turn { border-color: var(--navy); box-shadow: 0 0 0 3px var(--yellow); }
.pbar li.gone { opacity: .45; text-decoration: line-through; }
.pbar .dot { width: 14px; height: 14px; }
.log { font-size: 12px; color: var(--muted); text-align: center; min-height: 16px; }
.overlay { position: fixed; inset: 0; background: rgba(11, 27, 63, .55); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 10; }
.overlay .card { width: 100%; max-width: 380px; text-align: center; }
.overlay h2 { margin: 0 0 12px; }
.ranking { text-align: left; padding: 0; list-style: none; margin: 0 0 6px; }
.ranking li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; font-weight: 600; }
.ranking li:first-child { background: #fff6d6; }
.overlay .btn:not(.big) { margin-top: 10px; width: 100%; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 600; z-index: 20; max-width: 90vw; text-align: center; }
.foot { text-align: center; font-size: 12px; color: var(--muted); padding: 14px; }
.foot a { color: var(--navy2); font-weight: 600; }

/* video call */
.callbar { background: #fff; border-radius: 16px; padding: 8px; margin-bottom: 10px; box-shadow: 0 4px 16px rgba(11, 27, 63, .07); }
.vtiles { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.vtiles:not(:empty) { margin-bottom: 8px; }
.vtile { position: relative; flex: none; width: 104px; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #0b1b3f; border: 3px solid #c3cad8; transition: box-shadow .2s; }
.vtile.turn { box-shadow: 0 0 0 3px var(--yellow); }
.vtile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vtile.me video { transform: scaleX(-1); }
.vtile.me.back video { transform: none; }
.vtile .vname { position: absolute; left: 4px; bottom: 3px; right: 4px; color: #fff; font-size: 11px; font-weight: 600; text-shadow: 0 1px 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vtile .vwait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9fb0d4; font-size: 11px; }
.callctl { display: flex; gap: 6px; align-items: center; justify-content: center; }
.btn.call { border-color: #2e9e44; color: #1d7a33; padding: 8px 14px; }
.btn.hang { border-color: #e53935; background: #e53935; color: #fff; padding: 8px 14px; }
.icon-btn2 { width: 40px; height: 38px; border-radius: 10px; border: 2px solid #d9e0ee; background: #fff; font-size: 17px; cursor: pointer; }
.icon-btn2.off { background: #fde4e4; border-color: #e53935; }
body.incall .board-wrap { max-width: min(560px, calc(100vh - 360px)); }

/* chat */
.chatbox { width: 100%; background: #fff; border-radius: 16px; padding: 10px; margin-top: 10px; box-shadow: 0 4px 16px rgba(11, 27, 63, .07); }
.chatlist { height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding: 2px 2px 6px; font-size: 14px; }
.chat-empty { color: var(--muted); font-size: 13px; text-align: center; margin: auto; }
.cmsg { display: flex; gap: 6px; align-items: baseline; line-height: 1.35; word-break: break-word; }
.cmsg .dot { width: 10px; height: 10px; flex: none; position: relative; top: 1px; }
.cmsg b { flex: none; font-weight: 600; }
.cmsg.mine { background: #fff6d6; border-radius: 8px; padding: 2px 6px; }
.chat-quick { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; margin-bottom: 7px; }
.chat-quick button { flex: none; border: 1px solid #d9e0ee; background: #f4f6fb; border-radius: 99px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.chat-form input { font-size: 15px; padding: 9px 12px; }
.chat-form .btn { padding: 9px 14px; }
.chat-pop { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); background: rgba(11, 27, 63, .88); color: #fff; padding: 6px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; max-width: 85%; z-index: 3; pointer-events: none; animation: popin .25s ease-out; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes popin { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* v6 call audio */
.vtile audio { display: none; }
.vtile .vmeter { position: absolute; left: 0; right: 0; top: 0; height: 4px; background: #22c55e; transform-origin: left; transform: scaleX(0); transition: transform .08s linear; }
#callSoundBtn { background: #f59e0b; color: #111; font-weight: 700; border: 0; border-radius: 999px; padding: 6px 12px; animation: pulseSnd 1s infinite alternate; }
@keyframes pulseSnd { to { transform: scale(1.06); } }

/* v7 desktop layout: big board left, call + status + chat on the right */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  main:has(#game:not(.hidden)) { max-width: 1400px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-auto-rows: min-content; column-gap: 24px; row-gap: 10px; align-items: start; }
  main:has(#game:not(.hidden)) #game { display: contents; }
  main:has(#game:not(.hidden)) > * , main:has(#game:not(.hidden)) #game > * { grid-column: 2; min-width: 0; }
  main:has(#game:not(.hidden)) #game > .board-wrap { grid-column: 1; grid-row: 1 / span 30; justify-self: center; width: min(calc(100vh - 110px), calc(100vw - 440px)); max-width: none; }
  main:has(#game:not(.hidden)) .chatbox { margin-top: 0; }
  main:has(#game:not(.hidden)) .chatlist { height: max(110px, calc(100vh - 560px)); }
  main:has(#game:not(.hidden)) .vtiles { flex-wrap: wrap; overflow: visible; }
  main:has(#game:not(.hidden)) .vtile { width: calc(50% - 3px); }
  main:has(#game:not(.hidden)) #endOverlay { grid-column: auto; }
}

/* v8 end game */
.btn.end { flex: none; background: #fff; color: #c62828; border: 2px solid #f1c4c4; padding: 8px 12px; font-size: 14px; }
#endWhy { margin: -4px 0 10px; }

/* v9 in-app dialog */
.overlay.ask { z-index: 30; backdrop-filter: blur(3px); animation: askFade .15s ease-out; }
.ask-card { text-align: center; max-width: 340px; animation: askPop .2s cubic-bezier(.3, 1.4, .5, 1); }
.ask-card h2 { margin: 6px 0 6px; font-size: 21px; }
.ask-card p { margin: 0 0 16px; font-size: 14px; }
.ask-icon { width: 56px; height: 56px; margin: 0 auto 4px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: #fff6d9; box-shadow: inset 0 0 0 3px var(--yellow); }
.ask-icon.danger { background: #fdecec; box-shadow: inset 0 0 0 3px #f3b4b4; }
.ask-card input { margin: 0 0 14px; font-size: 14px; }
.ask-btns { display: flex; gap: 10px; }
.ask-btns .btn { flex: 1; }
.btn.danger { background: #e53935; border-color: #e53935; color: #fff; }
@keyframes askPop { from { transform: scale(.85); opacity: 0; } }
@keyframes askFade { from { opacity: 0; } }

/* v10 voice call */
.btn.call.voice { border-color: #2563eb; color: #1d4ed8; }
.vtile .vini { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 34px; font-weight: 700; color: #fff; background: radial-gradient(circle at 50% 40%, #24407e, #0b1b3f); }
.vtile.novid .vini { display: flex; }
.vtile.novid video { visibility: hidden; }

/* v11 icons */
.ic { width: 20px; height: 20px; display: block; flex: none; }
.icon-btn { display: inline-grid; place-items: center; }
.icon-btn .ic { width: 18px; height: 18px; }
.btn.call { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; }
.btn.call .ic { width: 18px; height: 18px; }
.callctl { gap: 10px; flex-wrap: wrap; }
.rbtn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: #e8edf7; color: var(--navy); display: grid; place-items: center; cursor: pointer; transition: background .15s, transform .1s; }
.rbtn:hover { background: #dbe3f2; }
.rbtn:active { transform: scale(.94); }
.rbtn.off { background: #e53935; color: #fff; }
.rbtn.hang { background: #e53935; color: #fff; width: 58px; border-radius: 999px; }
.rbtn.hang .ic { transform: rotate(135deg); }
/* v11 chat: floating button + panel */
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
.chat-x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: #eef2fa; color: var(--navy); display: grid; place-items: center; cursor: pointer; }
.chat-x .ic { width: 16px; height: 16px; }
.chat-fab { position: fixed; right: 18px; bottom: 18px; z-index: 8; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 20px rgba(11, 27, 63, .35); }
.chat-fab .ic { width: 24px; height: 24px; }
.chat-fab .badge { position: absolute; top: -3px; right: -3px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: #e53935; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.chatbox { position: fixed; right: 18px; bottom: 86px; z-index: 9; width: min(360px, calc(100vw - 24px)); margin: 0; box-shadow: 0 12px 40px rgba(11, 27, 63, .28); display: none; }
body.chat-open .chatbox:not(.hidden) { display: block; animation: askPop .18s ease-out; }
.chatbox .chatlist { height: min(300px, 40vh); }
@media (max-width: 600px) { .chatbox { right: 12px; left: 12px; width: auto; bottom: 84px; } }
/* computer during a game: chat stays open in the right column, no floating button */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  main:has(#game:not(.hidden)) .chatbox:not(.hidden) { position: static; display: block; width: auto; box-shadow: 0 4px 16px rgba(11, 27, 63, .07); animation: none; }
  main:has(#game:not(.hidden)) .chat-head { display: none; }
  main:has(#game:not(.hidden)) .chat-fab { display: none; }
}

.vtile .vname { display: flex; align-items: center; gap: 3px; }
.vtile .vname .ic.mut { width: 12px; height: 12px; color: #ff6b6b; }


/* v12: game picker + Bagchal */
.gpick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 14px; }
.gopt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-radius: 14px; border: 2px solid #dfe3ec; background: #fff; cursor: pointer; font: inherit; color: #0b1b3f; transition: border-color .2s, transform .15s, box-shadow .2s; }
.gopt .gi { font-size: 30px; line-height: 1.1; }
.gopt b { font-size: 16px; }
.gopt small { color: #6b7591; font-size: 12px; }
.gopt.on { border-color: #f5c400; box-shadow: 0 4px 14px rgba(245, 196, 0, .35); transform: translateY(-1px); background: #fffbea; }
.gopt:active { transform: scale(.97); }
.lobby-game { text-align: center; font-weight: 800; font-size: 18px; margin: 0 0 6px; color: #0b1b3f; }
.bcp { pointer-events: none; will-change: transform; }
.bcp text { user-select: none; }
.bcp.can circle { stroke-width: .09; }
.bcp.can { filter: drop-shadow(0 0 .06px #f5c400); }
.bcp.sel circle { stroke: #f5c400; stroke-width: .12; }
.bchit { cursor: pointer; }
.bchint { pointer-events: none; }
.bchint.place, .bchint.go { fill: rgba(46, 158, 68, .55); animation: bcpulse .9s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.bchint.cap { fill: none; stroke: #e53935; stroke-width: .08; animation: bcpulse .7s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes bcpulse { from { transform: scale(.75); opacity: .6; } to { transform: scale(1.05); opacity: 1; } }
.bcinfo { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 6px 0; }
.bcstat { position: relative; overflow: hidden; background: #fff; border: 1px solid #e3e6ee; border-radius: 10px; padding: 5px 10px 7px; font-size: 13px; color: #33405e; }
.bcstat i { position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p); background: #f5c400; transition: width .4s ease; }
