:root {
  color-scheme: dark;
  --bg: #0a0d12;
  --panel: #121720;
  --panel-2: #181f2b;
  --text: #f5f7fb;
  --muted: #9aa6b6;
  --line: #273140;
  --accent: #7ee787;
  --accent-2: #79c0ff;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 85% 5%, rgba(121, 192, 255, .10), transparent 28rem),
    radial-gradient(circle at 10% 22%, rgba(126, 231, 135, .08), transparent 24rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button { font: inherit; }
.hero,
main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  min-height: 390px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 60px;
  align-items: end;
  padding: 72px 0 62px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 20px;
  max-width: 800px;
  font-size: clamp(44px, 7vw, 82px);
  line-height: .96;
  letter-spacing: -.05em;
}
.lede {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.keymap {
  display: grid;
  gap: 7px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(18, 23, 32, .8);
  color: var(--muted);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.keymap strong { color: var(--text); margin-bottom: 4px; }

main { padding: 58px 0 90px; }
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: end;
  margin-bottom: 24px;
}
.section-heading h2 {
  margin-bottom: 0;
  font-size: 34px;
  letter-spacing: -.03em;
}
.section-heading > p {
  max-width: 450px;
  margin-bottom: 2px;
  color: var(--muted);
  line-height: 1.5;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.sample-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
  box-shadow: 0 16px 50px rgba(0, 0, 0, .12);
}
.sample-preview {
  display: grid;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 20px;
  overflow: hidden;
  place-items: center;
  border: 1px solid #303b4b;
  border-radius: 9px;
  background: #080b10;
}
.preview-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0;
  image-rendering: pixelated;
  z-index: 1;
}
.preview-ready .preview-image { opacity: 1; }
.preview-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #354154;
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: preview-spin .8s linear infinite;
  z-index: 3;
}
.preview-status {
  position: absolute;
  bottom: 12px;
  color: var(--muted);
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  z-index: 3;
}
.preview-ready .preview-spinner,
.preview-ready .preview-status { display: none; }
.preview-error .preview-spinner { display: none; }
@keyframes preview-spin { to { transform: rotate(360deg); } }
.sample-index {
  margin-bottom: 36px;
  color: #59677a;
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.sample-category {
  color: var(--accent-2);
  font: 700 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.sample-card h3 {
  margin: 6px 0 9px;
  font-size: 22px;
  letter-spacing: -.02em;
}
.sample-card p {
  flex: 1;
  margin-bottom: 22px;
  color: var(--muted);
  line-height: 1.5;
}
.run {
  align-self: flex-start;
  padding: 9px 13px;
  border: 1px solid #3a495d;
  border-radius: 8px;
  color: var(--text);
  background: #202938;
  cursor: pointer;
}
.run:hover { border-color: var(--accent); background: #263242; }

.player {
  /* The third limit is (100vh - 160px) * 4/3. It leaves room for
     the dialog chrome while keeping the game viewport at exactly 4:3. */
  width: min(1120px, calc(100vw - 28px), calc(133.333vh - 213.333px));
  max-width: none;
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 1px solid #364256;
  border-radius: 14px;
  color: var(--text);
  background: #0b0f15;
  box-shadow: 0 30px 120px rgba(0, 0, 0, .65);
}
.player::backdrop { background: rgba(0, 0, 0, .78); }
.player-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-height: 62px;
  padding: 10px 14px 10px 18px;
  border-bottom: 1px solid var(--line);
}
.player-bar > div:first-child { display: grid; gap: 3px; }
.player-category {
  color: var(--accent-2);
  font: 700 10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.player-actions { display: flex; gap: 8px; }
.player-actions button {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
}
.frame-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #05070a;
}
#sample-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #080b10;
}
#sample-frame.is-loading { visibility: hidden; }
.player-help {
  min-height: 37px;
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; gap: 34px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .hero, main { width: min(100% - 24px, 1180px); }
  .hero { padding-top: 48px; }
  .gallery { grid-template-columns: 1fr; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 14px; }
  .player-bar { align-items: flex-start; }
}
