:root {
  --bg: #0d0b12;
  --panel: rgba(30, 28, 38, 0.82);
  --panel-solid: #1d1b25;
  --panel-2: #282634;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --gold: #e9b843;
  --gold-hi: #ffdc7a;
  --gold-dark: #8f6a12;
  --purple: #9258e3;
  --purple-hi: #c39dff;
  --purple-dark: #4b2584;
  --text: #f4f1f8;
  --muted: #a9a3b8;
  --danger: #ff7b7b;
  --radius: 16px;
  --display: "Orbitron", "Exo 2", system-ui, sans-serif;
  --body: "Exo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 600 16px/1.4 var(--body);
  min-height: 100vh; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(146, 88, 227, 0.28), transparent 60%),
    radial-gradient(800px 500px at 100% 10%, rgba(233, 184, 67, 0.14), transparent 60%),
    radial-gradient(1.2px 1.2px at 20px 30px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 120px 90px, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1.4px 1.4px at 220px 160px, rgba(255, 230, 170, 0.4), transparent),
    radial-gradient(1px 1px at 300px 40px, rgba(200, 170, 255, 0.4), transparent),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 0l28 16v32L28 64 0 48V16zM28 64v33' fill='none' stroke='%23ffffff' stroke-opacity='0.025'/%3E%3C/svg%3E"),
    var(--bg);
  background-size: auto, auto, 340px 220px, 340px 220px, 340px 220px, 340px 220px, 56px 97px, auto;
  background-attachment: fixed;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* --- Buttons ------------------------------------------------------------------ */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--line-2); background: linear-gradient(180deg, #34313f, #24222e);
  font-weight: 800; letter-spacing: 0.02em; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.gold { background: linear-gradient(180deg, #ffe592, var(--gold) 55%, #c8901b); color: #2a1a00; border-color: #8f6a12; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 6px 20px rgba(233, 184, 67, 0.28); }
.btn.purple { background: linear-gradient(180deg, #c7a4ff, var(--purple) 55%, #6a36b8); color: #fff; border-color: #4b2584; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 20px rgba(146, 88, 227, 0.32); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.88rem; }
.btn.big { min-height: 52px; font-size: 1.05rem; font-family: var(--display); letter-spacing: 0.08em; }
.btn.danger { color: #ffb7b7; border-color: rgba(255, 123, 123, 0.35); background: rgba(80, 30, 36, 0.5); box-shadow: none; }
.icon-btn { width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); font-size: 1.1rem; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { min-height: 42px; padding: 6px 4px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); font-weight: 800; font-size: 0.9rem; text-transform: none; letter-spacing: 0; color: var(--text); display: grid; place-items: center; line-height: 1.15; }
.seg button small { display: block; font-size: 0.68rem; color: var(--muted); font-weight: 700; }
.seg button[aria-pressed="true"] { border-color: var(--gold); background: rgba(233, 184, 67, 0.1); box-shadow: 0 0 0 1px var(--gold) inset, 0 0 18px rgba(233, 184, 67, 0.15); color: var(--gold-hi); }

/* --- Lobby -------------------------------------------------------------------- */
.lobby { max-width: 980px; margin: 0 auto; padding: 26px 16px 48px; display: grid; gap: 18px; }
.hero { display: flex; align-items: center; gap: 18px; }
.hero-logo { position: relative; flex: none; width: 92px; height: 92px; border-radius: 24px; padding: 3px; background: conic-gradient(from 0deg, var(--gold), var(--purple), #6b6880, var(--gold)); animation: spin 9s linear infinite; box-shadow: 0 0 40px rgba(146, 88, 227, 0.35); }
.hero-logo img { display: block; width: 100%; height: 100%; border-radius: 21px; object-fit: cover; animation: spin 9s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero-text { flex: 1; min-width: 0; }
.hero h1 { margin: 0; font-family: var(--display); font-weight: 900; font-size: clamp(2rem, 8vw, 3.4rem); letter-spacing: 0.16em; line-height: 1; background: linear-gradient(90deg, #d7d3e2 0%, var(--gold-hi) 45%, var(--purple-hi) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 18px rgba(146, 88, 227, 0.35)); }
.hero p { margin: 8px 0 0; color: var(--muted); font-weight: 700; letter-spacing: 0.04em; }
.lobby-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; align-content: start; backdrop-filter: blur(10px); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); }
.card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(140deg, rgba(233, 184, 67, 0.4), transparent 40%, rgba(146, 88, 227, 0.45)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.card h2 { margin: 0; font-size: 1.2rem; display: flex; align-items: center; gap: 10px; }
.tag { font-family: var(--display); font-size: 0.62rem; letter-spacing: 0.14em; padding: 4px 8px; border-radius: 999px; text-transform: uppercase; }
.tag.gold { background: rgba(233, 184, 67, 0.15); color: var(--gold-hi); border: 1px solid rgba(233, 184, 67, 0.4); }
.tag.purple { background: rgba(146, 88, 227, 0.18); color: var(--purple-hi); border: 1px solid rgba(146, 88, 227, 0.45); }
.card label { display: grid; gap: 7px; color: var(--muted); font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
input.code { min-height: 46px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.3); text-transform: uppercase; letter-spacing: 0.3em; font-family: var(--display); font-weight: 800; width: 100%; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.14em; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px dashed var(--line-2); }
.note { color: var(--muted); font-size: 0.9rem; margin: 0; }
.error { color: #ffb7b7; min-height: 1.2em; margin: 0; font-size: 0.92rem; }
.error a { color: var(--gold); font-weight: 800; }

/* --- Game layout ------------------------------------------------------------- */
.game {
  max-width: 1240px; margin: 0 auto; padding: 10px 12px calc(160px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px;
  grid-template-areas: "top" "side" "board" "ticker";
}
.topbar { grid-area: top; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .logo { flex: none; width: 38px; height: 38px; border-radius: 11px; background: url("/lab/logo.png") center / cover; box-shadow: 0 0 0 1px var(--line-2), 0 0 16px rgba(146, 88, 227, 0.3); }
.topbar .title { font-family: var(--display); font-weight: 900; letter-spacing: 0.2em; font-size: 1.05rem; }
.topbar .spacer { flex: 1; }
.chip { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); font-size: 0.78rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.side { grid-area: side; display: grid; gap: 8px; min-width: 0; }
.players { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.player {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "disc who count" "disc sub count";
  gap: 0 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); min-width: 0; transition: box-shadow 0.3s, border-color 0.3s;
}
.player .disc { grid-area: disc; width: 36px; height: 40px; display: grid; place-items: center; font-weight: 900; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.player.p0 .disc { background: radial-gradient(circle at 35% 30%, #fff2bf, var(--gold) 50%, #a87812); color: #3a2600; }
.player.p1 .disc { background: radial-gradient(circle at 35% 30%, #e2ccff, var(--purple) 50%, #4a2386); color: #fff; }
.player .who { grid-area: who; display: flex; align-items: center; gap: 6px; min-width: 0; }
.player .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .who em { font-style: normal; font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: var(--muted); }
.player .who em.off { color: var(--danger); }
.player .sub { grid-area: sub; color: var(--muted); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .count { grid-area: count; font-family: var(--display); font-weight: 800; font-size: 1.5rem; line-height: 1; text-align: right; }
.player .count small { display: block; font-family: var(--body); font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.player.turn.p0 { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 26px rgba(233, 184, 67, 0.28); }
.player.turn.p1 { border-color: var(--purple-hi); box-shadow: 0 0 0 1px var(--purple-hi), 0 0 26px rgba(146, 88, 227, 0.35); }
.player .clock { position: absolute; top: -9px; right: 10px; padding: 1px 8px; border-radius: 999px; background: var(--panel-solid); border: 1px solid var(--line-2); font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 800; font-size: 0.74rem; }
.player .clock.low { color: var(--danger); border-color: rgba(255, 123, 123, 0.5); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.55; } }
.territory { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: #6b5a8f; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4); }
.territory .g { background: linear-gradient(90deg, #b8861a, var(--gold-hi)); box-shadow: 0 0 12px rgba(233, 184, 67, 0.5); transition: width 0.5s ease; }
.territory .p { flex: 1; background: linear-gradient(90deg, var(--purple-hi), #5d2fa3); }
.meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; }
.meta b { color: var(--text); font-family: var(--display); font-weight: 800; }

/* --- Board ---------------------------------------------------------------------- */
.board-wrap { grid-area: board; position: relative; display: grid; place-items: center; min-width: 0; }
.board-host { width: 100%; max-width: 820px; }
svg.board { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; overflow: visible; }
svg.fx { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 820px; height: 100%; pointer-events: none; overflow: visible; }
.plate-glow { fill: none; stroke: rgba(233, 184, 67, 0.16); stroke-width: 22; stroke-linejoin: round; filter: blur(8px); }
.plate { fill: url(#hxPlate); stroke: url(#hxRim); stroke-width: 5; stroke-linejoin: round; }
.plate-inner { fill: rgba(0, 0, 0, 0.28); stroke: rgba(255, 255, 255, 0.05); stroke-width: 2; stroke-linejoin: round; }
.cell .face { fill: url(#hxCell); stroke: #1b1922; stroke-width: 2.5; stroke-linejoin: round; transition: fill 0.15s; }
.cell.alt .face { fill: url(#hxCellAlt); }
.cell .bevel { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 1.5; pointer-events: none; }
.cell.tap { cursor: pointer; }
.cell.tap:hover .face { fill: #6a677b; }
.cell.sel .face { stroke: var(--gold-hi); stroke-width: 4; filter: drop-shadow(0 0 6px rgba(255, 220, 122, 0.8)); }
.cell.dest .face { stroke: var(--gold); stroke-width: 3; stroke-dasharray: 7 5; animation: march 0.8s linear infinite; }
@keyframes march { to { stroke-dashoffset: -24; } }
.cell.path .face { fill: #5e4d86; }
.cell.last .face { stroke: rgba(255, 255, 255, 0.6); stroke-width: 3; }
.cell .hint { fill: var(--gold-hi); animation: hint 1.1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes hint { 50% { transform: scale(1.5); opacity: 0.5; } }
.cell .drop { font-family: var(--display); font-weight: 900; fill: #fff; paint-order: stroke; stroke: #1b1a20; stroke-width: 5px; }
.stack { pointer-events: none; }
.stack .shadow { fill: rgba(0, 0, 0, 0.4); }
.piece { stroke-width: 1.8; stroke-linejoin: round; }
.piece.p0.top { fill: url(#hxGold); stroke: #7b5a0e; }
.piece.p1.top { fill: url(#hxPurple); stroke: #3a1a6b; }
.piece.p0.under { fill: #b88a20; stroke: #6d500c; }
.piece.p1.under { fill: #5d2fa3; stroke: #2e1258; }
.rim { fill: none; stroke-width: 1.2; }
.rim.p0 { stroke: rgba(255, 248, 220, 0.55); }
.rim.p1 { stroke: rgba(240, 225, 255, 0.45); }
.stack text { font-family: var(--display); font-weight: 900; }
.sym.p0, .num.p0 { fill: #3a2600; }
.sym.p1, .num.p1 { fill: #fff; }
/* Move animations */
.pop .stack { animation: pop 0.42s cubic-bezier(0.2, 1.5, 0.4, 1); transform-box: fill-box; transform-origin: center; }
@keyframes pop { 0% { transform: translateY(-16px) scale(1.5); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
.pop .face { animation: land 0.5s ease-out; }
@keyframes land { 0% { fill: #8f86b3; } }
.flip .stack { animation: flip 0.6s ease-in-out; transform-box: fill-box; transform-origin: center; }
@keyframes flip { 0% { transform: scaleX(1); } 45% { transform: scaleX(0.05); filter: brightness(2); } 100% { transform: scaleX(1); } }
.charge .stack { animation: charge 0.13s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes charge { to { transform: scale(1.12); filter: brightness(1.5) drop-shadow(0 0 10px #fff3c4); } }
.floater { filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 12px rgba(255, 255, 255, 0.25)); }
.ring { fill: none; stroke: var(--gold-hi); stroke-width: 3; transform-box: fill-box; }

/* --- Move list ------------------------------------------------------------------- */
.ticker { grid-area: ticker; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; overflow: hidden; }
.ticker summary { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px; cursor: pointer; list-style: none; font-family: var(--display); font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.ticker summary::-webkit-details-marker { display: none; }
.ticker summary::after { content: "▾"; margin-left: auto; }
.ticker[open] summary::after { content: "▴"; }
.ticker summary .last { font-family: var(--body); letter-spacing: 0; text-transform: none; color: var(--text); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ticker[open] summary .last { display: none; }
.ticker ol { list-style: none; margin: 0; padding: 0 8px 10px; max-height: 220px; overflow-y: auto; display: grid; gap: 2px; scrollbar-width: thin; }
.ticker li { display: grid; grid-template-columns: 2.2em minmax(0, auto) minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 5px 8px; border-radius: 8px; font-size: 0.86rem; }
.ticker li:nth-child(odd) { background: rgba(255, 255, 255, 0.025); }
.ticker li:last-child { background: rgba(255, 255, 255, 0.07); }
.ticker li .n { color: var(--muted); font-family: var(--display); font-size: 0.72rem; text-align: right; }
.ticker li .who { display: flex; align-items: center; gap: 5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 8em; }
.ticker li .what { color: #ddd8e6; }
.ticker li.empty, .ticker li.end { grid-template-columns: 1fr; color: var(--muted); }
.ticker li.end { color: var(--gold-hi); font-weight: 800; }
.pip { display: inline-grid; place-items: center; width: 16px; height: 18px; font-style: normal; font-size: 0.6rem; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.pip.p0 { background: var(--gold); color: #3a2600; }
.pip.p1 { background: var(--purple); color: #fff; }

/* --- Action bar --------------------------------------------------------------------- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(20, 18, 27, 0.86), rgba(13, 11, 18, 0.96)); backdrop-filter: blur(12px);
}
.actionbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), var(--purple), transparent); opacity: 0.7; }
.actionbar .inner { max-width: 820px; margin: 0 auto; display: grid; gap: 10px; }
.actionbar .msg { font-weight: 800; font-size: 1.02rem; }
.actionbar .msg small { display: block; color: var(--muted); font-weight: 600; font-size: 0.86rem; }
.actionbar .you { font-family: var(--display); font-size: 0.8rem; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 999px; margin-left: 4px; }
.you.p0 { background: rgba(233, 184, 67, 0.15); color: var(--gold-hi); }
.you.p1 { background: rgba(146, 88, 227, 0.2); color: var(--purple-hi); }
.muted-msg { color: var(--muted); display: flex; align-items: center; gap: 10px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); animation: pulse 0.9s ease-in-out infinite; }
.pulse.p0 { background: var(--gold); } .pulse.p1 { background: var(--purple-hi); }
@keyframes pulse { 50% { transform: scale(0.5); opacity: 0.5; } }
.plan { display: flex; gap: 6px; flex-wrap: wrap; }
.plan .step { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2); }
.plan .step b { min-width: 1.4em; text-align: center; font-family: var(--display); }
.plan .step small { color: var(--muted); font-size: 0.7rem; }
.plan .step button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.25); font-weight: 900; }
.plan .step button:disabled { opacity: 0.25; }
.plan .step.final { border-color: rgba(233, 184, 67, 0.5); }

/* --- Overlays ----------------------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(5, 4, 9, 0.72); backdrop-filter: blur(4px); animation: fade 0.2s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal .sheet { width: min(560px, 100%); max-height: 88vh; overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 20px; padding: 20px; display: grid; gap: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); animation: rise 0.25s cubic-bezier(0.2, 1.2, 0.4, 1); }
@keyframes rise { from { transform: translateY(16px) scale(0.97); opacity: 0; } }
.modal h2 { margin: 0; font-family: var(--display); letter-spacing: 0.06em; }
.rules h3 { margin: 14px 0 4px; color: var(--gold-hi); font-family: var(--display); font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; }
.rules p, .rules li { color: #ddd8e6; font-weight: 600; }
.rules ul { margin: 0; padding-left: 20px; }
.gold-t { color: var(--gold-hi); } .purple-t { color: var(--purple-hi); }
.result { display: grid; gap: 8px; text-align: center; }
.result .crest { margin: 0 auto; width: 76px; height: 86px; display: grid; place-items: center; font-size: 2rem; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: linear-gradient(160deg, #6b6880, #34313f); }
.result.w0 .crest { background: radial-gradient(circle at 35% 30%, #fff2bf, var(--gold) 50%, #a87812); color: #3a2600; }
.result.w1 .crest { background: radial-gradient(circle at 35% 30%, #e2ccff, var(--purple) 50%, #4a2386); color: #fff; }
.result h2 { font-size: 1.7rem; }
.result .why { color: var(--muted); margin: 0; }
.result .score { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result .score div { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); display: grid; }
.result .score .p0 { border-color: rgba(233, 184, 67, 0.4); }
.result .score .p1 { border-color: rgba(146, 88, 227, 0.45); }
.result .score span { font-family: var(--display); font-size: 1.8rem; font-weight: 900; }
.result .score small { color: var(--muted); }
.waiting { text-align: center; justify-items: center; width: min(460px, 100%); }
.waiting .bigcode { font-family: var(--display); font-size: 2.6rem; font-weight: 900; letter-spacing: 0.3em; color: var(--gold-hi); text-shadow: 0 0 24px rgba(233, 184, 67, 0.4); }
.toast { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 30; padding: 10px 16px; border-radius: 12px; background: #3a2323; border: 1px solid #6a3434; color: #ffd0d0; font-weight: 800; max-width: calc(100vw - 32px); animation: rise 0.2s ease-out; }
.toast.good { background: #1f3320; border-color: #3f6a34; color: #d6ffcc; }
.banner { position: fixed; left: 50%; top: 38%; z-index: 15; transform: translate(-50%, -50%); pointer-events: none; font-family: var(--display); font-weight: 900; font-size: clamp(1.6rem, 6vw, 2.6rem); letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-hi); text-shadow: 0 0 30px rgba(233, 184, 67, 0.7), 0 2px 0 #000; animation: banner 1.4s ease-out forwards; white-space: nowrap; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); letter-spacing: 0.6em; } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1); letter-spacing: 0.2em; } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%); } }

/* --- Responsive ---------------------------------------------------------------------- */
.btn .sm { display: none; }
@media (max-width: 520px) {
  .topbar .title, .hide-sm { display: none; }
  .topbar .btn .lg { display: none; }
  .topbar .btn .sm { display: inline; font-size: 1rem; }
  .topbar .btn.small { min-width: 36px; }
  .player .who em:not(.off) { display: none; }
  .topbar { gap: 6px; }
  .topbar .btn.small { padding: 5px 9px; font-size: 0.8rem; min-height: 34px; }
  .icon-btn { width: 34px; height: 34px; font-size: 0.95rem; }
  .player { padding: 8px 10px; gap: 0 8px; }
  .player .disc { width: 30px; height: 34px; }
  .player .count { font-size: 1.25rem; }
  .hero-logo { width: 72px; height: 72px; border-radius: 20px; }
  .hero-logo img { border-radius: 17px; }
}
@media (min-width: 900px) {
  .game {
    grid-template-columns: minmax(0, 1fr) 330px;
    grid-template-areas: "top top" "board side" "board ticker";
    grid-template-rows: auto auto 1fr; align-items: start;
  }
  .players { grid-template-columns: minmax(0, 1fr); }
  .ticker { align-self: stretch; }
  .ticker summary { cursor: default; pointer-events: none; }
  .ticker summary::after { content: none; }
  .ticker ol { max-height: 46vh; }
  .actionbar .inner { max-width: 1240px; padding-right: 342px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
