/* ANTJANUS — Pixel Art / 8-bit
   Palette: Sweetie 16 by GrafxKid (lospec.com/palette-list/sweetie-16), brand slate #364f6a kept for panel title bars.
   Grid unit: 4px. Every border, offset and gap is a multiple of it. */

:root {
  --u: 4px;

  --sw-night: #1a1c2c;
  --sw-plum: #5d275d;
  --sw-red: #b13e53;
  --sw-orange: #ef7d57;
  --sw-gold: #ffcd75;
  --sw-lime: #a7f070;
  --sw-green: #38b764;
  --sw-teal: #257179;
  --sw-navy: #29366f;
  --sw-blue: #3b5dc9;
  --sw-sky: #41a6f6;
  --sw-cyan: #73eff7;
  --sw-white: #f4f4f4;
  --sw-mist: #94b0c2;
  --sw-slate: #566c86;
  --sw-ink: #333c57;
  --brand: #364f6a;

  --bg: #fbf1df;
  --bg-dot: rgba(26, 28, 44, 0.07);
  --surface: #ffffff;
  --surface-2: #f3e6cf;
  --ink: #1a1c2c;
  --ink-dim: #4a5068;
  --line: #1a1c2c;
  --drop: rgba(26, 28, 44, 0.9);
  --hi: rgba(255, 255, 255, 0.9);
  --lo: rgba(26, 28, 44, 0.1);
  --bar: #364f6a;
  --bar-ink: #ffffff;
  --link: #9e2f45;
  --action: #b13e53;
  --action-ink: #ffffff;
  --coin: #8a5a00;
  --focus: #3b5dc9;

  --w-ai: #5d275d;
  --w-ai-fill: #e9d3ec;
  --w-garden: #1f6b3d;
  --w-garden-fill: #cdefcf;
  --w-tools: #9a3b14;
  --w-tools-fill: #fbd9c8;
  --w-proj: #29366f;
  --w-proj-fill: #d4ddfa;
  --w-pat: #6e4a00;
  --w-pat-fill: #ffe7b3;

  --code-bg: #1a1c2c;
  --code-ink: #f4f4f4;

  --f-display: "Press Start 2P", "Courier New", monospace;
  --f-head: "Pixelify Sans", "Trebuchet MS", sans-serif;
  --f-term: "VT323", "Courier New", monospace;
  --f-body: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1a1c2c;
  --bg-dot: rgba(148, 176, 194, 0.08);
  --surface: #262b44;
  --surface-2: #333c57;
  --ink: #f4f4f4;
  --ink-dim: #b4c6d3;
  --line: #07080f;
  --drop: rgba(0, 0, 0, 0.75);
  --hi: rgba(148, 176, 194, 0.22);
  --lo: rgba(0, 0, 0, 0.3);
  --bar: #29366f;
  --bar-ink: #f4f4f4;
  --link: #73eff7;
  --action: #ef7d57;
  --action-ink: #1a1c2c;
  --coin: #ffcd75;
  --focus: #73eff7;

  --w-ai: #e7b6ee;
  --w-ai-fill: #5d275d;
  --w-garden: #a7f070;
  --w-garden-fill: #1f4d38;
  --w-tools: #ffb38f;
  --w-tools-fill: #6a2c1a;
  --w-proj: #a9c1ff;
  --w-proj-fill: #29366f;
  --w-pat: #ffcd75;
  --w-pat-fill: #5a4012;

  --code-bg: #0e0f1a;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1c2c;
    --bg-dot: rgba(148, 176, 194, 0.08);
    --surface: #262b44;
    --surface-2: #333c57;
    --ink: #f4f4f4;
    --ink-dim: #b4c6d3;
    --line: #07080f;
    --drop: rgba(0, 0, 0, 0.75);
    --hi: rgba(148, 176, 194, 0.22);
    --lo: rgba(0, 0, 0, 0.3);
    --bar: #29366f;
    --bar-ink: #f4f4f4;
    --link: #73eff7;
    --action: #ef7d57;
    --action-ink: #1a1c2c;
    --coin: #ffcd75;
    --focus: #73eff7;
    --w-ai: #e7b6ee;
    --w-ai-fill: #5d275d;
    --w-garden: #a7f070;
    --w-garden-fill: #1f4d38;
    --w-tools: #ffb38f;
    --w-tools-fill: #6a2c1a;
    --w-proj: #a9c1ff;
    --w-proj-fill: #29366f;
    --w-pat: #ffcd75;
    --w-pat-fill: #5a4012;
    --code-bg: #0e0f1a;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1.5px, transparent 1.6px);
  background-size: 16px 16px;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.65;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-style: dotted; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
h2, h3, h4 { font-family: var(--f-head); font-weight: 600; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; }
code { font-family: var(--f-body); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--action); color: var(--action-ink); padding: 8px 12px; font-family: var(--f-head); }
.skip:focus { top: 8px; }

.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.wrap-narrow { width: min(960px, 100% - 32px); margin-inline: auto; }
svg.px-ic { width: 1em; height: 1em; shape-rendering: crispEdges; flex: none; vertical-align: -0.125em; }
.pixelated { image-rendering: pixelated; }

/* ---------- pixel primitives ---------- */
/* Notched-corner panel: four 4px edge shadows leave the corners empty (NES.css technique) */
.px {
  position: relative;
  background: var(--surface);
  margin: var(--u);
  box-shadow:
    0 calc(var(--u) * -1) 0 0 var(--line),
    0 var(--u) 0 0 var(--line),
    calc(var(--u) * -1) 0 0 0 var(--line),
    var(--u) 0 0 0 var(--line),
    inset var(--u) var(--u) 0 0 var(--hi),
    inset calc(var(--u) * -1) calc(var(--u) * -1) 0 0 var(--lo),
    calc(var(--u) * 2) calc(var(--u) * 2) 0 0 var(--drop);
}
.px-flat { box-shadow: 0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line); }
.px-pad { padding: 24px; }
.bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bar); color: var(--bar-ink);
  font-family: var(--f-head); font-weight: 600; font-size: 1.05rem; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 6px 14px;
  border-bottom: 4px solid var(--line);
}
.bar .dots { margin-left: auto; display: flex; gap: 6px; }
.bar .dots i { width: 8px; height: 8px; background: currentColor; opacity: 0.7; display: block; }

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-ink: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 10px 20px; margin: 4px;
  background: var(--btn-bg); color: var(--btn-ink);
  font-family: var(--f-head); font-weight: 700; font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.05em;
  text-decoration: none; border: 0; cursor: pointer;
  box-shadow:
    0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line),
    inset -4px -4px 0 0 rgba(0, 0, 0, 0.18), inset 4px 4px 0 0 rgba(255, 255, 255, 0.25),
    6px 6px 0 0 var(--drop);
  transition: transform 100ms steps(2), box-shadow 100ms steps(2);
}
.btn:hover { transform: translate(-2px, -2px); box-shadow:
    0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line),
    inset -4px -4px 0 0 rgba(0, 0, 0, 0.18), inset 4px 4px 0 0 rgba(255, 255, 255, 0.25),
    8px 8px 0 0 var(--drop); text-decoration: none; }
.btn:active { transform: translate(4px, 4px); box-shadow:
    0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line),
    inset 4px 4px 0 0 rgba(0, 0, 0, 0.22); }
.btn-primary { --btn-bg: var(--action); --btn-ink: var(--action-ink); }
.btn-coin { --btn-bg: var(--sw-gold); --btn-ink: #1a1c2c; }
.btn-ghost { background: transparent; box-shadow: none; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; color: var(--ink); }
.btn-ghost:hover, .btn-ghost:active { box-shadow: none; transform: none; text-decoration-style: dotted; }
.btn-sm { min-height: 44px; padding: 6px 14px; font-size: 0.95rem; }
.btn[aria-busy="true"] { opacity: 0.8; cursor: progress; }

.link-arrow { font-family: var(--f-head); font-weight: 600; font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.link-arrow::after { content: " ▸"; }

/* ---------- header / nav ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: var(--bar); color: var(--bar-ink);
  border-bottom: 4px solid var(--line);
  box-shadow: 0 4px 0 0 var(--drop);
}
.head-row { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.logo { display: flex; align-items: center; gap: 12px; color: var(--bar-ink); text-decoration: none; }
.logo svg { width: 40px; height: 40px; }
.logo-words { display: flex; flex-direction: column; line-height: 1.2; }
.logo-words small { font-family: var(--f-term); font-size: 1.15rem; letter-spacing: 0.12em; opacity: 0.85; }
.logo-words b { font-family: var(--f-display); font-size: 0.8125rem; color: var(--sw-gold); letter-spacing: 0.02em; }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav a {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 6px 12px 6px 22px;
  color: var(--bar-ink); text-decoration: none; font-family: var(--f-head); font-weight: 600; font-size: 1.1rem;
}
.nav a::before { content: "▶"; position: absolute; left: 6px; font-size: 0.7rem; opacity: 0; }
.nav a:hover::before, .nav a[aria-current="page"]::before { opacity: 1; }
.nav a[aria-current="page"] { color: var(--sw-gold); }
.nav a:hover { color: var(--sw-gold); }
.nav a.nav-ai {
  margin-left: 8px; padding-left: 14px; background: var(--sw-plum); color: #fff;
  box-shadow: 0 -3px 0 0 var(--line), 0 3px 0 0 var(--line), -3px 0 0 0 var(--line), 3px 0 0 0 var(--line), inset 0 -4px 0 0 rgba(0,0,0,.3), inset 0 4px 0 0 #8a3f8a;
}
.nav a.nav-ai::before { display: none; }
.nav a.nav-ai[aria-current="page"], .nav a.nav-ai:hover { color: var(--sw-gold); }
.head-tools { display: flex; align-items: center; gap: 8px; }
.search { display: flex; align-items: center; }
.search input {
  width: 150px; min-height: 40px; padding: 4px 10px; border: 0; border-radius: 0;
  background: var(--sw-night); color: var(--sw-white); font-family: var(--f-term); font-size: 1.25rem;
  box-shadow: inset 3px 3px 0 0 #000;
}
.search input::placeholder { color: var(--sw-mist); }
.search button, .icon-btn {
  min-width: 44px; min-height: 44px; border: 0; cursor: pointer; background: var(--sw-ink); color: var(--sw-white);
  font-family: var(--f-head); font-weight: 600; font-size: 0.95rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: inset -3px -3px 0 0 rgba(0,0,0,.35), inset 3px 3px 0 0 rgba(255,255,255,.18);
}
.search button { padding: 0 10px; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active, .search button:active { box-shadow: inset 3px 3px 0 0 rgba(0,0,0,.4); }
.theme-toggle .ic-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: none; }
.menu-btn { display: none; }
.mobile-menu { display: none; }

/* HUD strip */
.hud {
  background: var(--sw-night); color: var(--sw-white); border-bottom: 4px solid var(--line);
  font-family: var(--f-term); font-size: 1.3rem; letter-spacing: 0.06em; line-height: 1.2;
}
.hud .wrap { display: flex; gap: 28px; align-items: center; min-height: 36px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.hud b { color: var(--sw-gold); font-weight: 400; }
.hud .hearts { color: var(--sw-red); display: inline-flex; gap: 3px; vertical-align: middle; }
.hud .hearts svg { width: 16px; height: 16px; }
.hud .sfx { margin-left: auto; background: none; border: 0; color: var(--sw-cyan); font: inherit; cursor: pointer; min-height: 36px; padding: 0 4px; }

@media (max-width: 1100px) {
  .search { display: none; }
}
@media (max-width: 860px) {
  .nav { display: none; }
  .menu-btn { display: inline-flex; }
  .head-tools { margin-left: auto; }
  .mobile-menu[data-open="true"] { display: block; background: var(--bar); border-top: 4px solid var(--line); padding: 8px 0 16px; }
  .mobile-menu a { display: flex; min-height: 48px; align-items: center; padding: 0 8px; color: var(--bar-ink); font-family: var(--f-head); font-weight: 600; font-size: 1.25rem; text-decoration: none; }
  .mobile-menu a::before { content: "▶"; font-size: 0.75rem; margin-right: 12px; opacity: 0; }
  .mobile-menu a[aria-current="page"] { color: var(--sw-gold); }
  .mobile-menu a[aria-current="page"]::before, .mobile-menu a:hover::before { opacity: 1; }
  .mobile-menu .search { display: flex; margin: 12px 8px 0; }
  .mobile-menu .search input { flex: 1; width: auto; }
  .hud .wrap { gap: 18px; font-size: 1.15rem; }
}

/* ---------- section scaffolding ---------- */
main { display: block; }
.section { padding: 56px 0 24px; }
.sec-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.sec-head .ic-tile { width: 56px; height: 56px; display: grid; place-items: center; background: var(--tile, var(--surface)); color: var(--tile-ink, var(--ink)); box-shadow: 0 -4px 0 var(--line), 0 4px 0 var(--line), -4px 0 0 var(--line), 4px 0 0 var(--line), inset -4px -4px 0 rgba(0,0,0,.18); margin: 4px; }
.sec-head .ic-tile svg { width: 32px; height: 32px; }
.eyebrow { display: block; font-family: var(--f-display); font-size: 0.8125rem; line-height: 1.6; letter-spacing: 0.04em; color: var(--ink-dim); text-transform: uppercase; margin-bottom: 8px; }
.sec-title { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.sec-sub { margin: 4px 0 0; color: var(--ink-dim); }
.sec-head .link-arrow { margin-left: auto; }

.world-ai { --tile: var(--w-ai-fill); --tile-ink: var(--w-ai); --world: var(--w-ai); --world-fill: var(--w-ai-fill); }
.world-garden { --tile: var(--w-garden-fill); --tile-ink: var(--w-garden); --world: var(--w-garden); --world-fill: var(--w-garden-fill); }
.world-tools { --tile: var(--w-tools-fill); --tile-ink: var(--w-tools); --world: var(--w-tools); --world-fill: var(--w-tools-fill); }
.world-proj { --tile: var(--w-proj-fill); --tile-ink: var(--w-proj); --world: var(--w-proj); --world-fill: var(--w-proj-fill); }
.world-pat { --tile: var(--w-pat-fill); --tile-ink: var(--w-pat); --world: var(--w-pat); --world-fill: var(--w-pat-fill); }

/* page hero (inner pages) */
.page-hero { padding: 48px 0 16px; }
.page-hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.page-hero h1 { font-family: var(--f-display); font-size: clamp(1.6rem, 4vw, 2.75rem); line-height: 1.35; margin-bottom: 20px; font-weight: 400; }
.page-hero .lede { font-size: 1.15rem; max-width: 60ch; }
.hero-art { overflow: hidden; }
.hero-art img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
@media (max-width: 860px) { .page-hero-grid { grid-template-columns: 1fr; } }

/* ---------- title screen (home) ---------- */
.title-screen { position: relative; overflow: hidden; background: #29366f; color: var(--sw-white); border-bottom: 4px solid var(--line); isolation: isolate; }
.title-screen::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: linear-gradient(180deg, #1a1c2c 0%, #1a1c2c 18%, #29366f 18%, #29366f 38%, #3b5dc9 38%, #3b5dc9 56%, #5d275d 56%, #5d275d 70%, #b13e53 70%, #b13e53 78%, #ef7d57 78%);
  background-size: 100% 100%;
}
:root:not([data-theme="dark"]) .title-screen::before {
  background: linear-gradient(180deg, #41a6f6 0%, #41a6f6 30%, #73eff7 30%, #73eff7 52%, #ffcd75 52%, #ffcd75 66%, #ef7d57 66%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .title-screen::before {
    background: linear-gradient(180deg, #1a1c2c 0%, #1a1c2c 18%, #29366f 18%, #29366f 38%, #3b5dc9 38%, #3b5dc9 56%, #5d275d 56%, #5d275d 70%, #b13e53 70%, #b13e53 78%, #ef7d57 78%);
  }
}
.title-screen .stars { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }
.title-screen .mountains { position: absolute; left: 0; right: 0; bottom: 0; z-index: -1; width: 100%; height: 55%; }
.title-screen .hero-bg-img { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.ts-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 48px; align-items: center; padding: 64px 0 88px; }
.portrait-frame { background: var(--sw-night); padding: 12px; max-width: 460px; justify-self: center; width: 100%; }
.portrait { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: #333c57; }
.portrait img, .portrait canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 30% 30%; }
.portrait canvas { image-rendering: pixelated; }
.portrait[data-mode="hd"] canvas { display: none; }
.portrait-cap { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 2px 0; font-family: var(--f-term); font-size: 1.3rem; color: var(--sw-white); }
.portrait-cap .btn { margin: 4px 4px 4px auto; }
.dialog {
  background: var(--surface); color: var(--ink); padding: 32px;
}
.ts-kicker { font-family: var(--f-display); font-size: 0.8125rem; color: var(--link); letter-spacing: 0.05em; margin-bottom: 18px; line-height: 1.8; }
.ts-title { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.45rem, 2.7vw, 2.3rem); line-height: 1.45; margin-bottom: 20px; }
.ts-sub { font-size: 1.1rem; color: var(--ink); max-width: 56ch; }
.stats-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 22px 0 26px; }
.stat { background: var(--surface-2); padding: 12px 12px 10px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.08); }
.stat b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 1.15rem; color: var(--link); line-height: 1.4; }
.stat span { font-family: var(--f-term); font-size: 1.3rem; line-height: 1.1; color: var(--ink-dim); }
.menu-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.press-start { font-family: var(--f-display); font-size: 0.8125rem; color: var(--sw-gold); text-align: center; margin: 0; position: absolute; left: 0; right: 0; bottom: 22px; text-shadow: 3px 3px 0 #1a1c2c; letter-spacing: 0.08em; }
.blink { animation: blink 1.1s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.bob { animation: bob 1.2s steps(2) infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
@media (max-width: 900px) {
  .ts-grid { grid-template-columns: 1fr; gap: 28px; padding: 32px 0 72px; }
  .portrait-frame { max-width: 360px; }
  .dialog { padding: 22px 18px; }
}
@media (max-width: 420px) {
  .stats-row { gap: 8px; }
  .stat { padding: 10px 8px 8px; }
  .stat b { font-size: 0.95rem; }
  .stat span { font-size: 1.15rem; }
}

/* ---------- cards ---------- */
.grid { display: grid; gap: 28px; }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1024px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g-4, .g-3, .g-2 { grid-template-columns: 1fr; } }

.card { display: flex; flex-direction: column; min-width: 0; }
.card .thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--world-fill, var(--surface-2)); border-bottom: 4px solid var(--line); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,.07) 0 2px, transparent 2px 4px); pointer-events: none; }
.card .thumb .lvl { position: absolute; left: 10px; top: 10px; z-index: 1; background: var(--sw-night); color: var(--sw-gold); font-family: var(--f-display); font-size: 0.8125rem; padding: 6px 8px 5px; line-height: 1.3; }
.card .thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--world, var(--ink)); }
.card .thumb .ph svg { width: 72px; height: 72px; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; gap: 8px; }
.card-meta { font-family: var(--f-term); font-size: 1.3rem; line-height: 1.1; color: var(--ink-dim); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.card h3 { font-size: 1.35rem; line-height: 1.25; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card h3 a:focus-visible { outline: none; }
.card:has(h3 a:focus-visible) { outline: 3px solid var(--focus); outline-offset: 8px; }
.card:hover { transform: translate(-2px, -2px); }
.card { transition: transform 120ms steps(2); }
.card p { margin: 0; color: var(--ink-dim); font-size: 0.95rem; }
.card .more { margin-top: auto; padding-top: 6px; font-family: var(--f-head); font-weight: 700; color: var(--link); text-transform: uppercase; font-size: 0.95rem; letter-spacing: 0.05em; }
.card .more::after { content: " ▸"; }

.chip, .tag {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 10px;
  font-family: var(--f-term); font-size: 1.2rem; line-height: 1; text-decoration: none;
  background: var(--world-fill, var(--surface-2)); color: var(--world, var(--ink));
  box-shadow: 0 -2px 0 var(--line), 0 2px 0 var(--line), -2px 0 0 var(--line), 2px 0 0 var(--line);
  margin: 2px;
}
a.tag:hover { background: var(--ink); color: var(--surface); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-block; font-family: var(--f-display); font-size: 0.8125rem; line-height: 1.3; padding: 5px 7px 4px;
  background: var(--sw-gold); color: #1a1c2c; box-shadow: 0 0 0 2px var(--line);
}
.badge-new { background: var(--sw-lime); }
.badge-lock { background: var(--sw-slate); color: #fff; }

/* save-file shelf */
.saves { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.save { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; padding: 16px; align-items: start; }
.save .save-img { aspect-ratio: 1; overflow: hidden; border: 4px solid var(--line); background: var(--surface-2); }
.save .save-img img { width: 100%; height: 100%; object-fit: cover; }
.save .slot { font-family: var(--f-display); font-size: 0.8125rem; color: var(--link); margin-bottom: 6px; line-height: 1.5; }
.save h3 { font-size: 1.2rem; }
.save h3 a { color: var(--ink); text-decoration: none; }
.save h3 a::after { content: ""; position: absolute; inset: 0; }
.save p { margin: 6px 0 0; font-size: 0.95rem; color: var(--ink-dim); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.save .xp { margin-top: 10px; height: 12px; background: var(--surface-2); box-shadow: 0 0 0 2px var(--line); position: relative; }
.save .xp i { position: absolute; inset: 0 auto 0 0; background: var(--sw-green); box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
@media (max-width: 1024px) { .saves { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .save { grid-template-columns: 80px minmax(0, 1fr); } }

/* power-up items */
.item { padding: 22px 20px; display: flex; flex-direction: column; gap: 10px; }
.item .item-ic { width: 64px; height: 64px; display: grid; place-items: center; background: var(--world-fill); color: var(--world); box-shadow: 0 0 0 4px var(--line); margin: 4px 4px 8px; }
.item .item-ic svg { width: 40px; height: 40px; }
.item h3 { font-size: 1.25rem; }
.item h3 a { color: var(--ink); text-decoration: none; }
.item h3 a::after { content: ""; position: absolute; inset: 0; }
.item p { margin: 0; color: var(--ink-dim); font-size: 0.95rem; }
.item .type { position: absolute; right: 14px; top: 16px; }

/* list rows (level select) */
.levels { list-style: none; margin: 0; padding: 0; }
.levels li { border-bottom: 4px dotted var(--surface-2); }
.levels li:last-child { border-bottom: 0; }
.level { position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 16px 20px; text-decoration: none; color: var(--ink); }
.level:hover { background: var(--surface-2); }
.level:hover .lvn::before { content: "▶ "; }
.level .lvn { font-family: var(--f-display); font-size: 0.8125rem; color: var(--link); padding-top: 6px; line-height: 1.5; }
.level strong { display: block; font-family: var(--f-head); font-weight: 600; font-size: 1.25rem; line-height: 1.3; }
.level span.d { display: block; color: var(--ink-dim); font-size: 0.95rem; margin-top: 4px; }
.level time { font-family: var(--f-term); font-size: 1.3rem; color: var(--ink-dim); white-space: nowrap; }
@media (max-width: 640px) {
  .level { grid-template-columns: 56px minmax(0, 1fr); padding: 14px 12px; }
  .level time { grid-column: 2; }
}

/* dialog box with NPC */
.npc { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 20px; align-items: center; padding: 22px; }
.npc .face { width: 96px; height: 96px; background: var(--sw-cyan); box-shadow: 0 0 0 4px var(--line); }
.npc .face svg { width: 100%; height: 100%; }
.npc .speaker { font-family: var(--f-display); font-size: 0.8125rem; color: var(--link); margin-bottom: 8px; line-height: 1.5; }
.npc p { font-size: 1.1rem; margin: 0 0 12px; }
.npc .next { font-size: 1rem; color: var(--link); }
@media (max-width: 560px) { .npc { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 16px; } .npc .face { width: 64px; height: 64px; } }

/* bottom trio */
.party a { display: flex; align-items: center; gap: 12px; min-height: 48px; color: var(--ink); text-decoration: none; font-family: var(--f-head); font-weight: 600; font-size: 1.15rem; padding: 4px 6px; }
.party a:hover { background: var(--surface-2); }
.party a:hover::after { content: "◀"; margin-left: auto; font-size: 0.8rem; color: var(--link); }
.party .sprite { width: 36px; height: 36px; display: grid; place-items: center; font-family: var(--f-display); font-size: 0.8125rem; color: #fff; box-shadow: 0 0 0 3px var(--line); flex: none; }
.party small { display: block; font-family: var(--f-term); font-size: 1.2rem; color: var(--ink-dim); font-weight: 400; line-height: 1; }
.dark-card { background: var(--sw-night); color: var(--sw-white); }
.dark-card h3, .dark-card p { color: var(--sw-white); }
.dark-card .bar { background: var(--sw-plum); color: #fff; }

/* ---------- footer ---------- */
.site-foot { margin-top: 72px; background: var(--sw-night); color: var(--sw-white); border-top: 4px solid #000; position: relative; }
.site-foot::before { content: ""; position: absolute; left: 0; right: 0; top: -20px; height: 16px; background:
  linear-gradient(90deg, var(--sw-green) 0 50%, #257179 50% 100%); background-size: 32px 16px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); border-top: 4px solid #000; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.4fr; gap: 36px; padding: 48px 0 32px; }
.site-foot h2 { font-family: var(--f-display); font-weight: 400; font-size: 0.8125rem; color: var(--sw-gold); margin-bottom: 14px; line-height: 1.6; }
.site-foot a { color: var(--sw-white); text-decoration: none; }
.site-foot a:hover { color: var(--sw-gold); text-decoration: underline; }
.site-foot ul { list-style: none; padding: 0; margin: 0; }
.site-foot li a { display: inline-flex; min-height: 36px; align-items: center; font-family: var(--f-head); font-size: 1.1rem; }
.site-foot p { color: #cfd9e2; }
.foot-form { display: flex; gap: 8px; flex-wrap: wrap; }
.foot-form input { flex: 1 1 160px; min-height: 48px; margin: 4px; padding: 6px 12px; border: 0; font-family: var(--f-term); font-size: 1.35rem; background: #f4f4f4; color: #1a1c2c; box-shadow: 0 0 0 4px #000, inset 3px 3px 0 #94b0c2; }
.foot-form .btn { --line: #000; }
.form-msg { font-family: var(--f-term); font-size: 1.3rem; min-height: 1.4em; margin: 8px 0 0; color: var(--sw-lime); }
.form-msg.is-error { color: #ffb3a8; }
.foot-bottom { border-top: 4px dotted #333c57; padding: 18px 0 28px; display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; font-family: var(--f-term); font-size: 1.3rem; color: #cfd9e2; }
@media (max-width: 900px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .foot-grid { grid-template-columns: 1fr; } }

/* ---------- jump bar / pills / filters ---------- */
.jumpbar { position: sticky; top: 72px; z-index: 20; background: var(--bg); padding: 12px 0; border-bottom: 4px solid var(--line); }
.jumpbar .wrap { display: flex; gap: 8px; align-items: center; overflow-x: auto; scrollbar-width: thin; padding: 4px; }
.jumpbar .lbl { font-family: var(--f-display); font-size: 0.8125rem; margin-right: 6px; white-space: nowrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 14px; margin: 3px;
  font-family: var(--f-head); font-weight: 600; font-size: 1.05rem; white-space: nowrap; text-decoration: none; cursor: pointer; border: 0;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 -3px 0 var(--line), 0 3px 0 var(--line), -3px 0 0 var(--line), 3px 0 0 var(--line);
}
.pill:hover { background: var(--surface-2); }
.pill[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.pill[aria-pressed="true"]::before { content: "▶"; font-size: 0.7rem; }
.pill .n { font-family: var(--f-term); font-size: 1.2rem; opacity: 0.85; }

/* ---------- landscape project cards ---------- */
.quest { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0; margin-bottom: 36px; }
.quest:nth-child(even) .quest-img { order: 2; border-left: 4px solid var(--line); border-right: 0; }
.quest-img { border-right: 4px solid var(--line); background: var(--sw-night); min-height: 260px; position: relative; overflow: hidden; }
.quest-img img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.quest-body { padding: 26px 28px; display: flex; flex-direction: column; gap: 12px; }
.quest-body h3 { font-size: 1.6rem; }
.quest-body p { margin: 0; }
.statline { display: flex; flex-wrap: wrap; gap: 8px 20px; font-family: var(--f-term); font-size: 1.3rem; color: var(--ink-dim); }
.statline b { color: var(--coin); font-weight: 400; }
@media (max-width: 800px) {
  .quest { grid-template-columns: 1fr; }
  .quest-img, .quest:nth-child(even) .quest-img { order: 0; border: 0; border-bottom: 4px solid var(--line); min-height: 0; aspect-ratio: 16 / 9; }
}

.legend-item { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.legend-item .li-img { border-right: 4px solid var(--line); background: #29366f; }
.legend-item .li-img img { width: 100%; height: 100%; object-fit: cover; }
.legend-item .li-body { padding: 30px; display: flex; flex-direction: column; gap: 14px; }
.legend-item h3 { font-size: 2rem; }
.meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.meter { background: var(--surface-2); padding: 12px; text-align: center; }
.meter b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 1.4rem; color: var(--link); line-height: 1.5; }
.meter span { font-family: var(--f-term); font-size: 1.3rem; color: var(--ink-dim); }
@media (max-width: 860px) { .legend-item { grid-template-columns: 1fr; } .legend-item .li-img { border-right: 0; border-bottom: 4px solid var(--line); aspect-ratio: 16/9; } }

.compact { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.compact h3 { font-size: 1.2rem; }
.compact h3 a { color: var(--ink); text-decoration: none; }
.compact h3 a::after { content: ""; position: absolute; inset: 0; }
.compact p { margin: 0; color: var(--ink-dim); font-size: 0.95rem; }
.stars { font-family: var(--f-term); font-size: 1.3rem; color: var(--coin); display: inline-flex; gap: 6px; align-items: center; }

/* ---------- about: character sheet ---------- */
.sheet { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 0; }
.sheet-portrait { background: var(--sw-night); padding: 16px; border-right: 4px solid var(--line); }
.sheet-portrait .portrait { aspect-ratio: 1; }
.sheet-portrait .portrait img, .sheet-portrait .portrait canvas { object-position: center; }
.sheet-body { padding: 28px 32px; }
.sheet-body h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.5rem, 3.2vw, 2.4rem); line-height: 1.4; margin-bottom: 10px; }
.cls { font-family: var(--f-head); font-weight: 600; font-size: 1.2rem; color: var(--link); margin-bottom: 18px; }
.attr { display: grid; grid-template-columns: 150px minmax(0, 1fr) 70px; align-items: center; gap: 12px; margin: 10px 0; font-family: var(--f-term); font-size: 1.35rem; }
.attr .track { height: 16px; background: var(--surface-2); box-shadow: 0 0 0 3px var(--line); position: relative; }
.attr .track i { position: absolute; inset: 0 auto 0 0; background: var(--fill, var(--sw-green)); box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); }
.attr .track i::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 12px, rgba(0,0,0,.25) 12px 14px); }
.attr b { font-weight: 400; color: var(--coin); text-align: right; }
@media (max-width: 860px) {
  .sheet { grid-template-columns: 1fr; }
  .sheet-portrait { border-right: 0; border-bottom: 4px solid var(--line); }
  .sheet-portrait .portrait { max-width: 320px; margin: 0 auto; }
  .sheet-body { padding: 22px 18px; }
  .attr { grid-template-columns: 110px minmax(0, 1fr) 56px; font-size: 1.2rem; }
}

.careerbar { display: flex; overflow: hidden; margin: 18px 0 28px; box-shadow: 0 0 0 4px var(--line); }
.careerbar span { flex: var(--y) 1 0; min-width: 0; padding: 10px 8px; font-family: var(--f-term); font-size: 1.15rem; line-height: 1.1; color: #1a1c2c; border-right: 4px solid var(--line); overflow: hidden; }
.careerbar span:last-child { border-right: 0; }
.careerbar span small { display: block; font-size: 1rem; opacity: .85; }
@media (max-width: 760px) { .careerbar { flex-wrap: wrap; } .careerbar span { flex: 1 1 45%; border-bottom: 4px solid var(--line); } }

.quests { list-style: none; padding: 0; margin: 0; display: grid; gap: 24px; }
.quest-log { padding: 22px 24px; display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; }
.quest-log .period { font-family: var(--f-display); font-size: 0.8125rem; color: var(--link); line-height: 1.7; }
.quest-log h3 { font-size: 1.35rem; margin-bottom: 6px; }
.quest-log ul { margin: 10px 0 0; padding: 0; list-style: none; }
.quest-log li { padding-left: 22px; position: relative; margin: 6px 0; }
.quest-log li::before { content: ""; position: absolute; left: 2px; top: 0.55em; width: 8px; height: 8px; background: var(--sw-gold); box-shadow: 0 0 0 2px var(--line); }
@media (max-width: 700px) { .quest-log { grid-template-columns: 1fr; gap: 8px; } }

details.expander > summary { list-style: none; cursor: pointer; }
details.expander > summary::-webkit-details-marker { display: none; }
details.expander[open] > summary .when-closed { display: none; }
details.expander:not([open]) > summary .when-open { display: none; }

.scrolls { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; counter-reset: sc; }
.scrolls li { counter-increment: sc; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; align-items: center; background: #f3e1b8; color: #1a1c2c; padding: 16px 20px; font-family: var(--f-head); font-size: 1.3rem; line-height: 1.35;
  box-shadow: 0 -4px 0 #6e4a00, 0 4px 0 #6e4a00, -4px 0 0 #6e4a00, 4px 0 0 #6e4a00, inset 0 -6px 0 rgba(110,74,0,.18); margin: 4px; }
.scrolls li::before { content: counter(sc, upper-roman); font-family: var(--f-display); font-size: 0.9rem; color: #7a1f33; }

.skill-tree { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.skill-group { padding: 0; }
.skill-group .inner { padding: 18px 20px 22px; }
.skill-group p { color: var(--ink-dim); margin-bottom: 14px; }
.slots { display: flex; flex-wrap: wrap; gap: 10px; }
.slot-item { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-2); font-family: var(--f-head); font-size: 1.05rem; box-shadow: 0 0 0 3px var(--line), inset -3px -3px 0 rgba(0,0,0,.12); margin: 3px; }
.slot-item::before { content: ""; width: 8px; height: 8px; background: var(--sw-lime); box-shadow: 0 0 0 2px var(--line); }
@media (max-width: 760px) { .skill-tree { grid-template-columns: 1fr; } }

.side-quests { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: stretch; }
.side-quests .photo { overflow: hidden; }
.side-quests .photo img { width: 100%; height: 100%; object-fit: cover; min-height: 320px; }
@media (max-width: 760px) { .side-quests { grid-template-columns: 1fr; } }

/* ---------- article ---------- */
.xpbar { position: fixed; left: 0; right: 0; top: 0; height: 10px; z-index: 60; background: var(--sw-night); border-bottom: 2px solid #000; }
.xpbar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--sw-lime) 0 12px, var(--sw-green) 12px 16px); }
.xpbar output { position: fixed; right: 12px; bottom: 12px; z-index: 61; font-family: var(--f-term); font-size: 1.2rem; background: var(--sw-night); color: var(--sw-lime); padding: 0 8px; box-shadow: 0 0 0 2px #000; }
.art-hero { position: relative; background: var(--sw-night); color: var(--sw-white); border-bottom: 4px solid var(--line); overflow: hidden; isolation: isolate; }
.art-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; opacity: 0.3; filter: grayscale(0.4); }
.art-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background:
  linear-gradient(0deg, #1a1c2c 0 22%, rgba(26,28,44,.85) 22% 40%, rgba(26,28,44,.6) 40% 60%, rgba(26,28,44,.35) 60%),
  repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 2px, transparent 2px 4px); }
.art-hero .wrap { padding: 96px 0 44px; }
.crumb { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-head); font-weight: 600; font-size: 1.1rem; color: var(--sw-lime); text-decoration: none; margin-bottom: 14px; }
.crumb:hover { text-decoration: underline; }
.art-hero h1 { font-family: var(--f-display); font-weight: 400; color: #fff; font-size: clamp(1.45rem, 3.4vw, 2.6rem); line-height: 1.45; max-width: 26ch; margin: 12px 0 18px; text-shadow: 4px 4px 0 #000; }
.art-hero .desc { font-size: 1.15rem; max-width: 60ch; color: #e8eef3; }
.art-hero .meta { display: flex; flex-wrap: wrap; gap: 8px 22px; font-family: var(--f-term); font-size: 1.4rem; color: var(--sw-gold); margin-top: 8px; }
.art-hero .meta a { color: var(--sw-cyan); }
.art-hero .tags .tag { --world-fill: #1f4d38; --world: #a7f070; --line: #000; }

.art-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 48px; align-items: start; padding-top: 44px; }
.toc-map { position: sticky; top: 100px; }
.toc-map .bar { font-size: 0.95rem; }
.toc-map ol { list-style: none; margin: 0; padding: 12px 8px 14px; counter-reset: t; }
.toc-map li { counter-increment: t; }
.toc-map a { display: grid; grid-template-columns: 36px 1fr; gap: 4px; padding: 6px 8px; min-height: 40px; align-items: center; color: var(--ink); text-decoration: none; font-family: var(--f-head); font-size: 1.05rem; line-height: 1.25; }
.toc-map a::before { content: "1-" counter(t); font-family: var(--f-term); font-size: 1.2rem; color: var(--ink-dim); }
.toc-map a:hover { background: var(--surface-2); }
.toc-map a[aria-current="true"] { background: var(--ink); color: var(--surface); }
.toc-map a[aria-current="true"]::before { color: var(--sw-gold); content: "▶"; }
.toc-mobile { display: none; }
@media (max-width: 1100px) {
  .art-layout { grid-template-columns: minmax(0, 1fr); }
  .toc-map { display: none; }
  .toc-mobile { display: block; margin-bottom: 28px; }
  .toc-mobile summary { min-height: 48px; }
  .toc-mobile ol { padding: 8px 16px 16px 40px; margin: 0; }
  .toc-mobile li { margin: 6px 0; font-family: var(--f-head); font-size: 1.1rem; }
}

.prose { max-width: 720px; font-size: 1.125rem; line-height: 1.75; }
.prose > * + * { margin-top: 1.1em; }
.prose p { margin: 0; }
.prose h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.6; margin-top: 2.4em; padding-top: 16px; border-top: 4px dotted var(--surface-2); display: flex; gap: 14px; align-items: baseline; }
.prose h2 .stage { font-family: var(--f-term); font-size: 1.35rem; color: var(--link); white-space: nowrap; }
.prose ol, .prose ul { padding-left: 0; list-style: none; counter-reset: li; }
.prose ol li, .prose ul li { position: relative; padding-left: 44px; margin: 8px 0; }
.prose ol li { counter-increment: li; }
.prose ol li::before { content: counter(li); position: absolute; left: 0; top: 0.15em; width: 28px; height: 28px; display: grid; place-items: center; font-family: var(--f-display); font-size: 0.8125rem; background: var(--sw-gold); color: #1a1c2c; box-shadow: 0 0 0 2px var(--line); }
.prose :not(pre) > code { background: var(--surface-2); padding: 1px 6px; font-size: 0.95em; box-shadow: 0 0 0 2px var(--surface-2); }
.prose em { font-style: italic; }

.callout { position: relative; padding: 18px 20px 18px 20px; font-size: 1.05rem; line-height: 1.65; }
.callout .who { font-family: var(--f-display); font-size: 0.8125rem; line-height: 1.6; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.callout .who svg { width: 22px; height: 22px; }
.callout p { margin: 0; }
.callout-item { background: #fff4d6; color: #1a1c2c; }
.callout-item .who { color: #6e4a00; }
.callout-item a { color: #7a1f33; }
.callout-item code { background: #ffe7b3 !important; box-shadow: 0 0 0 2px #ffe7b3 !important; }
:root[data-theme="dark"] .callout-item { background: #3e3320; color: #f4f4f4; }
:root[data-theme="dark"] .callout-item .who { color: #ffcd75; }
:root[data-theme="dark"] .callout-item a { color: #73eff7; }
:root[data-theme="dark"] .callout-item code { background: #5a4012 !important; box-shadow: 0 0 0 2px #5a4012 !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .callout-item { background: #3e3320; color: #f4f4f4; }
  :root:not([data-theme="light"]) .callout-item .who { color: #ffcd75; }
  :root:not([data-theme="light"]) .callout-item a { color: #73eff7; }
  :root:not([data-theme="light"]) .callout-item code { background: #5a4012 !important; box-shadow: 0 0 0 2px #5a4012 !important; }
}
.callout-note { background: var(--surface); }
.callout-note .who { color: var(--ink-dim); }
.callout-why { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; background: var(--surface); }
.callout-why .face { width: 64px; height: 64px; background: var(--sw-cyan); box-shadow: 0 0 0 4px var(--line); }
.callout-why .who { color: var(--w-garden); }
.callout-why .caret { position: absolute; right: 16px; bottom: 10px; color: var(--link); font-size: 0.9rem; }
.callout-quest { background: var(--w-ai-fill); color: var(--ink); }
.callout-quest .who { color: var(--w-ai); }

.cart { margin-left: 0; margin-right: 0; }
.prose .cart { width: min(820px, calc(100vw - 48px)); max-width: none; }
@media (max-width: 1100px) { .prose .cart { width: auto; } }
.cart-head { display: flex; align-items: center; gap: 12px; background: #333c57; color: #f4f4f4; padding: 6px 8px 6px 14px; border-bottom: 4px solid #000; }
.cart-head .lang { font-family: var(--f-display); font-size: 0.8125rem; background: var(--sw-sky); color: #1a1c2c; padding: 4px 6px 3px; }
.cart-head .lights { display: flex; gap: 6px; }
.cart-head .lights i { width: 10px; height: 10px; display: block; }
.cart-head .copy { margin-left: auto; min-height: 36px; padding: 0 12px; background: #1a1c2c; color: #f4f4f4; border: 0; font-family: var(--f-head); font-weight: 600; font-size: 0.95rem; cursor: pointer; box-shadow: inset -3px -3px 0 rgba(0,0,0,.4), inset 3px 3px 0 rgba(255,255,255,.12); }
.cart-head .copy:hover { color: var(--sw-gold); }
.cart pre { margin: 0; padding: 18px 20px; overflow-x: auto; background: var(--code-bg); color: var(--code-ink); font-size: 0.95rem; line-height: 1.6; tab-size: 2; }
.cart { --line: #000; background: var(--code-bg); }
.tok-k { color: #ff9fb2; }
.tok-s { color: #a7f070; }
.tok-c { color: #a9b8c6; font-style: italic; }
.tok-t { color: #73eff7; }
.tok-n { color: #ffcd75; }

.share-zone { margin-top: 56px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 32px; }
.save-point { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 18px; padding: 22px; }
.save-point .crystal svg { width: 72px; height: 72px; }
.save-point h3 { font-size: 1.4rem; margin-bottom: 6px; }
.save-point form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.save-point input[type="email"] { flex: 1 1 200px; min-height: 48px; margin: 4px; padding: 6px 12px; border: 0; font-family: var(--f-term); font-size: 1.35rem; background: var(--surface-2); color: var(--ink); box-shadow: 0 0 0 4px var(--line); }
.save-point .check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.95rem; color: var(--ink-dim); width: 100%; }
.save-point .check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--action); }
.save-point .form-msg { color: var(--w-garden); }
.save-point .form-msg.is-error { color: var(--link); }
@media (max-width: 900px) { .share-zone { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .save-point { grid-template-columns: 1fr; } .save-point .crystal svg { width: 56px; height: 56px; } }

/* ---------- patterns ---------- */
.three-ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.three-ways > div { padding: 20px 22px; border-right: 4px dotted var(--surface-2); }
.three-ways > div:last-child { border-right: 0; }
.three-ways h3 { font-size: 1.3rem; display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.three-ways h3 svg { width: 24px; height: 24px; color: var(--link); }
.three-ways p { margin: 0; color: var(--ink-dim); font-size: 0.95rem; }
.three-foot { padding: 16px 22px 20px; border-top: 4px solid var(--line); background: var(--surface-2); font-size: 0.95rem; }
@media (max-width: 800px) { .three-ways { grid-template-columns: 1fr; } .three-ways > div { border-right: 0; border-bottom: 4px dotted var(--surface-2); } }

.dex-controls { display: grid; gap: 16px; margin: 28px 0 24px; }
.dex-search { display: flex; }
.dex-search input { flex: 1; min-height: 56px; margin: 4px; padding: 8px 16px; border: 0; background: var(--surface); color: var(--ink); font-family: var(--f-body); font-size: 1rem; box-shadow: 0 0 0 4px var(--line), inset 4px 4px 0 var(--surface-2); }
.dex-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.dex-row .count { font-family: var(--f-term); font-size: 1.45rem; margin-right: auto; }
.dex-row select { min-height: 44px; margin: 3px; padding: 4px 10px; border: 0; background: var(--surface); color: var(--ink); font-family: var(--f-head); font-size: 1.05rem; box-shadow: 0 0 0 3px var(--line); }
.dex-row label { font-family: var(--f-head); font-size: 1.05rem; }
.clear-btn { background: none; border: 0; color: var(--link); font-family: var(--f-head); font-weight: 600; font-size: 1.05rem; text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 8px; }
.dex-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
@media (max-width: 1024px) { .dex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .dex-grid { grid-template-columns: 1fr; } }
.dex-card .thumb { aspect-ratio: auto; height: 168px; display: grid; place-items: center; background:
  linear-gradient(45deg, var(--world-fill) 25%, transparent 25% 75%, var(--world-fill) 75%) 0 0 / 24px 24px,
  linear-gradient(45deg, var(--world-fill) 25%, transparent 25% 75%, var(--world-fill) 75%) 12px 12px / 24px 24px,
  var(--surface-2); }
.dex-card .thumb::after { display: none; }
.dex-card .dexno { position: absolute; left: 10px; top: 10px; background: var(--sw-night); color: var(--sw-gold); font-family: var(--f-display); font-size: 0.8125rem; padding: 6px 8px 5px; }
.dex-card .badge { position: absolute; right: 10px; top: 10px; }
.dex-card .spr { width: 88px; height: 88px; color: var(--world); background: var(--surface); box-shadow: 0 0 0 4px var(--line), 6px 6px 0 4px var(--drop); display: grid; place-items: center; }
.dex-card .spr svg { width: 56px; height: 56px; }
.dex-card .good { font-size: 0.95rem; color: var(--ink); margin: 0; }
.dex-card .good b { font-family: var(--f-head); }
.empty { text-align: center; padding: 48px 24px; }
.empty h2 { font-size: 1.6rem; margin: 16px 0 8px; }
.empty svg { width: 80px; height: 80px; color: var(--ink-dim); }

.pd-head { padding: 36px 0 12px; }
.back { font-family: var(--f-head); font-weight: 600; font-size: 1.1rem; text-decoration: none; display: inline-flex; min-height: 44px; align-items: center; }
.back:hover { text-decoration: underline; }
.pd-head h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.5rem, 3.5vw, 2.5rem); line-height: 1.4; margin: 14px 0 18px; }
.pd-head .lede { font-size: 1.15rem; max-width: 70ch; }
.usecases { columns: 2; column-gap: 32px; padding: 0; list-style: none; margin: 12px 0 20px; }
.usecases li { break-inside: avoid; padding: 6px 0 6px 26px; position: relative; }
.usecases li::before { content: "▶"; position: absolute; left: 0; color: var(--link); font-size: 0.75rem; top: 0.75em; }
@media (max-width: 600px) { .usecases { columns: 1; } }
.panes { margin-top: 28px; }
.pane-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bar); border-bottom: 4px solid var(--line); }
.pane-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.pane-tabs [role="tab"] { min-height: 44px; padding: 4px 14px; border: 0; cursor: pointer; background: transparent; color: var(--bar-ink); font-family: var(--f-head); font-weight: 600; font-size: 1.05rem; }
.pane-tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 -3px 0 var(--line), 3px 0 0 var(--line), -3px 0 0 var(--line); }
.pane-tabs [role="tab"][aria-selected="true"]::before { content: "▶ "; font-size: 0.7rem; }
.pane-tabs [role="tab"]:hover { color: var(--sw-gold); }
.pane-tabs [role="tab"][aria-selected="true"]:hover { color: var(--ink); }
.pane-actions { margin-left: auto; display: flex; gap: 8px; }
.pane-actions button { min-height: 44px; padding: 4px 14px; border: 0; cursor: pointer; background: var(--sw-gold); color: #1a1c2c; font-family: var(--f-head); font-weight: 700; font-size: 1rem; box-shadow: inset -3px -3px 0 rgba(0,0,0,.25), 0 0 0 3px var(--line); }
.pane-actions button[hidden] { display: none; }
.pane { padding: 24px; }
.pane[hidden] { display: none; }
.pane pre { margin: 0; background: var(--code-bg); color: var(--code-ink); padding: 18px; overflow-x: auto; font-size: 0.95rem; line-height: 1.6; }
.pane .note { font-size: 0.95rem; color: var(--ink-dim); margin-bottom: 14px; }
.prompt-text { max-width: 72ch; font-size: 1.05rem; }

/* the demo pattern itself: hairline stat strip */
.stage { background: var(--bg); padding: 24px; box-shadow: inset 0 0 0 2px var(--surface-2); }
.stage .cap { font-size: 0.95rem; color: var(--ink-dim); margin: 0 0 12px; }
.hss-strip { display: grid; gap: 1px; background: var(--ink-dim); border: 1px solid var(--ink-dim); grid-template-columns: 1fr; margin-bottom: 28px; }
@media (min-width: 21rem) { .hss-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 52rem) { .hss-strip.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 60rem) { .hss-strip.five { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 36rem) and (max-width: 59.99rem) { .hss-strip.five { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.hss-tile { background: var(--surface); padding: 14px 16px; min-width: 0; text-align: left; border: 0; color: var(--ink); font: inherit; }
.hss-tile .l { display: block; font-family: var(--f-term); font-size: 1.2rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-dim); line-height: 1.1; }
.hss-tile .v { display: block; font-family: var(--f-display); font-size: 1.15rem; line-height: 1.6; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.hss-tile .v.none { color: var(--ink-dim); }
.hss-tile .s { font-size: 0.9rem; color: var(--ink-dim); }
button.hss-tile { cursor: pointer; min-height: 88px; }
button.hss-tile:hover { background: var(--surface-2); }
button.hss-tile[aria-pressed="true"] { background: var(--w-proj-fill); box-shadow: inset 0 -4px 0 var(--w-proj); }
button.hss-tile:focus-visible { outline-offset: -4px; }
.dl-list { list-style: none; margin: 0; padding: 0; background: var(--surface); box-shadow: 0 0 0 1px var(--ink-dim); }
.dl-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--surface-2); flex-wrap: wrap; }
.dl-list li[hidden] { display: none; }
.dl-list .st { font-family: var(--f-term); font-size: 1.25rem; line-height: 1.2; }
.dl-status { font-family: var(--f-term); font-size: 1.3rem; margin: 10px 0 0; }

/* stories */
.chapters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 1100px) { .chapters { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .chapters { grid-template-columns: 1fr; } }
.chapter.locked .thumb { background: repeating-linear-gradient(45deg, var(--surface-2) 0 8px, var(--surface) 8px 16px); }
.chapter.locked h3 { color: var(--ink-dim); }
.notice { display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px; background: #fff4d6; color: #1a1c2c; }
.notice svg { width: 28px; height: 28px; color: #9a3b14; }
.notice strong { font-family: var(--f-head); }

/* tag cloud */
.cloud { display: flex; flex-wrap: wrap; gap: 8px; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .card:hover, .btn:hover { transform: none; }
}

/* CRT mode (Konami code) */
body.crt::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 999; background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 2px, transparent 2px 4px); mix-blend-mode: multiply; }

/* UI pattern library article */
.prose .prose-fig { margin: 28px 0; padding: 0; overflow: hidden; }
.prose .prose-fig img { width: 100%; height: auto; display: block; }
.prose .callout p + p { margin-top: .8em; }
.prose .live-pattern a.btn { white-space: normal; text-decoration: none; height: auto; }
.prose p code { overflow-wrap: anywhere; }
.prose > * + p { margin-top: 1.1em; }
.prose > ul > li::before { content: ""; position: absolute; left: 14px; top: .62em; width: 10px; height: 10px; background: var(--link); box-shadow: 2px 2px 0 var(--ink, #000); }
