:root {
  --hud: #0d1016;
  --hud-2: #161b24;
  --panel: #222834;
  --asphalt: #1a1e24;
  --yellow: #f5d000;
  --cyan: #3de8ff;
  --magenta: #ff4ad8;
  --paper: #f4f0e6;
  --ink: #10141a;
  --muted: #9aa3b4;
  --sidewalk: #b8b4ac;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(ellipse at top, #1c2430 0%, var(--hud) 55%);
  color: var(--paper);
  font-family: "IBM Plex Mono", "Noto Sans Mono", "SFMono-Regular", ui-monospace, monospace;
}

body {
  display: flex;
  justify-content: center;
  padding: 12px 10px 28px;
}

.app {
  width: min(480px, 100%);
  background: var(--hud-2);
  border: 4px solid #080a0e;
  box-shadow:
    0 0 0 3px #2a3140,
    8px 8px 0 #080a0e;
}

.hud-top,
.hud-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--hud);
  border-bottom: 3px solid #080a0e;
}

.hud-bottom {
  border-bottom: 0;
  border-top: 3px solid #080a0e;
  flex-wrap: wrap;
}

.hud-bottom .btn-row {
  margin: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pip-dot {
  width: 10px;
  height: 10px;
  background: var(--cyan);
  box-shadow: 2px 2px 0 #080a0e;
  flex: 0 0 auto;
}

.pixel-title {
  margin: 0;
  font-size: clamp(18px, 5.4vw, 24px);
  letter-spacing: 0.06em;
  line-height: 1.2;
  color: #f7f4ee;
}

.pixel-title span {
  color: var(--cyan);
}

.pips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.pips i {
  width: 8px;
  height: 8px;
  background: #2a3140;
  box-shadow: 1px 1px 0 #080a0e;
}

.pips i.on {
  background: var(--cyan);
}

.pips i.now {
  background: var(--yellow);
}

.stage {
  padding: 12px;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.06) 0 1px,
      transparent 1px 3px
    ),
    var(--panel);
}

.subtitle {
  margin: 0;
  color: var(--yellow);
  font-size: 14px;
}

.lede,
.end-note {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.screen[hidden] {
  display: none;
}

.btn {
  display: inline-block;
  padding: 10px 14px;
  border: 3px solid #080a0e;
  background: var(--yellow);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 4px 4px 0 #080a0e;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  background: var(--cyan);
}

.btn:disabled {
  background: #4a5160;
  color: #1c2028;
  cursor: not-allowed;
  box-shadow: 4px 4px 0 #1c2028;
}

.btn-ghost {
  background: var(--panel);
  color: var(--paper);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.play-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.hint {
  margin: 0;
  color: var(--paper);
  font-size: 13px;
}

.extra-hint {
  margin: 0 0 8px;
  color: var(--yellow);
  font-size: 12px;
  white-space: pre-line;
}

.counts {
  color: var(--cyan);
  font-size: 13px;
  white-space: nowrap;
}

.board-wrap {
  padding: 0;
  background: var(--sidewalk);
  border: 3px solid #080a0e;
  box-shadow: 4px 4px 0 #080a0e;
}

.board {
  position: relative;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}

.board canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#scene,
#title-scene {
  display: block;
  width: 100%;
  height: auto;
}

#links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  box-shadow: 2px 2px 0 #080a0e;
}

.swatch-in {
  background: var(--cyan);
}

.swatch-out {
  background: var(--yellow);
}

.swatch-mag {
  background: var(--magenta);
}

.swatch-left {
  background: #3dff5a;
}

.swatch-straight {
  background: #f4f4f0;
}

.foot {
  margin: 14px 0 0;
  font-size: 13px;
}

.foot a {
  color: var(--cyan);
}

.end-title {
  margin: 4px 0 0;
  font-size: 22px;
  line-height: 1.3;
}

.meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.card {
  margin-top: 12px;
  padding: 12px;
  background: var(--panel);
  border: 3px solid #080a0e;
}

.card h2,
.card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.map-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
}

.empty {
  color: var(--muted);
}

.title-board {
  margin-top: 14px;
  pointer-events: none;
}

@media (max-width: 420px) {
  body {
    padding: 8px 6px 20px;
  }

  .hud-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .btn.full {
    width: 100%;
    text-align: center;
  }

  .play-head {
    flex-direction: column;
  }
}
