:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: rgba(12, 18, 30, .82);
  --ink: #e8eef8;
  --muted: #8b97ad;
  --line: rgba(255, 255, 255, .12);
  --gold: #ffd166;
  --accent: #e07a3a;
  --blue: #3469b2;
  --red: #eb2127;
  --ok: #3dd68c;
  --font: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(224, 122, 58, .12), transparent 50%),
    radial-gradient(700px 400px at 100% 0%, rgba(52, 105, 178, .1), transparent 45%),
    var(--bg);
}
a { color: var(--gold); text-decoration: none; }
img { max-width: 100%; }

.hub {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}
.hub-brand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.hub-brand strong {
  font-size: 1.4rem;
  letter-spacing: .04em;
  color: var(--gold);
}
.hub-brand span { color: var(--muted); font-size: .92rem; }
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.hub-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: inherit;
}
.hub-card:hover { border-color: rgba(255, 209, 102, .45); }
.hub-card img {
  width: 100%;
  height: 72px;
  object-fit: contain;
  background: rgba(0, 0, 0, .35);
  border-radius: 8px;
}
.hub-card h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}
.hub-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.hub-empty { color: var(--muted); }

body.is-board, body.is-kiosk {
  min-height: 100vh;
  overflow: hidden;
  background-color: #05070c;
}
body.is-board::before,
body.is-kiosk::before {
  content: "";
  position: fixed;
  inset: -28px;
  z-index: 0;
  background-color: #05070c;
  background-image: var(--game-bg, none);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: blur(5px) saturate(.95);
  transform: scale(1.04);
  pointer-events: none;
}
body.is-board::after,
body.is-kiosk::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(115deg, rgba(2, 8, 18, .7), rgba(8, 14, 26, .52) 55%, rgba(4, 10, 18, .66));
  pointer-events: none;
}
.stage { position: relative; z-index: 1; }
.kiosk-main, .board-main {
  min-height: 100dvh;
  padding: 18px clamp(12px, 2vw, 32px);
  display: grid;
  gap: clamp(10px, 1.4vw, 20px);
}
.kiosk-main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}
.board-main { grid-template-columns: 1fr; }
.score-panel {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 1.2vw, 18px);
}
header.top {
  background: var(--panel);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.4vw, 22px);
  padding: clamp(10px, 1.2vw, 18px) clamp(14px, 1.6vw, 26px);
  border-radius: 18px;
}
header.top img {
  height: clamp(48px, 7vw, 96px);
  width: auto;
  max-width: min(280px, 40vw);
  object-fit: contain;
}
header.top h1 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(22px, 2.6vw, 44px);
  line-height: 1;
  letter-spacing: .02em;
}
header.top .year { color: var(--muted); font-weight: 700; margin-left: auto; }
.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: .12em;
  font-size: clamp(12px, 1.2vw, 18px);
}
.live i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px rgba(61, 214, 140, .8);
}

.register {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(14px, 2vw, 26px);
  border-radius: 18px;
  background: var(--panel);
  border: 2px solid var(--line);
  text-align: center;
}
.register-marquee {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  object-fit: contain;
  border-radius: 10px;
  background: #000;
  flex: 0 0 auto;
}
.register h2 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(20px, 2.2vw, 36px);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.register p { margin: 0; font-size: clamp(16px, 1.6vw, 24px); font-weight: 700; }
#qr {
  width: clamp(140px, 22vw, 260px);
  height: clamp(140px, 22vw, 260px);
  padding: 10px;
  border-radius: 14px;
  background: #fff;
}
#qr img, #qr canvas { display: block; width: 100%; height: 100%; }

#board, .js-board {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(10, minmax(0, 1fr));
  gap: clamp(4px, .7vw, 10px);
  opacity: 1;
  transition: opacity .32s ease, transform .32s ease;
}
#board.is-page-out, .js-board.is-page-out { opacity: 0; transform: translateY(10px); }
#board.is-sorting, .js-board.is-sorting { overflow: hidden; }
.board-progress {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
}
.board-progress[hidden] { display: none !important; }
.board-progress-fill {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--gold), #ffe566);
}
.board-progress.is-running .board-progress-fill {
  animation: board-progress-grow linear forwards;
  animation-duration: var(--board-progress-ms, 30s);
}
@keyframes board-progress-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.score-row {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: clamp(40px, 5vw, 72px) minmax(0, 1fr) max-content;
  align-items: stretch;
  border-radius: 14px;
  min-height: 0;
  background: var(--panel);
  border: 2px solid var(--line);
}
.score-row--empty { pointer-events: none; }
.score-row--empty .rank-num { opacity: .4; }
.score-row--empty .empty-mark {
  grid-column: 2 / -1;
  display: grid;
  place-items: center;
  color: rgba(232, 238, 248, .35);
  font-size: clamp(20px, 2.4vw, 36px);
  font-weight: 800;
}
.score-row.is-leader { border-color: var(--gold); box-shadow: 0 0 22px rgba(255, 209, 102, .32); }
.score-row.is-moving { z-index: 4; }
.rank {
  display: grid;
  place-items: center;
  font-size: clamp(18px, 2.4vw, 42px);
  font-weight: 900;
  color: var(--gold);
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
}
.player {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0 clamp(8px, 1.2vw, 20px);
}
.player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(16px, 2vw, 36px);
  font-weight: 800;
  line-height: 1;
}
.tail {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 12px 0 8px;
}
.pending[hidden] { display: none !important; }
.pending-bubble {
  padding: 4px 8px;
  border: 1px solid rgba(255, 209, 102, .65);
  background: rgba(255, 209, 102, .14);
  color: #ffe08a;
  font-size: clamp(11px, 1.1vw, 14px);
  font-weight: 800;
  white-space: nowrap;
}
.score {
  color: var(--gold);
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 900;
  font-size: clamp(16px, 2.2vw, 40px);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fx-layer { position: absolute; z-index: 2; inset: 0; overflow: hidden; pointer-events: none; }
.wipe {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--blue) 0%, #5a8fd4 50%, var(--accent) 100%);
  opacity: .7;
}

body.is-wall {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(900px 480px at 8% -8%, rgba(224, 122, 58, .22), transparent 52%),
    radial-gradient(760px 420px at 100% 4%, rgba(52, 105, 178, .2), transparent 48%),
    radial-gradient(500px 320px at 50% 110%, rgba(255, 209, 102, .08), transparent 55%),
    linear-gradient(165deg, #10182a 0%, #080b12 42%, #0a1220 100%);
}
body.is-wall.is-cycle {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100dvh;
}
.wall {
  display: grid;
  grid-template-columns: repeat(var(--wall-n, 1), minmax(0, 1fr));
  min-height: 100dvh;
  gap: 8px;
  padding: 8px;
  opacity: 1;
  transition: opacity .9s ease;
}
body.is-cycle .wall {
  min-height: 0;
  height: 100%;
}
.wall-timer {
  position: relative;
  height: 8px;
  margin: 0 16px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
}
.wall-timer[hidden] { display: none !important; }
.wall-timer-fill {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--gold), #ffe566);
}
.wall-timer.is-running .wall-timer-fill {
  animation: board-progress-grow linear forwards;
  animation-duration: var(--wall-timer-ms, 30s);
}
.wall.is-fade { opacity: 0; }
.wall[data-n="1"] { --wall-n: 1; }
.wall[data-n="2"] { --wall-n: 2; }
.wall[data-n="3"] { --wall-n: 3; }
.wall[data-n="4"] { --wall-n: 4; }
.wall-col {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  overflow: hidden;
}
.wall-col header.top {
  display: block;
  padding: 0;
  overflow: hidden;
  background: #000;
  height: var(--wall-head-h, auto);
}
.wall-col header.top img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  object-fit: fill;
}
.wall.is-heads .wall-col header.top img {
  height: 100%;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.wall-empty {
  padding: 40px 24px;
  color: var(--muted);
}
.wall-empty code { color: var(--gold); }

@media (max-width: 720px) {
  .kiosk-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    min-height: 100dvh;
  }
  body.is-board, body.is-kiosk { overflow: auto; }
  body.is-wall { overflow: auto; }
  .wall { grid-template-columns: 1fr; min-height: auto; }
  .wall-col { min-height: 70dvh; }
}
