:root {
  color-scheme: light;
  --instrument-navy: #102a43;
  --flight-deep: #071b2b;
  --flight-blue: #2e668a;
  --sky: #83cadf;
  --sky-light: #d7edf2;
  --ice: #e8f2f5;
  --steel: #9fb5c2;
  --ink: #102a43;
  --muted-ink: #405f70;
  --safety-amber: #e88a2a;
  --safety-yellow: #f3c64e;
  --moss: #6f9e4a;
  --danger: #b94735;
  --white: #f8fbfc;
  --black: #06131d;
  --focus: #164f6f;
  --topbar-height: 64px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--flight-deep);
}

body {
  color: var(--ink);
  overscroll-behavior: none;
}

button,
select,
a {
  font: inherit;
}

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

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

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

.app-shell {
  display: grid;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  grid-template-rows: calc(var(--topbar-height) + env(safe-area-inset-top)) minmax(0, 1fr);
  background: var(--flight-deep);
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  min-width: 0;
  padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 3px solid var(--black);
  background: var(--ice);
}

.home-link {
  display: inline-flex;
  width: max-content;
  min-height: 44px;
  padding: 0 14px;
  align-items: center;
  gap: 8px;
  color: var(--instrument-navy);
  border: 2px solid var(--instrument-navy);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 3px 0 var(--instrument-navy);
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.home-link:hover,
.home-link:focus-visible {
  background: var(--sky-light);
}

.home-link:active {
  box-shadow: 0 1px 0 var(--instrument-navy);
  transform: translateY(2px);
}

.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 9px;
  line-height: 1;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--instrument-navy);
  border-radius: 9px;
  background: var(--white);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-lockup strong {
  display: block;
  font-family: "Arial Narrow", "Aptos Narrow", "Trebuchet MS", sans-serif;
  font-size: 1.05rem;
  font-stretch: condensed;
  letter-spacing: -.02em;
}

.brand-lockup small {
  display: block;
  margin-top: 4px;
  color: var(--flight-blue);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.utility-nav {
  display: flex;
  min-width: 0;
  justify-content: flex-end;
  gap: 7px;
}

.utility-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 2px solid var(--instrument-navy);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 3px 0 var(--instrument-navy);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 1.02rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.utility-button:hover {
  background: var(--sky-light);
}

.utility-button:active,
.utility-button[aria-pressed="true"].optional-camera {
  box-shadow: 0 1px 0 var(--instrument-navy);
  transform: translateY(2px);
}

#sound-icon {
  display: block;
  font-size: .76rem;
  letter-spacing: -.18em;
  transform: translateX(-1px);
}

.game-layout {
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 14px max(clamp(10px, 2vw, 28px), env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(clamp(10px, 2vw, 28px), env(safe-area-inset-left));
  grid-template-columns: minmax(132px, 168px) minmax(320px, 520px) minmax(146px, 188px);
  justify-content: center;
  gap: clamp(10px, 1.5vw, 20px);
  background:
    linear-gradient(90deg, rgba(131, 202, 223, .08), transparent 18%, transparent 82%, rgba(131, 202, 223, .08)),
    var(--flight-deep);
}

.telemetry-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  flex-direction: column;
  align-self: center;
  color: var(--ice);
  border-top: 3px solid var(--steel);
  border-bottom: 3px solid var(--steel);
  background: #0d2637;
}

.telemetry-heading {
  display: flex;
  padding-bottom: 10px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--sky-light);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .67rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(159, 181, 194, .45);
}

.telemetry-heading i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 2px solid var(--sky);
  border-radius: 50%;
}

.readout-stack {
  display: grid;
  margin: 18px 0 14px;
  gap: 16px;
}

.readout-stack div {
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(159, 181, 194, .28);
}

.readout-stack dt {
  color: #c4d8df;
  font-size: .73rem;
  font-weight: 700;
}

.readout-stack dd {
  margin: 4px 0 0;
  color: var(--white);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  letter-spacing: -.05em;
  line-height: .95;
}

.readout-stack dd small {
  margin-left: 4px;
  color: var(--safety-yellow);
  font-size: .72rem;
  letter-spacing: 0;
}

.spring-meter {
  position: relative;
  display: grid;
  width: 64px;
  height: clamp(104px, 22vh, 174px);
  margin: auto;
  grid-template-rows: 9px 1fr 11px;
  justify-items: center;
  transition: transform 180ms var(--ease-out);
}

.spring-cap,
.spring-foot {
  display: block;
  width: 54px;
  border: 2px solid var(--steel);
  background: var(--flight-blue);
}

.spring-foot {
  width: 64px;
  background: var(--safety-amber);
}

.spring-coil {
  display: block;
  width: 36px;
  min-height: 0;
  background:
    linear-gradient(145deg, transparent 41%, var(--sky-light) 42% 50%, transparent 51%) 0 0 / 36px 18px,
    linear-gradient(35deg, transparent 41%, var(--steel) 42% 50%, transparent 51%) 0 9px / 36px 18px;
  transform-origin: bottom;
  transition: transform 220ms var(--ease-out);
}

.spring-meter.is-impact .spring-coil {
  transform: scaleY(.58);
}

.meter-caption {
  margin: 10px 0 16px;
  color: #c4d8df;
  font-size: .68rem;
  line-height: 1.4;
  text-align: center;
}

.run-state {
  display: flex;
  min-height: 36px;
  padding: 8px;
  align-items: center;
  gap: 8px;
  color: var(--ice);
  border: 1px solid rgba(159, 181, 194, .55);
  font-size: .72rem;
  font-weight: 800;
}

.state-lamp {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 2px solid var(--steel);
  border-radius: 50%;
  background: var(--safety-yellow);
}

.app-shell[data-phase="playing"] .state-lamp {
  background: var(--moss);
}

.app-shell[data-phase="over"] .state-lamp {
  background: var(--danger);
}

.stage-frame {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-self: stretch;
  overflow: hidden;
  border: 3px solid var(--black);
  border-radius: 14px;
  background: var(--sky);
  box-shadow: 0 6px 0 #000;
}

.mobile-readout {
  display: none;
}

.stage-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  flex: 1;
  isolation: isolate;
  overflow: hidden;
  background: var(--sky);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 280px;
  touch-action: pinch-zoom;
  cursor: ew-resize;
}

#game-canvas:focus-visible {
  outline: 0;
  box-shadow:
    inset 0 0 0 4px var(--white),
    inset 0 0 0 7px var(--focus);
}

.altimeter {
  position: absolute;
  z-index: 5;
  top: 16px;
  right: 13px;
  display: grid;
  width: 48px;
  height: calc(100% - 124px);
  min-height: 170px;
  max-height: 500px;
  padding: 7px 6px;
  grid-template-rows: auto 1fr auto;
  color: var(--ice);
  border: 2px solid rgba(232, 242, 245, .78);
  background: rgba(7, 27, 43, .86);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  text-align: center;
}

.altimeter-title {
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.altimeter-track {
  position: relative;
  display: flex;
  margin: 7px 0;
  flex-direction: column;
  justify-content: space-between;
  border-right: 2px solid var(--steel);
}

.altimeter-track i {
  width: 12px;
  height: 1px;
  margin-left: auto;
  background: var(--steel);
}

.altimeter-track i:nth-child(odd) {
  width: 20px;
}

.altimeter-marker {
  position: absolute;
  right: 3px;
  bottom: calc(27px + (100% - 58px) * var(--altitude-progress, 0));
  width: 36px;
  height: 9px;
  border: 2px solid var(--black);
  background: var(--safety-yellow);
  transform: translateY(50%);
  transition: bottom 180ms var(--ease-out);
}

.altimeter strong {
  font-size: .63rem;
}

.play-instruction {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 84px;
  display: inline-flex;
  width: max-content;
  max-width: calc(100% - 150px);
  margin: 0;
  padding: 7px 10px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--white);
  border: 1px solid rgba(232, 242, 245, .8);
  background: rgba(7, 27, 43, .88);
  font-size: .72rem;
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
  transition: opacity 180ms var(--ease-out);
}

.play-instruction.is-dismissed {
  opacity: 0;
}

.touch-controls {
  position: absolute;
  z-index: 7;
  right: 14px;
  bottom: 12px;
  left: 14px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.move-button {
  display: grid;
  width: 64px;
  height: 58px;
  padding: 0;
  place-items: center;
  color: var(--ice);
  border: 2px solid rgba(232, 242, 245, .9);
  border-radius: 10px;
  background: rgba(7, 27, 43, .84);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .75);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 1.6rem;
  font-weight: 900;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out), background-color 120ms var(--ease-out);
}

.move-button:hover {
  background: rgba(46, 102, 138, .94);
}

.move-button.is-held,
.move-button:active {
  color: var(--black);
  background: var(--safety-amber);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .75);
  transform: translateY(3px);
}

.impact-ring {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 16px;
  border: 3px solid var(--safety-yellow);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.6);
}

.impact-ring.is-active {
  animation: impact-ring 280ms var(--ease-out);
}

@keyframes impact-ring {
  0% { opacity: .9; transform: translate(-50%, -50%) scale(.5); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.5); }
}

.stage-shell.is-impact {
  animation: stage-impact 180ms var(--ease-out);
}

@keyframes stage-impact {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(3px); }
}

.game-overlay {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: none;
  padding: 18px;
  place-items: center;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--ice);
  background: rgba(7, 27, 43, .94);
}

.game-overlay.is-visible {
  display: grid;
}

.briefing-card {
  width: min(100%, 368px);
  padding: clamp(18px, 4vh, 30px);
  color: var(--ink);
  border: 3px solid var(--black);
  border-radius: 14px;
  background: var(--ice);
  box-shadow: 0 6px 0 var(--black);
  text-align: center;
}

.specimen-window {
  position: relative;
  display: grid;
  width: clamp(108px, 22vh, 148px);
  aspect-ratio: 1;
  margin: 0 auto 14px;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--instrument-navy);
  border-radius: 12px;
  background: var(--white);
}

.specimen-window img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.specimen-window span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 3px 5px;
  color: var(--ice);
  background: var(--instrument-navy);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .55rem;
  font-weight: 900;
}

.briefing-code {
  margin: 0 0 8px;
  color: var(--flight-blue);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.briefing-card h2 {
  margin: 0;
  font-family: "Arial Narrow", "Aptos Narrow", "Trebuchet MS", sans-serif;
  font-size: clamp(1.65rem, 4vh, 2.5rem);
  letter-spacing: -.03em;
  line-height: 1;
  text-wrap: balance;
}

.briefing-card > p:not(.briefing-code):not(.new-record) {
  max-width: 34ch;
  margin: 12px auto 18px;
  color: var(--muted-ink);
  font-size: .91rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.briefing-controls {
  display: flex;
  margin-bottom: 18px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted-ink);
  font-size: .72rem;
  font-weight: 700;
}

kbd {
  display: inline-grid;
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  place-items: center;
  color: var(--ice);
  border-bottom: 3px solid var(--black);
  border-radius: 5px;
  background: var(--instrument-navy);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .72rem;
  font-weight: 900;
}

.primary-action {
  min-height: 48px;
  padding: 0 24px;
  color: var(--black);
  border: 2px solid var(--black);
  border-radius: 8px;
  background: var(--safety-yellow);
  box-shadow: 0 4px 0 var(--black);
  font-weight: 900;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), box-shadow 140ms var(--ease-out), background-color 140ms var(--ease-out);
}

.primary-action:hover {
  background: #ffd968;
}

.primary-action:active {
  box-shadow: 0 1px 0 var(--black);
  transform: translateY(3px);
}

.result-altitude {
  margin: 20px auto 14px;
  padding: 14px;
  border-top: 2px solid var(--instrument-navy);
  border-bottom: 2px solid var(--instrument-navy);
}

.result-altitude > span {
  display: block;
  color: var(--muted-ink);
  font-size: .74rem;
  font-weight: 800;
}

.result-altitude strong {
  display: block;
  margin-top: 5px;
  color: var(--instrument-navy);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: clamp(2.6rem, 9vh, 4.4rem);
  letter-spacing: -.07em;
  line-height: 1;
}

.result-altitude strong small {
  margin-left: 4px;
  color: var(--danger);
  font-size: .9rem;
  letter-spacing: 0;
}

.new-record {
  width: max-content;
  margin: 0 auto 16px;
  padding: 5px 9px;
  color: var(--black);
  border: 2px solid var(--black);
  background: var(--safety-amber);
  font-size: .75rem;
  font-weight: 900;
}

.platform-legend {
  display: grid;
  margin: 16px 0;
  padding: 0;
  gap: 13px;
  list-style: none;
}

.platform-legend li {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 9px;
}

.platform-legend b,
.platform-legend small {
  display: block;
}

.platform-legend b {
  color: var(--white);
  font-size: .76rem;
}

.platform-legend small {
  margin-top: 2px;
  color: #bfd3da;
  font-size: .62rem;
  line-height: 1.3;
}

.platform-swatch {
  position: relative;
  display: grid;
  width: 42px;
  height: 18px;
  place-items: center;
  color: var(--black);
  border: 2px solid var(--black);
  border-radius: 4px;
  background: var(--moss);
  font-family: ui-monospace, monospace;
  font-size: .7rem;
  font-weight: 900;
}

.swatch-normal::after {
  position: absolute;
  right: 7px;
  left: 7px;
  bottom: -6px;
  height: 4px;
  content: "";
  background: var(--steel);
}

.swatch-moving {
  background: var(--sky);
}

.swatch-breaking {
  background: var(--safety-amber);
}

.swatch-spring {
  background: var(--moss);
}

.swatch-spring::before {
  position: absolute;
  top: -9px;
  width: 18px;
  height: 9px;
  content: "";
  border: 2px solid var(--safety-yellow);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.camera-module {
  position: relative;
  width: 100%;
  margin-top: auto;
  overflow: hidden;
  border: 2px solid var(--steel);
  background: var(--black);
}

.camera-module video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-module span {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 3px 4px;
  color: var(--white);
  background: var(--black);
  font-family: ui-monospace, monospace;
  font-size: .5rem;
  font-weight: 900;
}

.camera-module-stage {
  position: absolute;
  z-index: 6;
  top: 12px;
  left: 12px;
  display: none;
  width: 94px;
  margin: 0;
  box-shadow: 0 3px 0 rgba(6, 19, 29, .72);
}

.desktop-hint {
  display: flex;
  margin: auto 0 0;
  padding-top: 12px;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  color: #c4d8df;
  border-top: 1px solid rgba(159, 181, 194, .35);
  font-size: .62rem;
  line-height: 1.3;
}

.desktop-hint kbd {
  min-width: 24px;
  height: 22px;
  color: var(--instrument-navy);
  border-bottom-color: var(--steel);
  background: var(--ice);
}

.version-info {
  position: fixed;
  z-index: 25;
  right: max(7px, env(safe-area-inset-right));
  bottom: max(5px, env(safe-area-inset-bottom));
  color: rgba(232, 242, 245, .78);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .58rem;
  pointer-events: none;
}

.app-dialog {
  width: min(92vw, 430px);
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--ink);
  border: 3px solid var(--black);
  border-radius: 14px;
  background: var(--ice);
  box-shadow: 0 6px 0 var(--black);
}

.app-dialog::backdrop {
  background: rgba(6, 19, 29, .76);
}

.app-dialog form {
  padding: 20px;
}

.app-dialog header {
  display: flex;
  padding-bottom: 14px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 2px solid var(--instrument-navy);
}

.app-dialog header p {
  margin: 0 0 4px;
  color: var(--flight-blue);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.app-dialog h2 {
  margin: 0;
  font-family: "Arial Narrow", "Aptos Narrow", "Trebuchet MS", sans-serif;
  font-size: 1.65rem;
  letter-spacing: -.025em;
}

.dialog-close {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  flex: 0 0 auto;
  place-items: center;
  color: var(--ice);
  border: 2px solid var(--black);
  border-radius: 7px;
  background: var(--instrument-navy);
  font-size: 1.4rem;
  cursor: pointer;
}

.dialog-close:hover,
.dialog-close:focus-visible {
  background: var(--flight-blue);
}

.setting-row {
  display: grid;
  margin: 18px 0;
  grid-template-columns: 1fr minmax(150px, auto);
  align-items: center;
  gap: 14px;
}

.setting-row b,
.setting-row small {
  display: block;
}

.setting-row b {
  font-size: .9rem;
}

.setting-row small {
  margin-top: 3px;
  color: var(--muted-ink);
  font-size: .72rem;
}

.setting-row select {
  min-height: 44px;
  padding: 0 34px 0 10px;
  color: var(--ink);
  border: 2px solid var(--instrument-navy);
  border-radius: 7px;
  background: var(--white);
  font-size: 1rem;
}

.dialog-version {
  display: flex;
  padding-top: 13px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted-ink);
  border-top: 1px solid var(--steel);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .72rem;
}

.manual-list {
  display: grid;
  margin: 18px 0;
  padding: 0;
  gap: 14px;
  list-style: none;
}

.manual-list li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
}

.manual-list > li > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--ice);
  border-radius: 6px;
  background: var(--instrument-navy);
  font-family: ui-monospace, monospace;
  font-size: .68rem;
  font-weight: 900;
}

.manual-list p {
  margin: 0;
}

.manual-list b,
.manual-list small {
  display: block;
}

.manual-list b {
  font-size: .86rem;
}

.manual-list small {
  margin-top: 3px;
  color: var(--muted-ink);
  font-size: .76rem;
  line-height: 1.45;
}

.dialog-action {
  width: 100%;
}

@media (max-width: 1000px) {
  #fa-help-btn {
    display: none !important;
  }
}

@media (max-width: 840px) {
  :root {
    --topbar-height: 58px;
  }

  .topbar {
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-bottom: 6px;
  }

  .brand-lockup small,
  .home-label {
    display: none;
  }

  .home-link {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-lockup strong {
    font-size: .88rem;
  }

  .utility-nav {
    gap: 5px;
  }

  .utility-button {
    width: 44px;
    height: 44px;
    border-radius: 7px;
  }

  .game-layout {
    padding: 8px max(6px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    grid-template-columns: minmax(0, 1fr);
  }

  .telemetry-panel {
    display: none;
  }

  .stage-frame {
    width: min(100%, 560px);
    margin: 0 auto;
    box-shadow: 0 4px 0 #000;
  }

  .mobile-readout {
    display: flex;
    min-height: 46px;
    padding: 5px 12px;
    align-items: center;
    justify-content: space-between;
    color: var(--ice);
    border-bottom: 2px solid var(--black);
    background: var(--instrument-navy);
  }

  .mobile-readout > span {
    display: flex;
    align-items: baseline;
    gap: 7px;
  }

  .mobile-readout small {
    color: #c4d8df;
    font-size: .66rem;
    font-weight: 800;
  }

  .mobile-readout strong {
    color: var(--white);
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 1rem;
  }

  .mobile-readout b {
    color: var(--safety-yellow);
    font-size: 1.25rem;
  }

  .camera-module-stage:not([hidden]) {
    display: block;
  }

  #fa-help-btn,
  #funapp-favorite-btn {
    display: none !important;
  }

  .version-info {
    right: auto;
    bottom: max(7px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (max-width: 520px) {
  .brand-lockup {
    display: none;
  }

  .utility-button {
    width: 44px;
    height: 44px;
  }

  .stage-frame {
    border-radius: 10px;
  }

  .altimeter {
    right: 8px;
    width: 42px;
  }

  .touch-controls {
    right: 10px;
    bottom: max(9px, env(safe-area-inset-bottom));
    left: 10px;
  }

  .move-button {
    width: 66px;
    height: 58px;
  }

  .play-instruction {
    bottom: 78px;
    max-width: calc(100% - 110px);
    font-size: .66rem;
  }

  .briefing-card {
    width: min(100%, 340px);
  }

  .specimen-window {
    width: min(126px, 19vh);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --topbar-height: 52px;
  }

  .topbar {
    padding-top: calc(4px + env(safe-area-inset-top));
    padding-bottom: 4px;
  }

  .home-link {
    min-height: 44px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .utility-button {
    width: 44px;
    height: 44px;
    box-shadow: 0 2px 0 var(--instrument-navy);
  }

  .game-layout {
    padding-top: 5px;
    padding-bottom: max(5px, env(safe-area-inset-bottom));
    grid-template-columns: minmax(108px, 132px) minmax(300px, 430px) minmax(112px, 146px);
    gap: 7px;
  }

  .telemetry-panel {
    display: flex;
    padding: 8px;
    align-self: stretch;
  }

  .telemetry-heading {
    padding-bottom: 5px;
    font-size: .55rem;
  }

  .readout-stack {
    margin: 7px 0;
    gap: 6px;
  }

  .readout-stack div {
    padding-bottom: 4px;
  }

  .readout-stack dt {
    font-size: .58rem;
  }

  .readout-stack dd {
    font-size: 1.3rem;
  }

  .spring-meter,
  .meter-caption,
  .run-state,
  .desktop-hint,
  .telemetry-panel .camera-module {
    display: none !important;
  }

  .camera-module-stage:not([hidden]) {
    top: 7px;
    left: 7px;
    display: block !important;
    width: 72px;
  }

  .platform-legend {
    margin: 7px 0 0;
    gap: 6px;
  }

  .platform-legend li {
    grid-template-columns: 32px 1fr;
    gap: 5px;
  }

  .platform-legend b {
    font-size: .58rem;
  }

  .platform-legend small {
    display: none;
  }

  .platform-swatch {
    width: 31px;
    height: 14px;
  }

  .stage-frame {
    box-shadow: 0 3px 0 #000;
  }

  .mobile-readout {
    display: none;
  }

  .game-overlay {
    padding: 7px;
  }

  .briefing-card {
    display: grid;
    width: min(100%, 390px);
    padding: 10px 14px;
    grid-template-columns: 92px 1fr;
    column-gap: 12px;
    align-items: center;
    text-align: left;
  }

  .specimen-window {
    width: 88px;
    margin: 0;
    grid-row: 1 / 6;
  }

  .briefing-code {
    margin-bottom: 3px;
    font-size: .55rem;
  }

  .briefing-card h2 {
    font-size: 1.35rem;
  }

  .briefing-card > p:not(.briefing-code):not(.new-record) {
    margin: 3px 0 6px;
    font-size: .7rem;
    line-height: 1.3;
  }

  .briefing-controls {
    margin: 0 0 5px;
    justify-content: flex-start;
  }

  .primary-action {
    min-height: 44px;
    padding: 0 16px;
  }

  .result-card {
    display: block;
    max-width: 320px;
    text-align: center;
  }

  .result-altitude {
    display: flex;
    margin: 7px 0;
    padding: 5px 8px;
    align-items: center;
    justify-content: space-between;
  }

  .result-altitude strong {
    margin: 0;
    font-size: 2rem;
  }

  .new-record {
    margin-bottom: 6px;
  }

  .altimeter {
    top: 8px;
    height: calc(100% - 82px);
  }

  .play-instruction {
    bottom: 64px;
  }

  .touch-controls {
    bottom: 7px;
  }

  .move-button {
    width: 54px;
    height: 46px;
  }

  .app-dialog {
    width: min(92vw, 560px);
    max-height: calc(100dvh - 12px);
  }

  .app-dialog form {
    padding: 12px;
  }

  .app-dialog header {
    padding-bottom: 7px;
  }

  .manual-list {
    margin: 9px 0;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }

  .manual-list li {
    grid-template-columns: 28px 1fr;
    gap: 5px;
  }

  .manual-list > li > span {
    width: 27px;
    height: 27px;
  }

  .manual-list small {
    font-size: .64rem;
    line-height: 1.25;
  }
}

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

  .stage-shell.is-impact,
  .impact-ring.is-active {
    animation: none !important;
  }
}
