:root {
  color-scheme: dark;
  --bg: #04080e;
  --panel: rgba(9, 16, 27, 0.92);
  --panel-2: #0d1827;
  --line: #2b405d;
  --text: #f2ecdc;
  --muted: #98a7ba;
  --accent: #9bcf6a;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, #183353 0, #091625 38%, #04080e 78%),
    var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

button, summary { font: inherit; }

.page-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #a4b0c1;
  font-size: 12px;
  letter-spacing: .08em;
}

h1 {
  margin: 0;
  color: #f3eddf;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
  letter-spacing: .045em;
  text-shadow: 0 4px 0 #111926;
}

.tagline {
  margin: 9px 0 0;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: .08em;
}

.build-badge {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid #466184;
  border-radius: 999px;
  color: #b9cbe1;
  background: #0c1726;
  font-size: 12px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(300px, 1fr);
  gap: 20px;
  align-items: start;
}

.game-card,
.info-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

.game-card { padding: 16px; }
.info-card { overflow: hidden; }
.info-card section,
.info-card details { padding: 17px 18px; }
.info-card section + section,
.info-card details { border-top: 1px solid var(--line); }

canvas {
  display: block;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 420 / 640;
  margin: 0 auto;
  border: 1px solid #385272;
  border-radius: 14px;
  background: #08111d;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .025);
  image-rendering: pixelated;
  touch-action: none;
  user-select: none;
}

.hud-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
  margin-top: 12px;
}

.hud-box {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
}

.hud-box > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.hud-box strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-value {
  display: flex;
  align-items: center;
  gap: 6px;
}

.next-value img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  image-rendering: pixelated;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

button {
  padding: 10px 14px;
  border: 1px solid #3b587d;
  border-radius: 999px;
  color: var(--text);
  background: #14263c;
  cursor: pointer;
}

button:hover { filter: brightness(1.1); }
button:active { transform: translateY(1px); }

.controls-copy {
  margin: 13px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

h2 {
  margin: 0 0 12px;
  color: #dfe7d1;
  font-size: 17px;
  letter-spacing: .05em;
}

ul, ol {
  margin: 0;
  padding-left: 1.25em;
  color: #c4cedb;
  line-height: 1.7;
}

.level-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.level-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #273b56;
  border-radius: 10px;
  background: #0b1523;
}

.level-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  image-rendering: pixelated;
}

.level-item b,
.level-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-item b { font-size: 12px; }
.level-item small { margin-top: 2px; color: var(--muted); font-size: 10px; }

summary {
  cursor: pointer;
  color: #dbe7c8;
  font-weight: 700;
}

details ol { margin-top: 12px; }

@media (max-width: 900px) {
  .site-header { align-items: flex-start; }
  .build-badge { display: none; }
  .layout { grid-template-columns: 1fr; }
  .info-card { order: 2; }
}

@media (max-width: 480px) {
  .page-shell { padding: 10px; }
  .site-header { margin: 8px 4px 14px; }
  .game-card { padding: 9px; border-radius: 13px; }
  canvas { border-radius: 10px; }
  .hud-box { padding: 8px; }
  .hud-box strong { font-size: 16px; }
  .level-list { grid-template-columns: 1fr 1fr; }
}
