:root {
  color-scheme: dark;
  --base: #080f1d;
  --panel: #0e1a2b;
  --edge: #264158;
  --text: #eef7ff;
  --muted: #a8bfd3;
  --cyan: #67ebff;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  color: var(--text);
  background: var(--base);
  font-family: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 80% 14%, #122c42, transparent 48rem),
    var(--base);
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible, canvas:focus-visible, input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}
[hidden] { display: none !important; }
.wrap { width: min(calc(100% - 4rem), 80rem); margin-inline: auto; }
.site-header {
  border-bottom: 1px solid #26374a;
  background: #080f1dd9;
}
.header-inner { min-height: 4.25rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; font-weight: 650; text-decoration: none; }
.brand img { display: block; border-radius: .25rem; image-rendering: pixelated; }
.header-link, .site-footer a { color: var(--muted); text-underline-offset: .24em; }
.header-link:hover, .site-footer a:hover { color: var(--cyan); }

.launch {
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(0, 1.65fr);
  align-items: center;
  gap: clamp(1.75rem, 4vw, 4rem);
  padding-block: clamp(2.4rem, 6vw, 5.5rem) clamp(2.5rem, 5vw, 4.75rem);
}
.intro { min-width: 0; }
.version {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 1.1rem;
  padding: .48rem .65rem;
  border: 1px solid #31536a;
  color: var(--cyan);
  background: #12263a;
  font: 600 .75rem/1 var(--mono);
  letter-spacing: .08em;
}
.version span { color: var(--text); }
h1 {
  margin: 0;
  font-size: clamp(3rem, 4.8vw, 4.75rem);
  line-height: .99;
  letter-spacing: -.07em;
  overflow-wrap: anywhere;
}
.subtitle {
  margin: .65rem 0 0;
  color: var(--cyan);
  font: 650 clamp(1rem, 2vw, 1.3rem)/1.2 var(--mono);
  letter-spacing: .16em;
}
.studio { margin: .7rem 0 0; color: var(--muted); font-size: .92rem; }
.intro-copy { max-width: 31ch; margin: 1.5rem 0; font-size: 1.08rem; line-height: 1.55; color: #c2d3e1; }
.launch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem; }
.graphics-option {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 2.75rem;
  color: var(--muted);
  font-size: .86rem;
  cursor: pointer;
}
.graphics-option input { margin: 0; width: 1rem; height: 1rem; accent-color: var(--cyan); }
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  min-height: 3.25rem;
  border: 1px solid var(--cyan);
  background: var(--cyan);
  color: #081321;
  padding: .7rem 1.2rem;
  font-weight: 720;
  cursor: pointer;
}
.primary:hover { background: #a1f4ff; }
.primary:disabled { opacity: .65; cursor: wait; }
.play-mark {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}
.requirements { margin: .85rem 0 0; color: var(--muted); font-size: .8rem; }

.stage { min-width: 0; border: 1px solid #34566d; background: var(--panel); box-shadow: 0 20px 55px #02070d70; }
.stage-bar, .stage-foot { display: flex; align-items: center; justify-content: space-between; gap: .65rem 1rem; padding-inline: .9rem; }
.stage-bar { min-height: 3rem; border-bottom: 1px solid var(--edge); }
.stage-bar > span { display: inline-flex; align-items: center; gap: .6rem; font: 500 .8rem/1.2 var(--mono); color: #c2d3e1; }
.status-dot { display: inline-block; width: .45rem; aspect-ratio: 1; background: var(--cyan); }
.stage-actions { display: flex; gap: .35rem; }
.stage-actions button {
  min-height: 2.75rem;
  padding: .3rem .65rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--cyan);
  white-space: nowrap;
  cursor: pointer;
  font-size: .85rem;
}
.stage-actions button:hover { border-color: var(--edge); background: #162a3f; }
.screen { position: relative; overflow: hidden; width: 100%; aspect-ratio: 16 / 9; background: #060c18; }
.poster, canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.poster { position: absolute; inset: 0; object-fit: cover; }
canvas { position: relative; touch-action: none; }
canvas:focus-visible { outline-offset: -2px; }
.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #030a15b8;
  padding: 1rem;
}
.loading-card { width: min(100%, 24rem); padding: 1rem; border: 1px solid #305771; background: #0b1828; text-align: center; }
.loading p { color: var(--text); margin: 0; }
.loading progress { display: block; width: 100%; height: .65rem; margin-top: .85rem; accent-color: var(--cyan); }
.stage-foot { flex-wrap: wrap; min-height: 2.5rem; border-top: 1px solid var(--edge); }
.stage-foot p { margin: .35rem 0; color: var(--muted); font-size: .76rem; line-height: 1.35; }
#orientation { display: none; }

html[data-game-state="ready"] .launch { grid-template-columns: 1fr; padding-block-start: 1.6rem; }
html[data-game-state="ready"] .intro { display: none; }
html[data-game-state="ready"] .stage { width: min(100%, calc(max(400px, 79dvh) * 16 / 9)); margin-inline: auto; }
.stage:fullscreen, .stage.is-expanded {
  container-type: size;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  border: 0;
  background: #050b16;
}
.stage.is-expanded { position: fixed; inset: 0; z-index: 5; height: 100dvh; }
body.is-expanded { overflow: hidden; }
.stage:fullscreen .stage-bar, .stage:fullscreen .stage-foot,
.stage.is-expanded .stage-bar, .stage.is-expanded .stage-foot { width: 100%; background: var(--panel); }
.stage:fullscreen .screen, .stage.is-expanded .screen {
  width: min(100cqw, calc((100cqh - 6rem) * 16 / 9));
}

.controls { border-top: 1px solid var(--edge); padding: 2rem 0 3rem; }
.controls h2 { margin: 0 0 1.2rem; font-size: 1.55rem; letter-spacing: -.02em; }
.control-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.control-card { min-width: 0; border: 1px solid var(--edge); background: var(--panel); padding: 1.05rem; }
.control-card h3 { font-size: 1rem; color: var(--cyan); margin: 0 0 .75rem; }
.control-card dl { margin: 0; }
.control-card dl > div { display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: .55rem; row-gap: .25rem; padding: .6rem 0; border-top: 1px solid #22364b; font-size: .84rem; }
.control-card dt { color: var(--muted); }
.control-card dd { margin: 0; }
kbd { border: 1px solid #3b556e; padding: .05em .34em; color: #ecfaff; background: #152438; font: .82em var(--mono); white-space: nowrap; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 1.5rem; padding: 1.2rem 0 1.6rem; border-top: 1px solid var(--edge); color: var(--muted); font-size: .8rem; }
.site-footer > div { display: flex; gap: 1rem; }

@media (max-width: 59rem) {
  .launch { display: flex; flex-direction: column; align-items: stretch; }
  .intro-copy { max-width: 40ch; }
  .control-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 39rem) {
  .wrap { width: calc(100% - 2rem); }
  .header-inner { min-height: 3.5rem; }
  .launch { gap: 1.5rem; padding-block: 2rem; }
  h1 { font-size: clamp(2.45rem, 10vw, 3.7rem); }
  .control-grid { grid-template-columns: 1fr; }
}
@media (pointer: coarse) and (orientation: portrait) {
  #orientation { display: block; }
}
@media (orientation: portrait) {
  html[data-input="touch"] #orientation { display: block; }
}
@media (max-height: 31rem) and (pointer: coarse) and (orientation: landscape) {
  html[data-game-state="ready"] .launch { padding-block-start: .6rem; }
  html[data-game-state="ready"] .stage { width: min(100%, calc(max(170px, 70dvh) * 16 / 9)); }
}
