:root {
  color-scheme: dark;
  --black: #020304;
  --glass: #050708;
  --phosphor: #effffa;
  --dim: #8ca29b;
  --line: #35443f;
  --panel: #0b0e0e;
  font-family: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  display: grid;
  place-items: center;
  padding: clamp(0px, 2vw, 24px);
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 42px 42px,
    #080a0b;
  color: var(--phosphor);
}

button, a { font: inherit; }

.cabinet {
  width: min(1120px, 100%);
  background: #090b0c;
  border: 1px solid #303a37;
  box-shadow: 0 24px 80px rgba(0,0,0,.7), inset 0 1px rgba(255,255,255,.05);
}

.screen {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--black);
  box-shadow: inset 0 0 90px rgba(0,0,0,.9);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.phosphor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, transparent 0 3px, rgba(0,0,0,.16) 3px 4px),
    radial-gradient(ellipse at center, transparent 58%, rgba(0,0,0,.38) 100%);
  mix-blend-mode: multiply;
}

.utility-bar {
  position: absolute;
  z-index: 5;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.utility-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(239,255,250,.28);
  background: rgba(5,7,8,.72);
  color: var(--phosphor);
  text-decoration: none;
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
}

.utility-button:first-child { font-size: 21px; }
.utility-button:hover { border-color: var(--phosphor); box-shadow: 0 0 12px rgba(239,255,250,.2); }
.utility-button:focus-visible, button:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 3px; }
.utility-button.is-muted { color: #65716d; text-decoration: line-through; }

.overlay {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2,3,4,.55);
  transition: opacity .18s linear;
}

.overlay--hidden { opacity: 0; pointer-events: none; }
.title-lockup, .message-lockup { width: min(700px, 100%); text-align: center; }
.maker { margin: 0 0 16px; color: var(--dim); font-size: clamp(10px, 1.4vw, 14px); text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: 0; font-weight: 400; }
h1 {
  color: var(--phosphor);
  font-size: clamp(48px, 11vw, 116px);
  line-height: .9;
  text-shadow: 0 0 6px rgba(239,255,250,.82), 0 0 22px rgba(190,255,234,.35);
}
h2 { font-size: clamp(42px, 9vw, 88px); text-shadow: 0 0 12px rgba(239,255,250,.55); }
#messageScore { margin: 14px 0 26px; font-size: clamp(22px, 4vw, 40px); }

.ship-mark {
  width: 0;
  height: 0;
  margin: 26px auto 32px;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 58px solid var(--phosphor);
  filter: drop-shadow(0 0 7px rgba(239,255,250,.7));
}

.ship-mark::after {
  content: "";
  position: absolute;
  width: 36px;
  height: 18px;
  margin: -9px 0 0 -54px;
  background: var(--black);
  clip-path: polygon(0 50%, 100% 0, 72% 50%, 100% 100%);
}

.start-button {
  min-width: 180px;
  min-height: 46px;
  padding: 10px 20px;
  border: 1px solid var(--phosphor);
  background: transparent;
  color: var(--phosphor);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(239,255,250,.13), inset 0 0 10px rgba(239,255,250,.06);
}
.start-button:hover { background: var(--phosphor); color: var(--black); }

.pause {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2,3,4,.7);
  font-size: clamp(36px, 8vw, 72px);
  text-shadow: 0 0 12px currentColor;
}

.control-deck {
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #28312f;
  background: var(--panel);
}

.control-deck button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 64px;
  padding: 6px 2px;
  border: 1px solid #3c4945;
  background: #101414;
  color: var(--phosphor);
  cursor: pointer;
  user-select: none;
  touch-action: none;
}
.control-deck button:active, .control-deck button.is-held { background: var(--phosphor); color: var(--black); }
.control-deck span { font-size: 21px; line-height: 1; }
.control-deck small { font-size: 8px; }
.control-deck .fire { border-color: #b7cbc4; }
.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; }

@media (max-width: 700px), (pointer: coarse) {
  body { display: block; padding: 0; background: var(--black); }
  .cabinet { min-height: 100vh; border: 0; }
  .control-deck { display: grid; }
  .utility-bar { top: 10px; left: 10px; right: 10px; }
  .utility-button { width: 34px; height: 34px; }
}

@media (max-width: 430px) {
  .control-deck { gap: 5px; padding: 7px; }
  .control-deck button { min-height: 58px; }
  .control-deck span { font-size: 18px; }
  h1 { font-size: 45px; }
}

@media (max-height: 700px) and (orientation: landscape) {
  body { padding: 0; }
  .cabinet { width: min(100%, 900px); }
  .screen { max-height: 100vh; width: auto; margin: auto; }
  .control-deck { display: none; }
}
