:root {
  --void: #05060a;
  --panel: rgba(12, 14, 24, 0.72);
  --stroke: rgba(255, 255, 255, 0.12);
  --text: #f4f6ff;
  --muted: rgba(244, 246, 255, 0.55);
  --accent: #7cf7ff;
  --accent-2: #ff7a18;
  --glow: 0 0 40px rgba(124, 247, 255, 0.22);
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--text);
  font-family: "Outfit", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow: hidden;
  /* Avoid scroll chaining / rubber-band fighting the inner `.screen` scroller on phones. */
  overscroll-behavior: none;
}

#app {
  position: fixed;
  inset: 0;
}

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

/* Nitro: wide circular rim of heavy blur + soft vignette (speed tunnel read). */
.nitro-speed-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  will-change: opacity;
  /* Small clear bullseye; long soft ramp so blur covers most of the view in a circle. */
  -webkit-mask-image: radial-gradient(
    circle farthest-corner at 50% 50%,
    transparent 0%,
    transparent 14%,
    rgba(0, 0, 0, 0.35) 42%,
    rgba(0, 0, 0, 0.82) 78%,
    #000 100%
  );
  mask-image: radial-gradient(
    circle farthest-corner at 50% 50%,
    transparent 0%,
    transparent 14%,
    rgba(0, 0, 0, 0.35) 42%,
    rgba(0, 0, 0, 0.82) 78%,
    #000 100%
  );
  backdrop-filter: blur(27px) saturate(1.08);
  -webkit-backdrop-filter: blur(27px) saturate(1.08);
  background: rgba(2, 6, 16, 0.28);
  box-shadow:
    inset 0 0 0 1px rgba(124, 247, 255, 0.12),
    inset 0 0 96px rgba(124, 247, 255, 0.05),
    inset 0 0 220px 100px rgba(0, 0, 0, 0.5);
}

.nitro-speed-vignette.nitro-speed-vignette--reduced {
  -webkit-mask-image: radial-gradient(
    circle farthest-corner at 50% 50%,
    transparent 0%,
    transparent 12%,
    rgba(0, 0, 0, 0.45) 40%,
    rgba(0, 0, 0, 0.92) 76%,
    #000 100%
  );
  mask-image: radial-gradient(
    circle farthest-corner at 50% 50%,
    transparent 0%,
    transparent 12%,
    rgba(0, 0, 0, 0.45) 40%,
    rgba(0, 0, 0, 0.92) 76%,
    #000 100%
  );
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: transparent;
  box-shadow:
    inset 0 0 0 1px rgba(124, 247, 255, 0.1),
    inset 0 0 140px 64px rgba(0, 0, 0, 0.62),
    inset 0 0 280px 120px rgba(2, 5, 14, 0.42);
}

.casino-closed-banner,
.care-closed-banner,
.shop-closed-banner,
.health-closed-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 14;
  pointer-events: none;
  max-width: min(92vw, 520px);
  padding: 12px 18px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.95rem, 4.2vw, 1.38rem);
  font-weight: 600;
  letter-spacing: 0.07em;
  line-height: 1.32;
  color: rgba(200, 214, 240, 0.95);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.7), 0 0 24px rgba(0, 0, 0, 0.4);
}

.minimap-wrap {
  /* Same palette as #minimap radar-bg gradient + rings (single source for HUD bars). */
  --radar-cyan: 124, 247, 255;
  --radar-blue-mid: 21, 35, 68;
  --radar-blue-dark: 8, 14, 28;
  position: absolute;
  top: calc(94px + var(--safe-top));
  left: max(10px, env(safe-area-inset-left));
  right: auto;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.minimap {
  width: min(34vw, 132px);
  height: min(34vw, 132px);
  display: block;
  box-sizing: border-box;
  border-radius: 50%;
  overflow: hidden;
  /* Match .hud-health-track: solid rim + inset depth */
  border: 1px solid rgba(var(--radar-cyan), 0.18);
  box-shadow:
    inset 0 0 12px rgba(0, 0, 0, 0.42),
    0 6px 18px rgba(0, 0, 0, 0.48);
}

.hud-health-wrap {
  width: min(34vw, 132px);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hud-stat-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Match coords / shiba count: monospace, size, color */
.hud-stat-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.56rem, 2.34vw, 0.68rem);
  font-weight: 500;
  color: rgba(200, 214, 240, 0.88);
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.hud-stat-sub {
  font-size: 0.68em;
  font-weight: 500;
  vertical-align: baseline;
  position: relative;
  bottom: -0.08em;
}

.hud-stat-row--points {
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 1px;
}

.hud-points-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.66rem, 2.6vw, 0.82rem);
  font-weight: 600;
  color: rgba(var(--radar-cyan), 0.95);
  letter-spacing: 0.04em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6), 0 0 10px rgba(var(--radar-cyan), 0.18);
  font-variant-numeric: tabular-nums;
}

.minimap-wrap .hud-health-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(var(--radar-cyan), 0.18);
  /* Echo radar-bg: mid blue → outer dark (see #radar-bg stops). */
  background: linear-gradient(
    180deg,
    rgba(var(--radar-blue-mid), 0.38) 0%,
    rgba(var(--radar-blue-dark), 0.92) 100%
  );
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.42);
}

.minimap-wrap .hud-health-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  /* Filled segment: cyan like minimap ring / sweep, not a separate gray. */
  background: linear-gradient(
    90deg,
    rgba(var(--radar-cyan), 0.2) 0%,
    rgba(var(--radar-cyan), 0.38) 100%
  );
  box-shadow: inset 0 1px 0 rgba(var(--radar-cyan), 0.35), 0 0 10px rgba(var(--radar-cyan), 0.18);
  transition: width 80ms linear;
}

.minimap-wrap .hud-nitro-fill {
  background: linear-gradient(
    90deg,
    rgba(255, 200, 120, 0.35) 0%,
    rgba(255, 184, 74, 0.72) 55%,
    rgba(255, 236, 180, 0.55) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.45), 0 0 12px rgba(255, 184, 74, 0.28);
}

.minimap-bg {
  stroke: rgba(var(--radar-cyan), 0.18);
  stroke-width: 0.028;
}

.minimap-ring {
  fill: none;
  stroke: rgba(var(--radar-cyan), 0.34);
  stroke-width: 0.028;
  stroke-linecap: round;
}

.minimap-ring--inner {
  stroke: rgba(var(--radar-cyan), 0.22);
  stroke-width: 0.022;
  stroke-linecap: round;
}

.minimap-sweep {
  fill: rgba(var(--radar-cyan), 0.12);
  stroke: rgba(var(--radar-cyan), 0.32);
  stroke-width: 0.014;
  stroke-linejoin: round;
  transform-origin: 0 0;
}

/* Hub / portal spawn landmark on radar (position updated in JS, same projection as dots). */
.minimap-spawn-cross {
  pointer-events: none;
}

.minimap-spawn-cross-arm {
  stroke: rgba(168, 85, 247, 0.92);
  stroke-width: 0.026;
  stroke-linecap: round;
}

.minimap-casino-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.1px;
  font-weight: 500;
  letter-spacing: 0.06em;
  fill: rgba(200, 214, 240, 0.92);
  paint-order: stroke fill;
  stroke: rgba(8, 14, 28, 0.75);
  stroke-width: 0.018px;
  pointer-events: none;
}

.minimap-care-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.088px;
  font-weight: 500;
  letter-spacing: 0.05em;
  fill: rgba(200, 214, 240, 0.9);
  paint-order: stroke fill;
  stroke: rgba(8, 14, 28, 0.72);
  stroke-width: 0.016px;
  pointer-events: none;
}

.minimap-self {
  fill: rgba(255, 255, 255, 0.22);
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 0.028;
}

.minimap-compass-ring {
  transform-origin: 0 0;
}

.minimap-dir {
  fill: rgba(232, 241, 255, 0.9);
  font-size: 0.17px;
  text-anchor: middle;
  dominant-baseline: middle;
  letter-spacing: 0.02em;
  font-weight: 700;
}

.dir-n {
  fill: #ffffff;
  filter: drop-shadow(0 0 5px rgba(var(--radar-cyan), 0.35));
}

.minimap-dot {
  stroke: rgba(var(--radar-blue-dark), 0.75);
  stroke-width: 0.02;
}


.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: calc(16px + var(--safe-top)) 18px calc(22px + var(--safe-bottom));
  gap: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  /* Prefer vertical pan for this scroller so momentum scroll stays smooth on mobile. */
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  /* Own compositor layer: smoother iOS/Android scroll over full-screen canvas. */
  transform: translate3d(0, 0, 0);
  background: radial-gradient(120% 80% at 50% 0%, rgba(124, 247, 255, 0.08), transparent 55%),
    radial-gradient(90% 60% at 80% 100%, rgba(255, 122, 24, 0.07), transparent 50%), var(--void);
  z-index: 5;
}

.screen.overlay {
  background: rgba(5, 6, 10, 0.72);
  backdrop-filter: blur(10px);
  justify-content: center;
}

/* Game over: translucent world behind; compact popup + main menu. */
.screen.game-over-screen {
  z-index: 28;
  justify-content: center;
  align-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(5, 6, 10, 0.38);
  backdrop-filter: blur(5px) saturate(1.05);
  -webkit-backdrop-filter: blur(5px) saturate(1.05);
  pointer-events: auto;
}

.game-over-card {
  width: min(100%, 300px);
  margin: 0 auto;
  padding: 18px 20px 16px;
  border: 1px solid rgba(124, 247, 255, 0.22);
  background: rgba(10, 14, 26, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4) inset,
    0 16px 48px rgba(0, 0, 0, 0.5);
}

.game-over-title {
  margin: 0 0 6px;
  font-family: "Syne", "Outfit", sans-serif;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: clamp(1.15rem, 4.2vw, 1.35rem);
  color: rgba(255, 184, 120, 0.95);
  text-shadow: 0 0 20px rgba(255, 140, 70, 0.35);
}

.game-over-score {
  margin: 0 0 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(200, 220, 255, 0.92);
}

.instructions-manual-body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: clamp(14px, 3vw, 28px);
  flex: 1 1 auto;
  min-height: min(52vh, 440px);
  min-width: 0;
}

@media (max-width: 680px) {
  .instructions-manual-body {
    flex-direction: column;
    min-height: 0;
  }

  /* In a column flex container, % flex-basis is height — avoid distorted media/text rows. */
  .instructions-manual-figure {
    flex: 0 0 auto;
    width: 100%;
    align-self: stretch;
  }

  .instructions-manual-text {
    flex: 0 0 auto;
    width: 100%;
    align-self: stretch;
  }
}

/* Tutorials: stacked topic blocks inside the start-menu card */
.tutorials-all-slides {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 4vw, 32px);
  min-width: 0;
  outline: none;
}

#menu-panel-tutorials .tutorial-slide-block.instructions-manual-body {
  min-height: 0;
  flex: 0 0 auto;
}

#menu-panel-tutorials .tutorial-slide-block .instructions-manual-figure {
  --instructions-media-max-h: min(40vh, 320px);
  --instructions-media-min-h: min(28vh, 220px);
}

.instructions-manual-figure {
  --instructions-media-max-h: min(62vh, 560px);
  --instructions-media-min-h: min(44vh, 360px);
  margin: 0;
  flex: 1 1 46%;
  min-width: 0;
  height: auto;
  min-height: min(var(--instructions-media-min-h), var(--instructions-media-max-h));
  max-height: var(--instructions-media-max-h);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border: none;
  outline: none;
  border-radius: 0;
  background: transparent;
}

.instructions-manual-image {
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: var(--instructions-media-max-h);
  object-fit: contain;
  object-position: center;
  display: block;
  border: none;
  outline: none;
  box-shadow: none;
}

.instructions-manual-image-fallback {
  box-sizing: border-box;
  width: 100%;
  min-height: min(var(--instructions-media-min-h), var(--instructions-media-max-h));
  max-height: var(--instructions-media-max-h);
  display: grid;
  place-items: center;
  border: none;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(190, 210, 240, 0.76);
}

.instructions-manual-text {
  margin: 0;
  flex: 1 1 50%;
  min-width: 0;
  min-height: 40px;
  align-self: center;
  color: rgba(232, 238, 252, 0.95);
  font-size: 0.93rem;
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

.app-loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  background:
    radial-gradient(ellipse 100% 70% at 50% -10%, rgba(168, 247, 255, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(124, 247, 255, 0.08) 0%, transparent 50%),
    linear-gradient(168deg, #0f1a32 0%, #080d1a 40%, #05050f 100%);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.app-loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Fullscreen bridge when launching from Game Modes (separate from first-load screen). */
.enter-game-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: 65;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 100% 70% at 50% -10%, rgba(168, 247, 255, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(124, 247, 255, 0.08) 0%, transparent 50%),
    linear-gradient(168deg, #0f1a32 0%, #080d1a 40%, #05050f 100%);
}

.enter-game-overlay.hidden {
  display: none !important;
}

.enter-game-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    rgba(124, 247, 255, 0.95) 0%,
    rgba(200, 252, 255, 1) 45%,
    rgba(124, 247, 255, 0.85) 100%
  );
  box-shadow: 0 0 12px rgba(124, 247, 255, 0.45);
  transition: width 0.42s ease;
}

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.progress-bar-container {
  width: 200px;
  height: 2px;
  background: rgba(124, 247, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(124, 247, 255, 0.12);
  position: relative;
  overflow: hidden;
}

#progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(124, 247, 255, 0.95) 0%, rgba(200, 252, 255, 1) 45%, rgba(124, 247, 255, 0.85) 100%);
  box-shadow: 0 0 12px rgba(124, 247, 255, 0.45);
  transition: width 0.1s ease;
}

.loading-label {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  font-size: 0.75rem;
  font-family: "Syne", "Outfit", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 4px;
  color: #f2feff;
  text-transform: uppercase;
}

.loading-dots {
  display: inline-grid;
  grid-template-columns: 1ch 1ch 1ch;
  width: 3ch;
  min-width: 3ch;
  justify-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  letter-spacing: 0;
}

.loading-dot {
  display: block;
  opacity: 0;
  line-height: 1;
  animation-duration: 1.15s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.loading-dot:nth-child(1) { animation-name: loading-dot-1; }
.loading-dot:nth-child(2) { animation-name: loading-dot-2; }
.loading-dot:nth-child(3) { animation-name: loading-dot-3; }

@keyframes loading-dot-1 {
  0%, 9% { opacity: 0; }
  10%, 64% { opacity: 1; }
  65%, 100% { opacity: 0; }
}
@keyframes loading-dot-2 {
  0%, 24% { opacity: 0; }
  25%, 64% { opacity: 1; }
  65%, 100% { opacity: 0; }
}
@keyframes loading-dot-3 {
  0%, 39% { opacity: 0; }
  40%, 64% { opacity: 1; }
  65%, 100% { opacity: 0; }
}

#screen-start .brand {
  max-width: min(520px, 94vw);
}

.brand {
  text-align: center;
  max-width: 420px;
}

.brand-mark {
  display: block;
  width: clamp(3.5rem, 12vw, 4.75rem);
  height: auto;
  margin: 0 auto 6px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(124, 247, 255, 0.42));
}

.brand h1 {
  font-family: "Syne", "Outfit", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  margin: 0 0 8px;
  line-height: 1.05;
}

#screen-start .brand h1 {
  font-size: clamp(1.5rem, 4.55vw, 2.1rem);
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

#screen-start .tagline {
  font-size: 1.05rem;
}

.asset-preload-wrap {
  margin: 6px 0 10px;
  width: 100%;
}

.asset-preload-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(124, 247, 255, 0.35);
  background: rgba(18, 28, 45, 0.55);
}

.asset-preload-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7cf7ff, #b3fff1);
  box-shadow: 0 0 14px rgba(124, 247, 255, 0.42);
  transition: width 180ms ease-out;
}

.asset-preload-text {
  margin-top: 6px;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  color: rgba(216, 236, 255, 0.78);
}

.card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}

#screen-start .card {
  width: min(520px, 100%);
  padding: 24px 22px 20px;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}

/* Main menu outer panel — full grid column width (not capped like legacy start card). */
#screen-start .card.start-menu-panel-host {
  width: 100%;
  max-width: none;
  background: rgba(4, 7, 14, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

#screen-start .field {
  font-size: 0.9rem;
  margin-bottom: 16px;
}

#screen-start .field input[type="text"],
#screen-start .field input[type="password"],
#screen-start .field input[type="number"] {
  padding: 14px 14px;
  font-size: 1.08rem;
}

.telegram-toggle {
  margin: -4px 0 12px;
}

.telegram-auth-status {
  margin: -6px 0 14px;
}

.telegram-auth-status.is-error {
  color: #ffb4a8;
}

.telegram-auth-status.is-ok {
  color: rgba(124, 247, 255, 0.92);
}

.field-heading {
  display: flex;
  align-items: center;
}

.field-heading label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
}

.login-bridge-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2.2vw, 14px);
  margin: 6px 0 14px;
  flex-wrap: nowrap;
}

.login-bridge-icons__img {
  display: block;
  height: clamp(34px, 9vw, 52px);
  width: auto;
  max-width: min(100px, 26vw);
  object-fit: contain;
  flex: 0 1 auto;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.32));
}

.login-bridge-icons__img--tg {
  border-radius: 50%;
  height: clamp(20px, 5.4vw, 31px);
  max-width: min(60px, 15.6vw);
}

.login-bridge-icons__img--eth {
  height: clamp(22px, 5.84vw, 34px);
  max-width: min(65px, 16.86vw);
}

.login-bridge-icons__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.login-bridge-icons__arrow svg {
  width: clamp(32px, 9vw, 52px);
  height: auto;
  display: block;
}

@keyframes login-bridge-arrow-glow {
  0% {
    opacity: 0.28;
    filter: drop-shadow(0 0 0 transparent);
  }
  45% {
    opacity: 1;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.75));
  }
  100% {
    opacity: 1;
    filter: drop-shadow(0 0 9px rgba(255, 255, 255, 0.5));
  }
}

.login-bridge-icons__arrow:first-of-type svg,
.login-bridge-icons__arrow:last-of-type svg {
  animation: login-bridge-arrow-glow 0.65s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .login-bridge-icons__arrow:first-of-type svg,
  .login-bridge-icons__arrow:last-of-type svg {
    animation: none;
    opacity: 1;
    filter: drop-shadow(0 0 9px rgba(255, 255, 255, 0.5));
  }
}

.telegram-id-control {
  position: relative;
  display: flex;
  align-items: center;
}

#screen-start .telegram-id-control input[type="text"] {
  width: 100%;
  min-width: 0;
  padding-right: 112px;
  border-color: rgba(124, 247, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.025)),
    rgba(6, 8, 15, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(0, 0, 0, 0.18);
}

#screen-start .telegram-id-control input[type="text"]:focus {
  border-color: rgba(77, 187, 255, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(77, 187, 255, 0.22),
    0 0 20px rgba(53, 168, 255, 0.12);
}

.telegram-get-id-btn {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  min-height: 34px;
  padding: 8px 13px;
  border: 1px solid rgba(119, 210, 255, 0.58);
  border-radius: 10px;
  color: #f4fbff;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.2), transparent 46%),
    linear-gradient(160deg, #46bbff 0%, #177bde 58%, #0c4f9f 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 0 16px rgba(53, 168, 255, 0.26);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.07em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.telegram-get-id-btn:hover,
.telegram-get-id-btn:focus-visible {
  border-color: rgba(207, 240, 255, 0.86);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.26), transparent 48%),
    linear-gradient(160deg, #64c8ff 0%, #238cea 58%, #1060b9 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 0 22px rgba(53, 168, 255, 0.34);
  outline: none;
}

.telegram-get-id-btn:active {
  transform: translateY(-50%) scale(0.97);
}

.telegram-get-id-btn[data-link-ready="false"] {
  opacity: 0.9;
}

#screen-start .btn.primary.telegram-verify-btn {
  display: block;
  margin: 14px auto 0;
  width: auto;
  min-width: 0;
  padding: 10px 24px;
  font-size: 0.85rem;
}

#screen-start .btn.primary.telegram-verify-btn.hidden {
  display: none;
}

#screen-start .btn.primary {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 14px 20px;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: "Syne", "Outfit", system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-color: rgba(124, 247, 255, 0.35);
  color: #f2feff;
  background: linear-gradient(168deg, rgba(26, 52, 92, 0.98) 0%, rgba(13, 27, 56, 0.98) 100%);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(168, 247, 255, 0.24),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(124, 247, 255, 0.16),
    0 10px 24px rgba(0, 0, 0, 0.42),
    0 0 18px rgba(124, 247, 255, 0.26);
  /* Static “tubelight” on letters only — no motion. */
  text-shadow:
    0 0 6px rgba(186, 252, 255, 0.95),
    0 0 14px rgba(124, 247, 255, 0.55),
    0 0 22px rgba(124, 247, 255, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.35);
}

#screen-start .btn.primary:hover,
#screen-start .btn.primary:focus-visible {
  background: linear-gradient(168deg, rgba(33, 64, 112, 0.98) 0%, rgba(16, 34, 67, 0.98) 100%);
  border-color: rgba(124, 247, 255, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(168, 247, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(124, 247, 255, 0.2),
    0 0 14px rgba(124, 247, 255, 0.24),
    0 10px 24px rgba(0, 0, 0, 0.42),
    0 0 22px rgba(124, 247, 255, 0.32);
  outline: none;
}

/* Match ENTER ASTROVERSE CTA on game-over main menu (outside #screen-start). */
#screen-game-over .btn.primary {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 14px 20px;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: "Syne", "Outfit", system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-color: rgba(124, 247, 255, 0.35);
  color: #f2feff;
  background: linear-gradient(168deg, rgba(26, 52, 92, 0.98) 0%, rgba(13, 27, 56, 0.98) 100%);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(168, 247, 255, 0.24),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(124, 247, 255, 0.16),
    0 10px 24px rgba(0, 0, 0, 0.42),
    0 0 18px rgba(124, 247, 255, 0.26),
    var(--glow);
  text-shadow:
    0 0 6px rgba(186, 252, 255, 0.95),
    0 0 14px rgba(124, 247, 255, 0.55),
    0 0 22px rgba(124, 247, 255, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.35);
}

#screen-game-over .btn.primary:hover,
#screen-game-over .btn.primary:focus-visible {
  background: linear-gradient(168deg, rgba(33, 64, 112, 0.98) 0%, rgba(16, 34, 67, 0.98) 100%);
  border-color: rgba(124, 247, 255, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(168, 247, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(124, 247, 255, 0.2),
    0 0 14px rgba(124, 247, 255, 0.24),
    0 10px 24px rgba(0, 0, 0, 0.42),
    0 0 22px rgba(124, 247, 255, 0.32),
    var(--glow);
  outline: none;
}

.mode-picker {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-picker > legend {
  margin: -2px 0 10px;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 1rem;
  font-weight: 700;
  color: rgba(236, 244, 255, 0.96);
}

.mode-card {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.mode-card--reverse {
  flex-direction: row-reverse;
}

.mode-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-card-media {
  flex: 0 0 auto;
  align-self: center;
  width: 140px;
  min-width: 140px;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
  object-position: center;
  border: 1px solid rgba(124, 247, 255, 0.22);
  background: rgba(10, 14, 24, 0.55);
}

.mode-card-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.79rem;
  line-height: 1.34;
  color: rgba(230, 240, 255, 0.84);
}

.mode-card-copy strong {
  font-family: "Syne", "Outfit", sans-serif;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  color: #f4f8ff;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.mode-beta-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 224, 102, 0.45);
  background: rgba(255, 224, 102, 0.16);
  color: rgba(255, 235, 166, 0.95);
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-card:has(input[type="radio"]:checked) {
  border-color: rgba(168, 252, 255, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(210, 255, 255, 0.35),
    inset 0 0 0 1px rgba(124, 247, 255, 0.35),
    0 0 22px rgba(100, 230, 255, 0.28),
    0 0 40px rgba(60, 200, 255, 0.14);
}

.mode-card.is-locked {
  cursor: not-allowed;
  isolation: isolate;
  overflow: hidden;
  border-color: rgba(129, 153, 190, 0.24);
  background:
    radial-gradient(circle at 12% 12%, rgba(124, 247, 255, 0.12), transparent 34%),
    linear-gradient(145deg, rgba(20, 28, 46, 0.86), rgba(8, 10, 20, 0.94));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    inset 0 -24px 70px rgba(0, 0, 0, 0.34),
    0 10px 24px rgba(0, 0, 0, 0.22);
}

.mode-card.is-locked .mode-card-media,
.mode-card.is-locked .mode-card-copy {
  filter: grayscale(0.72) saturate(0.62) brightness(0.72);
  opacity: 0.62;
  transform: scale(0.985);
}

.mode-card.is-locked::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0%, transparent 38%, rgba(124, 247, 255, 0.12) 44%, transparent 52%, transparent 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 7px),
    radial-gradient(circle at 76% 24%, rgba(255, 204, 76, 0.12), transparent 28%),
    rgba(4, 7, 16, 0.34);
  background-position: var(--locked-shine-x, -260px) 0, 0 0, 0 0, 0 0;
  mix-blend-mode: screen;
  opacity: 0.78;
  /* Avoid animating opacity during scroll (main-thread cost on phones). */
  transition: background-position 0.06s linear;
}

body.is-scrolling .mode-card.is-locked::before {
  opacity: 1;
}

/* Pulse only while Solo is the active selection (avoids a bright glow on an unselected card). */
#mode-card-solo:not(.is-locked):has(input[type="radio"]:checked) {
  animation: survival-mode-pulse 2.6s ease-in-out infinite;
}

@keyframes survival-mode-pulse {
  0%,
  100% {
    box-shadow:
      inset 0 1px 0 rgba(230, 255, 255, 0.45),
      inset 0 0 0 1px rgba(140, 240, 255, 0.38),
      0 0 28px rgba(90, 235, 255, 0.38),
      0 0 52px rgba(60, 200, 255, 0.16);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(245, 255, 255, 0.65),
      inset 0 0 0 1px rgba(180, 252, 255, 0.55),
      0 0 38px rgba(120, 245, 255, 0.55),
      0 0 80px rgba(80, 220, 255, 0.28);
  }
}

/* Must beat later `.btn` rule (same element uses class="btn mode-cta"). */
.btn.mode-cta {
  position: relative;
  overflow: hidden;
  margin-top: 2px;
  border: 1px solid rgba(255, 214, 92, 0.92);
  border-radius: 12px;
  color: #0a0a0a;
  background: linear-gradient(
    165deg,
    #fff3b0 0%,
    #ffd84a 42%,
    #e8a820 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 220, 0.85),
    inset 0 -1px 0 rgba(180, 110, 0, 0.28),
    0 0 22px rgba(255, 200, 60, 0.38),
    0 6px 18px rgba(0, 0, 0, 0.22);
  text-shadow: none;
  animation: mode-cta-glow-breathe 2.8s ease-in-out infinite;
  transition:
    border-color 0.2s ease,
    transform 0.12s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.btn.mode-cta:hover,
.btn.mode-cta:focus-visible {
  border-color: rgba(255, 239, 188, 0.95);
  color: #0a0a0a;
  background: linear-gradient(165deg, #fff6c8 0%, #ffe066 100%);
  animation: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 220, 0.82),
    inset 0 -1px 0 rgba(168, 106, 0, 0.2),
    0 0 26px rgba(255, 218, 110, 0.42),
    0 6px 18px rgba(0, 0, 0, 0.24);
}

.btn.mode-cta:active {
  transform: scale(0.985);
  animation: none;
}

@keyframes mode-cta-glow-breathe {
  0%,
  100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 252, 220, 0.85),
      inset 0 -1px 0 rgba(180, 110, 0, 0.28),
      0 0 18px rgba(255, 200, 60, 0.3),
      0 6px 18px rgba(0, 0, 0, 0.22);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 252, 220, 0.9),
      inset 0 -1px 0 rgba(180, 110, 0, 0.28),
      0 0 26px rgba(255, 210, 90, 0.45),
      0 6px 18px rgba(0, 0, 0, 0.22);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn.mode-cta,
  #mode-card-solo:not(.is-locked):has(input[type="radio"]:checked) {
    animation: none;
  }
}

@media (max-width: 540px) {
  #input-telegram-id::placeholder {
    font-size: 0.86rem;
    letter-spacing: 0.01em;
  }

  .mode-card,
  .mode-card--reverse {
    flex-direction: column;
  }

  .mode-card-media {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
  }
}

/* Start screen: ~1.5× scale on desktop (vs default mobile layout). */
@media (min-width: 900px) {
  #screen-start .brand {
    max-width: min(960px, 94vw);
  }

  #screen-start .brand-mark:not(.brand-mark--landing-hero) {
    width: clamp(4.5rem, 5.5vw, 6rem);
  }

  .brand-mark--landing-hero {
    width: clamp(305px, 40vw, 655px);
    max-height: min(113vh, 728px);
  }

  #screen-start .card {
    width: min(960px, 100%);
    padding: 42px 42px 36px;
  }

  #screen-start .card.start-menu-panel-host {
    width: 100%;
    max-width: none;
    padding: 26px 32px;
  }

  #screen-start .brand h1 {
    font-size: clamp(2.48rem, 4.2vw, 3.52rem);
  }

  #screen-start .tagline {
    font-size: 1.68rem;
  }

  #screen-start .fineprint {
    max-width: 840px;
    font-size: 1.26rem;
  }

  #screen-start .field {
    font-size: 1.05rem;
    margin-bottom: 22px;
  }

  #screen-start .field span:first-child {
    font-size: 0.82rem;
  }

  .field-heading label {
    font-size: 0.82rem;
  }

  .telegram-get-id-btn {
    min-width: 104px;
    min-height: 48px;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
  }

  #screen-start .telegram-id-control input[type="text"] {
    padding-right: 136px;
  }

  #screen-start .muted.small {
    font-size: 1.02rem;
  }

  .mode-picker {
    gap: 18px;
  }

  .mode-picker > legend {
    font-size: 1.65rem;
    margin-bottom: 18px;
  }

  .mode-card {
    padding: 18px 21px;
    gap: 21px;
    border-radius: 16px;
  }

  .mode-card-media {
    width: 220px;
    min-width: 220px;
    aspect-ratio: 16 / 9;
    height: auto;
    border-radius: 14px;
  }

  .mode-card-copy {
    font-size: 1.32rem;
    line-height: 1.38;
    gap: 8px;
  }

  .mode-card-copy strong {
    font-size: 1.58rem;
  }

  .mode-beta-tag {
    padding: 2px 11px;
    font-size: 0.72rem;
  }

  .btn.mode-cta {
    font-size: 1.05rem;
    padding: 14px 18px;
  }

  #screen-start .field input[type="text"],
  #screen-start .field input[type="password"],
  #screen-start .field input[type="number"] {
    padding: 24px 24px;
    font-size: 1.68rem;
    border-radius: 14px;
  }

  #input-telegram-id::placeholder {
    font-size: 1.02rem;
  }

  #screen-start .btn.primary {
    padding: 24px 36px;
    font-size: 1.62rem;
    border-radius: 14px;
  }

  .asset-preload-track {
    height: 14px;
  }

  .asset-preload-text {
    font-size: 1.05rem;
  }

  #screen-start .text-link {
    font-size: 1.05rem;
  }

  /* Pilot Access (login): centered column, wider readable band on desktop */
  #menu-panel-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: min(920px, 96vw);
    margin-inline: auto;
    box-sizing: border-box;
  }

  #menu-panel-login > h2 {
    width: 100%;
    max-width: 22ch;
    margin-inline: auto;
  }

  #menu-panel-login .menu-panel-subtitle {
    width: 100%;
    max-width: min(52rem, 100%);
    margin-inline: auto;
    text-align: center;
  }

  #menu-panel-login #telegram-id-field {
    width: 100%;
    max-width: min(720px, 100%);
    margin-inline: auto;
  }

  #menu-panel-login .field-heading {
    justify-content: center;
  }

  #menu-panel-login .telegram-auth-status {
    width: 100%;
    max-width: min(44rem, 100%);
    margin-inline: auto;
    text-align: center;
  }

  #menu-panel-login .login-bridge-icons {
    gap: clamp(14px, 2.2vw, 28px);
  }

  #menu-panel-login .login-bridge-icons__img {
    height: clamp(48px, 5vw, 68px);
    max-width: min(128px, 16vw);
  }

  #menu-panel-login .login-bridge-icons__img--tg {
    height: clamp(38px, 4vw, 52px);
    max-width: min(80px, 11vw);
  }

  #menu-panel-login .login-bridge-icons__img--eth {
    height: clamp(40px, 4.2vw, 54px);
    max-width: min(84px, 11vw);
  }

  #menu-panel-login .login-bridge-icons__arrow svg {
    width: clamp(48px, 5vw, 72px);
  }
}

/* Full-screen main menu: landing shows only nav; detail shows one panel + Back (no page scroll). */
#screen-start.screen-start-menu {
  /* Landing hero logo: tweak horizontal position (positive = farther right). */
  --start-menu-logo-nudge-x: 78px;
  justify-content: flex-start;
  align-items: stretch;
  padding: 0;
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: manipulation;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

.menu-space-bg-root {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.start-menu-phase-landing .menu-space-bg-root {
  opacity: 1;
}

.start-menu-phase-detail .menu-space-bg-root {
  opacity: 0;
  visibility: hidden;
}

.menu-space-bg-root canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.start-menu-phase-detail .start-menu-nav {
  display: none !important;
}

.menu-entry-preview-root {
  display: none;
  position: absolute;
  inset: 0;
  left: 0;
  width: 100%;
  max-width: none;
  pointer-events: none;
  /* Behind nav/chrome so transparent rail can show GL across the whole viewport */
  z-index: 2;
}

.start-menu-phase-landing .menu-entry-preview-root {
  display: block;
}

.menu-entry-preview-root canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Landing: GL fills the viewport; rail stays readable via shadows (desktop + narrow). */
#screen-start.screen-start-menu.start-menu-phase-landing {
  background: transparent;
}

.start-menu-phase-landing .start-menu-nav {
  background: transparent;
  box-shadow: none;
}

.start-menu-phase-landing .start-menu-brand h1,
.start-menu-phase-landing .start-menu-brand .tagline {
  text-shadow:
    0 0 20px rgba(4, 8, 18, 0.95),
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 0 1px rgba(0, 0, 0, 1);
}

.start-menu-phase-landing .main-menu-btn {
  text-shadow:
    0 0 14px rgba(4, 8, 18, 0.92),
    0 1px 2px rgba(0, 0, 0, 0.88);
}

.start-menu-phase-landing .main-menu-btn.is-active {
  text-shadow:
    0 0 18px rgba(4, 10, 22, 0.95),
    0 0 10px rgba(124, 247, 255, 0.22),
    0 1px 2px rgba(0, 0, 0, 0.9);
}

.start-menu-phase-landing .start-menu-nav__logo-hero .brand-mark--landing-hero {
  filter: drop-shadow(0 4px 22px rgba(0, 0, 0, 0.72)) drop-shadow(0 0 28px rgba(124, 247, 255, 0.12));
}

.start-menu-nav {
  position: relative;
  z-index: 4;
  flex: 1 1 auto;
  width: 100%;
  min-height: min(100dvh, 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  padding: calc(16px + var(--safe-top)) max(16px, env(safe-area-inset-right)) calc(20px + var(--safe-bottom))
    max(16px, env(safe-area-inset-left));
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background:
    radial-gradient(ellipse 90% 55% at 12% 12%, rgba(124, 247, 255, 0.12), transparent 50%),
    radial-gradient(ellipse 70% 45% at 95% 88%, rgba(255, 122, 24, 0.05), transparent 48%),
    linear-gradient(178deg, rgba(6, 10, 22, 0.98), rgba(3, 5, 12, 1));
  box-shadow: none;
}

.start-menu-nav__rail {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.start-menu-nav__logo-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  pointer-events: none;
}

.brand-mark--landing-hero {
  display: block;
  width: clamp(232px, 47.32vw, 546px);
  height: auto;
  max-height: min(102vh, 619px);
  margin: 0;
  object-fit: contain;
}

.start-menu-phase-landing .start-menu-nav {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(12px, 3.5vw, 44px);
}

.start-menu-phase-landing .start-menu-nav__rail {
  flex: 1 1 auto;
  max-width: min(520px, 56%);
}

.start-menu-phase-landing .start-menu-nav__logo-hero {
  margin-left: 328px;
  align-self: center;
}

@media (max-width: 768px) {
  /*
   * Landing: nav + logo must stack above `.menu-entry-preview-root` (z-index 2) or the GL canvas hides them.
   * `start-menu-mobile-logo-bleed` on html/body is toggled from main.js while the landing menu is visible.
   *
   * Mobile hero logo horizontal tweak (desktop ignores this — it lives only inside this max-width block):
   *   On `#screen-start.screen-start-menu.start-menu-phase-landing`, change
   *   `--start-menu-logo-nudge-x-mobile` (e.g. 8px, 16px, 24px). Positive = farther right.
   */
  #screen-start.screen-start-menu.start-menu-phase-landing {
    --start-menu-logo-nudge-x-mobile: 106px;
  }

  html.start-menu-mobile-logo-bleed,
  body.start-menu-mobile-logo-bleed {
    overflow: visible !important;
    overscroll-behavior-x: none;
  }

  html.start-menu-mobile-logo-bleed #app {
    overflow: visible;
  }

  html.start-menu-mobile-logo-bleed #screen-start.screen.screen-start-menu.start-menu-phase-landing {
    overflow: visible !important;
    transform: none !important;
    touch-action: manipulation;
  }

  .start-menu-phase-landing .start-menu-nav {
    flex-direction: column;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
    gap: 18px;
    overflow: visible;
    position: relative;
    z-index: 6;
  }

  .start-menu-phase-landing .start-menu-nav__rail {
    max-width: 100%;
    width: min(520px, 100%);
  }

  .start-menu-phase-landing .start-menu-nav__logo-hero {
    margin-left: 0;
    width: 100%;
    justify-content: center;
    padding-right: max(8px, env(safe-area-inset-right));
    padding-left: max(8px, env(safe-area-inset-left));
    overflow: visible;
    position: relative;
    z-index: 1;
  }

  .start-menu-phase-landing .start-menu-nav__logo-hero .brand-mark--landing-hero {
    width: clamp(138px, 55.2vw, 253px);
    max-height: min(32vh, 230px);
    opacity: 1;
    transform: translateX(var(--start-menu-logo-nudge-x-mobile, 0px));
    will-change: auto;
  }
}

.start-menu-nav .start-menu-brand,
.start-menu-nav .main-menu-list {
  width: min(520px, 100%);
  max-width: 100%;
  align-self: flex-start;
}

.start-menu-brand {
  text-align: left;
  padding: 6px 0 18px 2px;
}

.start-menu-brand .brand-mark {
  margin: 0 0 8px;
  align-self: flex-start;
}

.start-menu-brand h1 {
  font-size: clamp(1.12rem, 2.3vw, 1.6rem);
  margin-bottom: 6px;
}

.start-menu-brand .tagline {
  font-size: 0.86rem;
  line-height: 1.35;
}

.main-menu-list {
  display: grid;
  gap: 4px;
  width: 100%;
}

.main-menu-btn {
  width: 100%;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(188, 210, 238, 0.82);
  font-family: "Syne", "Outfit", system-ui, sans-serif;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 12px 10px 12px 6px;
  text-align: left;
  cursor: pointer;
  transition:
    color 0.14s ease,
    background 0.14s ease,
    border-color 0.14s ease,
    box-shadow 0.14s ease;
}

.main-menu-btn:hover,
.main-menu-btn:focus-visible {
  color: rgba(236, 248, 255, 0.94);
  background: rgba(124, 247, 255, 0.05);
  outline: none;
}

/* Selected row: soft fill + glow — no trailing gradient edge. */
.main-menu-btn.is-active {
  color: #f8feff;
  border-color: transparent;
  background: rgba(124, 247, 255, 0.1);
  box-shadow: 0 0 20px rgba(124, 247, 255, 0.14);
}

.main-menu-btn.is-active:hover,
.main-menu-btn.is-active:focus-visible {
  border-color: transparent;
  background: rgba(124, 247, 255, 0.13);
  box-shadow: 0 0 26px rgba(124, 247, 255, 0.18);
}

.main-menu-btn.is-locked {
  position: relative;
  padding-right: 34px;
}

.main-menu-btn.is-locked::after {
  content: "";
  position: absolute;
  right: 14px;
  top: calc(50% - 1px);
  width: 11px;
  height: 9px;
  border: 2px solid rgba(225, 238, 255, 0.9);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(14, 22, 34, 0.28);
  pointer-events: none;
}

.main-menu-btn.is-locked::before {
  content: "";
  position: absolute;
  right: 16px;
  top: calc(50% - 8px);
  width: 7px;
  height: 5px;
  border: 2px solid rgba(225, 238, 255, 0.9);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  pointer-events: none;
}

.main-menu-btn.is-locked:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  filter: saturate(0.7);
}

.start-menu-phase-landing .start-menu-panel-host {
  display: none !important;
}

.start-menu-panel-host {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  max-width: none;
  border: none;
  border-radius: 0;
  background: rgba(4, 7, 14, 0.94);
  box-shadow: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: calc(10px + var(--safe-top)) max(14px, env(safe-area-inset-right))
    calc(14px + var(--safe-bottom)) max(14px, env(safe-area-inset-left));
  min-height: 0;
}

.start-menu-phase-detail .start-menu-panel-host:not(.hidden) {
  display: flex !important;
}

.menu-back-btn {
  position: relative;
  z-index: 8;
  flex: 0 0 auto;
  align-self: flex-start;
  width: auto;
  margin: 0 0 10px -2px;
  padding: 12px 10px 12px 6px;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(188, 210, 238, 0.82);
  font-family: "Syne", "Outfit", system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition:
    color 0.14s ease,
    background 0.14s ease,
    outline 0.14s ease;
}

.menu-back-btn:hover,
.menu-back-btn:focus-visible {
  color: rgba(236, 248, 255, 0.94);
  background: rgba(124, 247, 255, 0.05);
  outline: none;
}

.menu-panel {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}

/* Compact mode picker in detail view (fits without scroll when possible). */
.start-menu-panel-host .mode-picker {
  gap: 8px;
}

#menu-panel-gamemodes {
  max-width: min(1040px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

#menu-panel-gamemodes > h2 {
  text-align: center;
}

#menu-panel-gamemodes .mode-picker {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

#menu-panel-gamemodes .mode-card {
  display: grid;
  grid-template-columns: minmax(120px, clamp(132px, 30vw, 220px)) minmax(0, 1fr);
  align-items: center;
  column-gap: clamp(12px, 2.8vw, 18px);
  row-gap: 10px;
  padding: clamp(12px, 2.4vw, 16px) clamp(12px, 2.4vw, 18px);
  min-height: 0;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid rgba(124, 247, 255, 0.26);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.025) 40%, rgba(10, 16, 32, 0.35) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 10px 32px rgba(0, 0, 0, 0.25);
}

#menu-panel-gamemodes .mode-card-media {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  min-height: 0;
  object-fit: cover;
  object-position: center;
  border-radius: 12px;
  border: 1px solid rgba(124, 247, 255, 0.28);
  background: rgba(8, 12, 24, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow: hidden;
  align-self: center;
}

#menu-panel-gamemodes .mode-card-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  justify-content: center;
}

.start-menu-panel-host .mode-card-copy {
  font-size: 0.76rem;
  line-height: 1.38;
}

.start-menu-panel-host .mode-card-copy strong {
  font-size: 0.86rem;
}

#menu-panel-gamemodes .gamemodes-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 800px;
  margin: 12px auto 0;
  gap: 10px;
  box-sizing: border-box;
}

#menu-panel-gamemodes #btn-enter-astroverse {
  width: 100%;
  max-width: 100%;
  padding: 10px 16px;
  font-size: 0.82rem;
  letter-spacing: 0.13em;
  display: inline-flex;
  justify-content: center;
}

#menu-panel-gamemodes .mode-card:has(input[type="radio"]:checked) {
  border-color: rgba(200, 255, 255, 0.92);
  background:
    radial-gradient(ellipse 130% 90% at 50% -35%, rgba(140, 250, 255, 0.34), transparent 52%),
    radial-gradient(ellipse 70% 55% at 100% 50%, rgba(80, 200, 255, 0.12), transparent 58%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.05) 42%, rgba(12, 36, 52, 0.55) 100%);
  box-shadow:
    inset 0 1px 0 rgba(230, 255, 255, 0.55),
    inset 0 0 0 1px rgba(140, 240, 255, 0.45),
    0 0 0 1px rgba(100, 220, 255, 0.35),
    0 0 32px rgba(90, 235, 255, 0.45),
    0 0 64px rgba(60, 200, 255, 0.22),
    0 10px 36px rgba(0, 0, 0, 0.28);
}

#menu-panel-gamemodes .mode-card:has(input[type="radio"]:checked) .mode-card-media {
  border-color: rgba(190, 255, 255, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 20px rgba(100, 230, 255, 0.35);
}

#menu-panel-onchainads {
  max-width: min(980px, 100%);
  margin: 0 auto;
}

.menu-panel-onchainads .astro-ads-catalog {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 3vw, 22px);
  margin-bottom: clamp(14px, 3vw, 20px);
}

.menu-panel-onchainads .astro-ads-tier {
  border-radius: 14px;
  padding: clamp(12px, 2.6vw, 16px);
  background: rgba(8, 12, 26, 0.55);
  border: 1px solid rgba(124, 247, 255, 0.2);
}

.menu-panel-onchainads .astro-ads-tier--zenith {
  border-color: rgba(124, 247, 255, 0.35);
  box-shadow: inset 0 0 0 1px rgba(124, 247, 255, 0.06);
}

.menu-panel-onchainads .astro-ads-tier--core {
  border-color: rgba(255, 202, 77, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 202, 77, 0.07);
}

.menu-panel-onchainads .astro-ads-tier--nebule {
  border-color: rgba(179, 136, 255, 0.35);
  box-shadow: inset 0 0 0 1px rgba(179, 136, 255, 0.07);
}

.menu-panel-onchainads .astro-ads-tier-title {
  margin: 0 0 4px;
  font-family: "Syne", "Outfit", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.menu-panel-onchainads .astro-ads-tier-hint {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: rgba(198, 216, 238, 0.78);
  line-height: 1.35;
}

.menu-panel-onchainads .astro-ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}

.menu-panel-onchainads .astro-ads-empty {
  margin: 0;
  grid-column: 1 / -1;
  padding: 10px 4px;
  font-size: 0.82rem;
  color: rgba(198, 216, 238, 0.62);
  font-style: italic;
}

.menu-panel-onchainads .astro-ads-card {
  margin: 0;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(4, 8, 18, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-panel-onchainads .astro-ads-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 0.62;
  object-fit: cover;
  vertical-align: bottom;
}

.menu-panel-onchainads .astro-ads-thumb--broken {
  min-height: 72px;
  background: repeating-linear-gradient(
    -12deg,
    rgba(255, 202, 77, 0.12),
    rgba(255, 202, 77, 0.12) 8px,
    rgba(8, 12, 26, 0.5) 8px,
    rgba(8, 12, 26, 0.5) 16px
  );
}

.menu-panel-onchainads .astro-ads-card-title {
  padding: 6px 8px 8px;
  font-size: 0.68rem;
  line-height: 1.28;
  color: rgba(230, 236, 250, 0.88);
}

.menu-panel-onchainads .onchain-ads-cta-wrap {
  display: flex;
  justify-content: center;
  padding-top: 4px;
  padding-inline: clamp(8px, 2.5vw, 16px);
}

.menu-panel-onchainads .onchain-ads-cta-wrap .btn.mode-cta {
  width: min(620px, 100%);
}

.menu-panel h2 {
  margin: 0 0 8px;
  font-family: "Syne", "Outfit", sans-serif;
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  letter-spacing: 0.04em;
}

.menu-panel-subtitle {
  margin: 0 0 14px;
  color: rgba(198, 216, 238, 0.86);
  font-size: 0.86rem;
}

.profile-shell {
  border: 1px solid rgba(124, 247, 255, 0.24);
  border-radius: 12px;
  padding: 14px;
  background: rgba(9, 15, 28, 0.7);
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.profile-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(170, 194, 220, 0.82);
}

.profile-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-stat {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(124, 247, 255, 0.2);
  background: rgba(12, 20, 36, 0.75);
  display: grid;
  gap: 4px;
}

.profile-stat span {
  font-size: 0.72rem;
  color: rgba(180, 202, 228, 0.8);
}

.menu-dummy-list,
.menu-dummy-board {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: rgba(222, 237, 255, 0.9);
  font-size: 0.9rem;
}

.menu-dummy-board {
  padding-left: 0;
  list-style: none;
}

.menu-dummy-board li {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(124, 247, 255, 0.18);
  border-radius: 10px;
  padding: 10px;
}

.menu-dummy-board em {
  font-style: normal;
  color: rgba(124, 247, 255, 0.9);
}

.menu-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  font-size: 0.84rem;
  color: rgba(224, 240, 255, 0.88);
}

.menu-toggle-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(124, 247, 255, 0.18);
  border-radius: 10px;
  padding: 10px;
  background: rgba(12, 20, 36, 0.68);
}

@media (max-width: 920px) {
  .start-menu-nav .main-menu-list {
    grid-template-columns: 1fr;
  }

  .main-menu-btn {
    font-size: 0.76rem;
    padding: 12px 10px 12px 6px;
    text-align: left;
  }

  .start-menu-panel-host {
    padding: calc(8px + var(--safe-top)) max(10px, env(safe-area-inset-right))
      calc(12px + var(--safe-bottom)) max(10px, env(safe-area-inset-left));
  }

  .menu-panel {
    width: 100%;
  }

  .start-menu-panel-host .mode-card,
  .start-menu-panel-host .mode-card--reverse {
    flex-direction: row;
    padding: 8px;
  }

  #menu-panel-gamemodes .mode-card {
    grid-template-columns: minmax(108px, 38vw) minmax(0, 1fr);
  }

}

@media (max-width: 540px) {
  #menu-panel-gamemodes .mode-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-items: stretch;
    gap: 12px;
    padding: 14px 14px 16px;
  }

  #menu-panel-gamemodes .mode-card-media {
    width: 100%;
    max-width: none;
    aspect-ratio: 16 / 9;
    height: auto;
    object-fit: cover;
  }

  #menu-panel-onchainads .onchain-ads-cta-wrap .btn.mode-cta {
    width: 100%;
    max-width: 100%;
  }
}

.admin-card h2,
.pause-card h2 {
  font-family: "Syne", sans-serif;
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.field span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"] {
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 12px 12px;
  font-size: 1rem;
  outline: none;
}

.field input[readonly] {
  color: rgba(244, 246, 255, 0.72);
  background: rgba(255, 255, 255, 0.025);
}

.field input:focus {
  border-color: rgba(124, 247, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(124, 247, 255, 0.2);
}

.field input[type="color"] {
  height: 44px;
  border: none;
  padding: 0;
  background: transparent;
}

.field.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.field.checkbox span {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.88rem;
  color: var(--text);
}

.inline-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.grid-2 .span-2 {
  grid-column: span 2;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.btn {
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  width: 100%;
}

.btn.primary {
  background: linear-gradient(120deg, rgba(124, 247, 255, 0.25), rgba(255, 122, 24, 0.22));
  border-color: rgba(124, 247, 255, 0.35);
}

.btn.primary.glow {
  box-shadow: var(--glow);
}

.btn.ghost {
  background: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.text-link {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font-size: 0.88rem;
  padding: 8px;
}

.fineprint {
  max-width: 420px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8rem;
  line-height: 1.4;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(10px + var(--safe-top)) 12px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
  z-index: 4;
}

.hud-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  max-width: min(42vw, 198px);
  padding-right: 7px;
}

.hud .icon-btn {
  pointer-events: auto;
}

.hud-count-plain {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Same scale as coords; ~10% under prior coords clamp */
  font-size: clamp(0.56rem, 2.34vw, 0.68rem);
  font-weight: 500;
  color: rgba(200, 214, 240, 0.88);
  letter-spacing: 0.02em;
  padding-top: 2px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.hud-coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.56rem, 2.34vw, 0.68rem);
  font-weight: 500;
  color: rgba(200, 214, 240, 0.88);
  letter-spacing: 0.02em;
  line-height: 1.22;
  white-space: pre-line;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.hud-compass {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(10px + var(--safe-top));
  min-width: 40px;
  text-align: center;
  font-family: "Syne", "Outfit", sans-serif;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: clamp(0.95rem, 3.8vw, 1.15rem);
  color: #e8edf8;
  text-shadow: 0 0 14px rgba(124, 247, 255, 0.35);
  pointer-events: none;
}

/* Left-bottom toasts: same type as coords; sits above joystick padding. */
.alert-stack {
  position: absolute;
  left: max(10px, env(safe-area-inset-left));
  bottom: calc(18px + var(--safe-bottom) + 10dvh + 128px);
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  max-width: min(88vw, 300px);
  pointer-events: none;
}

.alert-stack.hidden {
  display: none;
}

.alert-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 6px;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.56rem, 2.34vw, 0.68rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.alert-line.alert-line--out {
  opacity: 0;
  transform: translateX(-8px);
}

@media (prefers-reduced-motion: reduce) {
  .alert-line {
    transition: opacity 0.25s ease;
  }

  .alert-line.alert-line--out {
    transform: none;
  }
}

.alert-name {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f4f7ff;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.alert-msg {
  color: rgba(200, 214, 240, 0.9);
  font: inherit;
  font-weight: 500;
}

.icon-btn {
  border-radius: 999px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--stroke);
  background: rgba(8, 10, 18, 0.55);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}

.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  /* Lift joystick ~30% viewport from bottom (was flush to safe area). */
  padding: 10px 12px calc(12px + var(--safe-bottom) + 10dvh);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  z-index: 10;
  isolation: isolate;
  pointer-events: none;
}

.controls--stick-only {
  justify-content: center;
}

.controls > * {
  pointer-events: auto;
}

.joystick-cluster {
  position: relative;
  width: 120px;
  height: 120px;
  flex: 0 0 auto;
  overflow: visible;
  /* Joystick radius 60px — keep button inner edge clear of the stick */
  --stick-action-ring-radius: 100px;
}

.stick-action-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.stick-action-btn {
  position: absolute;
  left: 0;
  top: 0;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  font-size: 0;
  color: rgba(124, 247, 255, 0.92);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  background: linear-gradient(168deg, rgba(21, 35, 68, 0.92) 0%, rgba(8, 14, 28, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(124, 247, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 4px 14px rgba(0, 0, 0, 0.42);
  transform: rotate(var(--ring-angle, 0deg)) translateX(var(--stick-action-ring-radius))
    rotate(calc(-1 * var(--ring-angle, 0deg)));
  transition:
    color 0.15s ease,
    filter 0.15s ease,
    transform 0.12s ease;
}

.stick-action-btn:hover,
.stick-action-btn:focus-visible {
  color: #e8fbff;
  filter: drop-shadow(0 0 10px rgba(124, 247, 255, 0.35));
  outline: none;
}

.stick-action-btn:active {
  transform: rotate(var(--ring-angle, 0deg)) translateX(var(--stick-action-ring-radius))
    rotate(calc(-1 * var(--ring-angle, 0deg))) scale(0.94);
}

.stick-action-btn--laser,
.stick-action-btn--chat {
  border: 1px solid rgba(124, 247, 255, 0.28);
}

.stick-action-btn--chat:disabled {
  color: rgba(110, 130, 145, 0.72);
  cursor: not-allowed;
  opacity: 0.72;
  filter: grayscale(0.45) brightness(0.88);
  border-color: rgba(90, 108, 120, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4),
    0 3px 10px rgba(0, 0, 0, 0.38);
}

.stick-action-btn--chat:disabled:hover,
.stick-action-btn--chat:disabled:focus-visible {
  color: rgba(110, 130, 145, 0.72);
  filter: grayscale(0.45) brightness(0.88);
}

.stick-action-btn--chat:disabled:active {
  transform: rotate(var(--ring-angle, 0deg)) translateX(var(--stick-action-ring-radius))
    rotate(calc(-1 * var(--ring-angle, 0deg)));
}

.stick-action-btn--nitro {
  color: rgba(255, 214, 120, 0.95);
  border: 1px solid rgba(255, 200, 90, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 190, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 0 16px rgba(255, 190, 70, 0.22),
    0 4px 14px rgba(0, 0, 0, 0.42);
}

.stick-action-btn--nitro:hover,
.stick-action-btn--nitro:focus-visible {
  color: #fff6d6;
  filter: drop-shadow(0 0 12px rgba(255, 200, 90, 0.35));
}

.stick-action-icon {
  display: block;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
}

.stick-zone {
  position: relative;
  width: 120px;
  height: 120px;
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.stick-zone:active {
  cursor: grabbing;
}

.stick-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(20, 24, 42, 0.78);
  border: 1px solid rgba(124, 247, 255, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    inset 0 0 24px rgba(0, 0, 0, 0.35),
    0 6px 28px rgba(0, 0, 0, 0.45);
}

.stick-knob {
  position: absolute;
  width: 40px;
  height: 40px;
  left: 50%;
  top: 50%;
  margin-left: -20px;
  margin-top: -20px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.45), rgba(124, 247, 255, 0.28));
  border: none;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.pause-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 700px) {
  .controls {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 420px) {
  .joystick-cluster {
    --stick-action-ring-radius: 92px;
  }

  .stick-action-btn {
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
  }

  .stick-action-icon {
    width: 22px;
    height: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stick-action-btn {
    transition: none;
  }
}

/* —— Bottom-right HUD: bag / leaderboard / settings (sci-fi clipped chips) —— */
.hud-actions {
  position: absolute;
  right: max(10px, env(safe-area-inset-right));
  bottom: calc(12px + var(--safe-bottom) + 10dvh + 86px);
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  pointer-events: none;
}

.hud-actions .hud-action-btn {
  pointer-events: auto;
}

.hud-action-btn {
  position: relative;
  width: 46px;
  height: 46px;
  padding: 0;
  margin: 0;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: rgba(124, 247, 255, 0.92);
  background: linear-gradient(168deg, rgba(21, 35, 68, 0.88) 0%, rgba(8, 14, 28, 0.96) 100%);
  box-shadow:
    inset 0 1px 0 rgba(124, 247, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 4px 14px rgba(0, 0, 0, 0.42);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
  transition:
    color 0.15s ease,
    filter 0.15s ease,
    transform 0.12s ease;
}

/* Outer chips only: slant the free edge; middle stays a square flush between them. */
.hud-action-btn:nth-child(1) {
  clip-path: polygon(0 11%, 100% 0, 100% 100%, 0 100%);
}

.hud-action-btn:nth-child(2) {
  clip-path: none;
}

.hud-action-btn:nth-child(3) {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 89%);
}

.hud-action-btn:hover,
.hud-action-btn:focus-visible {
  color: #e8fbff;
  filter: drop-shadow(0 0 10px rgba(124, 247, 255, 0.35));
  outline: none;
}

.hud-action-btn:active {
  transform: scale(0.96);
}

.hud-action-icon {
  display: block;
}

.hud-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  pointer-events: none;
}

.hud-modal-overlay:not(.hidden) {
  pointer-events: auto;
}

.hud-modal-scrim {
  position: absolute;
  inset: 0;
  background: transparent;
  cursor: pointer;
}

.hud-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 380px);
  max-height: min(72vh, 520px);
  overflow: auto;
  padding: 18px 18px 16px;
  border: 1px solid rgba(124, 247, 255, 0.28);
  background: rgba(12, 14, 24, 0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35) inset,
    0 18px 48px rgba(0, 0, 0, 0.55);
  clip-path: polygon(0 10px, 10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px));
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  transform: translate3d(0, 0, 0);
}

@media (prefers-reduced-motion: reduce) {
  .hud-modal-panel {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(12, 14, 24, 0.78);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hud-modal-overlay:not(.hidden) .hud-modal-panel {
    animation: hud-modal-in 0.2s ease-out;
  }
}

@keyframes hud-modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hud-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(124, 247, 255, 0.28);
  border-radius: 6px;
  background: rgba(8, 10, 18, 0.55);
  color: rgba(124, 247, 255, 0.9);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.hud-modal-close:hover,
.hud-modal-close:focus-visible {
  background: rgba(124, 247, 255, 0.12);
  color: #f4fbff;
  outline: none;
}

.hud-modal-title {
  margin: 0 40px 12px 0;
  font-family: "Syne", "Outfit", sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(232, 240, 255, 0.96);
  text-shadow: 0 0 18px rgba(124, 247, 255, 0.25);
}

.hud-modal-body {
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(200, 214, 240, 0.9);
}

.hud-modal-placeholder {
  margin: 0;
  color: var(--muted);
}

.leaderboard-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.leaderboard-row:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 247, 255, 0.28);
  background: rgba(124, 247, 255, 0.07);
}

.leaderboard-row.is-top-1 {
  border-color: rgba(255, 215, 86, 0.5);
  background: linear-gradient(135deg, rgba(255, 215, 86, 0.2), rgba(255, 255, 255, 0.04));
  box-shadow: 0 0 18px rgba(255, 205, 70, 0.18);
}

.leaderboard-row.is-top-2 {
  border-color: rgba(190, 220, 255, 0.42);
  background: linear-gradient(135deg, rgba(190, 220, 255, 0.16), rgba(255, 255, 255, 0.04));
}

.leaderboard-row.is-top-3 {
  border-color: rgba(255, 164, 92, 0.42);
  background: linear-gradient(135deg, rgba(255, 164, 92, 0.15), rgba(255, 255, 255, 0.04));
}

.leaderboard-row.is-you {
  outline: 1px solid rgba(124, 247, 255, 0.55);
  box-shadow: 0 0 20px rgba(124, 247, 255, 0.18);
}

.leaderboard-rank,
.leaderboard-score {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.leaderboard-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-name small {
  display: block;
  margin-top: 2px;
  color: rgba(200, 214, 240, 0.72);
  font-size: 0.68rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-you {
  display: inline-flex;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(124, 247, 255, 0.16);
  color: rgba(124, 247, 255, 0.96);
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* Multiverse Social — minimal sci-fi comms (top-right, glass, pilot colors in feed). */
.metaverse-chat {
  position: absolute;
  top: calc(8px + var(--safe-top));
  right: max(8px, env(safe-area-inset-right));
  z-index: 22;
  max-width: min(240px, 44vw);
  pointer-events: none;
}

.metaverse-chat__panel {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px 7px 6px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(165deg, rgba(10, 18, 36, 0.19) 0%, rgba(4, 8, 18, 0.26) 100%);
  backdrop-filter: blur(8px) saturate(1.08);
  -webkit-backdrop-filter: blur(8px) saturate(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.metaverse-chat__feed {
  /* ~5 compact lines */
  max-height: calc(5 * 0.78rem + 6px);
  min-height: 22px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1px 1px 2px;
  margin: 0 -1px;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 247, 255, 0.16) transparent;
}

.metaverse-chat__feed::-webkit-scrollbar {
  width: 4px;
}

.metaverse-chat__feed::-webkit-scrollbar-thumb {
  background: rgba(124, 247, 255, 0.12);
  border-radius: 99px;
}

.metaverse-chat__line {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.45rem, 1.85vw, 0.52rem);
  line-height: 1.28;
  color: rgba(228, 236, 255, 0.82);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  word-break: break-word;
  padding: 2px 0;
  border-bottom: 1px solid rgba(124, 247, 255, 0.04);
}

.metaverse-chat__line:last-child {
  border-bottom: none;
}

.metaverse-chat__name {
  font-weight: 700;
}

.metaverse-chat__msg {
  font-weight: 400;
  color: rgba(232, 240, 255, 0.72);
}

.metaverse-chat__feed:empty::before {
  content: "Channel idle — tap chat on the stick";
  display: block;
  font-size: 0.48rem;
  font-style: italic;
  color: rgba(124, 247, 255, 0.22);
  padding: 4px 0 1px;
  letter-spacing: 0.02em;
}

.metaverse-chat__compose {
  margin-top: 2px;
}

.metaverse-chat__compose-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 7px;
  border: none;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: none;
}

.metaverse-chat__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: rgba(240, 246, 255, 0.88);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.58rem;
  outline: none;
  padding: 3px 2px;
}

.metaverse-chat__input::placeholder {
  color: rgba(124, 247, 255, 0.24);
}

.metaverse-chat__send-hint {
  flex-shrink: 0;
  font-size: 0.56rem;
  font-weight: 700;
  color: rgba(124, 247, 255, 0.3);
  user-select: none;
}

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