:root {
  --font-size: 12px;
  --color-background: #000;
  --color-text-primary: #8aef9d;
  --color-text-muted: #6fa47e;
  --color-border: #2a7742;
  --color-terminal-green: #36ff76;
  color-scheme: dark;
  font: 16px/1.5 system-ui, sans-serif;
  background: var(--color-background);
  color: var(--color-text-primary);
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
body { margin: 0; }
main {
  box-sizing: border-box;
  width: min(1100px, calc(100% - 32px));
  margin: 32px auto;
  padding: 32px 16px 16px;
  border: 1px solid var(--color-border);
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--font-size);
  line-height: 1.5;
}
main > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
main > header h1 {
  margin: 0;
  color: var(--color-terminal-green);
  font-size: 1.5em;
  font-weight: 700;
}
button { background: #2a3140; color: inherit; border: 1px solid #526079; padding: 9px 12px; border-radius: 5px; font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
.buttons > button:disabled {
  opacity: 0.5;
  cursor: default;
}
button:not(:disabled):hover { background: #3c4960; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
main > header > a,
.buttons > button {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: #071a0d;
  box-shadow: 2px 2px #0a3418;
  color: var(--color-text-primary);
  text-align: center;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
main > header > a:hover,
.buttons > button:is(:hover, :focus-visible):not(:disabled) {
  border-color: var(--color-terminal-green);
  background: var(--color-terminal-green);
  color: var(--color-background);
}
main > header > a:focus-visible,
.source a:focus-visible,
.buttons > button:focus-visible {
  outline: 2px solid var(--color-terminal-green);
  outline-offset: 3px;
}
.viewport {
  margin-top: 24px;
  text-align: center;
  font: 16px/1.5 system-ui, sans-serif;
  color: #e4e7ee;
}
canvas { display: block; margin: auto; width: min(100%, 800px); height: auto; background: #000; outline: 1px solid #363b49; }
canvas:focus { outline: 2px solid #aaa4fb; }
#game-surface { position: relative; margin: auto; width: min(100%, 800px); background: #000; }
#game-surface:fullscreen { width: 100%; height: 100%; display: grid; place-items: center; background: #000; }
#game-surface:fullscreen canvas { width: min(100vw, calc(100vh * var(--canvas-aspect, 1.333333333))); height: auto; }
#loading-overlay { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; background: #080a10; }
#loading-overlay[hidden], #progress[hidden] { display: none; }
#progress { width: min(80%, 480px); accent-color: #aaa4fb; }
#movie-overlay { position: absolute; inset: 0; z-index: 2; background: #000; }
#movie-overlay[hidden] { display: none; }
#movie-video { display: block; width: 100%; height: 100%; object-fit: contain; }
.movie-controls { position: absolute; bottom: 12px; left: 12px; right: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px; background: #000b; font-size: 14px; }
.movie-controls span { flex: 1; }
main > p { margin: 12px 0; }
.source { color: var(--color-text-muted); }
.source a { color: inherit; text-decoration: underline; }
.source a:hover { color: var(--color-terminal-green); }
@media (max-width: 450px) {
  main {
    width: calc(100% - 16px);
    margin: 16px auto;
    padding: 16px 8px 8px;
  }
}
