:root {
  --spine: #1e3a2c;
  --wheat: #e8d48a;
  --pen: #c43a2a;
  --paper: #f6ecd4;
  --ink: #23180e;
  --mute: #6a5a40;
  --line: #d4c49a;
  --display: "Libre Baskerville", "Noto Serif SC", serif;
  --sans: "Noto Sans SC", "PingFang SC", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.7;
}
body::before {
  content: "";
  position: fixed;
  left: 14px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--pen);
  z-index: 50;
  pointer-events: none;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
.app-link { color: var(--pen); text-decoration: underline; text-underline-offset: 3px; }
button { font-family: inherit; cursor: pointer; }
label { display: block; font-size: 13px; color: var(--mute); }
input[type="range"] { width: min(260px, 100%); accent-color: var(--pen); }
.fiber {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 6;
  opacity: 0.14;
  background-image: url("images/texture.webp");
  background-size: 420px auto;
  mix-blend-mode: multiply;
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 22px; top: 12px; z-index: 80; background: var(--pen); color: #fff; padding: 8px; }
.spine {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 28px 10px 36px;
  background: var(--spine);
  color: var(--wheat);
  border-bottom: 1px solid #0e2018;
}
.brand { font-family: var(--display); font-size: 24px; }
.brand small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #b8c4a8;
  font-weight: 400;
}
.nav-toggle {
  display: none;
  background: var(--pen);
  color: #fff;
  border: 0;
  padding: 7px 12px;
}
.book-links { display: flex; gap: 14px; font-size: 14px; flex-wrap: wrap; align-items: center; }
.book-links a { color: #c8d4bc; }
.book-links a.is-active, .book-links a:hover { color: var(--wheat); }
.book-links .live { background: var(--pen); color: #fff; padding: 6px 12px; font-weight: 700; }
.open {
  position: relative;
  display: block;
  min-height: calc(100vh - 56px);
  background: repeating-linear-gradient(180deg, transparent 0 28px, rgba(196, 58, 42, 0.06) 28px 29px);
}
.open figure { margin: 0; }
.open figure img { width: 100%; height: calc(100vh - 56px); object-fit: cover; display: block; }
.wheat {
  position: absolute;
  left: 40px;
  top: 50%;
  transform: translateY(-50%);
  width: min(520px, 44vw);
  z-index: 2;
  padding: 28px;
  background: rgba(246, 236, 212, 0.94);
  box-shadow: 8px 8px 0 rgba(30, 58, 44, 0.16);
}
.kicker { font-family: var(--mono); letter-spacing: 0.16em; font-size: 11px; color: var(--pen); margin: 0 0 10px; }
h1, h2, h3 { font-family: var(--display); margin: 0 0 10px; line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(28px, 4.2vw, 42px); }
.lead { color: var(--mute); max-width: 36em; }
.leaf {
  margin: 18px 0;
  padding: 16px 18px;
  background: #fff8e0;
  border: 1px solid var(--line);
  box-shadow: 6px 6px 0 rgba(30, 58, 44, 0.12);
  transform: rotate(-0.4deg);
}
.n { font-family: var(--display); font-size: 42px; margin: 0 0 6px; color: var(--pen); }
.n span { font-size: 16px; color: var(--mute); }
.leaf button {
  margin-top: 10px;
  background: var(--pen);
  color: #fff;
  border: 0;
  padding: 8px 14px;
}
.leaf.is-ok { border-color: var(--spine); }
.leaf.is-ok .n { color: var(--spine); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; padding: 10px 16px; border: 1px solid currentColor; }
.btn.green { background: var(--spine); color: var(--wheat); border-color: var(--spine); font-weight: 700; }
.w { width: min(1080px, calc(100% - 56px)); margin: 0 auto; padding: 72px 0; }
.ledger { background: var(--spine); color: var(--wheat); }
.ledger .kicker { color: #e8a090; }
.ledger .app-link { color: #ffc8b8; }
.tri { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 16px; }
.tri article { background: #fff; padding: 16px; border-top: 4px solid var(--pen); }
.ledger .tri article { background: #163024; border-top-color: var(--wheat); }
.tri ul, .io ul, #rules ol { margin: 0; padding-left: 1.1em; }
.steps { padding-left: 1.2em; max-width: 46em; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.pair figure { margin: 0; }
.pair img { width: 100%; height: 220px; object-fit: cover; }
.pair figcaption { font-size: 13px; color: #c8d4bc; margin-top: 8px; }
.io { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.io > div { background: #163024; padding: 16px; }
.url { margin-top: 16px; font-family: var(--mono); font-size: 13px; }
footer { padding: 20px 36px 48px; color: var(--mute); font-size: 13px; }
@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  .spine { flex-wrap: wrap; padding-left: 28px; }
  .book-links { display: none; width: 100%; flex-direction: column; background: #163024; padding: 12px; }
  .book-links.open { display: flex; }
  .open, .tri, .pair, .io { grid-template-columns: 1fr; }
  .open figure img { height: 42vh; }
  .wheat {
    position: static;
    transform: none;
    width: auto;
    margin: 0;
    box-shadow: none;
    padding: 28px 24px 36px 32px;
  }
  body::before { left: 8px; }
}
