/* [play] game kit: the shared Bankasi Media look for every 1v1 game (Geist, 800-weight
   uppercase wordmark, 600-weight tight headings, graphite brackets, frosted charcoal panels,
   blue-silver halo with no lift on hover), plus the party, lobby, result and countdown screens. */
@font-face { font-family: "Geist"; src: url("../fonts/geist-v1.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@property --silver-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes silver-spin { to { --silver-angle: 360deg; } }

:root {
  --ink: #151515; --paper: #f4f3ef; --soft: #dcdcd7; --muted: #a09c94; --bracket: #9b978f; --label: #c9d1d8;
  --card: rgba(24, 26, 29, .72); --line: rgba(255, 255, 255, .14); --line-strong: rgba(255, 255, 255, .3);
  --glow: 0 0 6px rgba(255,255,255,.7), 0 0 22px rgba(227,237,255,.7), 0 0 48px rgba(201,220,246,.45);
  --halo: conic-gradient(from var(--silver-angle), rgba(140,152,168,.25) 0deg, rgba(175,190,208,.6) 60deg, rgba(225,238,255,.95) 115deg, #fff 145deg, rgba(240,248,255,1) 165deg, rgba(180,195,215,.8) 205deg, rgba(125,138,155,.35) 260deg, rgba(140,152,168,.25) 360deg);
  --opp: #9fb4c9; --good: #9fd6a8; --bad: #e7a39b;
  --b0: #8fb3dc; --b1: #d6b65f; --b2: #9cc595; --b3: #e3987a; --b4: #b39ad6; --b5: #68bdb0; --b6: #e2a0bf; --b7: #ece0bd; --b8: #98928a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--paper); letter-spacing: -.01em;
  background: radial-gradient(1000px 560px at 80% -10%, rgba(201,220,246,.10), transparent 60%), radial-gradient(800px 480px at 0% 40%, rgba(255,255,255,.035), transparent 60%), #151515;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
.br { font-weight: 300; color: var(--bracket); }
.glow { text-shadow: var(--glow); }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px clamp(16px, 4vw, 40px); }
.brand { display: flex; align-items: baseline; gap: 14px; color: inherit; text-decoration: none; white-space: nowrap; }
.wordmark { font-weight: 800; font-size: 15px; letter-spacing: .18em; text-transform: uppercase; }
.wordmark sup { font-size: 6.6px; letter-spacing: .22em; margin-left: .1em; vertical-align: 1.3em; }
.play-mark { font-size: 15px; font-weight: 600; }
.pill-btn { padding: 7px 14px; border: 1px solid #a0a0a0; border-radius: 8px; background: rgba(255,255,255,.07); font-size: 11.4px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.pill-btn:hover, .pill-btn:focus-visible { outline: none; border-color: #fff; box-shadow: 0 0 18px rgba(175,202,238,.45); }

main { flex: 1; display: flex; flex-direction: column; }
.screen { display: none; flex: 1; }
.screen[data-active] { display: flex; flex-direction: column; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* buttons */
.btn { position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px; border-radius: 14px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.06); color: var(--paper); font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; transition: box-shadow .3s, border-color .2s; }
.btn::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; background: var(--halo); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity .3s; pointer-events: none; }
.btn:hover:not(:disabled), .btn:focus-visible { outline: none; box-shadow: 0 0 22px 1px rgba(175,202,238,.45); }
.btn:hover:not(:disabled)::after, .btn:focus-visible::after { opacity: 1; animation: silver-spin 3.6s linear infinite; }
.btn.primary { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.btn.big { height: 58px; width: 100%; font-size: 16px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.btn.wide { width: 100%; margin-top: 14px; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 10px; margin-top: 12px; }
.row .btn { flex: 1; }
.row.center { justify-content: center; flex-wrap: wrap; }
.row.center .btn { flex: 0 1 auto; }

/* panels */
.panel { width: min(480px, calc(100% - 32px)); margin: auto; padding: clamp(20px, 4vw, 30px); border-radius: 18px; background: var(--card); border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0,0,0,.28); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); }
.panel.wide { width: min(640px, calc(100% - 24px)); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel h2 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -.035em; }
.x { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.x:hover, .x:focus-visible { outline: none; color: var(--paper); border-color: var(--line-strong); }
.sub { margin: 4px 0 16px; color: var(--soft); line-height: 1.55; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.field > span { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--label); }
.field.grow { flex: 1; min-width: 0; }
.field input { height: 48px; width: 100%; min-width: 0; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.95); color: var(--ink); padding: 0 14px; font-size: 16px; }
.field input:focus { outline: none; box-shadow: 0 0 0 4px rgba(175,202,238,.4); }
#codeInput { text-transform: uppercase; letter-spacing: .3em; font-weight: 600; }
.join-row { display: flex; gap: 10px; align-items: flex-end; margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--line); }
.join-row .btn { flex: none; }
.msg { min-height: 1.3em; margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.msg.err { color: var(--bad); }
.code-box { display: flex; flex-direction: column; align-items: center; padding: 16px; border-radius: 14px; background: var(--paper); color: var(--ink); margin-top: 10px; }
.code-box span { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: #6b675f; }
.code-box b { font-size: clamp(36px, 9vw, 50px); font-weight: 600; letter-spacing: .28em; margin-right: -.28em; }
.roster { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.roster li { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; border: 1px solid var(--line); border-radius: 999px; }
.roster li b { font-weight: 600; }
.roster li small { margin-left: auto; color: var(--muted); font-size: 12px; }
.roster li.waiting { color: var(--muted); border-style: dashed; }
.settings { display: grid; gap: 4px; margin-top: 8px; }
.av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 700; background: var(--paper); color: var(--ink); }
.av.opp { background: var(--opp); }
.av.emoji { background: rgba(255,255,255,.1); font-size: 18px; }

/* game */
.game { width: min(560px, 100%); margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; flex: 1; }
.bar { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.05); display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover, .icon-btn:focus-visible { outline: none; border-color: var(--line-strong); }
.bar-mid { flex: 1; min-width: 0; text-align: center; }
.bar-mid small { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.bar-mid b { display: block; font-size: 20px; font-weight: 600; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { min-width: 64px; height: 42px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.versus[hidden] { display: none; }
.vchip { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.vchip.opp { flex-direction: row-reverse; padding: 6px 6px 6px 12px; text-align: right; }
.vchip .meta { flex: 1; min-width: 0; }
.vchip b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vchip .prog { height: 4px; margin-top: 5px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
.vchip .prog i { display: block; height: 100%; width: 0; background: var(--paper); border-radius: 4px; transition: width .3s; }
.vchip.opp .prog i { background: var(--opp); margin-left: auto; }
.vchip.done { border-color: rgba(159,214,168,.6); box-shadow: 0 0 18px rgba(159,214,168,.25); }
.vscore { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .04em; }

/* result overlay */
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(10,10,10,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .25s ease; }
.overlay[hidden] { display: none; }
.result { text-align: center; margin: 0; }
.result-art { width: 120px; height: 120px; margin: 0 auto 8px; }
.result small { font-size: 11px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.result h2 { margin: 6px 0 4px; font-size: clamp(36px, 9vw, 48px); text-shadow: var(--glow); }
.result .sub { margin-bottom: 8px; }
.score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 12px 0 4px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.05); }
.score .side { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.score .side b { font-size: 13px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score .nums { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }

.countdown { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; background: rgba(10,10,10,.5); pointer-events: none; }
.countdown[hidden] { display: none; }
.countdown b { font-size: 140px; font-weight: 700; text-shadow: var(--glow); animation: count .9s ease; }
@keyframes count { from { transform: scale(1.6); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }

dialog { border: 0; border-radius: 16px; padding: 26px; width: min(460px, calc(100% - 32px)); background: #fff; color: var(--ink); }
dialog::backdrop { background: rgba(21,21,21,.55); }
dialog h2 { margin: 0 0 10px; font-weight: 600; letter-spacing: -.03em; }
.rules { padding-left: 18px; line-height: 1.6; color: #34332f; margin: 0 0 16px; }

@media (max-width: 560px) {
  .wordmark { font-size: 13.5px; }
  .play-mark { font-size: 13.5px; }
  .brand { gap: 10px; }
  .diff button small { font-size: 9.5px; }
  .tool { height: 50px; }
}
.score[hidden], .vchip[hidden] { display: none; }
#lobbySettings .diff { grid-template-columns: repeat(var(--k, 3), 1fr); }
.foot-note { text-align: center; font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.game { gap: 12px; padding-top: 4px; }
.bar-mid b { font-size: 22px; }
.note { min-height: 40px; display: grid; place-items: center; padding: 8px 14px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--soft); text-align: center; }
.note.bad { background: rgba(196,70,26,.14); border-color: rgba(231,163,155,.4); }
.note.good { background: rgba(159,214,168,.1); border-color: rgba(159,214,168,.4); }
.tools { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
body.multi .solo-only { display: none; }
body:not(.multi) .multi-only { display: none; }
.stage { flex: 1; display: grid; place-items: center; min-height: 0; position: relative; }
@media (max-width: 560px) {
  .bar-mid b { font-size: 19px; }
  .timer { min-width: 56px; height: 38px; font-size: 15px; }
  .icon-btn { width: 38px; height: 38px; }
  .tool { font-size: 10px; letter-spacing: .06em; }
  .top { padding: 14px 16px 6px; }
}
/* tabs and tool buttons */
.diff { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.diff button { height: 46px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; transition: background .2s, color .2s; }
.diff button b { font-size: 14px; font-weight: 600; color: inherit; }
.diff button small { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; opacity: .75; }
.diff button[aria-checked="true"] { background: var(--paper); color: var(--ink); }
.diff button:focus-visible { outline: 2px solid rgba(175,202,238,.7); }
.diff.small button { height: 38px; }
.diff.small { margin-bottom: 0; }
.tool { height: 54px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.05); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; color: var(--soft); }
.tool svg { width: 20px; height: 20px; }
.tool:hover, .tool:focus-visible { outline: none; border-color: var(--line-strong); color: var(--paper); }
.tool[aria-pressed="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.tool[hidden] { display: none; }

/* no double-tap zoom: buttons and play areas take quick repeated taps */
html, body, button, a, .tool, .diff button { touch-action: manipulation; }
.no-touch { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* shared bits for the newer games */
.tool.primary-tool { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.tool:disabled { opacity: .4; cursor: default; }
.say { display: flex; gap: 8px; }
.say input { flex: 1; min-width: 0; height: 50px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.95); color: var(--ink); padding: 0 16px; font-size: 17px; font-weight: 500; }
.say input:focus { outline: none; box-shadow: 0 0 0 4px rgba(175,202,238,.4); }
.say input:disabled { opacity: .55; }
.say input.shake { animation: kshake .3s; box-shadow: 0 0 0 3px rgba(231,163,155,.7); }
@keyframes kshake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.say .btn { height: 50px; flex: none; }
.big-btn { width: 100%; height: 56px; border-radius: 16px; border: 0; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.big-btn:disabled { opacity: .4; cursor: default; }
.card-k { padding: 16px 18px; border-radius: 18px; background: var(--card); border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0,0,0,.28); }
.kicker-s { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.pips { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; min-height: 26px; }
.pips span { min-width: 26px; height: 26px; padding: 0 9px; border-radius: 999px; display: grid; place-items: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; border: 1px solid var(--line); color: var(--muted); }
.pips span.w { border-color: rgba(159,214,168,.5); color: var(--good); }
.pips span.l { border-color: rgba(231,163,155,.4); color: var(--bad); }
.pips span.on { border-color: var(--paper); color: var(--paper); }
