:root {
  color-scheme: light;
  --ink: #20201d;
  --muted: #67685f;
  --paper: #f4f0e5;
  --shell: #d8d5cc;
  --shell-dark: #77747b;
  --screen: #9bbc0f;
  --button: #8c1c4f;
  --accent: #27462f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, #fff 0, transparent 34rem),
    var(--paper);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.7;
}

button, canvas { touch-action: none; }
button { font: inherit; }
a { color: var(--accent); }

.page {
  width: min(100% - 32px, 960px);
  margin: 0 auto;
  padding: 48px 0 64px;
}

.intro { margin-bottom: 32px; }
.intro h1 { margin: 0; font-size: clamp(2rem, 6vw, 4rem); letter-spacing: .05em; }
.intro p { max-width: 42rem; margin: 8px 0 0; }
.eyebrow { color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .2em; }

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  gap: 48px;
  align-items: start;
}

.console {
  padding: 24px 24px 18px;
  overflow: hidden;
  border: 1px solid #bab7ae;
  border-radius: 22px 22px 70px 22px;
  background: var(--shell);
  box-shadow: 0 18px 45px rgb(49 45 34 / 18%);
  user-select: none;
  -webkit-user-select: none;
}

.screen-frame {
  position: relative;
  padding: 18px;
  border-radius: 12px 12px 34px 12px;
  background: var(--shell-dark);
}

#display {
  display: block;
  width: 100%;
  aspect-ratio: 10 / 9;
  image-rendering: pixelated;
  background: var(--screen);
}

#status {
  position: absolute;
  inset: 18px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 20px;
  text-align: center;
  background: rgb(155 188 15 / 92%);
}
#status[hidden] { display: none; }
#status.error { color: #4b1010; }
#fps { position: absolute; right: 20px; bottom: 18px; font-size: 9px; }

.controls { position: relative; min-height: 190px; margin-top: 28px; }
.controls button { border: 0; cursor: pointer; }
.controls button.pressed { filter: brightness(1.5); transform: translateY(2px); }

.dpad {
  position: absolute;
  top: 0;
  left: 4px;
  width: 114px;
  height: 114px;
}
.dpad button {
  position: absolute;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #bbb;
  background: #303136;
  font-size: 13px;
}
.dpad .up { left: 38px; border-radius: 7px 7px 0 0; }
.dpad .left { top: 38px; border-radius: 7px 0 0 7px; }
.dpad .right { top: 38px; left: 76px; border-radius: 0 7px 7px 0; }
.dpad .down { top: 76px; left: 38px; border-radius: 0 0 7px 7px; }

.action-buttons {
  position: absolute;
  top: 16px;
  right: 0;
  display: flex;
  gap: 17px;
  transform: rotate(-13deg);
}
.action-buttons button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  color: #f4dce7;
  background: var(--button);
  box-shadow: inset 0 -4px 0 rgb(55 5 27 / 28%);
  font-weight: 800;
}
.action-buttons button span { display: inline-block; transform: rotate(13deg); }

.system-buttons {
  position: absolute;
  right: 0;
  bottom: 14px;
  left: 0;
  display: flex;
  justify-content: center;
  gap: 16px;
}
.system-buttons button {
  min-width: 66px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #49454b;
  background: #858187;
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / 22%);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.pause {
  display: block;
  margin: 0 auto;
  padding: 6px 12px;
  border: 1px solid #aaa69e;
  border-radius: 999px;
  color: #4f4d48;
  background: #ece9e1;
  cursor: pointer;
  font-size: .75rem;
}

.guide h2 { margin: 0 0 8px; font-size: 1.15rem; }
.guide h2:not(:first-child) { margin-top: 28px; }
.guide p { margin: 0 0 16px; }
.guide dl { margin: 0; }
.guide dl div { display: grid; grid-template-columns: 7em 1fr; border-top: 1px solid #d6d0c1; }
.guide dt, .guide dd { margin: 0; padding: 7px 0; }
.guide dt { font-weight: 700; }
.keyboard { margin-top: 16px !important; color: var(--muted); font-size: .9rem; }
kbd { padding: 1px 5px; border: 1px solid #bcb6a8; border-radius: 4px; background: #fff; box-shadow: 0 1px 0 #bcb6a8; }
.article-links { display: flex; flex-wrap: wrap; gap: 8px; }
.article-links a { padding: 6px 12px; border: 1px solid #bcb6a8; border-radius: 999px; background: rgb(255 255 255 / 45%); font-weight: 700; text-decoration: none; }
.links { display: flex; gap: 20px; margin-top: 30px !important; font-weight: 700; }
.credit { color: var(--muted); font-size: .75rem; }

@media (max-width: 760px) {
  .page { width: min(100% - 20px, 430px); padding-top: 24px; }
  .layout { grid-template-columns: 1fr; gap: 36px; }
  .console { padding: 16px 16px 12px; }
  .screen-frame { padding: 12px; }
  #status { inset: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
