:root {
  --ink: #0a0a0a;
  --paper: #f4f4f2;
  --card: rgba(255, 255, 255, 0.86);
  --rule: #0a0a0a;
  --dim: #6b6b6b;
  --red: #d6241c;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--sans); font-size: 16px; line-height: 1.45; }
a { color: inherit; text-underline-offset: 2px; }
h1, h2, h3 { font-weight: 700; margin: 0; letter-spacing: -0.02em; }

/* ------------------------------------------------ stage */
.stage { position: relative; height: 100vh; min-height: 640px; overflow: hidden; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#world:active { cursor: grabbing; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); background: var(--paper); transition: opacity 0.8s; }
.loading.done { opacity: 0; pointer-events: none; }

.title-card { position: absolute; top: 28px; left: 32px; max-width: 420px; pointer-events: none; }
h1 { font-size: clamp(40px, 5.4vw, 76px); line-height: 0.92; letter-spacing: -0.045em; }
.lede { margin: 16px 0 0; font-size: 16px; max-width: 360px; color: #222; }
.lede b { font-weight: 500; color: var(--ink); }

.card {
  position: absolute;
  background: var(--card);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--rule);
  padding: 14px 16px;
}
.brain-card { top: 24px; right: 24px; width: 360px; max-height: calc(100% - 48px); overflow: auto; }
.brain-card header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.brain-card h2, .card h2 { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; }
.brain-card header span { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.brain-card header b { color: var(--ink); font-weight: 600; }
#brain { display: block; width: 100%; height: 210px; margin-top: 8px; cursor: crosshair; }
.hover { margin: 2px 0 6px; font-family: var(--mono); font-size: 11px; color: var(--dim); min-height: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.legend .eye { background: #111; } .legend .mid { background: #969696; }
.legend .out { border: 1.5px solid var(--red); background: #fff; } .legend .fire { background: var(--red); }
.card h3 { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin: 14px 0 6px; border-top: 1px solid #ddd; padding-top: 10px; }
#warm { color: var(--red); }
.meter { display: grid; grid-template-columns: 74px 1fr 50px; gap: 0 8px; align-items: center; padding: 3px 4px; }
.meter.on { background: var(--ink); color: #fff; }
.meter.on .m-neurons, .meter.on .m-val { color: #bbb; }
.m-label { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.m-bar { position: relative; height: 8px; background: #e4e4e2; }
.meter.on .m-bar { background: #333; }
.m-bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--red); transition: width 0.08s; }
.m-bar b { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--ink); }
.meter.on .m-bar b { background: #fff; }
.m-val { font-family: var(--mono); font-size: 11px; color: var(--dim); text-align: right; }
.m-neurons { grid-column: 2 / 4; font-family: var(--mono); font-size: 10px; color: #8a8a8a; }
#log { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px solid #ddd; font-family: var(--mono); font-size: 11px; color: var(--dim); min-height: 106px; }
#log li { padding: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#log li:first-child { color: var(--ink); }
#log li.win { color: #138a2e; } #log li.over, #log li.poke { color: var(--red); }

.game-card { left: 24px; bottom: 24px; width: 400px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.stats dt { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.stats dd { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.presses { margin: 8px 0 4px; font-family: var(--mono); font-size: 11px; color: var(--dim); display: flex; justify-content: space-between; gap: 8px; }
.presses code { font-family: var(--mono); color: var(--ink); white-space: pre; }
#history { display: block; width: 100%; height: 34px; }
.controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.seg { display: inline-flex; }
.seg button + button { border-left: 0; }
button { font-family: var(--mono); font-size: 11px; color: var(--ink); background: #fff; border: 1px solid var(--rule); padding: 6px 9px; cursor: pointer; }
button:hover { background: #eee; }
button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ------------------------------------------------ about */
.about { padding: 72px 32px 24px; max-width: 1240px; margin: 0 auto; }
.about > h2 { font-size: clamp(30px, 4vw, 48px); letter-spacing: -0.04em; border-bottom: 2px solid var(--ink); padding-bottom: 12px; }
.about .cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-top: 24px; }
.about h3 { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.about p { margin: 0; color: #333; }
.about b { font-weight: 600; color: var(--ink); }
.honest { margin-top: 28px !important; padding: 14px 16px; border-left: 3px solid var(--red); background: #fff; max-width: 820px; }
footer { padding: 24px 32px 48px; max-width: 1240px; margin: 0 auto; font-family: var(--mono); font-size: 11px; color: var(--dim); }
footer p { margin: 4px 0; }

/* ------------------------------------------------ smaller screens */
@media (max-width: 1100px) {
  .brain-card { width: 320px; }
  .game-card { width: 360px; }
}
@media (max-width: 860px) {
  .stage { height: auto; min-height: 0; overflow: visible; display: flex; flex-direction: column; }
  #world { position: relative; height: 64vh; min-height: 380px; }
  .title-card { top: 18px; left: 16px; right: 16px; }
  h1 { font-size: 40px; }
  .lede { display: none; }
  .card { position: static; width: auto; max-height: none; margin: 12px 16px 0; backdrop-filter: none; background: #fff; }
  .game-card { order: 2; }
  .brain-card { order: 3; }
  .about { padding: 48px 16px 16px; }
  .about .cols { grid-template-columns: 1fr; gap: 20px; }
  footer { padding: 20px 16px 40px; }
}
