:root {
  color-scheme: dark;
  font-family: "Courier New", ui-monospace, monospace;
  background: #55adf2;
}

@font-face {
  font-family: "Press Start 2P";
  src: url("./assets/press-start-2p.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.game-page {
  display: grid;
  place-items: center;
  background: #0090fc;
}

#game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#game {
  width: 100%;
  height: 100%;
}

canvas {
  display: block;
  image-rendering: pixelated;
}

.menu-page,
.map-page {
  background: #55adf2;
}

.menu-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 620px;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background: #55adf2;
}

.menu-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("./assets/sonic-perps-landing-ocean.png") center / cover no-repeat;
  image-rendering: pixelated;
  animation: menu-pan 18s steps(10, end) infinite alternate;
}

.menu-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(2, 42, 118, 0.08) 0 22%, rgba(2, 20, 72, 0.3) 66%, rgba(0, 10, 34, 0.55) 100%),
    linear-gradient(180deg, rgba(0, 113, 216, 0.02) 0%, rgba(0, 25, 84, 0.12) 56%, rgba(0, 11, 42, 0.34) 100%);
}

.menu-panel {
  position: relative;
  z-index: 2;
  width: min(620px, 88vw);
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
  transform: translateY(-8px);
}

.brand-avatar {
  width: clamp(78px, 8vw, 112px);
  height: clamp(78px, 8vw, 112px);
  object-fit: cover;
  display: block;
  border: 4px solid #eaffff;
  box-shadow: 5px 5px 0 #073276;
  image-rendering: pixelated;
  clip-path: polygon(0 10px, 10px 10px, 10px 0, calc(100% - 10px) 0, calc(100% - 10px) 10px, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 10px calc(100% - 10px), 0 calc(100% - 10px));
}

.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;
}

.menu-logo {
  width: min(560px, 84vw);
  height: auto;
  display: block;
  image-rendering: pixelated;
  filter: drop-shadow(5px 5px 0 rgba(8, 37, 92, 0.34));
}

.tagline {
  margin: 0 0 8px;
  color: #ffffff;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(10px, 1.5vw, 15px);
  font-weight: 900;
  line-height: 1.45;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #124b98;
}

.menu-actions {
  width: min(390px, 78vw);
  display: grid;
  gap: 10px;
  justify-items: center;
}

.menu-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 13px 24px 12px;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(62, 179, 255, 0.94), rgba(24, 91, 205, 0.94));
  box-shadow:
    0 0 0 3px #eafcff,
    inset 0 4px 0 rgba(255, 255, 255, 0.28),
    inset 0 -5px 0 rgba(4, 35, 108, 0.4),
    5px 5px 0 #08295f;
  color: #ffffff;
  cursor: pointer;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(12px, 1.4vw, 16px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.15;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #08295f;
  image-rendering: pixelated;
  clip-path: polygon(0 8px, 8px 8px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 8px, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px));
}

#play-link {
  background: linear-gradient(180deg, rgba(255, 222, 87, 0.96), rgba(239, 146, 36, 0.96));
  color: #08295f;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.5);
}

.jup-button {
  background: linear-gradient(180deg, rgba(91, 244, 199, 0.95), rgba(52, 112, 220, 0.95));
  color: #061b48;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.48);
}

.menu-button:hover {
  transform: translate(2px, 2px);
  filter: brightness(1.08);
  box-shadow:
    0 0 0 3px #eafcff,
    inset 0 4px 0 rgba(255, 255, 255, 0.28),
    inset 0 -5px 0 rgba(4, 35, 108, 0.4),
    3px 3px 0 #08295f;
}

.menu-button:focus-visible {
  outline: 4px solid #fff176;
  outline-offset: 4px;
}

.button-icon {
  display: inline-block;
  min-width: 20px;
  color: inherit;
  text-align: center;
}

.wallet-status {
  margin: -2px 0 0;
  color: #e9f8ff;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(8px, 1vw, 11px);
  font-weight: 900;
  line-height: 1.45;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #164f99;
}

.wallet-status.is-connected {
  color: #8efcff;
}

.wallet-status.is-error {
  color: #fff08a;
}

.leaderboard {
  position: relative;
  width: min(390px, 78vw);
  min-height: 94px;
  padding: 14px 20px 18px;
  border: 0;
  background: rgba(8, 49, 88, 0.78);
  box-shadow:
    0 0 0 3px #8fffb7,
    inset 0 4px 0 rgba(255, 255, 255, 0.14),
    5px 5px 0 #052654;
  color: #ffffff;
  text-shadow: 2px 2px 0 #12386e;
  clip-path: polygon(0 8px, 8px 8px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 8px, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px));
}

.leaderboard h2 {
  margin: 0;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(10px, 1.3vw, 14px);
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.leaderboard ol {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(8px, 1vw, 11px);
  font-weight: 900;
}

.leaderboard li {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.level-map {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background: #007be6;
}

.level-map::before {
  content: none;
}

.level-map::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.06), transparent 46%);
  animation: water-glint 5s steps(5, end) infinite;
}

.map-panel {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100vh;
  background: url("./assets/sonic-perps-level-map.png") center / cover no-repeat;
  image-rendering: pixelated;
  overflow: hidden;
}

.map-wallet,
.map-back {
  position: absolute;
  z-index: 4;
  margin: 0;
  color: #ffffff;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(9px, 1vw, 13px);
  font-weight: 900;
  line-height: 1.35;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #06428a;
}

.map-wallet {
  top: 5%;
  left: 50%;
  max-width: min(560px, 80%);
  padding: 0;
  background: transparent;
  transform: translateX(-50%);
}

.map-back {
  left: 50%;
  bottom: 4%;
  padding: 8px 12px;
  transform: translateX(-50%);
  text-decoration: none;
  background: rgba(0, 67, 145, 0.34);
  box-shadow: none;
}

.map-back:hover {
  transform: translateX(-50%) translate(2px, 2px);
  color: #fff176;
}

.level-path {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.level-path::before {
  content: none;
}

.level-node {
  position: absolute;
  z-index: 2;
  width: clamp(62px, 7vw, 118px);
  height: clamp(42px, 5vw, 86px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  text-decoration: none;
  text-shadow: 2px 2px 0 #06428a;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -50%);
  animation: node-bob 3s steps(4, end) infinite;
}

.level-node span {
  display: none;
}

.level-node::before {
  content: "";
  position: absolute;
  inset: 5%;
  border-radius: 50%;
  background: rgba(142, 252, 255, 0.02);
  opacity: 0;
  box-shadow: 0 0 0 0 rgba(142, 252, 255, 0);
  transition: opacity 120ms linear, box-shadow 120ms linear;
}

.level-node::after {
  content: none;
}

.level-node strong,
.level-node em {
  font-style: normal;
  text-transform: uppercase;
}

.level-node strong {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 24px);
  width: max-content;
  max-width: 230px;
  color: #ffffff;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(10px, 1.25vw, 16px);
  line-height: 1.25;
  text-align: center;
  text-shadow: 3px 3px 0 #06428a, -2px 0 0 #06428a, 2px 0 0 #06428a;
  transform: translateX(-50%);
}

.level-node em {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 210px;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(7px, 0.8vw, 10px);
  color: #c9ffff;
  line-height: 1.25;
  text-align: center;
  text-shadow: 2px 2px 0 #06428a;
  transform: translateX(-50%);
}

.level-node:hover {
  transform: translate(-50%, -50%) translateY(-3px);
  filter: brightness(1.08);
}

.level-node:hover::before {
  opacity: 1;
  box-shadow: 0 0 22px 12px rgba(142, 252, 255, 0.38);
}

.level-node.is-current::before {
  opacity: 1;
  animation: current-node-pulse 1.4s steps(4, end) infinite;
}

.level-node[data-state="complete"] strong::after {
  content: " ✓";
  color: #8fffb7;
}

.level-node[data-state="preview"] {
  opacity: 0.86;
}

.level-node:focus-visible {
  outline: 4px solid #fff176;
  outline-offset: 8px;
}

.level-node--meadow {
  left: 14.2%;
  top: 74.8%;
  animation-delay: 0s;
}

.level-node--aqua {
  left: 22.6%;
  top: 47.4%;
  animation-delay: 0.35s;
}

.level-node--neon {
  left: 42.7%;
  top: 61.7%;
  animation-delay: 0.7s;
}

.level-node--crystal {
  left: 53.7%;
  top: 34.8%;
  animation-delay: 1.05s;
}

.level-node--tide {
  left: 58.1%;
  top: 74.8%;
  animation-delay: 1.4s;
}

.level-node--palm {
  left: 77%;
  top: 63.4%;
  animation-delay: 1.75s;
}

.level-node--sky {
  left: 83.6%;
  top: 39.5%;
  animation-delay: 2.1s;
}

@keyframes menu-pan {
  from {
    background-position: 49% 50%;
  }

  to {
    background-position: 51% 50%;
  }
}

@keyframes map-drift {
  from {
    background-position: 49% 50%;
  }

  to {
    background-position: 51% 50%;
  }
}

@keyframes water-glint {
  0%,
  100% {
    opacity: 0.52;
  }

  50% {
    opacity: 0.82;
  }
}

@keyframes path-sparkle {
  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 0.95;
  }
}

@keyframes node-bob {
  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -5px;
  }
}

@keyframes current-node-pulse {
  0%,
  100% {
    box-shadow: 0 0 12px 6px rgba(142, 252, 255, 0.34);
  }

  50% {
    box-shadow: 0 0 28px 14px rgba(255, 241, 118, 0.45);
  }
}

@media (max-width: 720px) {
  .menu-screen {
    min-height: 560px;
  }

  .menu-panel {
    width: 94vw;
    gap: 12px;
    transform: translateY(-30px);
  }

  .menu-logo {
    width: 88vw;
    max-width: 700px;
  }

  .tagline {
    margin-top: 0;
  }

  .leaderboard {
    padding-inline: 18px;
  }

  .map-panel {
    width: min(178vh, 148vw);
  }

  .level-node {
    width: clamp(52px, 12vw, 78px);
    height: clamp(52px, 12vw, 78px);
  }

  .level-node strong {
    max-width: 150px;
    font-size: clamp(8px, 2.1vw, 11px);
  }

  .level-node em {
    display: none;
  }
}

.stage-page {
  background: #55adf2;
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.stage-screen {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: visible;
  isolation: isolate;
  background: #55adf2;
}

.stage-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url("./assets/sonic-perps-landing-ocean.png") center / cover no-repeat;
  image-rendering: pixelated;
  transform: scale(1.04);
}

.stage-screen::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 44, 110, 0.24), rgba(0, 19, 60, 0.6)),
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.12), transparent 34%);
}

.stage-shell {
  position: relative;
  z-index: 2;
  width: min(1120px, calc(100vw - 40px));
  margin: 32px 0;
  padding: 28px;
  display: grid;
  gap: 22px;
  background: rgba(3, 27, 73, 0.62);
  box-shadow:
    0 0 0 3px #eafcff,
    inset 0 4px 0 rgba(255, 255, 255, 0.18),
    8px 8px 0 rgba(2, 17, 51, 0.82);
  clip-path: polygon(0 12px, 12px 12px, 12px 0, calc(100% - 12px) 0, calc(100% - 12px) 12px, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 12px calc(100% - 12px), 0 calc(100% - 12px));
}

.stage-header {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.stage-kicker,
.stage-subtitle,
.stage-wallet,
.stage-card__eyebrow,
.stage-card__meta,
.stage-card__cta,
.game-overlay-hint,
.game-overlay-meta span {
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0;
}

.stage-kicker {
  margin: 0;
  color: #8efcff;
  font-size: clamp(9px, 1vw, 12px);
  text-shadow: 2px 2px 0 #073276;
}

.stage-header h1 {
  margin: 0;
  color: #ffffff;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1;
  text-shadow: 4px 4px 0 #0c3b85, 8px 8px 0 rgba(3, 17, 49, 0.9);
}

.stage-subtitle {
  margin: 0;
  max-width: 680px;
  color: #eafcff;
  font-size: clamp(8px, 0.95vw, 11px);
  line-height: 1.7;
  text-shadow: 2px 2px 0 #0c3b85;
}

.stage-wallet {
  margin: 0;
  color: #fff176;
  font-size: clamp(8px, 0.95vw, 11px);
  line-height: 1.5;
  text-shadow: 2px 2px 0 #0c3b85;
}

.stage-grid {
  display: grid;
  gap: 18px;
}

.stage-result-banner {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  color: #ffffff;
  background: rgba(8, 54, 119, 0.92);
  box-shadow:
    0 0 0 3px #fff6a3,
    inset 0 4px 0 rgba(255, 255, 255, 0.18),
    6px 6px 0 rgba(3, 17, 49, 0.82);
  clip-path: polygon(0 10px, 10px 10px, 10px 0, calc(100% - 10px) 0, calc(100% - 10px) 10px, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 10px calc(100% - 10px), 0 calc(100% - 10px));
}

.stage-result-banner strong,
.stage-result-banner span {
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0;
  text-shadow: 2px 2px 0 #0c3b85;
}

.stage-result-banner strong {
  font-size: clamp(10px, 1vw, 13px);
}

.stage-result-banner span {
  font-size: clamp(8px, 0.92vw, 11px);
  line-height: 1.55;
}

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

.quest-card,
.zone-panel,
.stage-chip {
  position: relative;
  overflow: hidden;
  color: #ffffff;
  text-decoration: none;
  background: rgba(8, 44, 106, 0.9);
  box-shadow:
    0 0 0 3px #dff7ff,
    inset 0 4px 0 rgba(255, 255, 255, 0.16),
    6px 6px 0 rgba(3, 17, 49, 0.82);
  clip-path: polygon(0 10px, 10px 10px, 10px 0, calc(100% - 10px) 0, calc(100% - 10px) 10px, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 10px calc(100% - 10px), 0 calc(100% - 10px));
}

.quest-card {
  min-height: 120px;
  padding: 16px 18px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  transition: transform 120ms linear, filter 120ms linear;
}

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

.zone-panel {
  min-height: 174px;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.quest-card::before,
.zone-panel::before,
.stage-chip::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.24;
}

.quest-card--ocean::before,
.zone-panel--ocean::before,
.stage-chip--ocean::before {
  background: linear-gradient(135deg, rgba(39, 197, 255, 0.4), transparent 60%);
}

.quest-card--tutorial::before,
.zone-panel--tutorial::before,
.stage-chip--tutorial::before {
  background: linear-gradient(135deg, rgba(86, 231, 255, 0.38), transparent 60%);
}

.quest-card--island::before,
.zone-panel--island::before,
.stage-chip--island::before {
  background: linear-gradient(135deg, rgba(76, 255, 145, 0.34), transparent 60%);
}

.quest-card--desert::before,
.zone-panel--desert::before,
.stage-chip--desert::before {
  background: linear-gradient(135deg, rgba(255, 193, 86, 0.34), transparent 60%);
}

.quest-card--hell::before,
.zone-panel--hell::before,
.stage-chip--hell::before {
  background: linear-gradient(135deg, rgba(255, 117, 167, 0.34), transparent 60%);
}

.quest-card--boss::before,
.zone-panel--boss::before,
.stage-chip--boss::before {
  background: linear-gradient(135deg, rgba(177, 132, 255, 0.36), transparent 60%);
}

.quest-card--lab::before,
.zone-panel--lab::before,
.stage-chip--lab::before {
  background: linear-gradient(135deg, rgba(182, 230, 255, 0.28), transparent 60%);
}

.quest-card:hover,
.quest-card.is-current,
.stage-chip:hover,
.stage-chip.is-current {
  transform: translate(-2px, -2px);
  filter: brightness(1.08);
}

.quest-card.is-current,
.stage-chip.is-current {
  box-shadow:
    0 0 0 3px #8efcff,
    inset 0 4px 0 rgba(255, 255, 255, 0.16),
    6px 6px 0 rgba(3, 17, 49, 0.82);
}

.quest-card.is-complete,
.stage-chip.is-complete {
  box-shadow:
    0 0 0 3px #8fffb7,
    inset 0 4px 0 rgba(255, 255, 255, 0.16),
    6px 6px 0 rgba(3, 17, 49, 0.82);
}

.stage-chip.is-next {
  box-shadow:
    0 0 0 3px #fff176,
    inset 0 4px 0 rgba(255, 255, 255, 0.16),
    6px 6px 0 rgba(3, 17, 49, 0.82);
}

.stage-card:focus-visible,
.quest-card:focus-visible,
.stage-chip:focus-visible,
.stage-action:focus-visible,
.game-overlay-button:focus-visible {
  outline: 4px solid #fff176;
  outline-offset: 4px;
}

.quest-card__eyebrow,
.zone-panel__eyebrow,
.zone-panel__count,
.stage-chip__secondary {
  position: relative;
  z-index: 1;
  color: #8efcff;
  font-size: 9px;
  line-height: 1.5;
  text-shadow: 2px 2px 0 #0c3b85;
}

.quest-card__title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(13px, 1.3vw, 18px);
  line-height: 1.4;
  text-shadow: 3px 3px 0 #0c3b85;
}

.quest-card__meta {
  position: relative;
  z-index: 1;
  color: #ffffff;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: 9px;
  line-height: 1.55;
  text-shadow: 2px 2px 0 #0c3b85;
}

.zone-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.zone-panel__copy {
  display: grid;
  gap: 8px;
}

.zone-panel__eyebrow {
  margin: 0;
}

.zone-panel h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(14px, 1.45vw, 18px);
  line-height: 1.4;
  text-shadow: 3px 3px 0 #0c3b85;
}

.zone-panel__count {
  min-width: max-content;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.08);
}

.zone-stage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stage-chip {
  min-height: 72px;
  padding: 12px 14px;
  display: grid;
  align-content: center;
  gap: 6px;
  flex: 1 1 160px;
  transition: transform 120ms linear, filter 120ms linear;
  scroll-margin-block: 96px;
}

.stage-chip__primary {
  position: relative;
  z-index: 1;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(11px, 1vw, 13px);
  line-height: 1.4;
  text-shadow: 2px 2px 0 #0c3b85;
}

.stage-chip__secondary {
  position: relative;
  z-index: 1;
  color: #fff176;
}

.stage-chip__status {
  position: relative;
  z-index: 1;
  margin-top: 3px;
  color: #dff7ff;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: 8px;
  line-height: 1.5;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #0c3b85;
}

.stage-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.stage-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  min-height: 48px;
  padding: 12px 18px;
  color: #ffffff;
  text-decoration: none;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.25;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #0c3b85;
  background: rgba(8, 44, 106, 0.9);
  box-shadow:
    0 0 0 3px #dff7ff,
    inset 0 4px 0 rgba(255, 255, 255, 0.16),
    6px 6px 0 rgba(3, 17, 49, 0.82);
  clip-path: polygon(0 8px, 8px 8px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 8px, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px));
}

.stage-action--quest {
  background: linear-gradient(180deg, rgba(255, 222, 87, 0.96), rgba(239, 146, 36, 0.96));
  color: #08295f;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.46);
}

.stage-action:hover,
.game-overlay-button:hover {
  transform: translate(2px, 2px);
  filter: brightness(1.06);
}

.opensonic-page {
  background: #000000;
}

.opensonic-page canvas {
  width: 100vw;
  height: 100vh;
  max-height: none;
  image-rendering: pixelated;
}

.opensonic-overlay {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 16px;
  pointer-events: none;
}

.game-overlay-button,
.game-overlay-meta {
  pointer-events: auto;
}

.game-overlay-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 42px;
  padding: 10px 14px;
  color: #ffffff;
  text-decoration: none;
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #08295f;
  background: rgba(8, 44, 106, 0.9);
  box-shadow:
    0 0 0 3px #dff7ff,
    inset 0 4px 0 rgba(255, 255, 255, 0.16),
    5px 5px 0 rgba(3, 17, 49, 0.82);
  clip-path: polygon(0 8px, 8px 8px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 8px, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px));
}

.game-overlay-meta {
  margin-left: auto;
  padding: 12px 16px;
  display: grid;
  gap: 6px;
  justify-items: end;
  text-align: right;
  color: #ffffff;
  background: rgba(3, 27, 73, 0.78);
  box-shadow:
    0 0 0 3px #dff7ff,
    inset 0 4px 0 rgba(255, 255, 255, 0.16),
    5px 5px 0 rgba(3, 17, 49, 0.82);
  clip-path: polygon(0 8px, 8px 8px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 8px, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px));
}

.game-overlay-meta strong {
  font-family: "Press Start 2P", "Courier New", ui-monospace, monospace;
  font-size: clamp(10px, 1vw, 12px);
  line-height: 1.4;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #0c3b85;
}

.game-overlay-meta span,
.game-overlay-hint {
  color: #8efcff;
  font-size: 9px;
  line-height: 1.5;
  text-shadow: 2px 2px 0 #0c3b85;
}

.game-overlay-hint {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  margin: 0;
  padding: 10px 12px;
  pointer-events: none;
  text-align: right;
  background: rgba(3, 27, 73, 0.78);
  box-shadow:
    0 0 0 3px #dff7ff,
    inset 0 4px 0 rgba(255, 255, 255, 0.16),
    5px 5px 0 rgba(3, 17, 49, 0.82);
  clip-path: polygon(0 8px, 8px 8px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 8px, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px));
}

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

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

  .stage-shell {
    width: min(100vw - 22px, 720px);
    padding: 18px;
  }

  .opensonic-overlay {
    top: 12px;
    right: 12px;
  }

  .game-overlay-meta {
    margin-left: 0;
    justify-items: start;
    text-align: left;
  }

  .game-overlay-hint {
    left: auto;
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 640px) {
  .quest-strip {
    grid-template-columns: 1fr;
  }

  .zone-panel__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .zone-stage-row {
    flex-direction: column;
  }
}

@media (min-width: 901px) and (max-width: 1220px) {
  .zone-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
