:root {
  color-scheme: dark;
  --bg: #050905;
  --panel: rgba(12, 19, 10, 0.88);
  --line: rgba(230, 205, 120, 0.15);
  --line-strong: rgba(241, 211, 120, 0.28);
  --text: #fffdf3;
  --text-soft: #d2cfb5;
  --text-dim: #888a6f;
  --cyan: #f2c94c;
  --cyan-bright: #fff0a8;
  --mint: #9bdc7b;
  --gold: #ffb84d;
  --coral: #ff7a79;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.54);
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -8%, rgba(120, 156, 38, 0.2), transparent 37%),
    radial-gradient(circle at 88% 74%, rgba(238, 171, 39, 0.08), transparent 34%),
    linear-gradient(180deg, #090e07 0%, var(--bg) 63%);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button,
a {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(239, 205, 92, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(239, 205, 92, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.28;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
}

.ambient-orb-a {
  top: -34vw;
  left: 13vw;
  width: 66vw;
  height: 58vw;
  background: radial-gradient(circle, rgba(159, 183, 44, 0.17), transparent 68%);
  animation: breathe 18s ease-in-out infinite alternate;
}

.ambient-orb-b {
  right: -22vw;
  bottom: -30vw;
  width: 60vw;
  height: 55vw;
  background: radial-gradient(circle, rgba(242, 186, 51, 0.1), transparent 68%);
  animation: breathe 22s ease-in-out infinite alternate-reverse;
}

.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1240px, calc(100% - 56px));
  height: 84px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 232, 145, 0.38);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, rgba(255, 230, 125, 0.25), rgba(12, 16, 8, 0.95) 68%);
  color: var(--cyan-bright);
  font-size: 16px;
  font-weight: 700;
  box-shadow: inset 0 0 18px rgba(242, 201, 76, 0.14);
}

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-copy strong {
  font-size: 18px;
  letter-spacing: 0.04em;
}

.brand-copy small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav-link,
.sound-button,
.back-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 14px;
}

.nav-link:hover,
.back-button:hover {
  color: var(--text);
}

.nav-quiet {
  color: var(--text-dim);
}

.sound-button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 11px;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 56px));
  min-height: calc(100vh - 168px);
  margin: 0 auto;
}

.screen {
  animation: reveal 480ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.home-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(430px, 0.95fr);
  gap: clamp(54px, 8vw, 112px);
  align-items: center;
  min-height: calc(100vh - 168px);
  padding: 54px 0 90px;
}

.eyebrow,
.micro-label {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 25px;
}

.eyebrow span {
  color: var(--cyan);
}

.home-copy h1 {
  margin: 0;
  font-size: clamp(58px, 7vw, 94px);
  font-weight: 650;
  letter-spacing: -0.06em;
  line-height: 1.02;
}

.home-copy h1 em {
  background: linear-gradient(92deg, #ffffff 4%, #ffe07b 46%, #9bdc7b 94%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: normal;
  white-space: nowrap;
}

.home-lede {
  max-width: 610px;
  margin: 32px 0 0;
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1.9;
}

.home-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 36px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 52px;
  padding: 0 19px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.primary-button {
  min-width: 220px;
  border: 1px solid rgba(255, 238, 164, 0.55);
  background: linear-gradient(110deg, #ffe27e, #f2b93e 54%, #ffcf58);
  color: #1a1203;
  font-size: 15px;
  font-weight: 700;
}

.secondary-button {
  min-height: 47px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-soft);
  font-size: 13px;
}

.primary-button:hover {
  transform: translateY(-2px);
}

.secondary-button:hover {
  border-color: rgba(255, 224, 123, 0.42);
  color: var(--text);
}

.best-score {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
}

.best-score strong {
  color: var(--gold);
  font-size: 16px;
}

.how-to-play {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

.how-to-play span {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 11px;
}

.how-to-play b {
  margin-right: 7px;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 9px;
}

.home-object-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 26px;
}

.guide-object {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.028);
}

.guide-nectar {
  border-color: rgba(255, 216, 85, 0.2);
}

.guide-pollen {
  border-color: rgba(255, 177, 74, 0.24);
}

.guide-thorn {
  border-color: rgba(255, 113, 121, 0.22);
}

.guide-object > span:last-child {
  min-width: 0;
}

.guide-object strong,
.guide-object small {
  display: block;
}

.guide-object strong {
  font-size: 12px;
}

.guide-object small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-symbol {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  flex: none;
  border-radius: 9px;
  font-family: var(--font-mono);
  font-size: 17px;
}

.guide-nectar .guide-symbol {
  border: 1px solid rgba(255, 216, 85, 0.36);
  background: rgba(255, 208, 60, 0.09);
  color: #ffe279;
  box-shadow: 0 0 16px rgba(255, 205, 60, 0.12);
}

.guide-pollen .guide-symbol {
  border: 1px solid rgba(255, 177, 74, 0.4);
  background: rgba(255, 153, 49, 0.1);
  color: #ffc15a;
}

.guide-thorn .guide-symbol {
  border: 1px solid rgba(255, 113, 121, 0.36);
  background: rgba(255, 93, 108, 0.09);
  color: #ff8790;
}

.home-setup {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(255, 226, 122, 0.22);
  border-radius: 17px;
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 214, 80, 0.08), transparent 34%),
    rgba(6, 11, 6, 0.9);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.035),
    0 14px 32px rgba(0, 0, 0, 0.16);
}

.setup-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.setup-heading > span {
  flex: none;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.setup-heading strong {
  flex: none;
  font-size: 13px;
  white-space: nowrap;
}

.setup-heading small {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 12px;
  margin-top: 12px;
}

.setup-field {
  min-width: 0;
}

.setup-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--text-soft);
  font-size: 10px;
}

.setup-label small {
  color: var(--text-dim);
  font-size: 8px;
}

.setup-segmented,
.player-count-picker {
  display: grid;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(255, 237, 176, 0.12);
  border-radius: 10px;
  background: rgba(1, 4, 2, 0.48);
}

.setup-segmented {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.player-count-picker {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.setup-segmented button,
.player-count-picker button {
  min-width: 0;
  min-height: 37px;
  padding: 4px 5px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.setup-segmented button b,
.setup-segmented button small {
  display: block;
}

.setup-segmented button b {
  color: var(--text-soft);
  font-size: 10px;
}

.setup-segmented button small {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 6px;
  letter-spacing: 0.08em;
}

.player-count-picker button {
  font-family: var(--font-mono);
  font-size: 11px;
}

.setup-segmented button:hover,
.player-count-picker button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.setup-segmented button[aria-pressed="true"],
.player-count-picker button[aria-pressed="true"] {
  border-color: rgba(255, 225, 126, 0.26);
  background: rgba(255, 207, 71, 0.13);
  color: #ffe585;
}

.setup-segmented button[aria-pressed="true"] b {
  color: #ffe585;
}

.setup-segmented button:disabled,
.player-count-picker button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}

.setup-music-field {
  grid-column: 1 / -1;
}

.setup-race-field {
  grid-column: 1 / -1;
}

.music-picker {
  position: relative;
  z-index: 30;
}

.music-picker-trigger {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid rgba(255, 237, 176, 0.2);
  border-radius: 10px;
  background: linear-gradient(120deg, rgba(255, 221, 105, 0.06), rgba(1, 4, 2, 0.64));
  color: var(--text-soft);
  cursor: pointer;
  font-size: 10px;
  text-align: left;
}

.music-picker-trigger:hover,
.music-picker-trigger[aria-expanded="true"] {
  border-color: rgba(255, 225, 126, 0.4);
  background: linear-gradient(120deg, rgba(255, 221, 105, 0.11), rgba(1, 4, 2, 0.72));
}

.music-picker-trigger i {
  width: 7px;
  height: 7px;
  flex: none;
  border-right: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

.music-picker-trigger[aria-expanded="true"] i {
  transform: translateY(2px) rotate(225deg);
}

.music-mode-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  z-index: 80;
  max-height: 300px;
  padding: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(255, 222, 113, 0.28);
  border-radius: 13px;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 208, 75, 0.09), transparent 32%),
    rgba(5, 10, 6, 0.98);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.58);
  scrollbar-color: rgba(255, 212, 92, 0.42) rgba(255, 255, 255, 0.04);
  scrollbar-width: thin;
}

.music-mode-menu[hidden] {
  display: none;
}

.music-mode-menu.opens-up {
  top: auto;
  bottom: calc(100% + 7px);
}

.music-mode-group + .music-mode-group {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 230, 150, 0.08);
}

.music-mode-group > span {
  display: block;
  padding: 4px 8px 6px;
  color: var(--gold);
  font: 8px/1.3 var(--font-mono);
  letter-spacing: 0.12em;
}

.music-mode-option {
  display: block;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 10px;
  text-align: left;
}

.music-mode-option small {
  display: block;
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 8px;
  line-height: 1.35;
}

.music-mode-option:hover,
.music-mode-option:focus-visible,
.music-mode-option[aria-selected="true"] {
  border-color: rgba(255, 225, 126, 0.22);
  background: rgba(255, 211, 78, 0.09);
  color: var(--text);
}

.home-rulebook {
  margin-top: 16px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(110deg, rgba(255, 220, 105, 0.035), transparent 55%),
    rgba(255, 255, 255, 0.012);
}

.rules-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.rules-line {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-items: baseline;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.55;
}

.rules-line + .rules-line {
  margin-top: 5px;
}

.rules-line b {
  color: var(--text-soft);
  font-weight: 600;
}

.preview-stage {
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 20%, rgba(184, 155, 34, 0.18), transparent 45%),
    linear-gradient(145deg, rgba(22, 31, 12, 0.95), rgba(7, 10, 5, 0.99));
  box-shadow: var(--shadow);
}

.preview-topline,
.preview-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.preview-visual {
  position: relative;
  margin: 15px 0 10px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(255, 225, 128, 0.2);
  border-radius: 19px;
  background: #070b06;
}

.preview-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 220ms ease, transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

.preview-visual.is-switching img {
  opacity: 0.18;
  transform: scale(1.025);
}

.preview-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 7, 3, 0.06) 35%, rgba(3, 7, 3, 0.88)),
    radial-gradient(circle at 50% 62%, transparent 25%, rgba(2, 5, 2, 0.34) 100%);
}

.preview-caption {
  position: absolute;
  right: 18px;
  bottom: 16px;
  left: 18px;
  display: grid;
  gap: 3px;
}

.preview-caption span {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.14em;
}

.preview-caption strong {
  font-size: 23px;
  letter-spacing: -0.03em;
}

.preview-caption small {
  color: var(--text-soft);
  font-size: 10px;
}

.preview-scenes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-bottom: 12px;
}

.preview-scenes button {
  display: grid;
  gap: 2px;
  padding: 7px 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.015);
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 8px;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.preview-scenes button b {
  font-size: 9px;
}

.preview-scenes button span {
  font-family: var(--font-sans);
  font-size: 9px;
}

.preview-scenes button:hover,
.preview-scenes button.is-active {
  border-color: rgba(255, 220, 105, 0.3);
  background: rgba(255, 210, 72, 0.07);
  color: var(--text);
}

.perspective-field {
  position: relative;
  height: 500px;
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid rgba(229, 211, 119, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(rgba(225, 204, 109, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(225, 204, 109, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, #101908, #030603);
  background-size: 100% 44px, 33.333% 100%, auto;
  perspective: 540px;
}

.perspective-field::after {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, transparent 0 10%, rgba(2, 5, 10, 0.8) 72%);
  content: "";
}

.horizon-glow {
  position: absolute;
  top: 35%;
  left: 50%;
  width: 170px;
  height: 110px;
  background: radial-gradient(ellipse, rgba(255, 212, 92, 0.36), transparent 70%);
  filter: blur(12px);
  transform: translateX(-50%);
}

.rail {
  position: absolute;
  top: 22%;
  bottom: -12%;
  width: 1px;
  background: linear-gradient(transparent, rgba(255, 212, 92, 0.48), rgba(155, 220, 123, 0.1));
  transform-origin: top center;
}

.rail-left {
  left: 18%;
  transform: rotate(15deg);
}

.rail-mid-left {
  left: 40%;
  transform: rotate(4deg);
}

.rail-mid-right {
  right: 40%;
  transform: rotate(-4deg);
}

.rail-right {
  right: 18%;
  transform: rotate(-15deg);
}

.ring {
  position: absolute;
  left: 50%;
  border: 1px solid rgba(255, 212, 92, 0.2);
  border-radius: 50%;
  transform: translateX(-50%) rotateX(72deg);
  animation: ring-pass 5s linear infinite;
}

.ring-a {
  top: 18%;
  width: 160px;
  height: 160px;
}

.ring-b {
  top: 31%;
  width: 250px;
  height: 250px;
  animation-delay: -1.8s;
}

.ring-c {
  top: 48%;
  width: 370px;
  height: 370px;
  animation-delay: -3.2s;
}

.node {
  position: absolute;
  z-index: 2;
  border-radius: 50%;
  animation: node-approach 4.8s linear infinite;
}

.node-signal {
  left: calc(50% - 8px);
  width: 16px;
  height: 16px;
  background: var(--cyan);
  box-shadow: 0 0 22px var(--cyan);
}

.node-evidence {
  left: calc(18% - 7px);
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: var(--gold);
  box-shadow: 0 0 20px var(--gold);
  transform: rotate(45deg);
  animation-delay: -2s;
}

.node-noise {
  right: calc(18% - 8px);
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: var(--coral);
  box-shadow: 0 0 20px var(--coral);
  animation-delay: -3.4s;
}

.ship {
  position: absolute;
  bottom: 58px;
  left: calc(50% - 27px);
  z-index: 3;
  width: 54px;
  height: 38px;
  border-radius: 52% 48% 46% 54%;
  background:
    linear-gradient(90deg, transparent 16%, #19170d 16% 29%, transparent 29% 61%, #19170d 61% 74%, transparent 74%),
    linear-gradient(180deg, #fff0a8, #f2b93e 48%, #c37c17);
  box-shadow: 0 0 24px rgba(255, 205, 75, 0.38);
  filter: drop-shadow(0 0 16px rgba(255, 212, 92, 0.42));
}

.ship::before,
.ship::after {
  position: absolute;
  top: -13px;
  width: 31px;
  height: 20px;
  border: 1px solid rgba(232, 255, 249, 0.5);
  border-radius: 70% 30% 70% 30%;
  background: rgba(220, 252, 255, 0.13);
  content: "";
  box-shadow: 0 0 18px rgba(220, 252, 255, 0.16);
}

.ship::before {
  left: -21px;
  transform: rotate(-18deg);
}

.ship::after {
  right: -21px;
  transform: rotate(18deg) scaleX(-1);
}

.game-screen {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: clamp(30px, 4vw, 52px);
  align-items: center;
  min-height: calc(100vh - 168px);
  padding: 40px 0 70px;
}

.game-screen:fullscreen {
  display: block;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(139, 157, 45, 0.13), transparent 42%),
    #050805;
}

.game-screen:fullscreen .game-status {
  display: none;
}

.game-screen:fullscreen .play-shell {
  width: 100%;
  height: 100%;
  max-width: none;
  padding: 0;
}

.game-screen:fullscreen .scene-frame {
  height: 100%;
}

.game-screen:fullscreen #three-container {
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
}

.game-status {
  display: flex;
  flex-direction: column;
  align-self: center;
  min-width: 0;
}

.screen-exit-button {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 9;
  display: none;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(255, 238, 171, 0.26);
  border-radius: 999px;
  background: rgba(4, 8, 4, 0.8);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.game-screen:fullscreen .screen-exit-button {
  display: inline-flex;
  align-items: center;
}

.game-screen:fullscreen .play-shell,
.game-screen:fullscreen .scene-frame {
  min-width: 0;
}

.game-screen:fullscreen .scene-frame {
  border-radius: 18px;
}

.game-screen:fullscreen .in-game-hud {
  inset: 12px;
}

.game-screen:fullscreen .hud-metrics {
  bottom: 18px;
}

.game-screen:fullscreen .mini-map {
  bottom: 16px;
  left: 16px;
}

.game-screen:fullscreen .screen-exit-button {
  right: 18px;
  bottom: 18px;
}

.game-status {
  align-self: center;
}

.back-button {
  color: var(--text-dim);
}

.game-utility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 26px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 231, 144, 0.1);
}

.fullscreen-button {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
}

.fullscreen-button:hover {
  border-color: rgba(255, 220, 105, 0.35);
  color: var(--text);
}

.micro-label {
  margin: 0 0 9px;
  color: var(--cyan);
  font-size: 9px;
}

.zone-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 0;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
}

.zone-meta b {
  color: var(--text-soft);
  font-weight: 500;
}

.zone-meta > span:first-child {
  color: var(--zone-accent, var(--cyan));
}

.score-block {
  margin-top: 14px;
}

.score-block span,
.status-grid span {
  display: block;
  color: var(--text-dim);
  font-size: 10px;
}

.ai-score-card {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(111, 224, 255, 0.18);
  border-radius: 13px;
  background:
    linear-gradient(120deg, rgba(85, 218, 255, 0.06), transparent 68%),
    rgba(255, 255, 255, 0.014);
}

.ai-score-head,
.ai-score-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-score-head {
  color: var(--text-soft);
  font-size: 10px;
}

.ai-score-head small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 8px;
}

.ai-score-line {
  margin-top: 7px;
  color: var(--text-dim);
  font-size: 9px;
}

.ai-score-line strong {
  color: #94edff;
  font-family: var(--font-mono);
  font-size: 11px;
}

.player-chip {
  display: inline-grid;
  min-width: 22px;
  height: 16px;
  place-items: center;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1;
}

.player-chip.p1 {
  border: 1px solid rgba(255, 215, 83, 0.4);
  background: rgba(255, 199, 51, 0.11);
  color: #ffe17b;
}

.player-chip.p2 {
  border: 1px solid rgba(84, 218, 255, 0.36);
  background: rgba(84, 218, 255, 0.1);
  color: #8aeaff;
}

.player-chip.p3 {
  border: 1px solid rgba(255, 111, 200, 0.38);
  background: rgba(255, 111, 200, 0.1);
  color: #ff9ad9;
}

.player-chip.p4 {
  border: 1px solid rgba(155, 220, 123, 0.38);
  background: rgba(155, 220, 123, 0.1);
  color: #b8ef9e;
}

.player-chip.p5 {
  border: 1px solid rgba(255, 148, 102, 0.38);
  background: rgba(255, 148, 102, 0.1);
  color: #ffb690;
}

.score-block strong {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 68px;
  letter-spacing: -0.06em;
  line-height: 1;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 28px;
}

.status-grid div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.018);
}

.status-grid strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 17px;
}

.status-grid .combo-stat {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--combo-color) 8%, transparent), transparent 68%),
    rgba(255, 255, 255, 0.018);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.combo-stat strong {
  color: var(--combo-color);
  text-shadow: 0 0 16px color-mix(in srgb, var(--combo-color) 40%, transparent);
}

.combo-stat small {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-pips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  margin-top: 8px;
}

.combo-pips i {
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  transition: background 150ms ease, box-shadow 150ms ease;
}

.combo-pips i.is-filled {
  background: var(--combo-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--combo-color) 55%, transparent);
}

.combo-stat.is-hit {
  border-color: color-mix(in srgb, var(--combo-color) 44%, transparent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--combo-color) 11%, transparent);
  transform: translateY(-1px);
}

.rule-card {
  min-height: 134px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: rgba(56, 189, 248, 0.035);
}

.rule-card.is-active {
  border-color: rgba(244, 201, 108, 0.5);
  background: rgba(244, 201, 108, 0.055);
}

.rule-state {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.rule-card strong {
  display: block;
  margin-top: 11px;
  font-size: 22px;
}

.rule-card p {
  margin: 9px 0 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.65;
}

.object-legend {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 231, 144, 0.08);
  border-bottom: 1px solid rgba(255, 231, 144, 0.08);
  color: var(--text-dim);
  font-size: 10px;
}

.player-legend {
  display: none;
  gap: 16px;
  margin-top: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
}

.player-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.player-orbit {
  width: 15px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.player-orbit.p2 {
  color: #64dff4;
}

.player-orbit.p1 {
  color: #ffd45c;
}

.player-orbit.p3 {
  color: #ff6fc8;
}

.player-orbit.p4 {
  color: #9bdc7b;
}

.player-orbit.p5 {
  color: #ff9466;
}

.object-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  white-space: nowrap;
}

.object-icon {
  position: relative;
  display: inline-grid;
  width: 13px;
  height: 13px;
  place-items: center;
  flex: none;
}

.object-signal {
  border: 1px solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.object-signal::after {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--cyan-bright);
  content: "";
}

.object-evidence {
  border: 1px solid var(--gold);
  transform: rotate(45deg) scale(0.78);
  box-shadow: 0 0 8px rgba(244, 201, 108, 0.34);
}

.object-noise::before,
.object-noise::after {
  position: absolute;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--coral);
  box-shadow: 0 0 7px rgba(255, 134, 120, 0.34);
  content: "";
}

.object-noise::before {
  transform: rotate(45deg);
}

.object-noise::after {
  transform: rotate(-45deg);
}

.controls-desktop {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 231, 144, 0.08);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
}

.controls-desktop span:last-child {
  margin-left: 0;
  text-align: left;
}

.play-shell {
  width: min(100%, 900px);
  justify-self: end;
}

.in-game-hud {
  position: absolute;
  inset: 13px 15px;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 0.9fr) minmax(0, 1.18fr);
  grid-template-rows: max-content;
  gap: 10px;
  align-items: stretch;
  align-content: start;
  pointer-events: none;
}

.in-game-hud.is-solo {
  grid-template-columns: minmax(180px, 0.82fr) minmax(220px, 1fr);
}

.in-game-hud.is-solo .hud-roster-panel {
  display: none;
}

.hud-panel {
  display: flex;
  height: 100%;
  min-height: 0;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 9px 11px;
  border: 1px solid rgba(255, 237, 176, 0.12);
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(4, 9, 5, 0.1), rgba(12, 18, 8, 0.018));
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.1),
    inset 0 1px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(6px) saturate(1.04);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.82);
}

.hud-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-score,
.hud-rival-score {
  display: block;
  margin-top: 2px;
  color: #fff6c9;
  font-family: var(--font-mono);
  font-size: 30px;
  line-height: 1;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.8),
    0 0 18px rgba(255, 213, 77, 0.2);
}

.hud-rival-score {
  color: #a9f1ff;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.8),
    0 0 18px rgba(94, 222, 255, 0.2);
}

.hud-hearts {
  display: flex;
  gap: 4px;
  margin-top: 5px;
}

.hud-player-panel > small,
.hud-combo-panel > small,
.hud-rival-panel > small,
.hud-roster-panel > small {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-player-panel > small b {
  color: var(--gold);
  font-family: var(--font-mono);
}

.hud-player-panel > small {
  margin-top: auto;
  padding-top: 7px;
}

.hud-combo-panel {
  justify-content: center;
  gap: 2px;
  text-align: center;
}

.hud-combo-panel.is-hit {
  animation: hud-chain-bump 280ms cubic-bezier(0.2, 1.4, 0.36, 1);
}

.hud-chain-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-top: 3px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.hud-chain-row strong {
  color: var(--combo-color);
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.04em;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.85),
    0 0 20px color-mix(in srgb, var(--combo-color) 36%, transparent);
}

.hud-combo-panel .combo-pips {
  max-width: 112px;
  margin: 7px auto 0;
}

.hud-rival-panel,
.hud-roster-panel {
  text-align: right;
}

.hud-rival-panel .hud-kicker {
  justify-content: flex-end;
}

.hud-rival-meta {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 8px;
}

.hud-rival-meta b {
  color: #a9f1ff;
  font-family: var(--font-mono);
  font-weight: 500;
}

.hud-roster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.hud-roster-head b {
  color: var(--text-soft);
  font-size: 8px;
  font-weight: 500;
}

.hud-roster-grid {
  display: grid;
  flex: 1;
  grid-auto-rows: minmax(20px, 1fr);
  gap: 3px;
  margin-top: 5px;
}

.hud-roster-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 3px 6px 3px 8px;
  border-left: 2px solid var(--roster-color, var(--cyan));
  border-radius: 5px;
  background: color-mix(in srgb, var(--roster-color, var(--cyan)) 3%, rgba(2, 5, 3, 0.12));
}

.hud-roster-person {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 7px;
}

.hud-roster-person b {
  color: var(--roster-color, var(--cyan));
  font-size: 7px;
}

.hud-roster-person span {
  overflow: hidden;
  color: var(--text-soft);
  font-family: var(--font-sans);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-roster-score {
  color: var(--roster-color, var(--cyan));
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-shadow: 0 0 12px color-mix(in srgb, var(--roster-color, var(--cyan)) 22%, transparent);
}

.hud-roster-hearts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 31px;
  font-size: 9px;
  line-height: 1;
}

.roster-heart {
  color: rgba(255, 255, 255, 0.14);
  font-style: normal;
  text-shadow: none;
}

.roster-heart.is-full {
  color: #ff5964;
  text-shadow: 0 0 7px rgba(255, 74, 86, 0.32);
}

.roster-heart.is-half {
  color: rgba(255, 89, 100, 0.58);
}

.hud-roster-item.is-out {
  opacity: 0.42;
}

.hud-metrics {
  position: absolute;
  bottom: 14px;
  left: 50%;
  display: flex;
  gap: 6px;
  transform: translateX(-50%);
}

.hud-metrics > span {
  padding: 5px 8px;
  border: 1px solid rgba(255, 236, 171, 0.13);
  border-radius: 999px;
  background: rgba(5, 10, 6, 0.58);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 8px;
  white-space: nowrap;
  backdrop-filter: blur(5px);
}

.hud-metrics strong {
  color: var(--text);
  font-size: 9px;
  font-weight: 500;
}

.hud-metrics #flight-profile.is-climb,
.hud-metrics #flight-profile.is-descent {
  color: inherit;
}

@keyframes hud-chain-bump {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.035);
    border-color: color-mix(in srgb, var(--combo-color) 46%, transparent);
    box-shadow:
      0 8px 18px rgba(0, 0, 0, 0.22),
      0 0 20px color-mix(in srgb, var(--combo-color) 12%, transparent),
      inset 0 1px rgba(255, 255, 255, 0.08);
  }
  100% {
    transform: scale(1);
  }
}

.play-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
}

.play-hud strong {
  color: var(--text);
  font-size: 12px;
}

#hud-combo {
  color: var(--combo-color);
  text-shadow: 0 0 12px color-mix(in srgb, var(--combo-color) 38%, transparent);
  transition: color 160ms ease, text-shadow 160ms ease;
}

#lives-value {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #ff626c;
  text-shadow: 0 0 12px rgba(255, 74, 86, 0.25);
}

#flight-profile.is-climb {
  color: var(--mint);
}

#flight-profile.is-descent {
  color: var(--coral);
}

.heart-icon {
  display: inline-flex;
  width: 15px;
  height: 14px;
}

.heart-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.heart-icon .heart-base {
  fill: transparent;
  stroke: rgba(232, 227, 211, 0.26);
  stroke-width: 1.8;
}

.heart-icon .heart-fill {
  fill: #ff5e6a;
  stroke: none;
  filter: drop-shadow(0 0 5px rgba(255, 75, 90, 0.3));
}

.heart-icon.is-half .heart-fill {
  clip-path: inset(0 50% 0 0);
}

.heart-icon.is-empty .heart-fill {
  display: none;
}

.scene-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: #02060d;
  box-shadow: var(--shadow);
  --combo-color: #38bdf8;
  --player-boost-color: #ffd45c;
}

#three-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  touch-action: none;
}

#three-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.zone-tint {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 84%, color-mix(in srgb, var(--zone-accent) 10%, transparent), transparent 54%),
    linear-gradient(180deg, color-mix(in srgb, var(--zone-accent) 3%, transparent), transparent 28%);
  mix-blend-mode: screen;
  opacity: 0.09;
  pointer-events: none;
  transition: background 700ms ease, opacity 700ms ease;
}

.boost-veil {
  position: absolute;
  inset: -16%;
  z-index: 4;
  background:
    repeating-conic-gradient(
      from 8deg at 50% 58%,
      transparent 0deg 7deg,
      color-mix(in srgb, var(--player-boost-color) 32%, transparent) 7.4deg 7.8deg,
      transparent 8.2deg 17deg
    );
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  mask-image: radial-gradient(circle at 50% 58%, transparent 0 26%, #000 62%, transparent 91%);
  transform: scale(1.12);
  transition: opacity 180ms ease;
}

.scene-frame.is-boosting .boost-veil {
  opacity: 0.48;
  animation: boost-streak 320ms linear infinite;
}

.lateral-veil {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  transition: opacity 90ms ease-out;
}

.scene-frame.is-lateral-left .lateral-veil {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--player-boost-color) 20%, transparent),
    transparent 22% 100%
  );
  box-shadow: inset 20px 0 34px color-mix(in srgb, var(--player-boost-color) 11%, transparent);
  opacity: 0.38;
}

.scene-frame.is-lateral-right .lateral-veil {
  background: linear-gradient(
    -90deg,
    color-mix(in srgb, var(--player-boost-color) 20%, transparent),
    transparent 22% 100%
  );
  box-shadow: inset -20px 0 34px color-mix(in srgb, var(--player-boost-color) 11%, transparent);
  opacity: 0.38;
}

.scene-frame.is-boosting {
  border-color: color-mix(in srgb, var(--player-boost-color) 48%, transparent);
  box-shadow:
    0 0 42px color-mix(in srgb, var(--player-boost-color) 14%, transparent),
    var(--shadow);
}

.scene-frame.is-braking {
  border-color: rgba(143, 229, 196, 0.34);
  box-shadow:
    0 0 32px rgba(123, 211, 172, 0.08),
    var(--shadow);
}

.scene-frame.is-braking .boost-veil {
  opacity: 0.08;
  animation: none;
}

.impact-flash {
  position: absolute;
  inset: 0;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
}

.impact-flash.is-nectar {
  background: radial-gradient(circle at 50% 58%, rgba(255, 224, 94, 0.3), transparent 30%);
  animation: impact-flash 360ms ease-out both;
}

.impact-flash.is-pollen {
  background:
    radial-gradient(circle at 50% 56%, rgba(255, 238, 152, 0.42), transparent 26%),
    linear-gradient(180deg, rgba(255, 165, 45, 0.08), transparent 58%);
  animation: impact-flash 520ms ease-out both;
}

.impact-flash.is-heal {
  background: radial-gradient(circle at 50% 58%, rgba(133, 255, 186, 0.28), transparent 36%);
  animation: impact-flash 560ms ease-out both;
}

.impact-flash.is-thorn {
  background: radial-gradient(circle at 50% 58%, rgba(255, 78, 77, 0.3), transparent 55%);
  animation: thorn-flash 520ms ease-out both;
}

.impact-text {
  position: absolute;
  bottom: 18%;
  left: 50%;
  z-index: 6;
  padding: 7px 13px;
  border: 1px solid rgba(255, 224, 116, 0.32);
  border-radius: 999px;
  background: rgba(10, 16, 7, 0.82);
  color: var(--cyan-bright);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  pointer-events: none;
  transform: translateX(-50%);
  animation: impact-copy 760ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.impact-text.is-pollen {
  border-color: rgba(255, 184, 77, 0.46);
  color: #ffe08a;
  font-size: 14px;
}

.impact-text.is-thorn {
  border-color: rgba(255, 122, 121, 0.48);
  color: #ffb1ad;
}

.impact-text.is-heal {
  border-color: rgba(133, 255, 186, 0.42);
  color: #a7ffd0;
  font-size: 13px;
}

.mini-map {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 5;
  width: 168px;
  height: 103px;
  border: 1px solid rgba(255, 225, 128, 0.22);
  border-radius: 14px;
  background: rgba(5, 10, 6, 0.34);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  opacity: 0.78;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

run-telemetry {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  width: min(300px, calc(100% - 28px));
  pointer-events: none;
}

.game-screen:fullscreen run-telemetry {
  right: 18px;
  bottom: 68px;
}

.start-countdown {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 54%, rgba(11, 33, 48, 0.26), transparent 25%),
    linear-gradient(180deg, rgba(1, 4, 9, 0.3), rgba(1, 4, 9, 0.76));
  text-align: center;
  pointer-events: none;
}

.start-countdown::before,
.start-countdown::after {
  position: absolute;
  left: 50%;
  width: min(72%, 620px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79, 221, 255, 0.52), transparent);
  content: "";
  transform: translateX(-50%);
}

.start-countdown::before {
  top: 32%;
}

.start-countdown::after {
  bottom: 29%;
}

.start-countdown > span {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.26em;
  animation: countdown-copy 420ms ease both;
}

.start-countdown > strong {
  min-width: 330px;
  color: #f6fbff;
  font-family: var(--font-mono);
  font-size: clamp(72px, 9vw, 118px);
  font-weight: 700;
  letter-spacing: -0.085em;
  line-height: 0.88;
  text-indent: -0.085em;
  text-shadow:
    0 0 20px rgba(79, 221, 255, 0.25),
    0 0 64px rgba(79, 221, 255, 0.14);
  animation: countdown-word 720ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.start-countdown > small {
  color: rgba(220, 239, 248, 0.62);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  animation: countdown-copy 480ms 60ms ease both;
}

.start-countdown.is-set > strong {
  color: var(--gold);
  text-shadow:
    0 0 22px rgba(244, 201, 108, 0.3),
    0 0 62px rgba(244, 201, 108, 0.16);
}

.start-countdown.is-go > strong {
  color: #8fffc5;
  text-shadow:
    0 0 24px rgba(125, 226, 177, 0.34),
    0 0 72px rgba(125, 226, 177, 0.2);
  animation: countdown-go 820ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.countdown-track {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  gap: 5px;
  margin-top: 5px;
}

.countdown-track i {
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  transform-origin: left;
}

.start-countdown[data-stage="1"] .countdown-track i:nth-child(1),
.start-countdown[data-stage="2"] .countdown-track i:nth-child(-n + 2),
.start-countdown[data-stage="3"] .countdown-track i,
.start-countdown[data-stage="4"] .countdown-track i {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(244, 201, 108, 0.52);
}

.webgl-fallback {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 24px;
  color: var(--text-soft);
  text-align: center;
}

.rule-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 5;
  min-width: 280px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
  transform: translateX(-50%);
  animation: banner-in 220ms ease both;
}

.rule-banner span {
  display: block;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.98);
}

.rule-banner strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.98), 0 0 28px rgba(0, 0, 0, 0.78);
}

.rule-banner small {
  display: block;
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 10px;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.98);
}

.zone-transition {
  position: absolute;
  top: 188px;
  left: 22px;
  width: min(30%, 300px);
  z-index: 7;
  display: grid;
  place-content: start;
  padding: 0;
  gap: 5px;
  background: transparent;
  text-align: left;
  pointer-events: none;
  animation: zone-shift 1.6s ease both;
}

.zone-transition span {
  color: var(--zone-accent, var(--cyan));
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-shadow: 0 0 16px rgba(0, 0, 0, 0.95), 0 0 24px rgba(0, 0, 0, 0.72);
}

.zone-transition strong {
  padding: 0;
  background: linear-gradient(180deg, #fff7c8, #f2c94c 52%, #9a6b12);
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 1px 0 rgba(57, 36, 2, 0.95))
    drop-shadow(0 4px 0 rgba(74, 48, 5, 0.52))
    drop-shadow(0 9px 20px rgba(0, 0, 0, 0.82));
  font-size: clamp(22px, 2.4vw, 32px);
  letter-spacing: -0.035em;
  transform: perspective(620px) rotateX(4deg);
}

.zone-transition small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.96);
}

.combo-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 1px solid color-mix(in srgb, var(--combo-color) 32%, transparent);
  border-radius: inherit;
  box-shadow:
    inset 0 0 26px color-mix(in srgb, var(--combo-color) 10%, transparent),
    0 0 26px color-mix(in srgb, var(--combo-color) 8%, transparent);
  opacity: 0.16;
  pointer-events: none;
  transition: opacity 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.combo-flash {
  position: absolute;
  top: 30%;
  right: 4%;
  z-index: 6;
  min-width: 170px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: right;
  transform: none;
  pointer-events: none;
  animation: combo-side 1.05s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.combo-flash::before,
.combo-flash::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--combo-color) 24%, transparent);
  border-radius: 50%;
  content: "";
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: combo-ring 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.combo-flash::after {
  animation-delay: 90ms;
}

.combo-flash span {
  color: var(--combo-color);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.96);
}

.combo-flash strong {
  display: block;
  margin-top: 2px;
  color: var(--combo-color);
  font-family: var(--font-mono);
  font-size: 52px;
  letter-spacing: -0.07em;
  line-height: 1;
  text-shadow:
    0 0 8px rgba(0, 0, 0, 0.9),
    0 0 24px color-mix(in srgb, var(--combo-color) 38%, transparent);
}

.combo-flash em {
  display: block;
  margin-top: 2px;
  color: #fff7d2;
  font-family: var(--font-sans);
  font-size: 22px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow:
    0 0 12px color-mix(in srgb, var(--combo-color) 62%, transparent),
    0 2px 0 rgba(0, 0, 0, 0.7);
}

.combo-flash small {
  display: block;
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 11px;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.94);
}

.end-overlay,
.paused-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2, 6, 13, 0.7);
  backdrop-filter: blur(8px);
}

.end-overlay.is-lives-out {
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 72, 62, 0.11), transparent 36%),
    rgba(8, 3, 7, 0.78);
}

.end-card {
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
  width: min(420px, 100%);
  max-height: calc(100% - 18px);
  padding: 20px 22px;
  overflow: hidden;
  border: 1px solid rgba(149, 233, 255, 0.28);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(13, 26, 48, 0.98), rgba(5, 9, 16, 0.99));
  box-shadow: var(--shadow);
}

.end-overlay.is-lives-out .end-card {
  border-color: rgba(255, 111, 97, 0.46);
  background: linear-gradient(145deg, rgba(40, 13, 22, 0.98), rgba(7, 6, 12, 0.99));
  box-shadow:
    0 0 54px rgba(255, 72, 62, 0.12),
    var(--shadow);
}

.end-overlay.is-lives-out .micro-label,
.end-overlay.is-lives-out .final-score {
  color: var(--coral);
}

.end-card h2 {
  margin: 4px 0 1px;
  font-size: 25px;
}

.final-score {
  color: var(--cyan-bright);
  font-family: var(--font-mono);
  font-size: 46px;
  font-weight: 650;
  letter-spacing: -0.07em;
  line-height: 1;
}

.final-note {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.final-trace {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
}

.final-trace strong {
  color: var(--text-soft);
  font-weight: 600;
}

.final-stats {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.final-stats span {
  flex: 1;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text-dim);
  font-size: 10px;
}

.final-stats strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
}

.final-standings {
  display: grid;
  min-height: 0;
  gap: 2px;
  margin-top: 8px;
  padding-top: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
}

.final-standing {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--standing-color, var(--cyan)) 5%, rgba(255, 255, 255, 0.015));
  color: var(--text-dim);
  font-size: 9px;
}

.final-standing.is-winner {
  border: 1px solid color-mix(in srgb, var(--standing-color, var(--cyan)) 30%, transparent);
  background: color-mix(in srgb, var(--standing-color, var(--cyan)) 10%, rgba(255, 255, 255, 0.02));
}

.final-standing-rank {
  color: var(--standing-color, var(--cyan));
  font-family: var(--font-mono);
}

.final-standing-person {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.final-standing-person b,
.final-standing-person span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.final-standing-person b {
  color: var(--standing-color, var(--cyan));
  font-family: var(--font-mono);
  font-size: 8px;
}

.final-standing-person span {
  color: var(--text-soft);
}

.final-standing-score {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(7, 9, 12, 0.94) 26%);
}

.end-actions .primary-button {
  min-width: 150px;
}

.paused-overlay {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 213, 77, 0.1), transparent 34%),
    rgba(3, 7, 5, 0.72);
  font-family: var(--font-mono);
}

.pause-card {
  width: min(370px, 100%);
  padding: 30px;
  border: 1px solid rgba(255, 224, 112, 0.28);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(24, 31, 12, 0.97), rgba(7, 11, 6, 0.99));
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.54),
    inset 0 1px rgba(255, 255, 255, 0.06);
  text-align: center;
}

.pause-kicker {
  color: var(--gold);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.pause-card h2 {
  margin: 12px 0 9px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 32px;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.pause-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 1.8;
}

.pause-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 24px;
}

.pause-actions .primary-button {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.pause-actions .secondary-button {
  justify-content: center;
  min-height: 44px;
  padding-inline: 12px;
}

.pause-shortcut {
  display: block;
  margin-top: 15px;
  color: var(--text-dim);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.mobile-controls {
  display: none;
}

.site-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1240px, calc(100% - 56px));
  min-height: 84px;
  margin: 0 auto;
  border-top: 1px solid rgba(157, 204, 255, 0.08);
  color: var(--text-dim);
  font-size: 11px;
}

.site-footer p {
  margin: 0;
}

.site-footer div {
  display: flex;
  gap: 20px;
}

.site-footer a:hover {
  color: var(--text);
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 80;
  padding: 11px 17px;
  border: 1px solid rgba(149, 233, 255, 0.3);
  border-radius: 999px;
  background: rgba(7, 15, 27, 0.96);
  color: var(--text);
  font-size: 12px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.noscript {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 12px;
  border-radius: 10px;
  background: var(--panel);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes breathe {
  from {
    transform: scale(0.96);
    opacity: 0.74;
  }
  to {
    transform: scale(1.06);
    opacity: 1;
  }
}

@keyframes ring-pass {
  0% {
    opacity: 0;
    transform: translateX(-50%) rotateX(72deg) scale(0.25);
  }
  30% {
    opacity: 0.76;
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) rotateX(72deg) scale(1.45);
  }
}

@keyframes node-approach {
  0% {
    top: 14%;
    opacity: 0;
    transform: scale(0.3);
  }
  15% {
    opacity: 1;
  }
  100% {
    top: 88%;
    opacity: 0.25;
    transform: scale(1.8);
  }
}

@keyframes banner-in {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes combo-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.78);
  }
  22% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.04);
  }
  78% {
    opacity: 1;
    transform: translate(-50%, -4px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -16px) scale(0.98);
  }
}

@keyframes combo-side {
  0% {
    opacity: 0;
    transform: translate(14px, 6px) scale(0.9);
  }
  22% {
    opacity: 1;
    transform: translate(0, 0) scale(1.03);
  }
  76% {
    opacity: 1;
    transform: translate(0, -3px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(0, -14px) scale(0.99);
  }
}

@keyframes combo-ring {
  0% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(0.45);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.9);
  }
}

@keyframes boost-streak {
  from {
    opacity: 0.34;
    transform: scale(1.08) rotate(0deg);
  }
  50% {
    opacity: 0.58;
  }
  to {
    opacity: 0.34;
    transform: scale(1.18) rotate(0.35deg);
  }
}

@keyframes impact-flash {
  0% {
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes thorn-flash {
  0%,
  100% {
    opacity: 0;
  }
  12%,
  38% {
    opacity: 1;
    transform: translateX(-5px);
  }
  25%,
  52% {
    opacity: 0.52;
    transform: translateX(5px);
  }
}

@keyframes impact-copy {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.82);
  }
  22% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.04);
  }
  74% {
    opacity: 1;
    transform: translate(-50%, -4px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -18px) scale(0.98);
  }
}

@keyframes countdown-word {
  0% {
    opacity: 0;
    filter: blur(12px);
    transform: scale(1.14);
  }
  24% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
  100% {
    opacity: 0.96;
    transform: scale(1);
  }
}

@keyframes countdown-go {
  0% {
    opacity: 0;
    filter: blur(18px);
    transform: scale(1.32);
  }
  20% {
    opacity: 1;
    filter: blur(0);
    transform: scale(0.96);
  }
  58% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    filter: blur(3px);
    transform: scale(1.08);
  }
}

@keyframes countdown-copy {
  from {
    opacity: 0;
    letter-spacing: 0.36em;
  }
  to {
    opacity: 1;
  }
}

@keyframes zone-shift {
  0% {
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .home-screen,
  .game-screen {
    grid-template-columns: 1fr;
  }

  .home-screen {
    gap: 52px;
    align-items: start;
    padding-top: 46px;
  }

  .home-copy {
    width: 100%;
    min-width: 0;
  }

  .preview-stage {
    max-width: 650px;
  }

  .home-setup {
    max-width: 680px;
  }

  .game-screen {
    gap: 28px;
  }

  .game-status {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 28px;
    width: 100%;
  }

  .play-shell {
    order: -1;
  }

  .game-utility-row,
  .game-status > .micro-label,
  .zone-meta {
    grid-column: 1 / -1;
  }

  .rule-card,
  .object-legend,
  .player-legend,
  .controls-desktop {
    grid-column: 1 / -1;
  }

  .play-shell {
    width: 100%;
    max-width: 900px;
    justify-self: center;
  }
}

@media (max-width: 720px) {
  .site-header,
  .shell,
  .site-footer {
    width: min(100% - 32px, 1240px);
  }

  .site-header {
    height: 74px;
  }

  .brand-copy small,
  .nav-quiet {
    display: none;
  }

  .site-nav {
    gap: 14px;
  }

  .sound-button {
    padding: 7px 9px;
  }

  .home-screen {
    min-height: auto;
    padding: 42px 0 70px;
  }

  .home-copy h1 {
    font-size: clamp(44px, 12.7vw, 68px);
  }

  .home-copy h1 em {
    white-space: normal;
  }

  .home-object-guide {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .home-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .home-actions .primary-button {
    width: 100%;
  }

  .setup-heading {
    flex-wrap: wrap;
  }

  .setup-heading small {
    width: 100%;
    margin-left: 0;
  }

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

  .setup-music-field {
    grid-column: auto;
  }

  .perspective-field {
    height: 400px;
  }

  .game-screen {
    padding-top: 22px;
  }

  .game-status {
    display: block;
  }

  .back-button {
    margin-bottom: 24px;
  }

  .score-block strong {
    font-size: 54px;
  }

  .status-grid {
    min-width: 0;
    margin-top: 20px;
  }

  .in-game-hud {
    inset: 8px;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .hud-panel {
    padding: 8px 9px;
  }

  .zone-transition {
    top: 54%;
    left: 12px;
    width: min(52%, 240px);
  }

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

  .hud-roster-item {
    padding: 3px 5px;
  }

  .hud-roster-person span {
    font-size: 7px;
  }

  .hud-combo-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    width: min(220px, 64%);
    justify-self: center;
  }

  .hud-metrics {
    bottom: 8px;
    gap: 3px;
  }

  .hud-metrics > span {
    padding: 4px 6px;
  }

  run-telemetry {
    right: 8px;
    bottom: 122px;
    left: 8px;
    width: auto;
  }

  .rule-card {
    min-height: 0;
  }

  .controls-desktop {
    display: none;
  }

  .scene-frame {
    border-radius: 22px;
  }

  #three-container {
    aspect-ratio: 4 / 5;
  }

  .play-hud {
    padding: 0 4px;
  }

  .mobile-controls {
    display: grid;
    grid-template-columns: 58px 1fr 58px;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
  }

  .mobile-controls button {
    width: 58px;
    height: 50px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 20px;
  }

  .mobile-controls span {
    color: var(--text-dim);
    font-size: 10px;
    text-align: center;
  }

  .end-actions {
    display: grid;
  }

  .end-actions .primary-button,
  .end-actions .secondary-button {
    width: 100%;
  }

  .site-footer {
    display: grid;
    gap: 12px;
    padding: 22px 0;
  }
}

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