:root {
  --bg: #07080a;
  --bg-2: #0f1417;
  --panel: rgba(18, 23, 27, 0.82);
  --panel-strong: rgba(20, 25, 29, 0.96);
  --metal: rgba(34, 41, 45, 0.9);
  --metal-dark: rgba(9, 12, 14, 0.94);
  --line: rgba(229, 244, 245, 0.16);
  --line-hot: rgba(200, 255, 46, 0.58);
  --ink: #f8fff7;
  --muted: #a9b7aa;
  --dim: #6f7a70;
  --acid: #c8ff2e;
  --cyan: #2ff4d0;
  --pink: #ff3d81;
  --amber: #ffcb47;
  --red: #ff4d4d;
  --violet: #9068ff;
  --garbage: #6b7377;
  --shadow: rgba(0, 0, 0, 0.45);
  --radius: 4px;
  --arena-width: 360px;
  --arena-height: 720px;
  --block-shadow: 0 18px 38px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --block-glow: 0 0 22px rgba(47, 244, 208, 0.14);
  --focus: 0 0 0 3px rgba(200, 255, 46, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 22% 18%, rgba(47, 244, 208, 0.1), transparent 32%),
    radial-gradient(circle at 78% 82%, rgba(200, 255, 46, 0.08), transparent 34%),
    linear-gradient(135deg, #050607 0%, #101519 48%, #07080a 100%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

#ambientCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  padding: 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
}

.app-shell > *,
.topbar,
main,
.play-screen,
.touch-controls {
  min-width: 0;
  max-width: 100%;
}

.app-shell.is-playing {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.plain-button,
.action-button,
.primary-button,
.mode-card,
.touch-controls button {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 38%),
    linear-gradient(180deg, var(--metal), var(--metal-dark)),
    var(--panel);
  box-shadow: var(--block-shadow);
  cursor: pointer;
  transition:
    transform 90ms ease,
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease;
}

.plain-button::after,
.action-button::after,
.primary-button::after,
.touch-controls button::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 10px;
  height: 10px;
  background: currentColor;
  opacity: 0.1;
  box-shadow: none;
  pointer-events: none;
}

.plain-button:hover,
.action-button:hover,
.primary-button:hover,
.mode-card:hover,
.touch-controls button:hover {
  transform: translate(-2px, -2px);
  border-color: rgba(200, 255, 46, 0.72);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.5), var(--block-glow), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.plain-button:active,
.action-button:active,
.primary-button:active,
.mode-card:active,
.touch-controls button:active {
  transform: translate(2px, 2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.48), inset 0 2px 12px rgba(0, 0, 0, 0.45);
}

.brand-button {
  justify-self: start;
  min-width: 176px;
  padding: 8px 12px 8px 8px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--ink);
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background:
    linear-gradient(135deg, var(--acid) 0 38%, var(--cyan) 38% 72%, var(--pink) 72%);
  color: #080908;
  font-weight: 950;
  font-size: 24px;
  box-shadow: 0 0 28px rgba(47, 244, 208, 0.28);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 17px;
  line-height: 1;
}

.brand-copy small {
  color: var(--muted);
  font-size: 12px;
}

.top-stats {
  justify-self: center;
  min-width: min(440px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 8px;
}

.top-stats div,
.record-strip,
.metric,
.result-grid div {
  min-width: 0;
  position: relative;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 45%),
    linear-gradient(180deg, rgba(40, 48, 52, 0.86), rgba(10, 13, 15, 0.82));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  padding: 8px 10px;
}

.top-stats span,
.record-strip span,
.metric span,
.panel-heading span,
.result-grid span,
.settings-grid label span,
.key-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.top-stats strong,
.record-strip strong,
.metric strong,
.panel-heading strong,
.result-grid strong {
  display: block;
  margin-top: 2px;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--acid);
}

.top-actions {
  justify-self: end;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.action-button,
.primary-button {
  min-width: 0;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 900;
  white-space: nowrap;
  text-transform: uppercase;
}

.primary-button {
  background:
    linear-gradient(135deg, rgba(200, 255, 46, 0.98), rgba(47, 244, 208, 0.92));
  color: #080908;
  border-color: rgba(200, 255, 46, 0.65);
}

main {
  min-height: 0;
}

.app-shell.is-playing main {
  overflow: hidden;
}

.menu-screen {
  width: min(1120px, 100%);
  min-height: calc(100vh - 132px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  align-content: center;
}

.menu-screen.is-hidden,
.play-screen.is-hidden,
.is-hidden {
  display: none !important;
}

.menu-hero {
  max-width: 760px;
  padding-top: 4vh;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--acid);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.menu-hero h1 {
  margin: 0;
  font-size: clamp(56px, 11vw, 142px);
  line-height: 0.8;
  text-transform: uppercase;
  text-shadow:
    0 0 20px rgba(200, 255, 46, 0.25),
    0 6px 0 rgba(255, 61, 129, 0.2);
}

.hero-copy {
  width: min(560px, 92vw);
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 24px);
  font-weight: 750;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.mode-card {
  position: relative;
  min-height: 178px;
  padding: 16px;
  display: grid;
  align-content: end;
  gap: 9px;
  overflow: hidden;
  text-align: left;
  border-width: 2px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(32, 39, 43, 0.9), rgba(8, 10, 12, 0.88));
}

.mode-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, currentColor 0 18px, transparent 18px 28px, currentColor 28px 46px, transparent 46px),
    linear-gradient(0deg, currentColor 0 18px, transparent 18px 28px, currentColor 28px 46px, transparent 46px);
  width: 92px;
  height: 92px;
  top: 12px;
  right: 12px;
  left: auto;
  bottom: auto;
  opacity: 0.055;
}

.mode-card::after {
  content: "";
  position: absolute;
  width: 64px;
  height: 64px;
  top: 14px;
  right: 14px;
  border: 0;
  background:
    linear-gradient(90deg, currentColor 0 18px, transparent 18px 25px, currentColor 25px 43px, transparent 43px),
    linear-gradient(0deg, currentColor 0 18px, transparent 18px 25px, currentColor 25px 43px, transparent 43px);
  opacity: 0.11;
  transform: rotate(0deg);
}

.mode-card > * {
  position: relative;
}

.mode-card strong {
  font-size: clamp(22px, 2vw, 30px);
  line-height: 0.95;
}

.mode-card span:last-child {
  max-width: 16ch;
  color: rgba(248, 255, 247, 0.75);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.25;
}

.mode-kicker {
  width: max-content;
  padding: 4px 8px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.42);
  color: currentColor;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.mode-card.hot {
  color: var(--acid);
}

.mode-card.blitz {
  color: var(--pink);
}

.mode-card.zen {
  color: var(--cyan);
}

.mode-card.duel {
  color: var(--amber);
}

.mode-card.custom {
  color: var(--violet);
}

.menu-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.play-screen {
  width: min(1160px, 100%);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(126px, 176px) var(--arena-width) minmax(126px, 176px);
  gap: 14px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.rail {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: center;
  max-height: min(100%, var(--arena-height));
}

.hud-panel {
  min-width: 0;
  position: relative;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 38%),
    linear-gradient(180deg, rgba(36, 43, 47, 0.88), rgba(9, 12, 14, 0.86)),
    var(--panel);
  box-shadow: var(--block-shadow), var(--block-glow);
  padding: 12px;
  overflow: hidden;
}

.hud-panel::after,
.record-strip::after,
.metric::after,
.top-stats div::after,
.result-grid div::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background: currentColor;
  opacity: 0.1;
  box-shadow: none;
  pointer-events: none;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-heading strong {
  max-width: 92px;
  color: var(--acid);
  font-size: 13px;
  text-align: right;
}

.hud-panel canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(20, 24, 27, 0.9), rgba(2, 3, 4, 0.92));
}

.stats-panel {
  display: grid;
  gap: 8px;
}

.metric {
  padding: 9px 10px;
}

.metric strong {
  color: var(--cyan);
}

.pressure-panel {
  min-height: 100px;
}

.meter {
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--acid), var(--amber), var(--red));
  transition: width 120ms ease;
}

.arena-column {
  min-width: 0;
}

.arena-frame {
  position: relative;
  width: var(--arena-width);
  height: var(--arena-height);
  margin: 0 auto;
  aspect-ratio: 1 / 2;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(24, 30, 34, 0.82), rgba(3, 4, 5, 0.82));
  box-shadow:
    0 0 0 1px rgba(200, 255, 46, 0.2) inset,
    8px 8px 0 rgba(0, 0, 0, 0.66),
    0 0 44px rgba(47, 244, 208, 0.13);
  overflow: hidden;
}

.arena-frame.is-shaking {
  animation: shake 130ms linear 1;
}

#boardCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--acid);
  font-size: clamp(72px, 18vw, 150px);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 0 34px rgba(200, 255, 46, 0.52);
  pointer-events: none;
}

.toast {
  position: absolute;
  left: 50%;
  top: 15%;
  transform: translateX(-50%);
  min-width: 160px;
  max-width: calc(100% - 32px);
  padding: 10px 12px;
  border: 1px solid rgba(200, 255, 46, 0.5);
  border-radius: var(--radius);
  background: rgba(7, 8, 10, 0.82);
  color: var(--ink);
  font-weight: 950;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

.spectator-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 203, 71, 0.58);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), transparent 42%),
    rgba(7, 8, 10, 0.86);
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.46);
  pointer-events: none;
}

.spectator-panel span,
.spectator-panel small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
}

.spectator-panel strong {
  color: var(--amber);
  font-size: clamp(16px, 2.6vw, 26px);
  line-height: 1;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.touch-controls {
  display: none;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.touch-controls button {
  min-width: 0;
  min-height: 48px;
  padding: 0 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  touch-action: manipulation;
}

.game-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(860px, calc(100dvh - 28px));
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(38, 45, 49, 0.92), rgba(8, 10, 12, 0.94)),
    var(--panel-strong);
  color: var(--ink);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.68), 0 28px 90px rgba(0, 0, 0, 0.62);
  overflow: hidden;
}

.game-dialog::backdrop {
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(4px);
}

.dialog-body {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 18px;
  max-height: calc(100dvh - 32px);
  overflow: auto;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.dialog-header h2 {
  margin: 0;
  font-size: clamp(28px, 6vw, 48px);
  line-height: 0.95;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.settings-grid label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  align-items: center;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), transparent 42%),
    rgba(0, 0, 0, 0.24);
}

.settings-grid input,
.settings-grid select {
  grid-column: 1 / -1;
  min-width: 0;
  color: var(--ink);
  accent-color: var(--acid);
  background: #111;
  border: 2px solid var(--line);
  border-radius: 2px;
  min-height: 38px;
  padding: 0 10px;
}

.settings-grid strong {
  color: var(--acid);
}

@media (max-width: 780px) {
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.key-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(0, 0, 0, 0.24);
}

.key-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(3px, -2px); }
  50% { transform: translate(-2px, 2px); }
  75% { transform: translate(2px, 1px); }
  100% { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .top-stats {
    grid-column: 1 / -1;
    order: 3;
    width: 100%;
  }

  .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-card {
    min-height: 152px;
  }

  .mode-card.custom {
    grid-column: 1 / -1;
  }

  .play-screen {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--arena-height) auto auto;
    align-items: start;
    align-content: start;
    justify-items: center;
    overflow: hidden;
  }

  .arena-column {
    order: 1;
  }

  .rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(100%, calc(var(--arena-width) * 1.75));
    max-height: none;
  }

  .rail-left {
    order: 2;
  }

  .rail-right {
    order: 3;
    grid-template-columns: 1fr 1fr;
  }

  .next-panel {
    grid-column: span 1;
  }

  .next-panel canvas {
    max-height: 180px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
    gap: 10px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .brand-button {
    width: calc(100vw - 20px);
    min-width: 0;
  }

  .brand-copy small {
    display: none;
  }

  .top-actions {
    justify-self: stretch;
    width: calc(100vw - 20px);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .action-button,
  .primary-button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 12px;
  }

  .top-stats {
    width: calc(100vw - 20px);
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .top-stats div {
    padding: 7px;
  }

  .menu-screen {
    min-height: auto;
  }

  .menu-hero {
    padding-top: 0;
  }

  .hero-copy {
    margin-top: 8px;
  }

  .mode-grid,
  .menu-footer {
    grid-template-columns: 1fr;
  }

  .mode-card {
    min-height: 126px;
  }

  .play-screen {
    width: calc(100vw - 20px);
    gap: 10px;
  }

  .arena-column {
    width: 100%;
    display: grid;
    place-items: center;
  }

  .arena-frame {
    width: var(--arena-width);
    height: var(--arena-height);
  }

  .rail,
  .rail-right {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stats-panel {
    grid-template-columns: 1fr;
  }

  .pressure-panel {
    min-height: 0;
  }

  .rival-panel {
    display: none;
  }

  .hud-panel {
    padding: 9px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.58);
  }

  .touch-controls {
    display: grid;
    width: calc(100vw - 20px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-self: end;
  }

  .settings-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    justify-content: stretch;
  }

  .dialog-actions button {
    flex: 1;
  }
}

@media (max-width: 360px) {
  .touch-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.app-shell:not(.is-playing) .touch-controls {
  display: none;
}

/* Route-shell redesign inspired by large competitive stacker menus. */
:root {
  --route-color: var(--acid);
  --slab-bg: rgba(24, 28, 36, 0.88);
}

body {
  background: #040609;
}

.identity-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(4, 5, 8, 0.92), rgba(8, 10, 15, 0.62)),
    url("assets/landscape-dawn.png") center / cover;
}

.identity-screen.is-hidden {
  display: none;
}

.identity-card {
  width: min(760px, 100%);
  display: grid;
  gap: 18px;
  padding: clamp(18px, 4vw, 34px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 34%),
    rgba(13, 17, 23, 0.9);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.7);
}

.identity-card h1 {
  margin: 0;
  font-size: clamp(54px, 12vw, 128px);
  line-height: 0.82;
}

.identity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.identity-grid label,
.join-bar input {
  display: grid;
  gap: 7px;
}

.identity-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.identity-grid input,
.join-bar input {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(2, 3, 5, 0.82);
  color: var(--ink);
  padding: 0 16px;
  font-size: 18px;
  font-weight: 850;
  text-transform: uppercase;
}

.identity-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.7fr;
  gap: 10px;
}

.identity-message {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.identity-message[data-tone="error"] {
  color: var(--red);
}

.identity-message[data-tone="warn"] {
  color: var(--amber);
}

.identity-message[data-tone="success"] {
  color: var(--acid);
}

.topbar {
  grid-template-columns: minmax(180px, 1fr) auto auto minmax(160px, 220px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-chip {
  justify-self: end;
  min-width: 150px;
  padding: 7px 9px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(4, 5, 7, 0.82);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  text-align: right;
}

.app-shell:not(.is-playing) .topbar {
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px);
}

.app-shell:not(.is-playing) .top-stats,
.app-shell:not(.is-playing) .top-actions {
  display: none;
}

.app-shell:not(.is-playing) .touch-controls {
  display: none;
}

.profile-chip strong,
.profile-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chip strong {
  font-size: 15px;
}

.profile-chip span {
  margin-top: 2px;
  color: #ff4d4d;
  font-weight: 950;
  text-transform: uppercase;
}

.menu-screen {
  width: min(1400px, 100%);
  min-height: calc(100vh - 108px);
  align-content: start;
}

.route-screen {
  display: none;
  width: 100%;
  padding-top: clamp(14px, 3vh, 34px);
}

.route-screen.is-active {
  display: grid;
  gap: 16px;
}

.route-stack {
  width: min(100%, 1320px);
  margin: 0 0 0 auto;
  display: grid;
  gap: 14px;
}

.route-stack.compact {
  width: min(100%, 1340px);
  margin-left: auto;
}

.route-slab {
  --slab-color: var(--route-color);
  position: relative;
  min-height: 118px;
  display: grid;
  grid-template-columns: 220px 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 12px 24px 12px 18px;
  border: 1px solid color-mix(in srgb, var(--slab-color) 55%, #000 45%);
  border-top-width: 3px;
  border-radius: 0;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--slab-color) 20%, transparent), transparent 35%),
    linear-gradient(90deg, color-mix(in srgb, var(--slab-color) 28%, #111 72%), rgba(12, 14, 18, 0.82));
  color: var(--slab-color);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.54);
  text-align: left;
}

.route-slab:hover {
  transform: translateX(-8px);
  border-color: var(--slab-color);
}

.slab-code {
  min-width: 0;
  font-size: clamp(62px, 7vw, 108px);
  font-weight: 950;
  line-height: 0.72;
  opacity: 0.92;
}

.slab-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.slab-copy strong {
  color: color-mix(in srgb, var(--slab-color) 72%, #fff 28%);
  font-size: clamp(34px, 4vw, 54px);
  line-height: 0.9;
  text-transform: uppercase;
}

.slab-copy small {
  color: color-mix(in srgb, var(--slab-color) 56%, #fff 44%);
  font-size: clamp(14px, 2vw, 22px);
  font-weight: 900;
  text-transform: uppercase;
}

.slab-count {
  min-width: 116px;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: clamp(28px, 4vw, 50px);
  font-weight: 950;
  text-align: center;
  text-transform: uppercase;
}

.route-mp { --slab-color: #ff74b9; }
.route-solo { --slab-color: #9c8dff; }
.route-channel { --slab-color: #62e66d; }
.route-config { --slab-color: #4fb9ff; }
.route-about { --slab-color: #b7b7b7; }
.route-quick { --slab-color: #ff834d; }
.route-league { --slab-color: #ff4d4d; }
.route-custom { --slab-color: #aebcff; }
.route-friend { --slab-color: #ffcb47; }
.route-list { --slab-color: #9bdad6; }
.room-hero { --slab-color: #d6a4ff; }
.solo-sprint { --slab-color: #c8ff2e; }
.solo-blitz { --slab-color: #ff3d81; }
.solo-zen { --slab-color: #2ff4d0; }
.solo-lab { --slab-color: #9068ff; }

.route-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.back-button {
  width: max-content;
  min-width: 126px;
}

.join-bar {
  width: min(1036px, 100%);
  margin-left: auto;
}

.locked-copy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(32, 0, 0, 0.68);
  color: #fff;
  font-size: clamp(24px, 4vw, 44px);
  font-weight: 950;
  text-transform: uppercase;
}

.route-league:not(.is-locked) .locked-copy {
  position: relative;
  inset: auto;
  justify-self: end;
  align-self: center;
  min-width: 176px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 48%),
    rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: clamp(15px, 1.7vw, 22px);
  line-height: 1.05;
  text-align: center;
}

.room-list {
  width: min(1226px, 100%);
  margin-left: auto;
  display: grid;
  gap: 14px;
}

.room-setup {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.2fr repeat(2, minmax(150px, 0.55fr));
  gap: 10px;
  margin-inline: auto;
}

.room-setup label {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--route-color) 42%, #fff 12%);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), transparent 42%),
    rgba(0, 0, 0, 0.28);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px) saturate(1.08);
}

.room-setup span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.room-setup input,
.room-setup select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 2px;
  background: rgba(3, 5, 8, 0.82);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.room-row {
  display: grid;
  grid-template-columns: minmax(170px, 260px) 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  border: 1px solid rgba(255, 184, 223, 0.32);
  border-radius: 0;
  background: rgba(44, 25, 36, 0.84);
  color: #ffb8df;
  padding: 10px 14px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.44);
  text-align: left;
}

.room-title {
  grid-row: 1 / -1;
  font-size: clamp(22px, 3vw, 36px);
  font-weight: 950;
  text-transform: uppercase;
}

.room-meta,
.room-rules {
  color: rgba(255, 218, 240, 0.58);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.room-meta {
  align-self: end;
}

.room-rules {
  align-self: start;
}

.room-row strong {
  grid-row: 1 / -1;
  font-size: clamp(24px, 3vw, 40px);
}

.channel-panel {
  width: min(1220px, 100%);
  margin-left: auto;
}

.player-hub {
  gap: 14px;
}

.profile-hero,
.hub-panel {
  border: 1px solid color-mix(in srgb, var(--route-color) 45%, #fff 12%);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 38%),
    rgba(8, 12, 15, 0.84);
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.54),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px) saturate(1.08);
}

.profile-hero {
  width: min(1220px, 100%);
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: clamp(16px, 2.4vw, 28px);
}

.profile-hero h2 {
  margin: 0;
  color: var(--route-color);
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.82;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.hub-copy {
  max-width: 62ch;
  margin: 10px 0 0;
  color: color-mix(in srgb, var(--route-color) 48%, #fff 52%);
  font-size: clamp(13px, 1.4vw, 17px);
  font-weight: 850;
  text-transform: uppercase;
}

.profile-actions {
  display: flex;
  gap: 8px;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.channel-grid div {
  min-height: 120px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--route-color) 48%, #fff 16%);
  background: rgba(14, 18, 22, 0.82);
}

.channel-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.channel-grid strong {
  display: block;
  margin-top: 10px;
  color: var(--route-color);
  font-size: clamp(22px, 2.6vw, 38px);
  overflow-wrap: anywhere;
}

.hub-panels {
  width: min(1220px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 14px;
}

.hub-panel {
  min-width: 0;
  padding: clamp(14px, 2vw, 20px);
}

.hub-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 12px;
}

.hub-panel-heading span,
.recent-run span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.hub-panel-heading strong {
  display: block;
  color: var(--route-color);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 0.95;
  text-transform: uppercase;
}

.leader-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.leader-tab {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  cursor: pointer;
}

.leader-tab.is-active {
  border-color: var(--route-color);
  background: color-mix(in srgb, var(--route-color) 22%, rgba(0, 0, 0, 0.36));
  color: #fff;
}

.hub-status {
  min-height: 18px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.leaderboard-rows,
.recent-runs {
  display: grid;
  gap: 8px;
}

.leaderboard-row,
.recent-run,
.leaderboard-empty,
.recent-empty {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 42%),
    rgba(0, 0, 0, 0.22);
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 10px;
}

.leader-rank {
  color: var(--route-color);
  font-size: 18px;
  font-weight: 950;
}

.leader-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.leader-main strong,
.leader-score,
.recent-run strong {
  color: var(--ink);
  font-weight: 950;
  text-transform: uppercase;
}

.leader-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-main small,
.recent-run small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.leader-score {
  color: var(--route-color);
  font-size: clamp(18px, 2vw, 26px);
}

.recent-run {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 10px;
}

.recent-run small {
  grid-column: 1 / -1;
}

.leaderboard-empty,
.recent-empty {
  padding: 14px;
  color: var(--muted);
  font-weight: 850;
  text-transform: uppercase;
}

.menu-footer {
  width: min(1120px, 100%);
  margin-left: auto;
}

.play-screen {
  backdrop-filter: none;
}

.hud-panel,
.top-stats div,
.record-strip,
.profile-chip,
.route-slab,
.room-row {
  backdrop-filter: blur(2px);
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .profile-chip {
    grid-column: 1 / -1;
    width: 100%;
  }

  .app-shell:not(.is-playing) .profile-chip {
    grid-column: auto;
    width: auto;
  }

  .route-slab {
    grid-template-columns: 132px 1fr;
    min-height: 104px;
    gap: 16px;
  }

  .slab-count {
    grid-column: 1 / -1;
    justify-self: end;
    min-width: 0;
    font-size: 22px;
    padding: 8px 12px;
  }

  .channel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hub-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .identity-grid,
  .identity-actions,
  .channel-grid {
    grid-template-columns: 1fr;
  }

  .room-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }

  .room-setup {
    grid-template-columns: 1fr;
  }

  .room-title {
    grid-row: 1;
  }

  .room-meta,
  .room-rules {
    grid-column: 1 / -1;
  }

  .room-row strong {
    grid-row: 1;
  }

  .route-screen {
    padding-top: 8px;
  }

  .route-stack,
  .route-stack.compact,
  .room-list,
  .channel-panel,
  .join-bar,
  .menu-footer {
    width: 100%;
    margin-left: 0;
  }

  .route-slab {
    grid-template-columns: 86px 1fr;
    min-height: 92px;
    padding: 10px;
  }

  .route-league:not(.is-locked) .locked-copy {
    grid-column: 1 / -1;
    justify-self: stretch;
    min-width: 0;
  }

  .profile-hero,
  .hub-panel-heading {
    display: grid;
    align-items: start;
  }

  .profile-actions,
  .leader-tabs {
    justify-content: stretch;
  }

  .leader-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaderboard-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .leader-score {
    grid-column: 2;
    justify-self: start;
  }

  .slab-code {
    font-size: 44px;
  }

  .slab-copy strong {
    font-size: 25px;
  }

  .slab-copy small {
    font-size: 12px;
  }
}

/* Floating depth remix: the landscape sits farther back while controls hover close. */
#ambientCanvas {
  filter: blur(1.15px) brightness(0.68) saturate(0.82);
  transform: scale(1.018);
  transform-origin: center;
}

body:not([data-route="play"]) #ambientCanvas {
  filter: blur(0.45px) brightness(0.86) saturate(1.08);
  transform: scale(1.008);
}

body[data-route="play"] #ambientCanvas {
  filter: blur(1.15px) brightness(0.68) saturate(0.82);
  transform: scale(1.018);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.08), transparent 28%),
    radial-gradient(circle at 84% 16%, rgba(47, 244, 208, 0.08), transparent 24%),
    linear-gradient(90deg, rgba(2, 3, 7, 0.38), transparent 18%, transparent 74%, rgba(2, 3, 7, 0.56)),
    linear-gradient(180deg, rgba(2, 3, 7, 0.3), transparent 36%, rgba(2, 3, 7, 0.62));
}

.app-shell {
  z-index: 2;
  isolation: isolate;
  perspective: 1300px;
  perspective-origin: 50% 42%;
}

.topbar {
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(31, 36, 41, 0.78), rgba(7, 9, 12, 0.78));
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.56),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(14px) saturate(1.12);
  transform: none;
}

.app-shell:not(.is-playing) .topbar {
  width: min(1180px, calc(100% - 24px));
  margin-inline: auto;
  transform: translateZ(70px);
}

.profile-chip,
.brand-button,
.top-stats div,
.top-actions .plain-button {
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.menu-screen {
  width: 100%;
  perspective: 1380px;
  perspective-origin: 50% 35%;
}

.route-screen {
  padding-top: clamp(10px, 2.3vh, 28px);
}

.route-screen.is-active {
  gap: clamp(14px, 2vh, 22px);
}

.route-stack,
.route-stack.compact {
  position: relative;
  width: min(1180px, calc(100% - 44px));
  margin-inline: auto;
  gap: clamp(12px, 1.9vh, 20px);
  transform-style: preserve-3d;
}

.route-stack::before {
  content: "";
  position: absolute;
  inset: 8% 10% -7%;
  z-index: -1;
  border-radius: 36px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.62), transparent 64%);
  filter: blur(22px);
  opacity: 0.86;
  transform: translateZ(-130px);
  pointer-events: none;
}

.route-slab {
  --float-x: 0px;
  --float-z: 54px;
  --tilt-y: -2.4deg;
  width: 100%;
  min-height: clamp(86px, 11.5vh, 112px);
  border-width: 1px;
  border-top-width: 2px;
  border-radius: 2px;
  overflow: visible;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent 39%),
    linear-gradient(180deg, color-mix(in srgb, var(--slab-color) 18%, rgba(37, 42, 48, 0.88)), rgba(9, 11, 14, 0.82)),
    rgba(12, 15, 20, 0.84);
  box-shadow:
    0 34px 88px rgba(0, 0, 0, 0.64),
    0 10px 24px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(11px) saturate(1.12);
  transform: translate3d(var(--float-x), 0, var(--float-z)) rotateY(var(--tilt-y));
  transform-style: preserve-3d;
  transition:
    transform 130ms ease,
    border-color 130ms ease,
    box-shadow 130ms ease,
    background 130ms ease;
}

.route-slab::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 0;
  border: 1px solid color-mix(in srgb, var(--slab-color) 26%, transparent);
  box-shadow:
    18px 0 0 -17px color-mix(in srgb, var(--slab-color) 62%, transparent),
    -18px 0 0 -17px rgba(255, 255, 255, 0.16);
  opacity: 0.66;
  pointer-events: none;
}

.route-slab::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: -20px;
  left: 28px;
  z-index: -1;
  height: 24px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.78), transparent 70%);
  filter: blur(12px);
  opacity: 0.76;
  pointer-events: none;
  transform: translateZ(-80px);
}

.route-slab:hover {
  border-color: color-mix(in srgb, var(--slab-color) 82%, #fff 18%);
  box-shadow:
    0 42px 102px rgba(0, 0, 0, 0.68),
    0 0 34px color-mix(in srgb, var(--slab-color) 18%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    inset 0 -1px 0 rgba(0, 0, 0, 0.42);
  transform: translate3d(calc(var(--float-x) - 10px), -4px, 92px) rotateY(-0.8deg);
}

.route-slab:active {
  transform: translate3d(calc(var(--float-x) - 3px), 2px, 34px) rotateY(var(--tilt-y)) scale(0.995);
}

.slab-code,
.slab-copy,
.slab-count {
  position: relative;
  z-index: 1;
}

.slab-code {
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.36),
    0 0 22px color-mix(in srgb, var(--slab-color) 24%, transparent);
}

.slab-code {
  font-size: clamp(54px, 6vw, 96px);
}

.slab-copy strong {
  font-size: clamp(30px, 3.4vw, 48px);
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.slab-copy small {
  font-size: clamp(12px, 1.55vw, 18px);
  display: block;
  min-width: 0;
  max-width: 100%;
  line-height: 1.12;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.slab-count {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 46%),
    rgba(0, 0, 0, 0.34);
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

#homeRoute .route-slab:nth-child(1) {
  width: min(100%, 1020px);
  justify-self: start;
  --float-x: -24px;
  --tilt-y: 4deg;
}

#homeRoute .route-slab:nth-child(2) {
  width: min(92%, 960px);
  justify-self: end;
  --float-x: 26px;
  --tilt-y: -4deg;
}

#homeRoute .route-slab:nth-child(3) {
  width: min(100%, 1120px);
  justify-self: center;
  --float-x: 0px;
  --float-z: 68px;
  --tilt-y: -1.5deg;
}

#homeRoute .route-slab:nth-child(4) {
  width: min(88%, 920px);
  justify-self: start;
  --float-x: -12px;
  --tilt-y: 3deg;
}

#homeRoute .route-slab:nth-child(5) {
  width: min(82%, 860px);
  justify-self: end;
  --float-x: 18px;
  --tilt-y: -3.4deg;
}

.route-stack.compact .route-slab:nth-child(odd) {
  width: min(96%, 1050px);
  justify-self: start;
  --float-x: -18px;
  --tilt-y: 3.2deg;
}

.route-stack.compact .route-slab:nth-child(even) {
  width: min(92%, 1000px);
  justify-self: end;
  --float-x: 22px;
  --tilt-y: -3.2deg;
}

.route-stack.compact .route-slab:first-child {
  width: min(100%, 1110px);
  --float-z: 72px;
}

.locked-copy {
  z-index: 3;
  padding: 12px 24px;
  background:
    linear-gradient(90deg, rgba(34, 0, 0, 0.86), rgba(34, 0, 0, 0.56)),
    rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(5px);
  font-size: clamp(18px, 2.6vw, 34px);
  line-height: 1.06;
  text-align: center;
  overflow-wrap: anywhere;
}

.route-toolbar,
.join-bar,
.room-list,
.channel-panel,
.menu-footer {
  width: min(1080px, calc(100% - 56px));
  margin-inline: auto;
}

.route-toolbar {
  transform: translateZ(80px);
}

.join-bar,
.channel-panel,
.menu-footer {
  transform: translateZ(64px);
}

.join-bar input,
.channel-grid div,
.room-row,
.menu-footer,
.back-button {
  border-radius: 2px;
  backdrop-filter: blur(10px) saturate(1.08);
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.54),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.back-button {
  min-width: 112px;
}

.room-list {
  gap: 13px;
  perspective: 1200px;
}

.room-row {
  width: min(100%, 1030px);
  justify-self: center;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), transparent 40%),
    linear-gradient(180deg, rgba(56, 36, 48, 0.82), rgba(20, 14, 20, 0.78));
  transform: translateZ(46px);
}

.room-row:nth-child(even) {
  width: min(94%, 1000px);
  justify-self: end;
  transform: translate3d(18px, 0, 38px) rotateY(-1.8deg);
}

.room-row:nth-child(odd) {
  justify-self: start;
  transform: translate3d(-12px, 0, 48px) rotateY(1.8deg);
}

.play-screen {
  perspective: 1180px;
  perspective-origin: 50% 46%;
}

.rail {
  transform: translateZ(30px);
}

.hud-panel {
  border-color: rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), transparent 40%),
    linear-gradient(180deg, rgba(38, 45, 49, 0.78), rgba(7, 9, 11, 0.76));
  box-shadow:
    0 26px 68px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px) saturate(1.08);
}

.arena-frame {
  box-shadow:
    0 0 0 1px rgba(200, 255, 46, 0.18) inset,
    0 34px 90px rgba(0, 0, 0, 0.68),
    0 0 42px rgba(47, 244, 208, 0.14);
  transform: translateZ(48px);
}

@media (max-width: 960px) {
  .app-shell {
    perspective: 980px;
  }

  .app-shell:not(.is-playing) .topbar {
    transform: translateZ(44px);
  }

  .route-stack,
  .route-stack.compact {
    width: min(100%, calc(100% - 20px));
  }

  #homeRoute .route-slab,
  .route-stack.compact .route-slab,
  .route-stack.compact .route-slab:nth-child(odd),
  .route-stack.compact .route-slab:nth-child(even) {
    width: 100%;
  }

  #homeRoute .route-slab:nth-child(odd) {
    justify-self: start;
    --float-x: -8px;
    --tilt-y: 1.8deg;
  }

  #homeRoute .route-slab:nth-child(even) {
    justify-self: end;
    --float-x: 8px;
    --tilt-y: -1.8deg;
  }

  .route-toolbar,
  .join-bar,
  .room-list,
  .channel-panel,
  .menu-footer {
    width: min(100%, calc(100% - 18px));
  }
}

@media (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
  }

  #ambientCanvas {
    filter: blur(0.65px) brightness(0.64) saturate(0.84);
    transform: scale(1.01);
  }

  body:not([data-route="play"]) #ambientCanvas {
    filter: blur(0.25px) brightness(0.84) saturate(1.04);
    transform: scale(1.004);
  }

  body::before {
    background:
      linear-gradient(90deg, rgba(2, 3, 7, 0.46), transparent 24%, transparent 72%, rgba(2, 3, 7, 0.58)),
      linear-gradient(180deg, rgba(2, 3, 7, 0.18), transparent 38%, rgba(2, 3, 7, 0.68));
  }

  .app-shell {
    perspective: none;
  }

  .app-shell:not(.is-playing) .topbar {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .app-shell:not(.is-playing) .profile-chip {
    justify-self: stretch;
    width: 100%;
    text-align: left;
  }

  .topbar,
  .route-toolbar,
  .join-bar,
  .channel-panel,
  .menu-footer,
  .rail,
  .arena-frame {
    transform: none;
  }

  .locked-copy {
    padding: 10px;
    font-size: 19px;
  }

  .route-stack,
  .route-stack.compact,
  .route-toolbar,
  .join-bar,
  .room-list,
  .channel-panel,
  .menu-footer {
    width: 100%;
  }

  .route-stack::before,
  .route-slab::after {
    display: none;
  }

  .route-slab {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    min-height: 84px;
    padding: 9px;
    overflow: hidden;
  }

  .slab-code {
    font-size: 38px;
  }

  .slab-copy {
    gap: 4px;
  }

  .slab-copy strong {
    font-size: 22px;
    line-height: 0.96;
  }

  .slab-copy small {
    font-size: 9px;
    line-height: 1.12;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #homeRoute .route-slab,
  #homeRoute .route-slab:nth-child(1),
  #homeRoute .route-slab:nth-child(2),
  #homeRoute .route-slab:nth-child(3),
  #homeRoute .route-slab:nth-child(4),
  #homeRoute .route-slab:nth-child(5),
  .route-stack.compact .route-slab,
  .route-stack.compact .route-slab:nth-child(odd),
  .route-stack.compact .route-slab:nth-child(even),
  .route-stack.compact .route-slab:first-child {
    width: 100%;
    justify-self: stretch;
    --float-x: 0px;
    --float-z: 0px;
    --tilt-y: 0deg;
    transform: none;
  }

  .route-slab:hover,
  .route-slab:active {
    transform: translateY(-2px);
  }

  .room-row,
  .room-row:nth-child(even),
  .room-row:nth-child(odd) {
    width: 100%;
    justify-self: stretch;
    transform: none;
  }
}

/* Checker-card menu remix: smaller floating blocks instead of wide menu slabs. */
.app-shell:not(.is-playing) .route-screen {
  padding-top: clamp(12px, 2.4vh, 30px);
}

.app-shell:not(.is-playing) .route-stack,
.app-shell:not(.is-playing) .route-stack.compact {
  width: min(1040px, calc(100% - 48px));
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: minmax(138px, auto);
  gap: 14px;
  margin-inline: auto;
  transform-style: preserve-3d;
}

.app-shell:not(.is-playing) .route-stack::before {
  inset: 4% 8% -9%;
  border-radius: 18px;
  background:
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0.68), transparent 66%),
    linear-gradient(90deg, transparent 0 49%, rgba(255, 255, 255, 0.06) 49% 51%, transparent 51%),
    linear-gradient(0deg, transparent 0 49%, rgba(255, 255, 255, 0.05) 49% 51%, transparent 51%);
  background-size: auto, 64px 64px, 64px 64px;
  opacity: 0.76;
}

.app-shell:not(.is-playing) .route-slab,
.app-shell:not(.is-playing) .route-screen > .route-slab {
  --float-x: 0px;
  --float-z: 64px;
  --tilt-y: 0deg;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 138px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  align-content: stretch;
  align-items: start;
  gap: 10px;
  padding: 14px;
  overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 36%),
    repeating-conic-gradient(
      from 45deg,
      color-mix(in srgb, var(--slab-color) 26%, rgba(255, 255, 255, 0.06)) 0 25%,
      rgba(3, 5, 8, 0.2) 0 50%
    ) 0 0 / 34px 34px,
    linear-gradient(180deg, color-mix(in srgb, var(--slab-color) 20%, rgba(35, 41, 48, 0.84)), rgba(7, 9, 12, 0.86));
  background-blend-mode: normal, soft-light, normal;
  box-shadow:
    0 28px 68px rgba(0, 0, 0, 0.62),
    0 0 0 1px color-mix(in srgb, var(--slab-color) 34%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.52);
  transform: translate3d(var(--float-x), 0, var(--float-z)) rotateY(var(--tilt-y));
}

.app-shell:not(.is-playing) .route-slab::before {
  inset: 9px;
  border: 1px solid color-mix(in srgb, var(--slab-color) 34%, transparent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--slab-color) 46%, transparent) 0 10px, transparent 10px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.16) 0 10px, transparent 10px);
  background-size: 100% 100%, 100% 100%;
  opacity: 0.72;
}

.app-shell:not(.is-playing) .route-slab::after {
  right: 16px;
  bottom: -18px;
  left: 16px;
  height: 22px;
}

.app-shell:not(.is-playing) .route-slab:hover {
  transform: translate3d(var(--float-x), -6px, 104px) rotateY(var(--tilt-y));
}

.app-shell:not(.is-playing) .route-slab:active {
  transform: translate3d(var(--float-x), 1px, 46px) rotateY(var(--tilt-y)) scale(0.992);
}

.app-shell:not(.is-playing) .slab-code {
  align-self: start;
  font-size: clamp(36px, 4.6vw, 66px);
  line-height: 0.82;
}

.app-shell:not(.is-playing) .slab-copy {
  min-width: 0;
  max-width: 100%;
  align-self: end;
  gap: 5px;
  overflow: hidden;
}

.app-shell:not(.is-playing) .slab-copy strong {
  font-size: clamp(19px, 2.2vw, 31px);
  line-height: 0.98;
}

.app-shell:not(.is-playing) .slab-copy small {
  font-size: clamp(9px, 1vw, 13px);
  line-height: 1.15;
}

.app-shell:not(.is-playing) .slab-count {
  justify-self: end;
  align-self: end;
  min-width: 0;
  padding: 8px 10px;
  font-size: clamp(18px, 2.4vw, 32px);
}

.app-shell:not(.is-playing) #homeRoute .route-slab:nth-child(1),
.app-shell:not(.is-playing) #homeRoute .route-slab:nth-child(3),
.app-shell:not(.is-playing) .route-stack.compact .route-slab:nth-child(1),
.app-shell:not(.is-playing) .route-stack.compact .route-slab:nth-child(2),
.app-shell:not(.is-playing) .route-stack.compact .route-slab:nth-child(3),
.app-shell:not(.is-playing) .route-stack.compact .route-slab:nth-child(4) {
  grid-column: span 2;
}

.app-shell:not(.is-playing) #homeRoute .route-slab:nth-child(1),
.app-shell:not(.is-playing) .route-stack.compact .route-slab:nth-child(odd) {
  --float-x: -10px;
  --tilt-y: 2.2deg;
}

.app-shell:not(.is-playing) #homeRoute .route-slab:nth-child(2),
.app-shell:not(.is-playing) #homeRoute .route-slab:nth-child(4),
.app-shell:not(.is-playing) .route-stack.compact .route-slab:nth-child(even) {
  --float-x: 10px;
  --tilt-y: -2.2deg;
}

.app-shell:not(.is-playing) #homeRoute .route-slab:nth-child(5) {
  --float-z: 78px;
}

.app-shell:not(.is-playing) #roomsRoute > .route-slab,
.app-shell:not(.is-playing) #customRoomRoute > .route-slab,
.app-shell:not(.is-playing) .config-actions > .route-slab {
  width: min(520px, 100%);
  margin-inline: auto;
}

.app-shell:not(.is-playing) .locked-copy {
  padding: 10px;
  font-size: clamp(15px, 2vw, 24px);
}

@media (max-width: 960px) {
  .app-shell:not(.is-playing) .route-stack,
  .app-shell:not(.is-playing) .route-stack.compact {
    width: min(720px, calc(100% - 22px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(126px, auto);
  }

  .app-shell:not(.is-playing) #homeRoute .route-slab:nth-child(1),
  .app-shell:not(.is-playing) #homeRoute .route-slab:nth-child(3),
  .app-shell:not(.is-playing) .route-stack.compact .route-slab:nth-child(1),
  .app-shell:not(.is-playing) .route-stack.compact .route-slab:nth-child(2),
  .app-shell:not(.is-playing) .route-stack.compact .route-slab:nth-child(3),
  .app-shell:not(.is-playing) .route-stack.compact .route-slab:nth-child(4) {
    grid-column: span 1;
  }
}

@media (max-width: 640px) {
  .app-shell:not(.is-playing) .route-screen {
    padding-top: 14px;
  }

  .app-shell:not(.is-playing) .route-stack,
  .app-shell:not(.is-playing) .route-stack.compact {
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(112px, auto);
    gap: 10px;
  }

  .app-shell:not(.is-playing) .route-slab,
  .app-shell:not(.is-playing) .route-screen > .route-slab {
    min-height: 112px;
    padding: 11px;
    gap: 7px;
    transform: none;
  }

  .app-shell:not(.is-playing) .route-slab:hover,
  .app-shell:not(.is-playing) .route-slab:active {
    transform: translateY(-2px);
  }

  .app-shell:not(.is-playing) .slab-code {
    font-size: 31px;
  }

  .app-shell:not(.is-playing) .slab-copy strong {
    font-size: 17px;
  }

  .app-shell:not(.is-playing) .slab-copy small {
    max-height: 2.4em;
    font-size: 8.5px;
  }

  .app-shell:not(.is-playing) .slab-count {
    font-size: 18px;
  }
}

@media (max-width: 560px) {
  .app-shell:not(.is-playing) .menu-screen {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    overflow: hidden;
  }

  .app-shell:not(.is-playing) .route-stack,
  .app-shell:not(.is-playing) .route-stack.compact {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(92px, auto);
  }

  .app-shell:not(.is-playing) .route-slab,
  .app-shell:not(.is-playing) .route-screen > .route-slab {
    min-height: 92px;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
  }

  .app-shell:not(.is-playing) .slab-code {
    font-size: 34px;
  }

  .app-shell:not(.is-playing) .slab-copy {
    align-self: center;
  }

  .app-shell:not(.is-playing) .slab-copy strong {
    font-size: 19px;
  }

  .app-shell:not(.is-playing) .slab-copy small {
    max-height: none;
  }
}

.route-league:not(.is-locked) .locked-copy {
  position: relative;
  inset: auto;
  justify-self: end;
  align-self: center;
  min-width: 176px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 48%),
    rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: clamp(15px, 1.7vw, 22px);
  line-height: 1.05;
  text-align: center;
}

@media (max-width: 640px) {
  .route-league:not(.is-locked) .locked-copy {
    grid-column: 1 / -1;
    justify-self: stretch;
    min-width: 0;
  }
}

.home-loop {
  width: min(1180px, calc(100% - 44px));
  margin-inline: auto;
  display: grid;
  gap: 12px;
  transform: translateZ(70px);
}

.home-callout,
.loop-strip {
  border: 1px solid color-mix(in srgb, var(--acid) 46%, #fff 10%);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), transparent 40%),
    linear-gradient(180deg, rgba(28, 35, 35, 0.86), rgba(5, 8, 9, 0.82));
  box-shadow:
    0 28px 74px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px) saturate(1.08);
}

.home-callout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  min-height: 156px;
  padding: clamp(16px, 2.4vw, 28px);
}

.home-callout h2 {
  margin: 0;
  color: var(--acid);
  font-size: clamp(42px, 7vw, 84px);
  line-height: 0.82;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.loop-copy {
  margin: 10px 0 0;
  color: color-mix(in srgb, var(--acid) 48%, #fff 52%);
  font-size: clamp(13px, 1.5vw, 18px);
  font-weight: 900;
  text-transform: uppercase;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-width: min(230px, 36vw);
}

.home-actions .primary-button,
.home-actions .action-button {
  min-height: 52px;
}

.loop-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.loop-strip div {
  min-width: 0;
  padding: 13px 16px;
  background: rgba(0, 0, 0, 0.22);
}

.loop-strip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.loop-strip strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: clamp(16px, 1.8vw, 24px);
  line-height: 1;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell:not(.is-playing) #homeRoute {
  align-content: start;
}

.app-shell:not(.is-playing) #homeRoute .route-stack {
  margin-top: 2px;
}

.app-shell:not(.is-playing) #homeRoute .route-about {
  opacity: 0.82;
}

@media (max-width: 960px) {
  .home-loop {
    width: min(720px, calc(100% - 22px));
    transform: translateZ(44px);
  }

  .home-callout {
    grid-template-columns: 1fr;
  }

  .home-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .home-loop {
    width: calc(100vw - 20px);
    max-width: 100%;
    margin-inline: 0;
    transform: none;
  }

  .home-callout {
    min-height: 0;
    min-width: 0;
    padding: 14px;
    overflow: hidden;
  }

  .home-actions,
  .loop-strip {
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
  }

  .home-actions .primary-button,
  .home-actions .action-button {
    width: 100%;
    min-width: 0;
  }

  .loop-strip strong {
    white-space: normal;
  }
}
