/* Playzone arcade games: shared look. Theme tokens switch with body[data-tod="day"|"night"]; each game sets --accent / --accent2 / --art on body or :root. */
:root { --radius: 18px; --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --seat0: #ff5d73; --seat1: #ffc547; --seat2: #3ddc97; --seat3: #5aa9ff; }
body[data-tod="day"] {
  --bg1: #e8f1ff; --bg2: #fbfdff; --card: #ffffff; --card2: #f0f5fb; --ink: #14233a; --muted: #566780; --line: #d3dfec;
  --accent: #5b5bf0; --accent2: #b44cf0; --accent-ink: #ffffff; --go1: #22c55e; --go2: #15803d; --bad-bg: #ffe0e2; --bad-ink: #a61e26; --ok-bg: #d9f7e5; --ok-ink: #0a6a33;
  --shadow: 0 8px 28px rgba(31, 70, 120, .14); --glow: rgba(91, 91, 240, .25); color-scheme: light;
}
body[data-tod="night"] {
  --bg1: #070b1f; --bg2: #141a45; --card: #151d44; --card2: #0e1537; --ink: #eaf0ff; --muted: #9bacd3; --line: #2a3a6c;
  --accent: #7c8cff; --accent2: #d36bff; --accent-ink: #0a1030; --go1: #35d97a; --go2: #1aa551; --bad-bg: #5a1d27; --bad-ink: #ffb8bd; --ok-bg: #12452c; --ok-ink: #8cf0b8;
  --shadow: 0 10px 34px rgba(0, 0, 0, .5); --glow: rgba(124, 140, 255, .3); color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  background: radial-gradient(900px 500px at 85% -10%, var(--glow), transparent 70%), radial-gradient(700px 400px at -10% 110%, var(--glow), transparent 70%), linear-gradient(180deg, var(--bg1), var(--bg2));
  background-attachment: fixed; transition: background .4s, color .3s; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); max-width: 1100px; margin: 0 auto; }
.back { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; padding: 10px 10px; border-radius: 10px; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
.back:hover { background: var(--card); color: var(--ink); }
.brand { margin: 0; font-size: clamp(1.15rem, 5vw, 1.6rem); font-weight: 800; letter-spacing: -.02em; flex: 1; text-align: center; white-space: nowrap; }
.brand span { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tools { display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; box-shadow: var(--shadow); }
.seg button { border: 0; background: transparent; padding: 7px 10px; border-radius: 999px; display: inline-flex; gap: 5px; align-items: center; font-size: .8rem; font-weight: 600; color: var(--muted); min-height: 36px; }
.seg button i { font-style: normal; }
.seg button[aria-checked="true"] { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); font-size: 1.1rem; }
.icon-btn[aria-pressed="false"] { opacity: .55; }
@media (max-width: 560px) { .seg button b { display: none; } .seg button { padding: 7px 11px; } .back span { display: none; } }

main { max-width: 1100px; margin: 0 auto; padding: 6px 14px calc(36px + env(safe-area-inset-bottom)); }
.screen[hidden] { display: none; }

/* cards, form bits, buttons */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: background .4s; min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 1.08rem; }
.menu-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 400px) { .top { gap: 6px; padding-left: 10px; padding-right: 10px; } .brand { font-size: 1.05rem; } .tools { gap: 6px; } .seg button { padding: 7px 7px; } }
@media (max-width: 820px) { .menu-grid { grid-template-columns: 1fr; } }
.hero-card h2 { font-size: clamp(1.35rem, 5vw, 1.9rem); line-height: 1.15; margin-bottom: 10px; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.label { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.field { display: block; margin-top: 14px; }
.field > span { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 6px; }
input[type="text"], input[type="search"] { width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--card2); font-size: 1rem; min-height: 48px; }
input[type="text"]:focus, input[type="search"]:focus { border-color: var(--accent); outline: none; }
.hint { color: var(--muted); font-size: .9rem; margin: 10px 0 0; line-height: 1.5; }
.err { color: var(--bad-ink); background: var(--bad-bg); padding: 10px 12px; border-radius: 10px; font-size: .9rem; margin: 12px 0 0; }
.menu-art { width: 100%; height: auto; max-height: 220px; border-radius: 14px; display: block; margin: 8px 0 2px; background: var(--card2); }

.btn { border: 0; border-radius: 14px; padding: 13px 20px; font-weight: 700; font-size: 1rem; min-height: 48px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; transition: transform .08s, filter .15s; box-shadow: 0 6px 18px var(--glow); }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.go { background: linear-gradient(180deg, var(--go1), var(--go2)); width: 100%; margin-top: 16px; box-shadow: 0 6px 18px rgba(34, 197, 94, .35); }
.btn.alt { background: var(--card2); color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--muted); border: 2px solid var(--line); box-shadow: none; }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: .9rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 2px solid var(--line); background: var(--card2); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: .88rem; min-height: 42px; color: var(--ink); }
.chips button[aria-checked="true"] { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }

.tabs { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); gap: 6px; background: var(--card2); padding: 4px; border-radius: 14px; margin-bottom: 4px; }
.tabs button { border: 0; background: transparent; border-radius: 11px; padding: 10px 6px; font-weight: 700; font-size: .92rem; min-height: 44px; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.or { text-align: center; margin: 16px 0 12px; position: relative; color: var(--muted); font-size: .8rem; }
.or::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.or span { position: relative; background: var(--card); padding: 0 10px; }
.joinrow { display: flex; gap: 10px; }
.joinrow input { text-transform: uppercase; letter-spacing: .25em; font-weight: 800; text-align: center; font-size: 1.15rem; min-width: 0; }
.joinrow .btn { min-width: 96px; }
.stats { text-align: center; color: var(--muted); font-size: .85rem; margin: 16px 0 0; min-height: 1.2em; }

/* lobby (PZ.lobby) */
.lobby-code { font-size: clamp(2.2rem, 11vw, 3.4rem); font-weight: 800; letter-spacing: .22em; text-align: center; padding: 10px 0 6px 0.22em; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0 4px; }
.seatbox { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--card2); border: 2px dashed var(--line); min-height: 58px; min-width: 0; }
.seatbox.filled { border-style: solid; }
.seatbox b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
.seatbox small { display: block; color: var(--muted); font-size: .75rem; }
.av { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; color: #10182e; background: var(--seatc, var(--seat0)); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.seatbox:not(.filled) .av { background: transparent; border: 2px dashed var(--line); color: var(--muted); box-shadow: none; }
.dots::after { content: ''; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* score strip + status */
.status { text-align: center; font-weight: 700; padding: 10px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.status.good { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.status.bad { background: var(--bad-bg); color: var(--bad-ink); border-color: transparent; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.pill .av { width: 22px; height: 22px; font-size: .7rem; box-shadow: none; }
.pill.turn { border-color: var(--seatc, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--seatc, var(--accent)) 30%, transparent); }
.pill.away { opacity: .55; }

/* results overlay */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(5, 8, 25, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .25s; }
.overlay > .card { width: min(440px, 100%); text-align: center; max-height: 92dvh; overflow: auto; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.overlay h2 { font-size: 1.6rem; margin: 4px 0 6px; }
.overlay .big { font-size: 3.2rem; line-height: 1; }
.overlay .row { justify-content: center; margin-top: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

/* toast + confetti */
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 80; background: var(--ink); color: var(--bg2); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: .92rem; max-width: min(92vw, 420px); text-align: center; opacity: 0; transition: .25s; pointer-events: none; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
#pzConfetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }
