:root {
  --bg-0: #0d1422;
  --bg-1: #121b2f;
  --panel: #17253c;
  --panel-deep: #101b2d;
  --line: rgba(255, 255, 255, 0.1);
  --text: #edf3ff;
  --muted: #a8b6d7;
  --blue-1: #4ed7ff;
  --blue-2: #2b77ff;
  --red-1: #ff9d8f;
  --red-2: #dd4957;
  --gold-1: #ffd86f;
  --gold-2: #ff9b2f;
  --green-1: #84ffd0;
  --green-2: #19b783;
  --pink-1: #ff8ed7;
  --pink-2: #9652ff;
  --cream-1: #f7d6b0;
  --cream-2: #ce8e60;
  --metal-a: #3f4f69;
  --metal-b: #202a3b;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.28);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 14%, rgba(59, 135, 255, 0.26), transparent 30%),
    radial-gradient(circle at 80% 12%, rgba(255, 87, 120, 0.22), transparent 32%),
    linear-gradient(180deg, #101828, #090f18 60%, #060b12);
  overflow-x: hidden;
}

button, input { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

.bg-grid,
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.bg-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: .35;
}
.bg-glow-left { background: radial-gradient(circle at 12% 18%, rgba(76, 210, 255, 0.18), transparent 32%); }
.bg-glow-right { background: radial-gradient(circle at 88% 18%, rgba(255, 109, 144, 0.16), transparent 32%); }

.app-shell {
  position: relative;
  width: min(1152px, calc(100% - 28px));
  min-height: calc(100svh - 40px);
  margin: max(12px, env(safe-area-inset-top)) auto max(28px, calc(env(safe-area-inset-bottom) + 16px));
  display: flex;
  flex-direction: column;
  z-index: 2;
}

.chrome-panel {
  position: relative;
  background: linear-gradient(180deg, rgba(27, 38, 60, 0.96), rgba(15, 24, 40, 0.95));
  border: 1px solid rgba(186, 216, 255, 0.12);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chrome-panel::before,
.chrome-panel::after {
  content: '';
  position: absolute;
  pointer-events: none;
}
.chrome-panel::before {
  inset: 1px;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,0.05);
}
.chrome-panel::after {
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent 12%, transparent 88%, rgba(0,0,0,0.24));
}

.site-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  margin: 0 auto 14px;
  max-width: 810px;
}
.site-actions { display: flex; align-items: center; gap: 12px; }
.icon-chip { min-width: 54px; width: 54px; min-height: 54px; padding: 0; }
.icon-chip img { width: 24px; height: 24px; filter: drop-shadow(0 0 8px rgba(95,224,255,.22)); }
.icon-chip.is-muted img { filter: drop-shadow(0 0 8px rgba(255,157,143,.2)); opacity: .9; }
.left-actions { justify-content: flex-start; }
.right-actions { justify-content: flex-end; }
.chip {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(9, 18, 33, 0.75);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 14px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: Orbitron, Inter, sans-serif;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pill-switch { box-shadow: 0 0 0 1px rgba(82, 217, 255, 0.1), 0 0 18px rgba(82, 217, 255, 0.2); }
.online-pill { box-shadow: 0 0 0 1px rgba(114, 255, 187, 0.14), 0 0 18px rgba(114, 255, 187, 0.16); }

.brand-lockup {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.brand-kicker {
  font-family: Orbitron, Inter, sans-serif;
  font-size: 10px;
  letter-spacing: .24em;
  color: #98b7eb;
}
.brand-name {
  font-family: Bungee, Orbitron, sans-serif;
  font-size: clamp(22px, 2.35vw, 34px);
  line-height: 1;
  letter-spacing: 0.04em;
  color: #ffd67e;
  text-shadow:
    0 2px 0 rgba(0,0,0,0.35),
    0 0 10px rgba(255, 166, 55, 0.4),
    0 0 24px rgba(60, 173, 255, 0.22);
}
.brand-name span {
  color: #9fd9ff;
  text-shadow: 0 0 12px rgba(81, 214, 255, 0.36);
}

.view { display: none; }
.view.active { display: block; }

.app-shell.view-lobby .view.active {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 10px 0 44px;
}

.app-shell.view-game .view.active,
.app-shell.view-results .view.active {
  display: block;
}

.lobby-hero {
  display: grid;
  grid-template-columns: 1.4fr .85fr;
  gap: 20px;
  padding: 28px;
  margin-bottom: 18px;
}
.hero-copy, .hero-right { position: relative; z-index: 1; }
.hero-badge {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  font-family: Orbitron, sans-serif;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #9de6ff;
  background: rgba(17, 31, 51, 0.72);
  margin-bottom: 14px;
}
#titleText {
  margin: 0;
  font-family: Orbitron, sans-serif;
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.06;
}
#heroTitle {
  margin: 8px 0 8px;
  font-family: Rajdhani, Inter, sans-serif;
  font-size: clamp(18px, 2vw, 24px);
  color: #ffd58b;
}
#heroTitle, #heroSubtitle { text-wrap: balance; }
#heroSubtitle { margin: 0 auto; max-width: 640px; color: var(--muted); font-size: clamp(14px, 1.3vw, 16px); line-height: 1.45; }
.hero-actions, .results-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.btn {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  min-width: 160px;
  font-family: Orbitron, Inter, sans-serif;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: white;
  box-shadow: var(--shadow-soft);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #5fe0ff, #2f74ff); }
.btn-secondary { background: linear-gradient(180deg, #5b6578, #31374b); }
.btn-confirm { background: linear-gradient(180deg, #ffd778, #ff8e33); }

.hero-right {
  display: grid;
  gap: 16px;
  align-content: center;
}
.mini-banner {
  position: relative;
  z-index: 1;
  border-radius: 22px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-soft);
}
.mini-banner span { font-family: Orbitron, sans-serif; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.mini-banner strong { font-family: Rajdhani, Inter, sans-serif; font-size: 28px; line-height: 1; }
.blue-panel { background: linear-gradient(180deg, rgba(20, 58, 120, 0.92), rgba(12, 24, 54, 0.94)); }
.red-panel { background: linear-gradient(180deg, rgba(106, 22, 44, 0.92), rgba(45, 10, 18, 0.94)); }
.neon-panel { background: linear-gradient(180deg, rgba(30, 83, 66, 0.92), rgba(11, 28, 25, 0.94)); }

.lobby-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
}
.lobby-card { padding: 22px; }
.section-kicker {
  display: inline-flex;
  font-family: Orbitron, sans-serif;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #93c4ff;
  margin-bottom: 8px;
}
.lobby-card h3 { margin: 0 0 14px; font-size: 28px; font-family: Rajdhani, Inter, sans-serif; }
.field { display: grid; gap: 8px; margin-bottom: 8px; }
.field span { color: var(--muted); font-size: 14px; }
#nameLabel { font-family: Orbitron, sans-serif; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: #93c4ff; }
#nameInput { text-align: center; font-family: Orbitron, sans-serif; font-size: 18px; letter-spacing: .04em; text-transform: uppercase; }
#nameInput::placeholder { text-align: center; color: rgba(237,243,255,.62); }
.field input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(9, 18, 33, 0.72);
  color: var(--text);
  border-radius: 16px;
  padding: 13px 16px;
  font-size: 16px;
}
.helper-copy { color: var(--muted); margin: 0 0 16px; }
.feature-list { margin: 0; padding-left: 18px; display: grid; gap: 12px; color: #dfe9ff; line-height: 1.45; }
.avatar-chooser-wrap { margin-top: 20px; }
.avatar-chooser { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.avatar-card {
  border: 1px solid rgba(255,255,255,0.12);
  max-width: 148px;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(24, 37, 60, 0.95), rgba(12, 19, 33, 0.96));
  border-radius: 16px;
  padding: 8px;
  color: var(--text);
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.avatar-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 12px;
  image-rendering: pixelated;
  box-shadow: 0 10px 20px rgba(0,0,0,0.35);
}
.avatar-card span { font-family: Orbitron, sans-serif; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.avatar-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0,0,0,.36); }
.avatar-card.active {
  border-color: rgba(89, 220, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(89, 220, 255, .3), 0 0 28px rgba(89, 220, 255, .24);
}

.broadcast-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  margin-bottom: 12px;
}
.player-pod, .broadcast-center { position: relative; z-index: 1; }
.player-pod { display: flex; align-items: center; gap: 12px; }
.player-right { justify-content: flex-end; }
.player-meta { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.player-meta.align-right { align-items: flex-end; text-align: right; }
.player-meta strong {
  font-family: Orbitron, sans-serif;
  font-size: clamp(18px, 2vw, 28px);
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pod-label-row { display: flex; gap: 10px; align-items: center; font-family: Orbitron, sans-serif; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.player-meta.align-right .pod-label-row { justify-content: flex-end; }
.pod-label { color: #9fd9ff; }
.pod-extra { color: #c9d5ef; font-size: 10px; }
.player-avatar {
  width: 80px;
  height: 106px;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.14);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 18px 26px rgba(0,0,0,.36);
  background: linear-gradient(180deg, #1a2740, #0c1222);
  flex: 0 0 auto;
}
.player-avatar img, .results-avatar img {
  width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated;
}
.avatar-blue { box-shadow: 0 0 0 1px rgba(90, 213, 255, 0.34), 0 0 24px rgba(90, 213, 255, 0.24), 0 18px 26px rgba(0,0,0,.36); }
.avatar-red { box-shadow: 0 0 0 1px rgba(255, 116, 142, 0.34), 0 0 24px rgba(255, 116, 142, 0.22), 0 18px 26px rgba(0,0,0,.36); }
.energy-track {
  width: 100%;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(4, 11, 20, .92);
  border: 1px solid rgba(255,255,255,.08);
}
.energy-fill {
  height: 100%;
  width: 0;
  transition: width .18s linear;
}
.energy-fill-blue { background: linear-gradient(90deg, #5cf1ff, #2f7bff); box-shadow: 0 0 18px rgba(92, 241, 255, .34); }
.energy-fill-red { background: linear-gradient(90deg, #ff7973, #ff4760); box-shadow: 0 0 18px rgba(255, 101, 121, .28); }
.broadcast-center {
  min-width: 260px;
  display: grid;
  gap: 2px;
  justify-items: center;
  text-align: center;
}
.broadcast-logo {
  font-family: Rajdhani, Orbitron, sans-serif;
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #ffd779;
  text-shadow: 0 0 12px rgba(255, 183, 74, .26), 0 0 22px rgba(72, 184, 255, .18);
}
.broadcast-phase {
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  font-family: Bungee, Orbitron, sans-serif;
  font-size: clamp(18px, 2vw, 28px);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #9fd9ff;
  text-shadow: 0 0 12px rgba(81, 214, 255, 0.28);
}
.broadcast-timer {
  min-width: 184px;
  padding: 8px 16px;
  background: linear-gradient(180deg, rgba(18, 24, 34, .98), rgba(7, 13, 22, .98));
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,.12);
  font-family: Orbitron, sans-serif;
  font-size: clamp(30px, 3vw, 44px);
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 24px rgba(255, 208, 80, .14);
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.score-card {
  position: relative;
  z-index: 1;
  border-radius: 20px;
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.score-card span { display: block; font-family: Orbitron, sans-serif; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #d9e3ff; }
.score-card strong { display: block; margin-top: 8px; font-family: Rajdhani, Inter, sans-serif; font-size: 32px; line-height: 1; }
.score-card em { display: block; margin-top: 4px; font-style: normal; color: #fff4c6; font-family: Orbitron, sans-serif; font-size: 18px; }
.score-card.emphasis strong { color: #fff6c3; }

.arena-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}
.battle-card {
  padding: 14px;
}
.battle-card-left { box-shadow: 0 0 0 1px rgba(84, 213, 255, .12), var(--shadow); }
.battle-card-rival { box-shadow: 0 0 0 1px rgba(255, 110, 133, .12), var(--shadow); }
.battle-topline { margin-bottom: 12px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.battle-topline h3 { margin: 0; font-size: 24px; font-family: Rajdhani, Inter, sans-serif; }
.board-top-right { font-family: Orbitron, sans-serif; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.score-mini { color: #9db1d3; }
.battle-scoreline strong { color: #fff1b9; font-size: 24px; }
.align-right { text-align: right; }

.board-top-right-compact {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.inline-match-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.inline-stat-chip {
  min-width: 86px;
  padding: 8px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(8, 15, 28, .82);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.inline-stat-chip span {
  color: #9db1d3;
  font-size: 10px;
  line-height: 1;
}
.inline-stat-chip strong {
  color: #f5f7ff;
  font-size: 18px;
  line-height: 1;
}
.inline-stat-chip-blue { box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 0 16px rgba(80, 190, 255, .12); }
.inline-stat-chip-red { box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 0 16px rgba(255, 80, 120, .12); }
.inline-stat-chip-green { box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 0 16px rgba(70, 230, 170, .12); }
.score-strip,
.ability-dock {
  display: none !important;
}

.tool-groups-top { position: relative; z-index: 2; margin-bottom: 12px; }
.tool-row { display: flex; gap: 10px; flex-wrap: wrap; }
.tool-pill {
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(30, 42, 66, 0.94), rgba(13, 21, 36, 0.96));
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-family: Orbitron, sans-serif;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.tool-pill.active { box-shadow: 0 0 0 1px rgba(109, 228, 255, .28), 0 0 18px rgba(109, 228, 255, .2); border-color: rgba(109, 228, 255, .8); }

.board-shell {
  position: relative;
  border-radius: 26px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(72, 86, 110, .95), rgba(28, 36, 51, .98));
  border: 2px solid rgba(233, 244, 255, 0.13);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.18), inset 0 -4px 0 rgba(0,0,0,.32), var(--shadow-soft);
}
.board-shell::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.08);
  pointer-events: none;
}
.board-shell-blue { box-shadow: inset 0 2px 0 rgba(255,255,255,.18), inset 0 -4px 0 rgba(0,0,0,.32), 0 0 0 1px rgba(89, 221, 255, .24), 0 0 30px rgba(66, 178, 255, .12), var(--shadow-soft); }
.board-shell-red { box-shadow: inset 0 2px 0 rgba(255,255,255,.18), inset 0 -4px 0 rgba(0,0,0,.32), 0 0 0 1px rgba(255, 110, 138, .24), 0 0 30px rgba(255, 85, 120, .1), var(--shadow-soft); }
.board-canvas-stack { position: relative; }
#boardCanvas, #boardFxCanvas, #ghostCanvas, #resultsYouBoard, #resultsEnemyBoard {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  image-rendering: pixelated;
}
#boardFxCanvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#ghostCanvas { aspect-ratio: 1; }
.board-overlay {
  position: absolute;
  inset: 16px;
  border-radius: 18px;
  background: rgba(6, 10, 16, .66);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  font-family: Orbitron, sans-serif;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #fef3bc;
  font-size: 16px;
}

body[data-phase="seed"] #ghostShell {
  margin-top: 0;
}

body[data-phase="seed"] .rival-progress-track {
  margin-bottom: 0;
}
.battle-footer {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 10px 14px;
  font-family: Orbitron, sans-serif;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(11, 19, 34, .78);
}
.status-chip strong { font-size: 12px; }
.status-chip-blue { box-shadow: 0 0 18px rgba(89, 220, 255, .14); }
.status-chip-red { box-shadow: 0 0 18px rgba(255, 102, 126, .14); }
.battle-hint { margin: 0; color: #c2d0ea; font-size: 14px; }

.versus-column {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding-top: 82px;
}
.versus-pulse {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 208, 92, .96), rgba(255, 121, 53, .9));
  color: #2a1007;
  font-family: Bungee, Orbitron, sans-serif;
  letter-spacing: .04em;
  box-shadow: 0 0 26px rgba(255, 161, 64, .34);
}
.boom-burst {
  position: sticky;
  top: 160px;
  z-index: 12;
  transform: scale(.78) rotate(-8deg);
  padding: 16px 18px 12px;
  background: radial-gradient(circle at 50% 50%, rgba(255, 205, 88, .98), rgba(255, 112, 50, .95));
  color: #3d1105;
  font-family: Bungee, Orbitron, sans-serif;
  font-size: 30px;
  line-height: 1;
  border-radius: 22px;
  border: 4px solid #fff3b1;
  box-shadow: 0 0 30px rgba(255, 137, 56, .46);
  clip-path: polygon(50% 0%, 61% 12%, 78% 3%, 82% 22%, 100% 20%, 91% 38%, 100% 50%, 86% 58%, 94% 76%, 78% 75%, 74% 95%, 58% 86%, 50% 100%, 40% 88%, 24% 94%, 20% 75%, 5% 77%, 12% 59%, 0% 50%, 10% 39%, 1% 20%, 20% 23%, 22% 4%, 40% 12%);
  animation: boom-pop .9s ease forwards;
}
.boom-burst.hidden { display: none !important; }

.rival-progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-family: Orbitron, sans-serif; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.rival-progress-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(4, 11, 20, .94);
  border: 1px solid rgba(255,255,255,.08);
  margin-bottom: 12px;
}
.rival-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ff8477, #ff475f); box-shadow: 0 0 18px rgba(255, 101, 121, .28); }

.ability-dock {
  margin-top: 14px;
  padding: 14px 18px;
}
.dock-title {
  position: relative;
  z-index: 1;
  font-family: Orbitron, sans-serif;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #95baf0;
  font-size: 12px;
  margin-bottom: 12px;
  text-align: center;
}
.dock-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.dock-item {
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 6px;
  box-shadow: var(--shadow-soft);
}
.dock-item .dock-label { font-family: Orbitron, sans-serif; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.9); }
.dock-item strong { font-family: Rajdhani, Inter, sans-serif; font-size: 28px; line-height: 1; }
.dock-item-green { background: linear-gradient(180deg, rgba(22, 84, 66, .96), rgba(8, 34, 28, .96)); }
.dock-item-blue { background: linear-gradient(180deg, rgba(21, 65, 126, .96), rgba(8, 26, 53, .96)); }
.dock-item-yellow { background: linear-gradient(180deg, rgba(136, 91, 17, .96), rgba(45, 26, 7, .96)); }
.dock-item-pink { background: linear-gradient(180deg, rgba(110, 35, 107, .96), rgba(32, 10, 36, .96)); }
.dock-bottomline {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: stretch;
  flex-wrap: wrap;
}
.feed-block, .dock-meta-item {
  flex: 1;
  min-width: 240px;
  border-radius: 16px;
  background: rgba(9, 16, 30, .74);
  border: 1px solid rgba(255,255,255,.08);
  padding: 12px 14px;
}
.feed-block span, .dock-meta-item span {
  display: block;
  color: #90a8d0;
  font-family: Orbitron, sans-serif;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.feed-block strong, .dock-meta-item strong { display: block; margin-top: 6px; font-size: 17px; }

.phase-splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 30;
  pointer-events: none;
  font-family: Bungee, Orbitron, sans-serif;
  font-size: clamp(42px, 8vw, 120px);
  color: #fff0af;
  text-shadow: 0 0 26px rgba(255, 183, 61, .42), 0 0 50px rgba(0, 181, 255, .22), 0 6px 0 rgba(0,0,0,.38);
  animation: splash-enter .95s ease forwards;
}
.hit-flash {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(255, 208, 114, .16), rgba(255, 97, 97, .22), transparent 62%);
  animation: flash-burst .5s ease forwards;
}
.hud-event {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  z-index: 28;
  padding: 14px 18px;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,.15);
  background: rgba(8, 12, 18, .86);
  font-family: Orbitron, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 24px 40px rgba(0,0,0,.35);
  animation: hud-event-in 1.1s ease forwards;
}
.feed-good { color: #afffd6; box-shadow: 0 0 26px rgba(81, 255, 177, .18), 0 24px 40px rgba(0,0,0,.35); }
.feed-bad { color: #fff0b4; box-shadow: 0 0 26px rgba(255, 155, 80, .18), 0 24px 40px rgba(0,0,0,.35); }

.impact { animation: screen-shake .42s ease; }

.results-wrap { padding: 24px; }
.results-wrap h2 { margin: 0 0 10px; font-family: Orbitron, sans-serif; font-size: clamp(30px, 4vw, 42px); }
.results-wrap p { margin: 0; color: var(--muted); }
.results-winner {
  margin: 18px 0 20px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(123, 82, 17, .92), rgba(47, 31, 7, .96));
  border: 1px solid rgba(255,255,255,.08);
  font-family: Orbitron, sans-serif;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #fff0b0;
}
.results-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.results-card { padding: 18px; }
.results-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.results-avatar {
  width: 72px;
  height: 96px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, #1a2740, #0c1222);
}
.results-card h3 { margin: 0; font-family: Orbitron, sans-serif; font-size: 24px; }
.results-stats { display: grid; gap: 8px; margin-bottom: 14px; }
.result-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(8, 16, 29, .62);
  border: 1px solid rgba(255,255,255,.06);
}
.blue-edge { box-shadow: 0 0 0 1px rgba(89, 221, 255, .22), var(--shadow-soft); }
.red-edge { box-shadow: 0 0 0 1px rgba(255, 110, 138, .22), var(--shadow-soft); }
.small-shell { max-width: 420px; }
.results-actions { justify-content: center; margin-top: 20px; }


.pause-banner {
  position: fixed;
  left: 50%;
  top: 78px;
  transform: translateX(-50%);
  z-index: 40;
  padding: 12px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(65, 18, 27, .96), rgba(20, 8, 15, .96));
  color: #ffe4af;
  font-family: Orbitron, sans-serif;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  box-shadow: 0 0 28px rgba(255, 120, 80, .22), var(--shadow-soft);
}

.broadcast-bar {
  background:
    linear-gradient(180deg, rgba(19, 26, 41, .96), rgba(10, 14, 22, .96)),
    url('/assets/ui/arcade-kit-a.png') center top / 100% auto no-repeat;
}

.arena-stage {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.battle-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.battle-card-left,
.battle-card-rival {
  position: relative;
  overflow: hidden;
}

.battle-card-left::after,
.battle-card-rival::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 14%, transparent 86%, rgba(0,0,0,.18));
}

.battle-card-left::before,
.battle-card-rival::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.06);
  pointer-events: none;
}

.board-shell {
  background:
    linear-gradient(180deg, rgba(72, 86, 110, .95), rgba(28, 36, 51, .98)),
    repeating-linear-gradient(180deg, rgba(255,255,255,.02) 0 2px, rgba(255,255,255,0) 2px 6px);
}

.board-shell::after {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 18px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 12%, transparent 88%, rgba(0,0,0,.14));
}

#ghostCanvas {
  aspect-ratio: 1;
  min-height: 520px;
}

.board-overlay {
  backdrop-filter: blur(3px);
}

.rival-progress-track {
  height: 14px;
}

.tool-row-seed,
#solveToolbar {
  justify-content: space-between;
}

.tool-row-seed .btn-confirm {
  margin-left: auto;
}

.boom-burst {
  text-shadow: 0 3px 0 rgba(0,0,0,.2);
}


@media (min-width: 981px) and (max-height: 860px) {
  .app-shell.view-game .site-topbar {
    margin-bottom: 4px;
    padding-block: 6px;
  }
  .app-shell.view-game #gameView {
    gap: 8px;
    padding-bottom: 8px;
  }
  .app-shell.view-game .score-strip {
    display: none;
  }
  .broadcast-bar {
    padding: 10px 14px;
    gap: 10px;
  }
  .player-avatar {
    width: 72px;
    height: 94px;
  }
  .player-meta strong {
    font-size: 18px;
  }
  .broadcast-center {
    min-width: 210px;
  }
  .broadcast-logo {
    font-size: 24px;
  }
  .broadcast-phase {
    font-size: 18px;
  }
  .broadcast-timer {
    min-width: 168px;
    padding: 8px 14px;
    font-size: 34px;
  }
  .battle-card {
    padding: 12px;
  }
  #mainBattlePanel .tool-groups-top {
    min-height: 54px;
    margin-bottom: 10px;
  }
  #rivalBattlePanel .rival-progress-header {
    min-height: 20px;
  }
  #rivalBattlePanel .rival-progress-track {
    margin-bottom: 28px;
  }
}
@media (max-width: 1220px) {
  #ghostCanvas { min-height: 0; }
}

@media (max-width: 980px) {
  .pause-banner { top: 10px; width: calc(100% - 24px); text-align: center; }
}

@keyframes splash-enter {
  0% { opacity: 0; transform: scale(.72); }
  12% { opacity: 1; transform: scale(1.06); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.96); }
}
@keyframes flash-burst {
  0% { opacity: 0; }
  15% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes hud-event-in {
  0% { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(.9); }
  18% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  84% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(.98); }
}
@keyframes screen-shake {
  0%, 100% { transform: translate3d(0,0,0); }
  20% { transform: translate3d(-6px, 2px, 0); }
  40% { transform: translate3d(7px, -4px, 0); }
  60% { transform: translate3d(-5px, 3px, 0); }
  80% { transform: translate3d(4px, -3px, 0); }
}
@keyframes boom-pop {
  0% { opacity: 0; transform: scale(.5) rotate(-12deg); }
  20% { opacity: 1; transform: scale(1.08) rotate(-8deg); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: scale(.95) rotate(-4deg); }
}


@media (min-width: 981px) and (max-height: 860px) {
  .app-shell.view-game .site-topbar {
    margin-bottom: 4px;
    padding-block: 6px;
  }
  .app-shell.view-game #gameView {
    gap: 8px;
    padding-bottom: 8px;
  }
  .app-shell.view-game .score-strip {
    display: none;
  }
  .broadcast-bar {
    padding: 10px 14px;
    gap: 10px;
  }
  .player-avatar {
    width: 72px;
    height: 94px;
  }
  .player-meta strong {
    font-size: 18px;
  }
  .broadcast-center {
    min-width: 210px;
  }
  .broadcast-logo {
    font-size: 24px;
  }
  .broadcast-phase {
    font-size: 18px;
  }
  .broadcast-timer {
    min-width: 168px;
    padding: 8px 14px;
    font-size: 34px;
  }
  .battle-card {
    padding: 12px;
  }
  #mainBattlePanel .tool-groups-top {
    min-height: 54px;
    margin-bottom: 10px;
  }
  #rivalBattlePanel .rival-progress-header {
    min-height: 20px;
  }
  #rivalBattlePanel .rival-progress-track {
    margin-bottom: 28px;
  }
}
@media (max-width: 1220px) {
  .arena-stage { grid-template-columns: 1fr; }
  .versus-column { display: none; }
  #ghostCanvas { max-height: min(70vw, 520px); }
}
@media (max-width: 1360px) {
  .app-shell { width: min(1220px, calc(100% - 24px)); }
  .lobby-center { max-width: 1080px; }
  .site-topbar { max-width: 1080px; }
}


@media (max-width: 980px) {
  .app-shell { min-height: auto; }
  .app-shell.view-lobby .view.active { align-items: flex-start; padding: 0 0 24px; }
  .site-topbar { grid-template-columns: 1fr; justify-items: center; }
  .site-actions { width: 100%; justify-content: center; }
  .lobby-hero, .lobby-grid, .results-grid, .score-strip, .dock-grid { grid-template-columns: 1fr; }
  .avatar-chooser { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .broadcast-bar { grid-template-columns: 1fr; }
  .player-right { justify-content: flex-start; }
  .player-meta.align-right { align-items: flex-start; text-align: left; }
  .player-meta.align-right .pod-label-row { justify-content: flex-start; }
  .battle-footer { flex-direction: column; align-items: flex-start; }
  .board-top-right-compact { justify-content: flex-start; }
  .inline-match-stats { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .app-shell { width: min(100% - 10px, 100%); min-height: auto; margin: 6px auto 20px; }
  .chrome-panel, .mini-banner, .score-card, .dock-item, .feed-block, .dock-meta-item, .btn, .tool-pill { border-radius: 16px; }
  .site-topbar, .lobby-hero, .lobby-card, .battle-card, .ability-dock, .results-wrap, .results-card { padding: 14px; }
  .brand-name { font-size: 26px; }
  .player-avatar { width: 62px; height: 82px; }
  .broadcast-timer { min-width: 148px; font-size: 28px; }
  .avatar-chooser { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-card strong { font-size: 26px; }
  .dock-item strong { font-size: 24px; }
  .phase-splash { font-size: 52px; }
}


.btn-muted { background: linear-gradient(180deg, #44506a, #252d3e); min-width: 0; }
.btn-copy { background: linear-gradient(180deg, #88f4cb, #169d74); min-width: 0; }
.lobby-center { width: min(100%, 810px); max-width: 810px; margin: 0 auto; padding: clamp(18px, 1.7vw, 24px); text-align: center; }
.lobby-stack { display: grid; gap: 12px; margin-top: 16px; }
.lobby-block { background: rgba(8, 16, 30, .54); border: 1px solid rgba(255,255,255,.08); border-radius: 20px; padding: 12px 14px; }
.action-block { background: transparent; border: 0; box-shadow: none; padding: 4px 0 0; }
.action-block::before, .action-block::after { display: none; }
.lobby-actions { justify-content: center; margin-top: 0; gap: 12px; flex-wrap: wrap; }
.action-block { display: grid; gap: 12px; justify-items: center; }
#leaveQueueBtn { justify-self: center; }
.invite-panel { display: grid; gap: 10px; text-align: center; width: min(100%, 740px); margin: 0 auto 4px; }
.invite-code-card { display: grid; gap: 10px; padding: 12px; border-radius: 18px; border: 1px solid rgba(255,255,255,.1); background: linear-gradient(180deg, rgba(18,30,52,.92), rgba(8,14,26,.96)); box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 22px rgba(0,0,0,.22); }
.invite-code-label { font-family: Orbitron, sans-serif; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: #9de6ff; }
.invite-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; max-width: 100%; }
#inviteLink { width: 100%; border: 1px solid rgba(255,255,255,.14); background: rgba(9,18,33,.72); color: var(--text); border-radius: 16px; padding: 12px 16px; font-size: clamp(12px, 1.4vw, 16px); font-family: Orbitron, sans-serif; letter-spacing: .04em; text-transform: none; text-align: center; overflow-wrap: anywhere; }
.invite-help { margin: 0; text-align: center; }
#avatarSectionLabel, #inviteLabel, #nameLabel { display: inline-flex; justify-content: center; width: 100%; }
.lobby-center #heroSubtitle { max-width: 680px; margin: 0 auto; }
.lobby-center .field { max-width: 414px; margin: 0 auto; text-align: center; }
.lobby-center .avatar-chooser { grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: 810px; margin: 0 auto; gap: 12px; }
.broadcast-phase.broadcast-versus { min-width: 112px; font-size: clamp(20px, 2vw, 30px); letter-spacing: .08em; color: #9fd9ff; box-shadow: none; }
.versus-pulse { width: 74px; height: 74px; padding: 0; overflow: hidden; background: transparent; box-shadow: none; }
.versus-pulse img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 24px rgba(255,156,69,.45)); }
.tool-pill { display: inline-flex; align-items: center; gap: 10px; }
.tool-pill::before { content: ''; width: 20px; height: 20px; background-position: center; background-repeat: no-repeat; background-size: contain; filter: drop-shadow(0 0 8px rgba(255,255,255,.14)); }
#brushNormal::before { background-image: url('/assets/ui/icon-mine-tool.svg'); }
#brushSmoke::before { background-image: url('/assets/ui/icon-smoke-tool.svg'); }
#brushClear::before { background-image: url('/assets/ui/icon-clear-tool.svg'); }
#modeOpen::before { background-image: url('/assets/ui/icon-open-tool.svg'); }
#modeFlag::before { background-image: url('/assets/ui/icon-flag-tool.svg'); }
#modeScan::before { background-image: url('/assets/ui/icon-scan-tool.svg'); }

#brushNormalDock::before { background-image: url('/assets/ui/icon-mine-tool.svg'); }
#brushSmokeDock::before { background-image: url('/assets/ui/icon-smoke-tool.svg'); }
#brushClearDock::before { background-image: url('/assets/ui/icon-clear-tool.svg'); }
#modeOpenDock::before { background-image: url('/assets/ui/icon-open-tool.svg'); }
#modeFlagDock::before { background-image: url('/assets/ui/icon-flag-tool.svg'); }
#modeScanDock::before { background-image: url('/assets/ui/icon-scan-tool.svg'); }
.boom-burst { width: 150px; min-height: 150px; padding: 0; background: center / contain no-repeat url('/assets/fx/explosion-burst.svg'); border: 0; box-shadow: none; clip-path: none; display: grid; place-items: center; }
.boom-burst.smoke { background-image: url('/assets/fx/smoke-burst.svg'); }
.boom-burst-label { transform: translateY(6px) rotate(-5deg); font-family: Bungee, Orbitron, sans-serif; font-size: 28px; color: #301108; text-shadow: 0 2px 0 rgba(255,255,255,.35), 0 0 12px rgba(255,255,255,.2); }
@media (max-width: 980px) { .lobby-center .avatar-chooser { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 560px; } .invite-row { grid-template-columns: 1fr; } .lobby-actions { flex-direction: column; width: min(100%, 360px); margin-inline: auto; } #leaveQueueBtn { width: min(100%, 360px); } .btn { width: 100%; } }

.versus-column { display: none !important; }

#connectionPill { display: none !important; }
.avatar-chooser.avatar-chooser-six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.loading-label { display: inline-flex; align-items: center; justify-content: center; }
.loading-live { display: inline-flex; align-items: center; justify-content: center; gap: 0; min-width: 18ch; }
.loading-live .loading-text { white-space: nowrap; }
.status-orb { width: 10px; height: 10px; border-radius: 999px; margin-right: 10px; background: radial-gradient(circle at 35% 35%, #c5fff3 0, #65ffd7 45%, #12d7a6 100%); box-shadow: 0 0 0 0 rgba(55,255,193,.55), 0 0 18px rgba(55,255,193,.95); animation: statusOrbPulse 1.35s ease-out infinite; flex: 0 0 auto; }
.status-orb-strong { width: 12px; height: 12px; box-shadow: 0 0 0 0 rgba(55,255,193,.6), 0 0 18px rgba(55,255,193,.98); }
.loading-live-invite .status-orb { background: radial-gradient(circle at 35% 35%, #fff2c5 0, #ffd56a 48%, #ff9f1d 100%); box-shadow: 0 0 0 0 rgba(255,180,80,.42), 0 0 18px rgba(255,180,80,.82); }
.loading-dots { display: inline-grid; grid-auto-flow: column; width: 1.9em; margin-left: .08em; text-align: left; }
.loading-dots span { display: inline-block; opacity: .12; transform: translateY(0); }
.loading-dots span:nth-child(1) { animation: loadingDotBounce 1.1s infinite; }
.loading-dots span:nth-child(2) { animation: loadingDotBounce 1.1s infinite .16s; }
.loading-dots span:nth-child(3) { animation: loadingDotBounce 1.1s infinite .32s; }
.queue-btn-live { display: inline-flex; align-items: center; justify-content: center; min-height: 1.1em; }
.loading-sub { display: block; min-height: 1.15em; font-size: 10px; line-height: 1.15; letter-spacing: .12em; text-transform: uppercase; color: rgba(215,240,255,.76); animation: loadingSubBlink 1.8s ease-in-out infinite; }
.invite-live { display: inline-flex; justify-content: center; width: 100%; }
.loading-sub-invite { color: rgba(255,220,160,.88); }
.invite-help { min-height: 4.8em; }
.queue-status { width: min(100%, 430px); margin: -2px auto 0; }
.queue-status-live { display: grid; justify-items: center; gap: 4px; padding: 8px 14px 2px; }
.queue-status-head { display: inline-flex; align-items: center; gap: 8px; font-family: Orbitron, sans-serif; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #b9edff; }
.queue-status-meta { font-size: 12px; color: rgba(220,232,245,.8); }
.queue-signal { display: inline-flex; align-items: end; gap: 3px; height: 14px; margin-top: 2px; }
.queue-signal span { width: 4px; border-radius: 999px; background: linear-gradient(180deg, rgba(147,236,255,.98), rgba(50,126,255,.9)); box-shadow: 0 0 8px rgba(94,229,255,.45); transform-origin: bottom center; }
.queue-signal span:nth-child(1) { height: 5px; animation: signalBars 1.05s ease-in-out infinite .0s; }
.queue-signal span:nth-child(2) { height: 8px; animation: signalBars 1.05s ease-in-out infinite .15s; }
.queue-signal span:nth-child(3) { height: 11px; animation: signalBars 1.05s ease-in-out infinite .3s; }
.queue-signal span:nth-child(4) { height: 14px; animation: signalBars 1.05s ease-in-out infinite .45s; }
#queueBtn.queueing, #invitePanel.waiting-live .invite-code-card { position: relative; overflow: hidden; }
#queueBtn.queueing::after, #invitePanel.waiting-live .invite-code-card::after { content: ''; position: absolute; inset: -20% auto -20% -32%; width: 26%; background: linear-gradient(90deg, rgba(255,255,255,0), rgba(148,231,255,.18), rgba(255,255,255,0)); transform: skewX(-18deg); animation: liveSweep 1.8s linear infinite; pointer-events: none; }
@keyframes loadingDotBounce { 0%, 100% { opacity: .12; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-2px) scale(1.12); } 60% { opacity: .72; transform: translateY(1px); } }
@keyframes statusOrbPulse { 0% { box-shadow: 0 0 0 0 rgba(55,255,193,.42), 0 0 14px rgba(55,255,193,.9); transform: scale(.92); } 70% { box-shadow: 0 0 0 10px rgba(55,255,193,0), 0 0 22px rgba(55,255,193,.95); transform: scale(1.08); } 100% { box-shadow: 0 0 0 0 rgba(55,255,193,0), 0 0 14px rgba(55,255,193,.9); transform: scale(.92); } }
@keyframes loadingSubBlink { 0%, 100% { opacity: .62; } 50% { opacity: 1; } }
@keyframes signalBars { 0%, 100% { transform: scaleY(.45); opacity: .42; } 50% { transform: scaleY(1); opacity: 1; } }
@keyframes liveSweep { 0% { transform: translateX(0) skewX(-18deg); opacity: 0; } 14% { opacity: 1; } 100% { transform: translateX(520%) skewX(-18deg); opacity: 0; } }
@media (max-width: 1100px) {
  .lobby-center { max-width: 846px; }
  .lobby-center .avatar-chooser, .avatar-chooser.avatar-chooser-six { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 620px; }
}

.results-rematch-status {
  margin-top: 14px;
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  color: var(--text-soft);
  min-height: 24px;
}
.results-rematch-status.active { color: #9fe7ff; }


/* Lobby header refinement: integrated brand without overlap, with balanced controls on desktop */
.app-shell.view-lobby .site-topbar {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 12px;
  width: min(100%, 1040px);
  max-width: 1040px;
  padding: 6px 8px 14px;
  margin: 0 auto 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}
.app-shell.view-lobby .site-topbar::before,
.app-shell.view-lobby .site-topbar::after {
  display: none;
}
.app-shell.view-lobby .left-actions {
  visibility: hidden;
  pointer-events: none;
  justify-content: flex-start;
}
.app-shell.view-lobby .right-actions {
  justify-content: flex-end;
  gap: 10px;
}
.app-shell.view-lobby .brand-lockup {
  gap: 8px;
  padding: 8px 0 6px;
  min-width: 0;
}
.app-shell.view-lobby .brand-lockup::before,
.app-shell.view-lobby .brand-lockup::after {
  content: '';
  position: absolute;
  top: 50%;
  width: clamp(44px, 7vw, 96px);
  height: 1px;
  background: linear-gradient(90deg, rgba(157,217,255,0), rgba(157,217,255,.72), rgba(157,217,255,0));
  opacity: .42;
}
.app-shell.view-lobby .brand-lockup::before { left: 0; transform: translate(calc(-100% - 18px), -50%); }
.app-shell.view-lobby .brand-lockup::after { right: 0; transform: translate(calc(100% + 18px), -50%); }
.app-shell.view-lobby .brand-kicker {
  padding: 0;
  font-size: 10px;
  letter-spacing: .28em;
  color: rgba(182, 210, 244, .82);
  text-shadow: 0 0 10px rgba(72, 179, 255, .2);
}
.app-shell.view-lobby .brand-name {
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: .95;
}
.app-shell.view-lobby .pill-switch,
.app-shell.view-lobby .icon-chip {
  min-height: 56px;
}
.app-shell.view-lobby .pill-switch {
  min-width: 106px;
}
.app-shell.view-lobby .lobby-center {
  position: relative;
}
.app-shell.view-lobby .lobby-center::before {
  content: '';
  position: absolute;
  inset: -10px 18% auto;
  height: 120px;
  background: radial-gradient(circle at 50% 0%, rgba(99, 209, 255, .14), rgba(99, 209, 255, 0) 70%);
  pointer-events: none;
}
@media (max-width: 1180px) {
  .app-shell.view-lobby .site-topbar {
    width: min(100%, 920px);
    max-width: 920px;
    grid-template-columns: minmax(88px, 1fr) auto minmax(88px, 1fr);
  }
  .app-shell.view-lobby .brand-lockup::before,
  .app-shell.view-lobby .brand-lockup::after {
    width: clamp(28px, 4vw, 64px);
  }
  .app-shell.view-lobby .brand-name {
    font-size: clamp(26px, 3.1vw, 40px);
  }
}
@media (max-width: 980px) {
  .app-shell.view-lobby .site-topbar {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
    padding-top: 6px;
    margin-bottom: 6px;
  }
  .app-shell.view-lobby .left-actions {
    display: none;
  }
  .app-shell.view-lobby .right-actions {
    justify-content: center;
    width: 100%;
  }
  .app-shell.view-lobby .brand-lockup {
    padding: 0;
  }
  .app-shell.view-lobby .brand-lockup::before,
  .app-shell.view-lobby .brand-lockup::after {
    display: none;
  }
}


/* v7 harmony refresh: cleaner lobby copy + refined utility controls */
.app-shell.view-lobby .site-topbar {
  position: relative;
  grid-template-columns: 1fr;
  justify-items: center;
  width: min(100%, 980px);
  max-width: 980px;
  padding: 6px 0 10px;
  margin: 0 auto 6px;
  overflow: visible;
}
.app-shell.view-lobby .right-actions {
  position: absolute;
  top: calc(100% + 26px);
  right: 20px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  z-index: 6;
}
.app-shell.view-lobby .brand-lockup {
  gap: 4px;
  padding: 8px 0 2px;
}
.app-shell.view-lobby .brand-kicker {
  font-size: 9px;
  letter-spacing: .22em;
  opacity: .82;
}
.app-shell.view-lobby .brand-name {
  font-size: clamp(28px, 3.25vw, 42px);
}
.app-shell.view-lobby .hero-badge,
.app-shell.view-lobby #heroTitle,
.app-shell.view-lobby #heroSubtitle {
  display: none;
}
.app-shell.view-lobby #titleText {
  margin-top: 2px;
  margin-bottom: 2px;
  font-size: clamp(20px, 2.15vw, 30px);
}
.app-shell.view-lobby .lobby-center {
  padding-top: clamp(34px, 3.2vw, 48px);
}
.app-shell.view-lobby .lobby-stack {
  gap: 10px;
  margin-top: 12px;
}
.app-shell.view-lobby .lobby-block {
  background: linear-gradient(180deg, rgba(9, 17, 31, .42), rgba(8, 14, 26, .3));
  border-color: rgba(255,255,255,.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
.app-shell.view-lobby .section-kicker {
  color: #a7d8ff;
  letter-spacing: .16em;
}
.app-shell.view-lobby .field span {
  margin-bottom: 10px;
}
.app-shell.view-lobby .chip {
  background: transparent;
  border: 0;
  box-shadow: none;
  min-height: 0;
  padding: 0;
  color: #dbeaf8;
}
.app-shell.view-lobby .right-actions .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .9;
  transition: transform .18s ease, opacity .18s ease, color .18s ease;
}
.app-shell.view-lobby .right-actions .chip:hover,
.app-shell.view-lobby .right-actions .chip:focus-visible {
  opacity: 1;
  transform: translateY(-1px);
}
.app-shell.view-lobby .icon-chip {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  height: 30px;
  border-radius: 0;
  background: transparent;
}
.app-shell.view-lobby .icon-chip img {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 0 8px rgba(111,228,255,.18));
  opacity: .92;
}
.app-shell.view-lobby .icon-chip.is-muted img {
  opacity: .72;
  filter: drop-shadow(0 0 8px rgba(255,173,143,.14));
}
.app-shell.view-lobby .pill-switch {
  min-width: 0;
  border-radius: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  color: #f2f7ff;
  position: relative;
  padding-left: 18px;
}
.app-shell.view-lobby .pill-switch::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 18px;
  background: linear-gradient(180deg, rgba(155,217,255,0), rgba(155,217,255,.38), rgba(155,217,255,0));
  transform: translateY(-50%);
}
.app-shell.view-lobby #inviteHelp {
  min-height: 0;
}
@media (max-width: 980px) {
  .app-shell.view-lobby .site-topbar {
    padding: 6px 0 8px;
    margin-bottom: 6px;
  }
  .app-shell.view-lobby .right-actions {
    position: static;
    justify-content: center;
    gap: 18px;
    margin-top: 6px;
  }
  .app-shell.view-lobby .lobby-center {
    padding-top: 24px;
  }
  .app-shell.view-lobby #titleText {
    margin-top: 4px;
  }
}



.action-block {
  align-items: center;
  display: grid;
  gap: 12px;
  width: min(100%, 700px);
  margin: 2px auto 0;
  padding: 14px 14px 12px;
  background: linear-gradient(180deg, rgba(8, 15, 27, .34), rgba(6, 12, 22, .18));
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.02);
}
.action-block::before,
.action-block::after {
  display: none;
}
.action-dual {
  order: 2;
  width: min(100%, 620px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.action-cta {
  min-height: 60px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 15px 20px;
  border-radius: 16px;
  border: 1px solid rgba(168, 216, 255, 0.14);
  background: linear-gradient(180deg, rgba(33, 44, 64, .96), rgba(18, 25, 39, .98));
  color: #edf4ff;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 22px rgba(0,0,0,.18);
}
.action-cta:hover:not(:disabled),
.action-cta:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(186, 226, 255, 0.22);
}
.action-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,0) 48%);
  pointer-events: none;
}
.action-cta::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,.04);
  pointer-events: none;
}
.action-cta > * { pointer-events: none; }
.action-ghost { display: none !important; }
#queueBtn {
  background: linear-gradient(180deg, rgba(66, 103, 150, .98) 0%, rgba(42, 71, 112, .98) 54%, rgba(22, 37, 58, .98) 100%);
  border-color: rgba(136, 195, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 12px 24px rgba(11, 33, 64, .2);
}
#queueBtn:hover:not(:disabled),
#queueBtn:focus-visible:not(:disabled) {
  border-color: rgba(155, 214, 255, .34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 14px 26px rgba(11, 33, 64, .22);
}
#challengeBtn {
  background: linear-gradient(180deg, rgba(59, 66, 82, .98) 0%, rgba(37, 43, 56, .98) 54%, rgba(22, 27, 38, .98) 100%);
  border-color: rgba(210, 222, 243, .12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 12px 24px rgba(0,0,0,.18);
}
#challengeBtn:hover:not(:disabled),
#challengeBtn:focus-visible:not(:disabled) {
  border-color: rgba(228, 234, 247, .2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 14px 26px rgba(0,0,0,.2);
}
#queueBtn.is-cancel,
#challengeBtn.is-cancel {
  background: linear-gradient(180deg, rgba(88, 93, 107, .98) 0%, rgba(54, 59, 72, .98) 54%, rgba(29, 34, 45, .98) 100%);
  border-color: rgba(255, 212, 144, .18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 12px 24px rgba(0,0,0,.18);
}
.queue-status {
  order: 3;
  width: min(100%, 460px);
  margin: 2px auto 0;
}
.queue-status-live {
  gap: 5px;
  padding: 6px 12px 0;
}
.queue-status-head {
  gap: 8px;
  font-size: 10px;
  letter-spacing: .14em;
  color: #c7e4ff;
}
.queue-status-meta {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(215,228,243,.66);
}
.queue-signal span {
  background: linear-gradient(180deg, rgba(163,221,255,.92), rgba(77,125,193,.84));
  box-shadow: 0 0 6px rgba(94,229,255,.24);
}
.invite-panel {
  order: 1;
  display: grid;
  gap: 10px;
  text-align: center;
  width: min(100%, 620px);
  margin: 0 auto 2px;
}
.invite-code-card {
  padding: 11px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(12,21,37,.9), rgba(8,14,25,.94));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.invite-help {
  min-height: 0;
  color: rgba(220,232,245,.78);
}
.loading-sub {
  font-size: 10px;
  letter-spacing: .11em;
  color: rgba(215,240,255,.62);
}
.loading-sub-invite {
  color: rgba(255,223,177,.74);
}
.action-block.private-active .action-dual { order: 1; }
.action-block.private-active #invitePanel { order: 2; }
.action-block.private-active #queueStatus { order: 3; }
@media (max-width: 980px) {
  .action-block {
    width: min(100%, 420px);
    padding: 12px 12px 10px;
  }
  .action-dual {
    grid-template-columns: 1fr;
    width: min(100%, 360px);
  }
}


/* v12 controls moved into lobby panel */
.app-shell.view-lobby .site-topbar {
  grid-template-columns: 1fr;
  justify-items: center;
}
.app-shell.view-lobby .lobby-center {
  position: relative;
  padding-top: clamp(44px, 4vw, 58px);
}
.app-shell.view-lobby .lobby-utility-controls {
  position: absolute;
  top: 18px;
  right: 22px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  z-index: 8;
}
.app-shell.view-lobby .lobby-utility-controls .chip {
  background: transparent;
  border: 0;
  box-shadow: none;
  min-height: 0;
  padding: 0;
  color: #dbeaf8;
  opacity: .92;
  transition: transform .18s ease, opacity .18s ease, color .18s ease;
}
.app-shell.view-lobby .lobby-utility-controls .chip:hover,
.app-shell.view-lobby .lobby-utility-controls .chip:focus-visible {
  opacity: 1;
  transform: translateY(-1px);
}
.app-shell.view-lobby .lobby-utility-controls .icon-chip {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  height: 28px;
}
.app-shell.view-lobby .lobby-utility-controls .icon-chip img {
  width: 17px;
  height: 17px;
}
.app-shell.view-lobby .lobby-utility-controls .pill-switch {
  min-width: 0;
  border-radius: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  position: relative;
  padding-left: 18px;
}
.app-shell.view-lobby .lobby-utility-controls .pill-switch::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 18px;
  background: linear-gradient(180deg, rgba(155,217,255,0), rgba(155,217,255,.38), rgba(155,217,255,0));
  transform: translateY(-50%);
}
.app-shell.view-lobby .right-actions {
  display: none !important;
}
@media (max-width: 980px) {
  .app-shell.view-lobby .lobby-center {
    padding-top: 56px;
  }
  .app-shell.view-lobby .lobby-utility-controls {
    top: 14px;
    right: 16px;
    gap: 14px;
  }
}
@media (max-width: 640px) {
  .app-shell.view-lobby .lobby-center {
    padding-top: 68px;
  }
  .app-shell.view-lobby .lobby-utility-controls {
    left: 0;
    right: 0;
    justify-content: center;
  }
}


/* Game board redesign aligned with lobby */
.app-shell.view-game {
  width: min(1540px, calc(100% - 20px));
}
.app-shell.view-game .site-topbar {
  width: min(1460px, 100%);
  max-width: 1460px;
  margin-bottom: 8px;
  padding: 8px 18px;
}
.app-shell.view-game .brand-lockup {
  gap: 4px;
}
.app-shell.view-game .brand-name {
  font-size: clamp(22px, 2vw, 30px);
}
.app-shell.view-game #gameView {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
}

.broadcast-bar {
  position: relative;
  padding: 12px 16px;
  gap: 14px;
  margin-bottom: 0;
  background:
    linear-gradient(180deg, rgba(22, 34, 54, .97), rgba(11, 17, 29, .97)),
    radial-gradient(circle at 18% 50%, rgba(76, 210, 255, .12), transparent 28%),
    radial-gradient(circle at 82% 45%, rgba(255, 100, 126, .10), transparent 28%);
  border-color: rgba(168, 209, 255, .14);
  box-shadow: 0 0 0 1px rgba(133, 193, 255, .08), var(--shadow);
}
.broadcast-bar::after {
  background: linear-gradient(90deg, rgba(85,214,255,.08), transparent 24%, transparent 76%, rgba(255,122,150,.07));
}
.player-pod {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(8, 15, 28, .58), rgba(8, 14, 24, .18));
  border: 1px solid rgba(255,255,255,.05);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.player-avatar {
  width: 84px;
  height: 108px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(18, 31, 48, .96), rgba(8, 13, 22, .98));
}
.player-meta strong {
  font-size: clamp(20px, 2vw, 28px);
}
.pod-label-row {
  font-size: 12px;
  letter-spacing: .13em;
}
.pod-extra { color: #b8c8e7; }
.energy-track {
  height: 14px;
  background: rgba(2, 8, 16, .9);
}
.energy-fill-blue { background: linear-gradient(90deg, #8af4ff, #3d8dff); }
.energy-fill-red { background: linear-gradient(90deg, #ff9c90, #ff5f78); }
.broadcast-center {
  min-width: 240px;
  gap: 6px;
}
.broadcast-logo {
  font-size: clamp(26px, 2.7vw, 38px);
  letter-spacing: .12em;
}
.broadcast-phase {
  font-size: clamp(20px, 2vw, 30px);
}
.broadcast-timer {
  min-width: 190px;
  padding: 10px 16px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(10, 18, 31, .98), rgba(6, 11, 20, .98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 0 0 1px rgba(255, 208, 100, .08), 0 12px 24px rgba(0,0,0,.26);
}

.arena-stage {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.battle-card {
  padding: 14px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(22, 34, 54, .96), rgba(11, 17, 29, .97));
  min-width: 0;
}
.battle-card-left,
.battle-card-rival {
  box-shadow: 0 0 0 1px rgba(255,255,255,.05), var(--shadow);
}
.battle-card-left::before,
.battle-card-rival::before {
  inset: 14px;
  border-radius: 24px;
  border-color: rgba(255,255,255,.05);
}
.battle-card-left::after,
.battle-card-rival::after {
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent 16%, transparent 84%, rgba(0,0,0,.16));
}
.battle-topline {
  margin-bottom: 14px;
  align-items: center;
}
.battle-topline .section-kicker {
  margin-bottom: 6px;
}
.battle-topline h3 {
  font-family: Orbitron, sans-serif;
  font-size: clamp(18px, 1.6vw, 24px);
  letter-spacing: .04em;
}
.board-top-right,
.inline-stat-chip span,
.status-chip,
.rival-progress-header,
.tool-pill,
#validationText,
#opponentHint {
  font-family: Orbitron, sans-serif;
}
.board-top-right-compact,
.inline-match-stats {
  gap: 8px;
}
.inline-stat-chip {
  min-width: 84px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(7, 13, 24, .74);
}
.tool-groups-top {
  margin-bottom: 14px;
  min-height: 62px;
  display: flex;
  align-items: center;
}
.tool-row {
  gap: 8px;
}
.tool-pill {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(21, 34, 52, .95), rgba(9, 15, 26, .96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.tool-pill.active {
  border-color: rgba(107, 220, 255, .72);
  box-shadow: 0 0 0 1px rgba(107, 220, 255, .16), 0 0 20px rgba(107, 220, 255, .12), inset 0 1px 0 rgba(255,255,255,.08);
}
.btn-confirm {
  border-radius: 14px;
}
.board-shell {
  max-width: min(100%, 620px);
  margin-inline: auto;
  padding: 12px;
  border-radius: 28px;
  border: 1px solid rgba(200, 230, 255, .13);
  background:
    linear-gradient(180deg, rgba(48, 64, 90, .97), rgba(18, 26, 40, .99)),
    repeating-linear-gradient(180deg, rgba(255,255,255,.018) 0 2px, rgba(255,255,255,0) 2px 6px);
}
.board-shell::before {
  inset: 9px;
  border-radius: 20px;
  border-color: rgba(255,255,255,.06);
}
.board-shell::after {
  inset: 10px;
  border-radius: 19px;
}
.board-shell-blue {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 1px rgba(90, 217, 255, .18), 0 0 26px rgba(72, 175, 255, .10), 0 12px 28px rgba(0,0,0,.28);
}
.board-shell-red {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 1px rgba(255, 125, 151, .16), 0 0 26px rgba(255, 90, 120, .08), 0 12px 28px rgba(0,0,0,.28);
}
#boardCanvas, #boardFxCanvas, #ghostCanvas, #resultsYouBoard, #resultsEnemyBoard {
  border-radius: 16px;
}
.battle-footer {
  margin-top: 14px;
  padding-top: 2px;
}
.status-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(7, 14, 25, .78);
}
.battle-hint {
  font-size: 13px;
  color: #abbbda;
}
.rival-progress-track {
  height: 10px;
  margin-bottom: 34px;
}
.rival-progress-header {
  min-height: 28px;
  align-items: center;
}
.rival-progress-fill {
  background: linear-gradient(90deg, #ffaf9c, #ff5f78);
}

.rotate-device-tip {
  display: none;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 50;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(14, 22, 37, .96), rgba(7, 11, 20, .98));
  box-shadow: 0 16px 32px rgba(0,0,0,.34);
  pointer-events: none;
}
.rotate-device-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 24px;
  color: #9fe6ff;
  background: rgba(18, 30, 48, .8);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.rotate-device-copy {
  display: grid;
  gap: 2px;
}
.rotate-device-copy strong {
  font-family: Orbitron, sans-serif;
  font-size: 12px;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: #eaf5ff;
}
.rotate-device-copy span {
  font-size: 12px;
  color: #b8c7e2;
}

.battle-preboard {
  display: grid;
  align-content: start;
}
.rival-preboard {
  gap: 0;
}
body.show-rotate-tip .rotate-device-tip {
  display: flex;
  animation: rotate-tip-in .28s ease forwards;
}
.rotate-device-tip.is-exiting {
  animation: rotate-tip-out .26s ease forwards;
}


@media (min-width: 981px) and (max-height: 860px) {
  .app-shell.view-game .site-topbar {
    margin-bottom: 4px;
    padding-block: 6px;
  }
  .app-shell.view-game #gameView {
    gap: 8px;
    padding-bottom: 8px;
  }
  .app-shell.view-game .score-strip {
    display: none;
  }
  .broadcast-bar {
    padding: 10px 14px;
    gap: 10px;
  }
  .player-avatar {
    width: 72px;
    height: 94px;
  }
  .player-meta strong {
    font-size: 18px;
  }
  .broadcast-center {
    min-width: 210px;
  }
  .broadcast-logo {
    font-size: 24px;
  }
  .broadcast-phase {
    font-size: 18px;
  }
  .broadcast-timer {
    min-width: 168px;
    padding: 8px 14px;
    font-size: 34px;
  }
  .battle-card {
    padding: 12px;
  }
  #mainBattlePanel .tool-groups-top {
    min-height: 54px;
    margin-bottom: 10px;
  }
  #rivalBattlePanel .rival-progress-header {
    min-height: 20px;
  }
  #rivalBattlePanel .rival-progress-track {
    margin-bottom: 28px;
  }
}
@media (max-width: 1220px) {
  .app-shell.view-game {
    width: min(100%, calc(100% - 18px));
  }
  .arena-stage {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) and (orientation: landscape) {
  body.game-active {
    overflow-x: hidden;
  }
  .app-shell.view-game {
    width: min(100%, calc(100% - 10px));
    margin-inline: auto;
  }
  .app-shell.view-game .site-topbar {
    margin-bottom: 6px;
    padding: 4px 8px;
  }
  .broadcast-bar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    padding: 8px 10px;
    gap: 8px;
  }
  .player-pod {
    padding: 8px 10px;
    gap: 10px;
  }
  .player-avatar {
    width: 56px;
    height: 72px;
    border-radius: 14px;
  }
  .player-meta strong {
    font-size: 18px;
  }
  .pod-label-row {
    font-size: 10px;
    gap: 6px;
  }
  .broadcast-center {
    min-width: 146px;
    gap: 3px;
  }
  .broadcast-logo {
    font-size: 22px;
  }
  .broadcast-phase {
    font-size: 17px;
  }
  .broadcast-timer {
    min-width: 132px;
    padding: 7px 10px;
    font-size: 24px;
    border-radius: 16px;
  }
  .arena-stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: start;
  }
  body[data-phase="seed"] .arena-stage {
    --mobile-board-size: min(calc(50vw - 18px), calc(100svh - 248px));
  }
  body[data-phase="solve"] .arena-stage,
  body[data-phase="results"] .arena-stage {
    --mobile-board-size: min(calc(50vw - 18px), calc(100svh - 206px));
  }
  #mainBattlePanel,
  #rivalBattlePanel {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    align-content: start;
  }
  .battle-card {
    padding: 9px;
    border-radius: 20px;
  }
  .battle-topline {
    margin-bottom: 10px;
  }
  .battle-topline h3 {
    font-size: 16px;
  }
  .section-kicker,
  .board-top-right,
  .rival-progress-header,
  .battle-hint,
  .status-chip,
  .tool-pill {
    font-size: 10px;
  }
  .inline-stat-chip {
    min-width: 68px;
    padding: 6px 8px;
  }
  .inline-stat-chip strong {
    font-size: 14px;
  }
  .tool-row {
    gap: 6px;
  }
  .tool-pill {
    min-height: 34px;
    padding: 7px 8px;
  }
  .tool-pill::before {
    width: 16px;
    height: 16px;
  }
  .btn-confirm {
    padding-inline: 12px;
  }
  .board-shell {
    max-width: 100%;
    width: 100%;
    padding: 7px;
    border-radius: 18px;
  }
  #boardCanvas,
  #boardFxCanvas,
  #ghostCanvas {
    width: 100%;
    height: auto;
    display: block;
  }
  .board-shell::before,
  .board-shell::after {
    inset: 7px;
    border-radius: 14px;
  }
  .battle-footer {
    margin-top: 8px;
    gap: 6px;
  }
  #mainBattlePanel .tool-groups-top {
    min-height: 50px;
    margin-bottom: 10px;
  }
  #rivalBattlePanel .rival-progress-header {
    min-height: 18px;
  }
  #rivalBattlePanel .rival-progress-track {
    margin-bottom: 24px;
  }
  .battle-footer .battle-hint {
    line-height: 1.35;
  }
}

@media (max-width: 980px) and (orientation: portrait) {
  .app-shell.view-game .site-topbar {
    margin-bottom: 10px;
  }
  .rotate-device-tip {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .broadcast-bar {
    padding: 12px;
  }
  .player-pod {
    padding: 8px;
  }
  .broadcast-timer {
    min-width: 138px;
  }
}

@keyframes rotate-tip-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes rotate-tip-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(10px); }
}


/* v20 game board redesign */
.broadcast-bar {
  background: linear-gradient(180deg, rgba(18, 28, 46, .97), rgba(8, 13, 23, .98));
}
.score-strip,
.ability-dock { display: none !important; }
.app-shell.view-game #gameView {
  display: grid;
  gap: 10px;
}
.mobile-action-dock {
  display: none;
  padding: 8px 10px;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.mobile-action-dock .tool-pill { flex: 1 1 0; min-width: 0; justify-content: center; }
.mobile-dock-phase { display: grid; gap: 6px; width: 100%; }
.mobile-dock-phase.hidden { display: none !important; }
.mobile-confirm-btn { width: 100%; }
.battle-preboard {
  gap: 8px;
  margin-bottom: 8px;
}
.battle-topline { margin-bottom: 8px; }
#mainBattlePanel .battle-topline .section-kicker,
#mainBattlePanel .battle-topline h3,
#rivalBattlePanel .battle-topline .section-kicker,
#rivalBattlePanel .battle-topline h3,
#validationText,
#opponentHint { display: none; }
#mainBattlePanel .battle-topline,
#rivalBattlePanel .battle-topline {
  min-height: 0;
  margin: 0;
}
#mainBattlePanel .tool-groups-top {
  min-height: 0;
  margin-bottom: 0;
}
#rivalBattlePanel .rival-progress-track { margin-bottom: 0; }
#rivalBattlePanel .rival-progress-header { margin-bottom: 6px; }
.battle-footer {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  min-height: 36px;
}
.footer-left { justify-content: center; }
.footer-right { justify-content: center; }
.status-chip { text-align: center; }
.arena-stage { margin-top: 0; }
.rotate-device-tip {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 120;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.rotate-device-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 14, .72);
  backdrop-filter: blur(3px);
}
.rotate-device-card {
  position: relative;
  z-index: 1;
  width: min(88vw, 360px);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 18px 18px 16px;
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(19, 28, 42, .96), rgba(8, 13, 22, .98));
  box-shadow: 0 28px 60px rgba(0,0,0,.42);
}
.rotate-device-art {
  width: min(54vw, 240px);
  max-width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.4));
}
.rotate-device-copy {
  text-align: center;
  display: grid;
  gap: 6px;
}
.rotate-device-copy strong {
  font-family: Orbitron, sans-serif;
  font-size: 16px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.rotate-device-copy span {
  font-size: 13px;
  line-height: 1.35;
  color: #b7c6e1;
}
body.show-rotate-tip .rotate-device-tip { display: flex; animation: rotate-tip-fade-in .28s ease forwards; }
.rotate-device-tip.is-exiting { animation: rotate-tip-fade-out .28s ease forwards; }
@keyframes rotate-tip-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rotate-tip-fade-out { from { opacity: 1; } to { opacity: 0; } }

@media (max-width: 980px) and (orientation: landscape) {
  html, body.game-active {
    overflow: hidden !important;
    overscroll-behavior: none;
  }
  body.game-active {
    position: fixed;
    inset: 0;
    width: 100%;
    height: var(--app-vh, 100dvh);
  }
  body.game-active .app-shell.view-game,
  .app-shell.view-game,
  .app-shell.view-game #gameView {
    width: 100%;
    min-height: var(--app-vh, 100dvh);
    height: var(--app-vh, 100dvh);
  }
  .app-shell.view-game {
    margin: 0;
    border-radius: 0;
    max-width: none;
  }
  .app-shell.view-game #gameView {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: linear-gradient(180deg, rgba(3, 9, 24, .97), rgba(4, 9, 22, .99));
  }
  .app-shell.view-game .site-topbar,
  .score-strip,
  .ability-dock,
  .battle-footer,
  .battle-preboard,
  #mainBattlePanel .tool-groups-top,
  .versus-column {
    display: none !important;
  }
  .app-shell.view-game #gameView {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 2px;
    padding: 2px;
    align-content: start;
    overflow: hidden;
    scroll-margin-top: 0;
  }
  .broadcast-bar {
    position: relative;
    padding: 2px 5px;
    gap: 4px;
    border-radius: 12px;
    margin-bottom: 0;
    min-height: 36px;
  }
  .player-pod { gap: 4px; min-width: 0; }
  .player-avatar { width: 24px; height: 34px; border-radius: 7px; }
  .player-meta { gap: 1px; min-width: 0; }
  .player-meta strong {
    font-size: clamp(9px, 1.55vw, 12px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
  }
  .pod-label-row, .pod-extra { font-size: 6px; }
  .energy-track { height: 6px; }
  .broadcast-center { min-width: 66px; gap: 0; }
  .broadcast-logo { font-size: 9px; letter-spacing: .14em; }
  .broadcast-phase { font-size: 9px; }
  .broadcast-timer { min-width: 58px; font-size: 13px; padding: 1px 4px; }
  .arena-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
    justify-items: stretch;
    gap: 4px;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    position: relative;
    padding: 0 2px 2px;
  }
  #mainBattlePanel { grid-column: 1; }
  #rivalBattlePanel { grid-column: 2; }
  #mainBattlePanel,
  #rivalBattlePanel {
    width: 100%;
    padding: 2px;
    border-radius: 12px;
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    align-items: center;
    justify-items: center;
    overflow: hidden;
    position: relative;
  }
  .mobile-action-dock {
    display: grid !important;
    grid-column: 1 / -1;
    grid-row: 1;
    align-self: center;
    justify-self: center;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 7;
    padding: 5px;
    gap: 5px;
    border-radius: 18px;
    min-width: 0;
    width: clamp(94px, 12vw, 112px);
    max-width: 112px;
    margin: 0;
    background: linear-gradient(180deg, rgba(8, 19, 47, .84), rgba(3, 11, 26, .88));
    box-shadow: 0 12px 30px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.06), 0 0 0 1px rgba(110, 214, 255, .14);
    backdrop-filter: blur(8px);
    pointer-events: auto;
  }
  .mobile-dock-phase {
    display: grid;
    gap: 5px;
  }
  #mobileSeedDock,
  #mobileSolveDock {
    grid-template-columns: 1fr;
  }
  .mobile-action-dock .tool-pill,
  .mobile-action-dock .btn-confirm {
    min-height: 31px;
    padding: 5px 7px;
    font-size: 10px;
    border-radius: 999px;
    width: 100%;
  }
  .mobile-action-dock .tool-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }
  .mobile-action-dock .tool-pill::before {
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(255,255,255,.2));
  }
  .board-shell {
    width: var(--landscape-board-width, 100%);
    height: var(--landscape-board-height, 100%);
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: var(--landscape-board-ratio, 1 / 1);
    padding: 1px;
    border-radius: 12px;
    margin-top: 0 !important;
    min-height: 0 !important;
    align-self: center;
    justify-self: center;
    overflow: hidden;
  }
  .board-canvas-stack,
  #ghostShell {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
  }
  #boardCanvas,
  #boardFxCanvas,
  #ghostCanvas {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: block;
    image-rendering: auto;
  }
  .board-overlay {
    font-size: clamp(14px, 2.2vw, 22px);
    letter-spacing: .08em;
    padding: 10px;
  }
}
@media (max-width: 980px) and (orientation: portrait) {
  body.game-active { overflow-y: auto; }
  .app-shell.view-game #gameView {
    min-height: auto;
    overflow: visible;
    padding-bottom: 18px;
  }
  .app-shell.view-game .site-topbar { margin-bottom: 6px; }
  .broadcast-bar {
    padding: 8px 10px;
    gap: 6px;
  }
  .player-avatar { width: 54px; height: 70px; }
  .broadcast-logo { font-size: 18px; }
  .broadcast-phase { font-size: 14px; }
  .broadcast-timer { min-width: 110px; font-size: 24px; padding: 7px 10px; }
  .mobile-action-dock { display: none !important; }
}
