:root {
  color-scheme: dark;
  --bg: #0d1015;
  --panel: #161b22;
  --raised: #222833;
  --line: #2a3140;
  --text: #c3c8cf;
  --dim: #808896;
  --bright: #eef1f5;
  --on: #5fd4a0;
  --on-ink: #0b1a14;
  --cyan: #39c6d1;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --width: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--on); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; height: auto; }
code, pre, kbd, dd { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--on); outline-offset: 2px; }

.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1.5rem; height: 48px; padding: 0 var(--gutter); background: rgba(13,16,21,.88); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.mark { display: flex; align-items: center; gap: .6rem; color: var(--bright); font: 600 1rem var(--mono); }
.mark:hover { text-decoration: none; }
.bar nav { display: flex; gap: 1.25rem; margin-left: auto; font: 500 .85rem var(--mono); }
.bar nav a { color: var(--dim); }
.bar nav a:hover { color: var(--bright); text-decoration: none; }

.hero { --edge: max(var(--gutter), (100% - var(--width)) / 2 + var(--gutter)); position: relative; height: min(88vh, 760px); min-height: 520px; overflow: hidden; border-bottom: 1px solid var(--line); }
#life { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; cursor: crosshair; touch-action: none; }
.hero-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(13,16,21,.94) 0%, rgba(13,16,21,.8) calc(var(--edge) + 420px), rgba(13,16,21,0) calc(var(--edge) + 820px)); }
.hero-copy { position: absolute; left: var(--edge); top: 50%; width: min(560px, calc(100% - 2 * var(--gutter))); transform: translateY(-50%); pointer-events: none; }
.hero-copy .actions { pointer-events: auto; }
h1 { margin: 0 0 1rem; color: var(--bright); font: 600 clamp(3.5rem, 10vw, 7rem)/1 var(--mono); letter-spacing: -.04em; }
.lede { margin: 0 0 2rem; font-size: clamp(1.05rem, 1.8vw, 1.25rem); color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.btn { display: inline-flex; align-items: center; height: 40px; padding: 0 1.1rem; border-radius: 3px; background: var(--raised); color: var(--bright); font: 500 .95rem var(--sans); }
.btn:hover { background: #2c3341; text-decoration: none; }
.btn-on { background: var(--on); color: var(--on-ink); }
.btn-on:hover { background: #7be0b3; }

.readout { position: absolute; left: var(--edge); bottom: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .55rem; padding: .35rem .75rem; border: 1px solid var(--line); background: rgba(22,27,34,.92); font: .8rem var(--mono); }
.readout span { color: var(--dim); }
.readout b { margin-right: .6rem; color: var(--bright); font-weight: 500; }
.readout .hint { margin-left: .4rem; }
.readout-play { width: 22px; height: 22px; padding: 0; border: 0; background: none; color: var(--on); font: .7rem var(--mono); cursor: pointer; }

.shot { max-width: var(--width); margin: -1px auto 0; padding: clamp(40px, 7vw, 88px) var(--gutter) 0; }
.shot img { border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 30px 80px rgba(0,0,0,.55), 0 0 0 6px var(--panel); }

.block { max-width: var(--width); margin: 0 auto; padding: clamp(64px, 10vw, 128px) var(--gutter) 0; }
.head { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem 4rem; align-items: end; margin-bottom: 2.5rem; }
h2 { margin: 0; color: var(--bright); font: 600 clamp(2rem, 4.5vw, 3rem)/1.1 var(--mono); letter-spacing: -.03em; }
.head p { margin: 0; color: var(--dim); }
.version { color: var(--on); font-size: .5em; letter-spacing: 0; vertical-align: middle; }

.rules { display: grid; grid-template-columns: 220px 1fr; gap: 1px; border: 1px solid var(--line); background: var(--line); }
.presets { display: flex; flex-direction: column; gap: 6px; padding: 14px; background: var(--panel); }
.presets button { height: 36px; border: 0; border-radius: 3px; background: var(--raised); color: var(--bright); font: 500 .95rem var(--sans); cursor: pointer; }
.presets button:hover { background: #2c3341; }
.presets button[aria-selected="true"] { background: var(--on); color: var(--on-ink); }
.rule-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); margin: 0; background: var(--bg); }
.rule-view img { width: 100%; image-rendering: pixelated; }
.rule-view figcaption { padding: 1.75rem; border-left: 1px solid var(--line); background: var(--panel); }
.rule-view code { display: block; margin-bottom: 1rem; color: var(--on); font-size: .95rem; word-break: break-all; }
.rule-view p { margin: 0; }

.strings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 1.5rem 0 0; border: 1px solid var(--line); background: var(--line); }
.strings div { padding: .9rem 1rem; background: var(--bg); }
.strings dt { color: var(--dim); font-size: .8rem; }
.strings dd { margin: .2rem 0 0; color: var(--bright); font-size: .85rem; word-break: break-all; }

.panels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.panel { border: 1px solid var(--line); background: var(--panel); }
.panel h3 { display: inline-block; margin: 0; padding: .3rem .7rem; background: var(--on); color: var(--on-ink); font: 500 .85rem var(--sans); }
.panel p { margin: 0; padding: 1rem 1.1rem 1.25rem; font-size: .95rem; }
.panel code { color: var(--bright); font-size: .88em; }

.downloads { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 0 0 2rem; padding: 0; list-style: none; }
.downloads a { display: flex; flex-direction: column; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); color: var(--text); }
.downloads a:hover { border-color: var(--on); text-decoration: none; }
.downloads b { color: var(--bright); font-weight: 600; }
.downloads span { color: var(--dim); font: .82rem var(--mono); }
.downloads a.mine { border-color: var(--on); background: rgba(95,212,160,.08); }
.downloads a.mine span::after { content: " · yours"; color: var(--on); }

.usage { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; }
pre { margin: 0; padding: 1.25rem 1.4rem; overflow-x: auto; border: 1px solid var(--line); background: #090b0f; color: var(--bright); font-size: .88rem; line-height: 1.7; }
pre .c { color: var(--dim); }
.keys { margin: 0; border: 1px solid var(--line); background: var(--panel); }
.keys div { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; align-items: center; padding: .55rem 1rem; border-bottom: 1px solid var(--line); }
.keys div:last-child { border-bottom: 0; }
.keys dd { margin: 0; color: var(--text); font: .9rem var(--sans); }
kbd { display: inline-block; min-width: 1.6rem; padding: .05rem .4rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; background: var(--raised); color: var(--bright); font-size: .78rem; text-align: center; }
.more { margin: 1.5rem 0 0; color: var(--dim); }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; max-width: var(--width); margin: clamp(64px, 10vw, 128px) auto 0; padding: 1.5rem var(--gutter) 2rem; border-top: 1px solid var(--line); color: var(--dim); font: .85rem var(--mono); }
.foot span { display: flex; align-items: center; gap: .5rem; }

@media (max-width: 900px) {
  .head, .usage { grid-template-columns: 1fr; }
  .rules { grid-template-columns: 1fr; }
  .presets { flex-direction: row; }
  .presets button { flex: 1; }
  .rule-view { grid-template-columns: 1fr; }
  .rule-view figcaption { border-left: 0; border-top: 1px solid var(--line); }
  .strings { grid-template-columns: repeat(2, 1fr); }
  .panels { grid-template-columns: 1fr 1fr; }
  .downloads { grid-template-columns: repeat(2, 1fr); }
  .hero-shade { background: linear-gradient(180deg, rgba(13,16,21,.2) 0%, rgba(13,16,21,.9) 45%, rgba(13,16,21,.9) 100%); }
  .hero-copy { top: auto; bottom: 76px; transform: none; }
}

@media (max-width: 560px) {
  .bar nav a:not(:last-child) { display: none; }
  .panels, .strings { grid-template-columns: 1fr; }
  .readout .hint { display: none; }
  .keys div { grid-template-columns: 7.5rem 1fr; }
}

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