:root {
  color-scheme: dark;
  --ink: #f7f9eb;
  --muted: #a9bac3;
  --line: #435460;
  --metal: #212f39;
  --green: #d4f45c;
  --blue: #7ae4f1;
  font: 16px system-ui, sans-serif;
  background: #101821;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--blue); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .56; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  padding: .75rem clamp(.8rem, 5vw, 3rem);
  background: #17222d;
  border-bottom: 1px solid #344451;
  color: var(--muted);
  font-size: .82rem;
}
.home {
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .32rem .63rem;
}
.home:hover { color: var(--green); }
main { width: min(100% - 1.5rem, 48rem); margin: 1.7rem auto 2rem; }
.game-heading { margin-bottom: 1rem; }
.game-heading .eyebrow {
  color: var(--blue);
  font: 700 .78rem ui-monospace, monospace;
  letter-spacing: .19em;
  text-transform: uppercase;
  margin: 0 0 .35rem;
}
.game-heading .description {
  max-width: 42rem;
  margin: .85rem 0 0;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.5;
}
h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.3rem);
  line-height: .95;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: -.045em;
  color: var(--green);
  text-shadow: 0 3px #35522c;
}
.cabinet {
  background: var(--metal);
  border: 1px solid #526471;
  border-radius: 12px;
  padding: .55rem;
  box-shadow: inset 0 1px #687d8a, 0 12px 24px #070b1066;
}
.cabinet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .2rem .28rem .55rem;
  font: 700 .82rem ui-monospace, monospace;
}
.cabinet-bar small { color: var(--muted); }
.cabinet-bar button {
  border: 1px solid var(--line);
  background: #16232d;
  color: var(--blue);
  border-radius: 5px;
  padding: .38rem .55rem;
}
.stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #080f17;
  border: 2px solid #11202a;
  border-radius: 6px;
}
#screen { width: 100%; aspect-ratio: 4 / 3; touch-action: none; overflow: hidden; }
#text-screen { white-space: pre; font: 10px monospace; line-height: 1; }
#screen canvas { display: block; width: 100%; height: 100%; object-fit: contain; touch-action: none; }
#launcher {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: .7rem;
  padding: 1rem;
  text-align: center;
  background: repeating-linear-gradient(0deg, #121c25aa 0 1px, transparent 1px 5px), radial-gradient(ellipse at 50% 25%, #254851, #111b27 67%);
}
.bumper {
  width: clamp(3.2rem, 11vw, 6rem);
  aspect-ratio: 1;
  border: 6px solid #1b313b;
  border-radius: 50%;
  background: radial-gradient(circle at 43% 40%, #f6ffc6 0 14%, #cce955 15% 34%, #7b9d37 35% 53%, #314634 54%);
  box-shadow: 0 0 0 1px #82975b, 0 0 25px #a0de7744, 0 6px #040b12;
}
#play {
  background: var(--green);
  color: #18220d;
  font-weight: 850;
  border: 1px solid #e8ff9f;
  border-radius: 6px;
  padding: .7rem 1.05rem;
  box-shadow: 0 4px #506328;
}
.tools { display: flex; gap: .4rem; }
#resume { border: 1px solid var(--line); background: #182832; border-radius: 6px; padding: .55rem .75rem; }
#status-text, .notice {
  margin: 0;
  font-size: .84rem;
  color: var(--muted);
}
.controls {
  display: grid;
  grid-template-columns: 1.05fr .9fr 1.05fr;
  gap: .48rem;
  margin-top: .55rem;
}
.center-controls { display: grid; gap: .38rem; }
.controls button {
  background: #243d4e;
  border: 1px solid #587b85;
  border-radius: 7px;
  min-height: 44px;
  font-weight: 800;
  font-size: clamp(.72rem, 2.9vw, .93rem);
  padding: .35rem;
  touch-action: none;
  user-select: none;
}
.controls > button { color: var(--green); }
.controls button.is-held { background: var(--green); color: #192312; }
kbd { display: block; font: .75em ui-monospace, monospace; opacity: .78; }
.notice { padding: .55rem .33rem .18rem; }
footer { font-size: .84rem; color: var(--muted); margin-top: .9rem; }
summary { cursor: pointer; display: list-item; width: fit-content; }
footer p { line-height: 1.5; }
.cabinet:fullscreen {
  width: 100vw;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(.5rem, env(safe-area-inset-top)) max(.5rem, env(safe-area-inset-right)) max(.5rem, env(safe-area-inset-bottom)) max(.5rem, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
}
.cabinet:fullscreen .cabinet-bar,
.cabinet:fullscreen .controls { width: min(48rem, 100%); }
.cabinet:fullscreen .stage { flex: 1; min-height: 0; width: 100%; }
@media (pointer: coarse) { .controls button { min-height: 48px; } }
@media (max-width: 550px) { main { margin-top: 1.15rem; } }
@media (orientation: landscape) and (max-height: 500px) {
  .cabinet:fullscreen { display: grid; grid-template-columns: 1fr min(27%, 12rem); grid-template-rows: auto minmax(0, 1fr); gap: .45rem; }
  .cabinet:fullscreen .cabinet-bar { grid-column: span 2; width: 100%; }
  .cabinet:fullscreen .stage { height: 100%; }
  .cabinet:fullscreen .controls { grid-template-columns: 1fr; }
}
.cabinet:fullscreen .stage,
.cabinet.is-expanded .stage { container-type: size; }
.cabinet:fullscreen #screen,
.cabinet.is-expanded #screen { width: min(100cqw, 133.333cqh); }
.cabinet.is-expanded {
  display: flex;
  position: fixed;
  z-index: 2;
  inset: 0;
  height: 100dvh;
  flex-direction: column;
  border-radius: 0;
  padding: max(.5rem, env(safe-area-inset-top)) max(.5rem, env(safe-area-inset-right)) max(.5rem, env(safe-area-inset-bottom)) max(.5rem, env(safe-area-inset-left));
}
.cabinet.is-expanded .stage { flex: 1; min-height: 0; }
body:has(.is-expanded) { overflow: hidden; }
@media (orientation: landscape) and (max-height: 500px) {
  .cabinet.is-expanded { display: grid; grid-template-columns: 1fr min(27%, 12rem); grid-template-rows: auto minmax(0, 1fr); gap: .45rem; }
  .cabinet.is-expanded .cabinet-bar { grid-column: span 2; }
  .cabinet.is-expanded .stage { height: 100%; }
  .cabinet.is-expanded .controls { grid-template-columns: 1fr; }
}
@media (min-width: 701px) and (min-height: 620px) {
  main { max-width: calc((100dvh - 19rem) * 4 / 3); }
}
#screen iframe { display: block; width: 100%; height: 100%; border: 0; }

#screen { position: relative; min-width: 0; }
#screen iframe { position: absolute; inset: 0; min-width: 0; min-height: 0; }

.controls, .controls * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  touch-action: none;
}
.controls button * { pointer-events: none; }
