/* gameofflife.com v3 — one stylesheet, every screen size */

:root {
  color-scheme: dark light;
  --bg: #0a1424;
  --surface: #0f1d33;
  --surface-2: #162a47;
  --surface-3: #1d3558;
  --line: rgba(170, 195, 230, 0.13);
  --line-strong: rgba(170, 195, 230, 0.26);
  --text: #e9eef6;
  --muted: #98a9c2;
  --accent: #f0a23b;
  --accent-ink: #1d1204;
  --accent-soft: rgba(240, 162, 59, 0.16);
  --focus: #7cc4ff;
  --danger: #ff8a7a;
  --board: #0b2341;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --panel-w: 360px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f1ea;
    --surface: #fffdf9;
    --surface-2: #efe8dc;
    --surface-3: #e5dccd;
    --line: rgba(60, 45, 20, 0.12);
    --line-strong: rgba(60, 45, 20, 0.24);
    --text: #1b2230;
    --muted: #5d6676;
    --accent: #c4621a;
    --accent-ink: #ffffff;
    --accent-soft: rgba(196, 98, 26, 0.12);
    --focus: #1f6fd1;
    --danger: #c23b2a;
    --shadow: 0 10px 30px rgba(60, 45, 20, 0.14);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg { flex: none; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; text-decoration: none; font-weight: 700; }
.skip:focus { top: 10px; }

/* ---------- header ---------- */

.site {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(14px, 3vw, 24px);
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; font-family: var(--font-display); font-weight: 800;
  font-size: 1.15rem; letter-spacing: -0.02em;
}
.brand-mark { width: 22px; height: 22px; fill: var(--accent); }
.brand-mark rect { rx: 0.18; }
.nav { display: flex; gap: 4px; }
.nav a {
  text-decoration: none; padding: 7px 12px; border-radius: 999px;
  color: var(--muted); font-weight: 600; font-size: 0.95rem;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface-2);
  font-weight: 650; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.97); }
.btn-small { min-height: 34px; padding: 0 14px; font-size: 0.9rem; }
.btn-quiet { background: transparent; }
.btn-accent { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent); filter: brightness(1.08); }
.link-btn {
  background: none; border: 0; padding: 4px 0; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px; font-size: 0.9rem;
}
.link-btn:hover { color: var(--text); }

/* ---------- game layout ---------- */

body.app {
  height: 100vh; height: 100dvh;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  min-height: 0;
}
.stage {
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px; min-height: 0; min-width: 0;
  padding: clamp(10px, 1.6vw, 18px);
  padding-left: max(clamp(10px, 1.6vw, 18px), env(safe-area-inset-left));
}
.board {
  position: relative; min-height: 0; overflow: hidden;
  border-radius: var(--radius); background: var(--board);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}
.board canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; cursor: crosshair;
}
.board canvas.is-stamping { cursor: copy; }

/* overlay bits on the board */
.hud {
  position: absolute; left: 10px; top: 10px; right: 10px;
  display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none;
}
.hud-item {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(5, 10, 20, 0.62); color: #eef3fa;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: 0.8rem; line-height: 1.5; border: 0;
}
.hud-item b { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 2ch; }
.hud-label { opacity: 0.7; }
.hud-rule { font-family: var(--mono); pointer-events: auto; cursor: pointer; }
.hud-rule.is-custom { background: var(--accent); color: var(--accent-ink); }
.hud-status { font-weight: 700; }
.hud-status[data-kind="extinct"] { background: rgba(160, 30, 20, 0.8); }

.stamp-bar {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  width: max-content; max-width: calc(100% - 24px);
  padding: 8px 8px 8px 16px; border-radius: 999px;
  background: rgba(5, 10, 20, 0.78); color: #eef3fa;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: var(--shadow); font-size: 0.9rem;
}
.stamp-hint { opacity: 0.7; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.08); color: inherit;
  font-weight: 650; font-size: 0.85rem;
}
.chip-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip-btn:hover { background: rgba(255, 255, 255, 0.16); }
.chip-btn-strong { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip-btn-strong:hover { background: var(--accent); filter: brightness(1.08); }

.intro {
  position: absolute; left: 12px; bottom: 12px; max-width: min(360px, calc(100% - 24px));
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  font-size: 0.92rem; animation: rise 0.35s ease-out both;
}
.intro p { margin: 0 0 12px; }
.intro-title { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- playback controls ---------- */

.controls {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 6px;
}
.ctl {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-weight: 650; font-size: 0.92rem;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.ctl svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ctl svg .fill { fill: currentColor; stroke: none; }
.ctl:hover:not(:disabled) { background: var(--surface-2); }
.ctl:active:not(:disabled) { transform: scale(0.96); }
.ctl:disabled { opacity: 0.4; cursor: default; }
.ctl-play {
  min-width: 128px; justify-content: center; min-height: 50px; padding: 0 22px;
  background: var(--accent); color: var(--accent-ink); border-color: transparent; font-size: 1rem;
}
.ctl-play:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.ctl-play .i-pause, .ctl-play[aria-pressed="true"] .i-play { display: none; }
.ctl-play[aria-pressed="true"] .i-pause { display: block; }

.speed {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 0.85rem; color: var(--muted);
}
.speed output { font-family: var(--mono); color: var(--text); min-width: 4.5ch; text-align: right; font-variant-numeric: tabular-nums; }
.speed input { width: 120px; }

input[type="range"] { accent-color: var(--accent); height: 28px; margin: 0; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* ---------- side panel ---------- */

.panel {
  display: flex; flex-direction: column; min-height: 0;
  border-left: 1px solid var(--line); background: var(--surface);
  padding-right: env(safe-area-inset-right);
}
.tabs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 10px; border-bottom: 1px solid var(--line);
}
[role="tab"] {
  min-height: 38px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-weight: 650; font-size: 0.9rem;
}
[role="tab"]:hover { color: var(--text); background: var(--surface-2); }
[role="tab"][aria-selected="true"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.panes { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.pane { padding: 16px 18px 22px; }
.pane > :first-child { margin-top: 0; }
.pane-title {
  margin: 22px 0 10px; font-size: 0.75rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.eyebrow { margin: 0 0 4px; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.01em; }
.rule-text { margin: 0 0 16px; color: var(--muted); font-size: 0.92rem; }
.tip { margin: 0 0 14px; font-size: 0.85rem; color: var(--muted); }
.hint { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); }
.hint a { color: var(--text); }
.keys { margin: 0; padding: 10px 18px 14px; border-top: 1px solid var(--line); }
.explainer { margin-top: 26px; padding-top: 4px; border-top: 1px solid var(--line); }
.explainer p { margin: 0 0 10px; font-size: 0.86rem; color: var(--muted); }
.explainer a { color: var(--text); }
.explainer ol, .explainer ul { margin: 0 0 12px; padding-left: 1.2em; font-size: 0.86rem; color: var(--muted); }
.explainer li { margin: 0 0 6px; }
.explainer li b { color: var(--text); font-weight: 600; }
.explainer .pane-title { margin-top: 18px; }

/* neighbour-count toggles */
.counts { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.counts legend { padding: 0; margin-bottom: 8px; font-size: 0.92rem; }
.count-row { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
#birthSet .count-row { grid-template-columns: repeat(9, 1fr); }
#birthSet .count-row::before { content: ""; } /* keeps 1–8 lined up under 1–8 of the row below */
.count { position: relative; }
.count input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.count span {
  display: grid; place-items: center; height: 38px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--bg);
  font-family: var(--mono); font-weight: 650; font-size: 0.95rem;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.count input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.count input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.count:hover input:not(:checked) + span { background: var(--surface-2); }
.count-unit { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); }

.rule-string { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.rule-string label { font-size: 0.85rem; color: var(--muted); }
.rule-string input {
  flex: 1 1 110px; min-width: 0; height: 34px; padding: 0 10px;
  border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg);
  font-family: var(--mono); text-transform: uppercase;
}

.presets { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.preset {
  width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg);
}
.preset:hover { border-color: var(--line-strong); background: var(--surface-2); }
.preset[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.preset-name { font-weight: 700; font-size: 0.92rem; }
.preset code { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); align-self: center; }
.preset-note { grid-column: 1 / -1; font-size: 0.82rem; color: var(--muted); }

/* patterns */
.pattern-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pattern {
  display: grid; gap: 6px; padding: 6px 6px 8px; text-align: center;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg);
  font-size: 0.78rem; font-weight: 600; line-height: 1.25;
}
.pattern canvas { width: 100%; height: 62px; border-radius: 6px; display: block; }
.pattern:hover { border-color: var(--line-strong); }
.pattern[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.rle { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.rle summary { cursor: pointer; font-weight: 650; font-size: 0.92rem; }
.rle textarea {
  width: 100%; margin-top: 10px; padding: 10px; resize: vertical;
  border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg);
  font: 0.8rem/1.4 var(--mono);
}
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* look */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.theme { position: relative; display: grid; gap: 6px; font-size: 0.8rem; font-weight: 600; text-align: center; cursor: pointer; }
.theme input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.theme-chip {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  height: 44px; border-radius: var(--radius-sm); border: 2px solid var(--line);
}
.theme-chip i { width: 12px; height: 12px; border-radius: 3px; }
.theme-chip i:first-child { display: none; }
.theme input:checked + .theme-chip { border-color: var(--accent); }
.theme input:focus-visible + .theme-chip { outline: 2px solid var(--focus); outline-offset: 2px; }

.swatches { display: flex; gap: 8px; margin-top: 12px; }
.swatch {
  flex: 1; display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg);
  font-size: 0.82rem; cursor: pointer;
}
.swatch input { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.swatch input::-webkit-color-swatch-wrapper { padding: 0; }
.swatch input::-webkit-color-swatch { border: 1px solid var(--line-strong); border-radius: 6px; }
.swatch input::-moz-color-swatch { border: 1px solid var(--line-strong); border-radius: 6px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 32px; border-radius: 999px; font-size: 0.85rem; font-weight: 650; color: var(--muted); }
.seg input:checked + span { background: var(--surface-3); color: var(--text); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); }

.field { display: grid; grid-template-columns: 6.5em 1fr 3.5em; align-items: center; gap: 10px; margin: 6px 0; font-size: 0.9rem; }
.field output { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); text-align: right; }
.toggle { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; align-items: center; margin: 10px 0; font-size: 0.9rem; cursor: pointer; }
.toggle input { width: 18px; height: 18px; margin: 0; }
.toggle small { grid-column: 2; color: var(--muted); font-size: 0.78rem; }
#lookReset { margin-top: 14px; }

/* stats */
.status-line { margin: 0 0 12px; font-weight: 650; }
.spark { margin: 0 0 16px; }
.spark canvas { width: 100%; height: 84px; display: block; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); }
.spark figcaption { margin-top: 6px; font-size: 0.78rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.stats div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); }
.stats dt { font-size: 0.75rem; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-family: var(--mono); font-size: 1.1rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- dialog, toast ---------- */

.dialog {
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  padding: 22px 24px; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.dialog h2 { margin: 0 0 14px; font-family: var(--font-display); font-size: 1.2rem; }
.shortcuts { margin: 0 0 18px; display: grid; gap: 8px; }
.shortcuts div { display: grid; grid-template-columns: 8em 1fr; gap: 10px; font-size: 0.92rem; }
.shortcuts dd { margin: 0; color: var(--muted); }
kbd {
  display: inline-block; min-width: 1.8em; padding: 1px 6px; text-align: center;
  border-radius: 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  background: var(--bg); font: 600 0.8rem/1.6 var(--mono);
}

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 40;
  padding: 10px 18px; border-radius: 999px; max-width: calc(100vw - 32px);
  background: var(--text); color: var(--bg); font-weight: 650; font-size: 0.9rem;
  box-shadow: var(--shadow); transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { position: fixed; inset: auto 16px 16px; padding: 14px; border-radius: var(--radius); background: var(--surface); }

/* ---------- phones and narrow tablets (portrait) ---------- */

@media (max-width: 820px) and (orientation: portrait), (max-width: 560px) {
  .site { padding-block: 8px; }
  .brand span { font-size: 1.05rem; }
  .nav a { padding: 6px 10px; font-size: 0.88rem; }

  .game { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .stage { padding: 8px 8px 6px; gap: 8px; }
  .board { border-radius: 12px; }
  .controls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .ctl { flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 4px 2px; border-radius: 12px; font-size: 0.72rem; }
  .ctl-play { min-width: 0; min-height: 52px; padding: 4px 2px; font-size: 0.78rem; grid-column: 3; grid-row: 1; }
  .ctl-play svg { width: 22px; height: 22px; }
  #btnReset { grid-column: 1; grid-row: 1; }
  #btnStep { grid-column: 2; grid-row: 1; }
  #btnRandom { grid-column: 4; grid-row: 1; }
  #btnClear { grid-column: 5; grid-row: 1; }
  .speed { grid-column: 1 / 5; grid-row: 2; min-height: 40px; border-radius: 12px; }
  .speed input { flex: 1; width: auto; }
  .ctl-share { grid-column: 5; grid-row: 2; min-height: 40px; }
  .ctl-share svg { width: 16px; height: 16px; }

  .panel {
    border-left: 0; border-top: 1px solid var(--line);
    max-height: 44dvh; padding-bottom: env(safe-area-inset-bottom);
    border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
  }
  .panel .tabs { padding: 8px 8px 6px; border-bottom-color: transparent; }
  .panel:not(.is-collapsed) .tabs { border-bottom-color: var(--line); }
  .panel.is-collapsed .panes, .panel.is-collapsed .keys { display: none; }
  .keys { display: none; }
  .pane { padding: 14px 14px 20px; }
  .intro { left: 8px; right: 8px; bottom: 8px; max-width: none; }
  .hud { left: 8px; top: 8px; }
  .hud-item { font-size: 0.74rem; padding: 3px 8px; }
}

/* ---------- landscape phones: short screens ---------- */

@media (max-height: 520px) and (orientation: landscape) {
  :root { --panel-w: 300px; }
  .site { padding-block: 4px; }
  .brand-mark { width: 18px; height: 18px; }
  .stage { padding: 6px; gap: 6px; }
  .controls { gap: 4px; flex-wrap: nowrap; }
  .ctl { min-height: 38px; padding: 0 10px; }
  .ctl span { display: none; }
  .ctl-play { min-width: 0; min-height: 38px; padding: 0 16px; }
  .ctl-play span { display: inline; }
  .speed { min-height: 38px; }
  .speed-label { display: none; }
  .speed input { width: 80px; }
  .tabs { padding: 6px; }
  [role="tab"] { min-height: 32px; font-size: 0.82rem; }
  .keys { display: none; }
}

@media (min-width: 1500px) { :root { --panel-w: 400px; } }

@media (hover: none) { .keys { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- content pages (patterns, about, 404) ---------- */

.content {
  max-width: 1100px; margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 32px) 64px;
}
.page-title {
  margin: 0 0 12px; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.05; letter-spacing: -0.03em;
}
.lede { margin: 0 0 28px; max-width: 62ch; color: var(--muted); font-size: 1.08rem; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }
.filter {
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: transparent; font-weight: 650; font-size: 0.88rem;
}
.filter[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.card canvas { display: block; width: 100%; aspect-ratio: 4 / 3; background: var(--board); cursor: pointer; }
.card-body { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 14px 16px 16px; }
.card h2 { margin: 0; font-size: 1.05rem; }
.card-meta { margin: 0; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.card .btn { margin-top: auto; align-self: flex-start; }
.card-body > .btn { margin-top: 10px; }
.card h2 a { color: inherit; text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
/* single pattern pages */
.crumbs { margin: 0 0 14px; font-size: 0.85rem; color: var(--muted); }
.crumbs a { color: var(--text); }
.pattern-page .card-meta { margin-bottom: 6px; }
.pattern-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 2fr); gap: 20px; align-items: start; margin-bottom: 8px; }
.pattern-hero canvas { aspect-ratio: 4 / 3; }
.facts { margin: 0 0 18px; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--surface); font-size: 0.92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.rle { margin: 0; padding: 12px 14px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 0.85rem; white-space: pre-wrap; word-break: break-all; }
.related { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.related li { margin: 0; }
@media (max-width: 720px) { .pattern-layout { grid-template-columns: 1fr; } }
.credit { margin-top: 36px; font-size: 0.85rem; color: var(--muted); }

.about-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 56px); align-items: start; }
.prose { font-size: 1.05rem; max-width: 64ch; }
.prose h2 { font-family: var(--font-display); font-size: 1.4rem; margin: 2em 0 0.5em; letter-spacing: -0.01em; }
.prose ol { padding-left: 1.3em; }
.prose li { margin: 0.35em 0; }
.prose a:not(.btn) { color: var(--accent); }
.signature { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }
.figure { margin: 0; }
.figure img, .figure .frame { display: block; width: 100%; border-radius: var(--radius); }
.figure figcaption { margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000; }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-facade {
  position: absolute; inset: 0; display: grid; place-items: center; gap: 8px; width: 100%;
  border: 0; color: #fff; background: radial-gradient(circle at center, #1d3558, #050a14);
  font-weight: 700;
}
.video-facade svg { width: 64px; height: 64px; }
.video-facade small { font-weight: 400; opacity: 0.75; }
.rules-card { margin: 1.2em 0; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.rules-card ol { margin: 0; }

.notfound { min-height: 70vh; display: grid; place-content: center; text-align: center; gap: 14px; }
.notfound canvas { width: min(320px, 80vw); aspect-ratio: 1; margin: 0 auto; border-radius: var(--radius); background: var(--board); }

@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; }
}
