:root {
  color-scheme: dark;
  --ink: #f8f5ea;
  --muted: #9da5b8;
  --night: #070914;
  --panel: #0c1021;
  --line: rgba(232, 238, 255, 0.13);
  --acid: #c9ff2f;
  --cyan: #1ee7f2;
  --coral: #ff4e64;
  --orange: #ff8b32;
  --purple: #8d5cff;
  --display: Impact, "Arial Black", "Arial Narrow", sans-serif;
  --sans: Inter, Avenir, "Segoe UI", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 78% 10%, rgba(141, 92, 255, 0.17), transparent 30%),
    radial-gradient(circle at 15% 80%, rgba(30, 231, 242, 0.11), transparent 29%),
    var(--night);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  z-index: 10;
  background-image:
    repeating-radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.36) 0 0.6px, transparent 0.8px 4px),
    repeating-radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.2) 0 0.5px, transparent 0.7px 5px);
  background-size: 7px 7px, 11px 11px;
  mix-blend-mode: soft-light;
}

.page-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.21;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.app-shell {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 1.25vh, 16px);
  padding: clamp(12px, 2vh, 24px) clamp(12px, 2vw, 30px) clamp(9px, 1.4vh, 18px);
}

.topbar,
.controls-bar {
  width: min(100%, 1800px);
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 38px;
  color: #080b18;
  background: var(--acid);
  font: 23px/1 var(--display);
  transform: skew(-7deg);
  box-shadow: 5px 5px 0 rgba(30, 231, 242, 0.7);
}

.brand-word {
  font: clamp(17px, 1.5vw, 26px)/1 var(--display);
  letter-spacing: 0.04em;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 78, 100, 0.42);
  color: #ff93a1;
  font: 9px/1 var(--mono);
  letter-spacing: 0.09em;
}

.live-pill i,
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 9px var(--coral);
  animation: pulse-dot 1.25s ease-in-out infinite;
}

.hud {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line);
  background: rgba(10, 13, 29, 0.76);
  backdrop-filter: blur(12px);
}

.hud-stat,
.crowd-meter {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7px clamp(12px, 1.3vw, 22px);
  border-left: 1px solid var(--line);
}

.hud > :first-child {
  border-left: 0;
}

.hud-label {
  color: var(--muted);
  font: 9px/1 var(--mono);
  letter-spacing: 0.14em;
}

.hud-stat strong {
  margin-top: 4px;
  font: 19px/1 var(--mono);
  letter-spacing: 0.03em;
}

.hud-time strong,
.hud-distance strong {
  color: var(--acid);
}

.hud-distance {
  min-width: 118px;
  background: rgba(201, 255, 47, 0.045);
}

.hud-distance strong {
  font-size: 24px;
}

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

.hud-distance strong small {
  font-size: 0.58em;
  color: var(--muted);
}

.life-hearts {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  margin-top: 3px;
}

.life-hearts span {
  color: var(--coral);
  font: 25px/1 var(--sans);
  text-shadow: 0 0 10px rgba(255, 78, 100, 0.6);
  transform: scale(1);
  transition: opacity 160ms, transform 160ms, color 160ms;
}

.life-hearts span.empty {
  color: transparent;
  opacity: 0.42;
  -webkit-text-stroke: 1.5px rgba(255, 147, 161, 0.9);
  text-shadow: none;
}

.life-hearts.hurt {
  animation: hearts-hit 420ms ease-out;
}

.life-hearts.gain span:not(.empty) {
  animation: heart-gain 520ms ease-out;
}

.crowd-meter {
  width: clamp(190px, 20vw, 320px);
  gap: 7px;
}

.crowd-copy {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.crowd-copy strong {
  color: var(--cyan);
  font: 10px/1 var(--mono);
  letter-spacing: 0.08em;
}

.meter-track {
  position: relative;
  height: 8px;
  overflow: visible;
  background: rgba(255, 255, 255, 0.09);
}

.meter-fill {
  width: 2%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--acid) 67%, var(--coral));
  box-shadow: 0 0 12px rgba(30, 231, 242, 0.65);
  transition: width 80ms linear;
}

.meter-threshold {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.75);
}

.meter-threshold.threshold-one {
  left: 42%;
}

.meter-threshold.threshold-two {
  left: 78%;
  background: var(--coral);
}

.meter-threshold span {
  position: absolute;
  right: 4px;
  bottom: 9px;
  color: rgba(255, 255, 255, 0.55);
  font: 6px/1 var(--mono);
  letter-spacing: 0.04em;
}

.threshold-two span {
  color: #ff93a1;
}

.game-frame {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  aspect-ratio: 16 / 9;
  max-width: min(100%, 1800px);
  margin-inline: auto;
  overflow: hidden;
  align-self: center;
  border: 1px solid rgba(220, 231, 255, 0.21);
  background: #0b1024;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 0 6px rgba(255, 255, 255, 0.018);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #0b1024;
}

.screen-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 110px rgba(0, 0, 0, 0.58);
}

.screen-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: white;
}

.screen-flash.hit {
  background: var(--coral);
  animation: screen-flash 280ms ease-out;
}

.screen-flash.good {
  background: var(--acid);
  animation: screen-flash 240ms ease-out;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
}

.overlay[hidden],
.boss-banner[hidden],
.boost-callout[hidden] {
  display: none;
}

.start-overlay {
  background:
    linear-gradient(90deg, rgba(7, 9, 20, 0.96) 0%, rgba(7, 9, 20, 0.86) 47%, rgba(7, 9, 20, 0.28) 100%),
    radial-gradient(circle at 76% 48%, rgba(141, 92, 255, 0.22), transparent 34%);
}

.start-card {
  width: 56%;
  justify-self: start;
  margin-left: 7%;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--cyan);
  font: clamp(8px, 0.65vw, 12px)/1 var(--mono);
  letter-spacing: 0.18em;
}

.eyebrow i {
  width: 28px;
  height: 1px;
  background: currentColor;
}

.start-card h1 {
  margin: 0.045em 0 0;
  font: clamp(74px, 9.3vw, 172px)/0.88 var(--display);
  letter-spacing: -0.075em;
  text-transform: uppercase;
  text-shadow: 9px 9px 0 rgba(141, 92, 255, 0.58);
}

.start-card h1 span {
  color: var(--acid);
}

.tagline {
  margin: 0.38em 0 0;
  font: clamp(18px, 1.7vw, 32px)/1.05 var(--display);
  letter-spacing: -0.025em;
}

.tagline em {
  color: var(--coral);
  font-style: normal;
}

.mission {
  max-width: 670px;
  margin: 1.15em 0;
  color: #c7ccdb;
  font-size: clamp(11px, 0.92vw, 17px);
  line-height: 1.55;
}

.mission strong {
  color: var(--ink);
}

.object-legend {
  width: min(100%, 650px);
  display: grid;
  grid-template-columns: 1.18fr 1fr;
  gap: 8px;
  margin: -3px 0 10px;
}

.object-legend > span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
}

.object-legend b {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  color: #080b18;
  font: clamp(9px, 0.7vw, 12px)/1 var(--display);
}

.object-legend b small {
  padding-left: 5px;
  border-left: 1px solid currentColor;
  font: 700 0.78em/1 var(--mono);
}

.legend-danger b {
  background: var(--coral);
}

.legend-bonus b {
  background: var(--acid);
}

.object-legend em {
  margin-left: auto;
  color: #cbd1df;
  font: clamp(6px, 0.48vw, 8px)/1.2 var(--mono);
  letter-spacing: 0.06em;
  font-style: normal;
  text-align: right;
}

.rule-strip {
  width: min(100%, 650px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: clamp(8px, 1vh, 13px) clamp(12px, 1.2vw, 19px);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.rule-strip div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.rule-strip > i {
  width: 1px;
  height: 21px;
  background: var(--line);
}

.rule-strip span {
  color: #cbd1df;
  font: clamp(7px, 0.58vw, 10px)/1 var(--mono);
  letter-spacing: 0.1em;
}

.rule-strip kbd,
.rule-strip b {
  min-width: 35px;
  color: var(--acid);
  font: clamp(12px, 1vw, 18px)/1 var(--display);
}

.rule-strip kbd {
  padding: 5px 7px;
  border: 1px solid rgba(201, 255, 47, 0.52);
  border-radius: 2px;
  font: 9px/1 var(--mono);
  box-shadow: 0 3px 0 rgba(201, 255, 47, 0.25);
}

.rule-strip small {
  font-size: 0.55em;
}

.wave-icon {
  letter-spacing: -0.2em;
}

.start-actions,
.result-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: clamp(12px, 1.6vh, 22px);
}

.primary-button,
.text-button,
.utility-actions button,
.jump-button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

.primary-button {
  position: relative;
  min-height: clamp(44px, 5.5vh, 64px);
  padding: 0 clamp(18px, 1.8vw, 30px);
  color: #080b18;
  background: var(--acid);
  font: clamp(10px, 0.82vw, 14px)/1 var(--display);
  letter-spacing: 0.035em;
  box-shadow: 7px 7px 0 rgba(30, 231, 242, 0.58);
  transform: translate(0, 0);
  transition: transform 120ms, box-shadow 120ms, background 120ms;
}

.primary-button:hover {
  transform: translate(2px, 2px);
  box-shadow: 5px 5px 0 rgba(30, 231, 242, 0.58);
}

.primary-button:active {
  transform: translate(6px, 6px);
  box-shadow: 1px 1px 0 rgba(30, 231, 242, 0.58);
}

.button-icon {
  display: inline-block;
  margin-right: 10px;
  color: var(--coral);
  font-size: 14px;
  animation: pulse-dot 1s ease-in-out infinite;
}

.text-button {
  padding: 12px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.36);
  background: transparent;
  color: #d9dce6;
  font: clamp(8px, 0.65vw, 11px)/1 var(--mono);
  letter-spacing: 0.08em;
}

.text-button:hover {
  color: var(--cyan);
  border-color: currentColor;
}

.permission-note {
  margin: 14px 0 0;
  color: #747d94;
  font: clamp(7px, 0.55vw, 9px)/1.3 var(--mono);
}

.countdown-overlay {
  background: rgba(5, 7, 17, 0.75);
  backdrop-filter: blur(8px);
  text-align: center;
}

.countdown-overlay span {
  color: var(--cyan);
  font: clamp(10px, 1vw, 18px)/1 var(--mono);
  letter-spacing: 0.24em;
}

.countdown-overlay strong {
  display: block;
  margin: 0.04em 0;
  color: var(--acid);
  font: clamp(110px, 18vw, 310px)/0.85 var(--display);
  text-shadow: 10px 10px 0 rgba(141, 92, 255, 0.62);
  animation: countdown-pop 700ms ease-out both;
}

.countdown-overlay small {
  display: block;
  color: #c0c6d5;
  font: clamp(8px, 0.65vw, 12px)/1 var(--mono);
  letter-spacing: 0.1em;
}

.boss-banner {
  position: absolute;
  z-index: 5;
  top: 8%;
  left: 50%;
  width: min(76%, 920px);
  padding: 14px 24px 16px;
  transform: translateX(-50%) rotate(-1deg);
  text-align: center;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: var(--coral);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.38);
  animation: boss-in 700ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.boss-banner span {
  display: block;
  font: clamp(7px, 0.58vw, 10px)/1 var(--mono);
  letter-spacing: 0.15em;
}

.boss-banner strong {
  display: block;
  margin: 4px 0;
  font: clamp(25px, 3.2vw, 56px)/0.95 var(--display);
  letter-spacing: -0.035em;
}

.boss-banner .boss-sub {
  color: #28070d;
}

.boost-callout {
  position: absolute;
  z-index: 4;
  top: 18%;
  right: 4%;
  padding: 12px 16px;
  transform: rotate(2deg);
  color: #070914;
  background: var(--acid);
  box-shadow: 7px 7px 0 rgba(30, 231, 242, 0.62);
  animation: boost-bounce 420ms ease-out both;
}

.boost-callout span,
.boost-callout strong {
  display: block;
}

.boost-callout.tier-two {
  color: white;
  background: var(--coral);
  box-shadow: 7px 7px 0 rgba(141, 92, 255, 0.7);
}

.hit-callout {
  position: absolute;
  z-index: 5;
  top: 21%;
  left: 4%;
  min-width: 220px;
  padding: 13px 18px;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: var(--coral);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.45);
  transform: rotate(-2deg);
  animation: hit-callout-in 250ms ease-out both;
}

.hit-callout[hidden] {
  display: none;
}

.hit-callout strong,
.hit-callout span {
  display: block;
}

.hit-callout strong {
  font: clamp(24px, 2.2vw, 40px)/0.95 var(--display);
}

.hit-callout span {
  margin-top: 5px;
  color: #2b050b;
  font: 9px/1 var(--mono);
  letter-spacing: 0.12em;
}

.boost-callout span {
  font: 8px/1 var(--mono);
  letter-spacing: 0.1em;
}

.boost-callout strong {
  margin-top: 4px;
  font: clamp(18px, 2vw, 35px)/1 var(--display);
}

.result-overlay {
  background:
    radial-gradient(circle at 50% 35%, rgba(201, 255, 47, 0.13), transparent 39%),
    rgba(5, 7, 17, 0.9);
  backdrop-filter: blur(7px);
}

.confetti-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-field i {
  --x: 50%;
  --delay: 0s;
  --duration: 3s;
  --drift: 0px;
  --spin: 720deg;
  --color: #c9ff2f;
  position: absolute;
  top: -8%;
  left: var(--x);
  width: 9px;
  height: 18px;
  background: var(--color);
  animation: confetti-fall var(--duration) linear var(--delay) infinite;
}

.result-card {
  width: min(82%, 850px);
  text-align: center;
}

.result-kicker {
  color: var(--cyan);
  font: clamp(8px, 0.7vw, 12px)/1 var(--mono);
  letter-spacing: 0.22em;
}

.result-card h2 {
  margin: 0.07em 0 0;
  color: var(--acid);
  font: clamp(60px, 9vw, 155px)/0.9 var(--display);
  letter-spacing: -0.06em;
  text-shadow: 9px 9px 0 rgba(141, 92, 255, 0.72);
}

.result-rank {
  margin: 0.25em 0 1em;
  font: clamp(21px, 2.4vw, 42px)/1 var(--display);
}

.result-rank span {
  color: #9da5b8;
  font-family: var(--sans);
  font-size: 0.45em;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-block: 1px solid var(--line);
}

.result-stats div {
  padding: clamp(10px, 1.4vh, 18px);
  border-left: 1px solid var(--line);
}

.result-stats div:first-child {
  border-left: 0;
}

.result-stats span,
.result-stats strong {
  display: block;
}

.result-stats span {
  color: var(--muted);
  font: clamp(7px, 0.55vw, 10px)/1 var(--mono);
  letter-spacing: 0.12em;
}

.result-stats strong {
  margin-top: 6px;
  font: clamp(17px, 1.6vw, 28px)/1 var(--display);
}

.result-quote {
  color: #c3c8d5;
  font-size: clamp(10px, 0.8vw, 14px);
  font-style: italic;
}

.result-actions {
  justify-content: center;
}

.controls-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  min-height: 28px;
  color: #747d94;
  font: 9px/1 var(--mono);
  letter-spacing: 0.1em;
}

.controls-bar p {
  margin: 0;
}

.controls-bar > p:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  animation: none;
}

.status-dot.ready {
  background: var(--cyan);
  box-shadow: 0 0 9px var(--cyan);
}

.event-copy {
  color: rgba(255, 255, 255, 0.38);
  text-align: center;
}

.utility-actions {
  justify-self: end;
  display: flex;
  gap: 16px;
}

.utility-actions button {
  padding: 0;
  background: transparent;
  color: #8f97aa;
  font: 9px/1 var(--mono);
  letter-spacing: 0.08em;
}

.utility-actions button:hover {
  color: var(--ink);
}

.jump-button {
  position: absolute;
  z-index: 7;
  right: 4%;
  bottom: 5%;
  display: none;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  color: #071019;
  background: var(--acid);
  font: 14px/1 var(--display);
  box-shadow: 0 0 0 7px rgba(201, 255, 47, 0.18);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: color 140ms, background 140ms, box-shadow 140ms, transform 100ms;
}

.jump-button span,
.jump-button small {
  display: block;
  pointer-events: none;
}

.jump-button small {
  margin-top: 4px;
  color: rgba(7, 16, 25, 0.68);
  font: 11px/1 var(--mono);
  letter-spacing: 0.04em;
}

.jump-button.jump-one-left {
  background: var(--cyan);
  box-shadow: 0 0 0 7px rgba(30, 231, 242, 0.18);
}

.jump-button.jump-spent {
  color: #d7dbe4;
  background: #555d70;
  box-shadow: 0 0 0 7px rgba(157, 165, 184, 0.12);
}

.jump-button.jump-spent small {
  color: rgba(255, 255, 255, 0.62);
}

.jump-button:active {
  transform: scale(0.94);
}

body.boost-tier-1 .game-frame,
body.boost-tier-2 .game-frame {
  border-color: rgba(201, 255, 47, 0.72);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 38px rgba(201, 255, 47, 0.18);
}

body.boost-tier-2 .game-frame {
  border-color: rgba(255, 78, 100, 0.88);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 48px rgba(255, 78, 100, 0.24);
}

body.boss-mode .topbar {
  animation: danger-shake 180ms linear 2;
}

@keyframes pulse-dot {
  50% { opacity: 0.35; transform: scale(0.76); }
}

@keyframes screen-flash {
  from { opacity: 0.34; }
  to { opacity: 0; }
}

@keyframes countdown-pop {
  from { opacity: 0; transform: scale(1.4) rotate(-4deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes boss-in {
  from { opacity: 0; transform: translate(-50%, -220%) rotate(-7deg); }
  to { opacity: 1; transform: translate(-50%, 0) rotate(-1deg); }
}

@keyframes boost-bounce {
  from { opacity: 0; transform: translateY(20px) scale(0.8) rotate(5deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(2deg); }
}

@keyframes danger-shake {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@keyframes hearts-hit {
  30% { transform: translateX(-6px) scale(1.2); }
  65% { transform: translateX(5px) scale(0.94); }
}

@keyframes heart-gain {
  45% { transform: scale(1.4) rotate(-8deg); }
}

@keyframes hit-callout-in {
  from { opacity: 0; transform: translateX(-35px) scale(0.86) rotate(-5deg); }
  to { opacity: 1; transform: translateX(0) scale(1) rotate(-2deg); }
}

@keyframes confetti-fall {
  from {
    transform: translate3d(0, -12vh, 0) rotate(0deg);
  }
  to {
    transform: translate3d(var(--drift), 118vh, 0) rotate(var(--spin));
  }
}

@media (max-width: 900px), (max-height: 620px) {
  .app-shell {
    padding: 8px;
    gap: 7px;
  }

  .brand-word,
  .live-pill,
  .hud-score,
  .event-copy {
    display: none;
  }

  .brand-mark {
    width: 38px;
    height: 31px;
    font-size: 19px;
  }

  .hud-stat,
  .crowd-meter {
    min-height: 38px;
    padding: 5px 9px;
  }

  .hud-time strong {
    font-size: 15px;
  }

  .crowd-meter {
    width: min(49vw, 240px);
  }

  .controls-bar {
    grid-template-columns: 1fr auto;
  }

  body.game-running .jump-button {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 50;
    display: grid;
    place-items: center;
    align-content: center;
    width: 92px;
    height: 92px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .topbar {
    display: block;
    min-width: 0;
  }

  .brand {
    display: none;
  }

  .hud {
    width: 100%;
    display: grid;
    grid-template-columns: auto auto minmax(76px, 0.9fr) minmax(112px, 1.45fr);
  }

  .hud-stat,
  .crowd-meter {
    min-width: 0;
    width: auto;
    padding: 5px 6px;
  }

  .hud-distance {
    min-width: 0;
  }

  .hud-distance strong {
    font-size: 18px;
  }

  .life-hearts {
    gap: 3px;
  }

  .life-hearts span {
    font-size: 20px;
  }

  .crowd-copy {
    gap: 5px;
  }

  .crowd-copy strong {
    font-size: 8px;
  }

  .game-frame {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 16 / 9;
  }

  .start-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    padding:
      max(18px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
    background: rgba(7, 9, 20, 0.82);
  }

  .start-card {
    width: min(100%, 520px);
    margin: clamp(8px, 7vh, 64px) auto 0;
  }

  .start-card h1 {
    font-size: clamp(62px, 22vw, 110px);
  }

  .mission {
    font-size: 12px;
  }

  .object-legend {
    grid-template-columns: 1fr;
  }

  .rule-strip > i,
  .rule-strip div:nth-of-type(3) {
    display: none;
  }

  .start-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
  }

  .primary-button {
    min-height: 49px;
  }

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

  .countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
  }

  .result-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    overflow-x: hidden;
    overflow-y: auto;
    padding:
      max(18px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
  }

  .result-card {
    width: min(100%, 520px);
    margin-block: auto;
  }

  .result-stats div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .result-stats div:first-child {
    border-top: 0;
  }

  .result-stats strong {
    margin-top: 0;
  }

  .result-quote {
    display: none;
  }

  .controls-bar > p:first-child {
    display: none;
  }

  .controls-bar {
    display: flex;
    justify-content: flex-end;
  }

  body.game-running .controls-bar {
    visibility: hidden;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .app-shell {
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    padding:
      max(4px, env(safe-area-inset-top))
      max(4px, env(safe-area-inset-right))
      max(4px, env(safe-area-inset-bottom))
      max(4px, env(safe-area-inset-left));
  }

  .topbar {
    position: fixed;
    top: max(6px, env(safe-area-inset-top));
    right: max(6px, env(safe-area-inset-right));
    left: max(6px, env(safe-area-inset-left));
    z-index: 12;
    display: flex;
    justify-content: flex-end;
    width: auto;
    pointer-events: none;
  }

  .topbar .brand,
  .controls-bar {
    display: none;
  }

  .game-frame {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 16 / 9;
  }

  .start-overlay,
  .result-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    overflow-x: hidden;
    overflow-y: auto;
    padding:
      max(10px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .start-overlay {
    display: block;
  }

  .start-card {
    width: min(92%, 760px);
    margin: 0 auto;
  }

  .start-card h1 {
    font-size: clamp(56px, 20vh, 78px);
  }

  .mission {
    margin-block: 0.55em;
    font-size: 10px;
    line-height: 1.35;
  }

  .object-legend {
    margin-bottom: 6px;
  }

  .object-legend > span {
    padding-block: 5px;
  }

  .rule-strip {
    padding-block: 6px;
  }

  .start-actions {
    margin-top: 8px;
  }

  .primary-button {
    min-height: 40px;
  }

  .permission-note {
    margin-top: 8px;
  }

  .countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
  }

  .result-card {
    width: min(86%, 760px);
    margin: auto;
  }
}

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