/* The fonts are "optional": text is drawn once, in whichever font is ready when the page first paints (the two
   files are preloaded, so that is usually ours). A font that arrives later waits for the next page, so words
   never re-wrap and push the page about after it has been drawn. */
@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dm-sans.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: optional;
}
@font-face {
  font-family: "Cormorant";
  src: url("/assets/fonts/cormorant.woff2") format("woff2");
  font-weight: 300 700;
  font-display: optional;
}

:root {
  /* Brand: sampled from the Kwyst logo and launcher icon. */
  --ink: #0b3d3d;
  --teal: #118993;
  --coral: #ff5f5a;
  --gold: #ffcb35;
  /* The game's Play button (intro screen): red with a dark red edge. */
  --play-red: #d7263d;
  --play-red-dark: #7a1020;
  --cream: #fef8e7;
  /* App surfaces: from the Flutter theme. */
  --paper: #faf5eb;
  --text: #302f29;
  --muted: #5f6359;
  --line: #ddd9cb;
  --card: #fffcf5;
  --hit: #2f7a57;
  --miss: #b0443f;
  /* The game's pixel art: night sky, grass and the yellow road. */
  --night: #082c30;
  --night-2: #0e4747;
  --grass: #5aa14a;
  --grass-dark: #3f7f3a;
  --road: #f3c03c;

  --radius: 10px;
  --edge: 3px solid var(--ink);
  --drop: 0 6px 0 var(--ink);
  --serif: "Cormorant", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 17px/1.6 var(--sans);
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

h1, h2, h3 { color: var(--ink); line-height: 1.08; margin: 0; }
h1, h2 { font-weight: 900; letter-spacing: -0.03em; }
h1 { font-size: clamp(2.2rem, 4.6vw, 3.3rem); }
h1 em { font-style: normal; color: var(--teal); }
h2 { font-size: clamp(1.9rem, 4vw, 2.9rem); margin-bottom: 1.2rem; }
h3 { font-size: 1.12rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 0.4rem; }
p { margin: 0; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.big { font-size: 1.14rem; max-width: 36em; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 30;
  background: var(--ink); color: var(--cream); padding: 10px 16px; border-radius: 10px;
}
.skip:focus { top: 12px; }

/* Small label above a heading, cut like a game tag. */
.tag {
  display: inline-block; margin-bottom: 1rem; padding: 5px 10px 4px;
  background: var(--ink); color: var(--cream);
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  border-radius: 4px;
}
.tag-gold { background: var(--gold); color: var(--ink); }

/* Pixel icons from icons.svg, and the game art, stay crisp when scaled. */
.px { width: 48px; height: 48px; display: block; }
.parade img, .stage-art { image-rendering: pixelated; }

/* Buttons: a chunky key that sinks when pressed. */
.btn, .store-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--gold); color: var(--ink);
  border: var(--edge); border-radius: var(--radius); box-shadow: 0 5px 0 var(--ink);
  padding: 12px 22px; font: 800 1rem/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}
.btn:hover, .store-pill:hover { background: #ffd95e; color: var(--ink); }
.btn:active, .store-pill:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn-small { padding: 9px 18px; font-size: 0.95rem; }

/* Play now: the game's own red Play button, bigger than anything near it. */
.btn-play {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: min(320px, 100%); padding: 18px 48px;
  background: var(--play-red); color: #fff;
  border: 3px solid var(--play-red-dark); border-radius: 14px; box-shadow: 0 7px 0 var(--play-red-dark);
  font: 900 clamp(1.4rem, 2.6vw, 1.75rem)/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--play-red-dark); text-decoration: none; cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}
.btn-play:hover { background: #e3384e; color: #fff; }
.btn-play:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--play-red-dark); }
.btn-play:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.btn-alt { background: var(--cream); }
.btn-alt:hover { background: #fff; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--cream); border-bottom: var(--edge);
}
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand img { width: 124px; }
.top nav { display: flex; gap: 6px; }
.top nav a {
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.95rem;
  padding: 7px 12px; border-radius: 8px;
}
.top nav a:hover { background: var(--gold); }

/* Hero: the title art fills the whole section, and the pitch sits in a dialog
   box over its lower half. The box starts far enough down that the castle and
   wordmark stay clear of it however the art is scaled. */
.hero {
  position: relative; overflow: hidden; background: var(--grass);
  padding-bottom: clamp(40px, 5vw, 64px); border-bottom: var(--edge);
}
.hero-art { position: absolute; inset: 0; display: block; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.dialog {
  background: var(--cream); border: var(--edge); border-radius: var(--radius);
  box-shadow: var(--drop); padding: clamp(22px, 4vw, 40px);
}
.hero-box { position: relative; max-width: 900px; margin: max(470px, 24vw) auto 0; text-align: center; }
.lede { font-size: 1.14rem; margin: 1.1rem auto 1.6rem; max-width: 34em; }
.cta { display: flex; flex-direction: column; align-items: center; gap: 28px; }
.cta-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 22px; }
.soon { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); }
.blink { width: 10px; height: 10px; background: var(--coral); animation: blink 1.2s steps(2, jump-none) infinite; }
@keyframes blink { to { opacity: 0.15; } }

/* Night sections: the Daily and the roadmap. */
.night {
  color: var(--cream);
  background-color: var(--night);
  background-image:
    radial-gradient(rgba(254, 248, 231, 0.55) 1px, transparent 1.5px),
    radial-gradient(rgba(254, 248, 231, 0.3) 1px, transparent 1.5px),
    linear-gradient(var(--night), var(--night-2));
  background-size: 220px 190px, 140px 160px, auto;
  background-position: 30px 20px, 90px 110px, 0 0;
  padding: clamp(56px, 8vw, 104px) 0;
  border-bottom: var(--edge);
}
.night h2, .night h3 { color: var(--cream); }
.night .big { color: rgba(254, 248, 231, 0.88); }

.daily-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: clamp(32px, 6vw, 72px); align-items: center; }
.night h2 { font-size: clamp(2.3rem, 5vw, 3.6rem); }
.stats { list-style: none; margin: 2rem 0 1.6rem; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stats li {
  background: rgba(254, 248, 231, 0.07); border: 2px solid rgba(254, 248, 231, 0.22);
  border-radius: var(--radius); padding: 12px 8px 12px; text-align: center;
}
.stats b { display: block; font-size: 2.3rem; font-weight: 900; line-height: 1; color: var(--gold); }
.stats span { display: block; margin-top: 6px; font-size: 0.78rem; line-height: 1.25; color: rgba(254, 248, 231, 0.8); }
.aside { font-size: 0.9rem; color: rgba(254, 248, 231, 0.65); max-width: 34em; }

/* The sample Kwyst */
.demo { margin: 0; }
.demo-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--gold); color: var(--ink);
  border: 3px solid var(--cream); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0; padding: 12px 18px;
}
.demo-title { font-weight: 900; font-size: 1.08rem; letter-spacing: -0.01em; }
.demo-turn { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.demo-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  background: var(--ink); color: var(--cream);
  border-inline: 3px solid var(--cream); padding: 10px 18px; font-size: 0.9rem; line-height: 1.35;
}
.demo-goal { display: flex; align-items: center; gap: 10px; }
.demo-goal .px { width: 24px; height: 24px; flex: none; }
.demo-goal b { color: var(--gold); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.72rem; margin-right: 4px; }
.hearts { display: inline-flex; gap: 4px; flex: none; }
.hp {
  width: 16px; height: 16px; background: var(--coral); display: inline-block;
  clip-path: polygon(0 25%, 25% 0, 50% 25%, 75% 0, 100% 25%, 100% 50%, 50% 100%, 0 50%);
}
.hp.empty { background: rgba(254, 248, 231, 0.22); }
.demo-body {
  background: var(--card); color: var(--text);
  border: 3px solid var(--cream); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius); padding: 20px 18px 16px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.35);
}
.demo-place, .demo-label {
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 800; color: var(--teal);
}
.demo-place { margin-bottom: 0.4rem; }
.demo-label { margin: 1.1rem 0 0.6rem; color: var(--muted); }
.prose { font-family: var(--serif); font-weight: 500; font-size: 1.36rem; line-height: 1.38; color: var(--text); min-height: 4.1em; }
.choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.choices button, .freeform input, .freeform button { font: inherit; color: inherit; }
.choices button {
  width: 100%; text-align: left; cursor: pointer;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 8px;
  box-shadow: 0 3px 0 var(--ink); padding: 10px 14px; font-size: 0.98rem; font-weight: 600;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}
.choices button:hover:not(:disabled) { background: #fff3c4; }
.choices button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.choices button:disabled { cursor: default; opacity: 0.55; }
.choices button[data-closed="true"] { text-decoration: line-through; box-shadow: none; border-style: dashed; }
.freeform { display: flex; gap: 8px; margin-top: 10px; }
.freeform input {
  flex: 1; min-width: 0; background: #fff; border: 2px dashed #b9b4a1; border-radius: 8px;
  padding: 10px 14px; font-size: 0.98rem;
}
.freeform input::placeholder { color: #7d8076; }
.freeform button {
  border: 2px solid var(--ink); border-radius: 8px; cursor: pointer; padding: 0 16px;
  background: var(--teal); color: #fff; font-weight: 800; box-shadow: 0 3px 0 var(--ink);
}
.freeform button:hover:not(:disabled) { background: var(--ink); }
.freeform :disabled { opacity: 0.55; cursor: default; }
.roll { display: flex; gap: 12px; align-items: center; font-size: 0.95rem; }
.roll:not(:empty) { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--paper); border: 2px solid var(--line); }
.roll strong { display: block; }
.roll em { display: block; font-style: normal; font-size: 0.85rem; color: var(--muted); }
.roll.is-rolling { color: var(--muted); }
.roll.is-hit { border-color: var(--hit); }
.roll.is-hit strong { color: var(--hit); }
.roll.is-miss { border-color: var(--miss); }
.roll.is-miss strong { color: var(--miss); }
.die {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center;
  background: var(--gold); color: var(--ink); font-weight: 900; font-size: 1.1rem;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.is-rolling .die { animation: wobble 0.14s steps(2) infinite; }
/* Before the roll the die shows the number needed and is the button that rolls. */
.roll button.die { border: 0; padding: 0; cursor: pointer; font: inherit; font-weight: 900; font-size: 1.1rem; }
.roll button.die:hover { background: #ffd95e; }
.roll.is-waiting { border-color: var(--ink); }
.demo-danger { margin-top: 0.6rem; padding: 8px 12px; border-radius: 8px; background: #fde8e6; border: 2px solid var(--miss); color: #7a231f; font-size: 0.92rem; font-weight: 700; }
@keyframes wobble { 50% { transform: rotate(12deg) scale(1.08); } }
.result { margin-top: 14px; }
.verdict { border: 2px solid var(--ink); border-radius: 8px; padding: 14px; background: var(--paper); }
.verdict-title { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; color: var(--hit); line-height: 1.1; }
.verdict.is-fallen .verdict-title, .verdict.is-late .verdict-title { color: var(--miss); }
.verdict-line { margin: 4px 0 8px; }
.verdict-score { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.badges { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.badges li { background: var(--gold); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 0.8rem; font-weight: 800; }
.kit { list-style: none; margin: 14px 0 0; padding: 12px 0 0; border-top: 2px dashed var(--line); display: flex; flex-wrap: wrap; gap: 6px; }
.kit li { background: #efe6d2; color: #5b4630; border-radius: 6px; padding: 3px 9px; font-size: 0.8rem; font-weight: 700; }
.kit li.spent { text-decoration: line-through; opacity: 0.5; }
.demo figcaption { margin-top: 16px; font-size: 0.85rem; color: rgba(254, 248, 231, 0.7); text-align: center; }

/* Features */
.features { padding: clamp(56px, 8vw, 104px) 0; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 20px; margin-top: 2rem; }
.card {
  background: var(--card); border: var(--edge); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--drop);
}
.card .px { margin-bottom: 14px; padding: 8px; width: 60px; height: 60px; background: var(--ink); border-radius: 8px; }
.card p { color: var(--muted); font-size: 0.98rem; }

/* How it plays: four stops along the yellow road. */
.how { background: var(--ink); color: var(--cream); padding: clamp(56px, 8vw, 96px) 0; }
.how h2, .how h3 { color: var(--cream); }
.trail { list-style: none; margin: 2.4rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; position: relative; }
.trail::before {
  content: ""; position: absolute; left: 0; right: 0; top: 19px; height: 6px;
  background: repeating-linear-gradient(90deg, var(--road) 0 14px, transparent 14px 22px);
}
.trail li { position: relative; padding-right: 8px; }
.trail p { color: rgba(254, 248, 231, 0.82); font-size: 0.98rem; }
.step-n {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 16px;
  background: var(--gold); color: var(--ink); font-weight: 900; font-size: 1.15rem;
  border: 3px solid var(--ink); border-radius: 8px; box-shadow: 0 0 0 3px var(--gold);
}

/* Adventurers on parade */
.party { background: #9fd3d6; padding-top: clamp(48px, 7vw, 88px); text-align: center; border-bottom: var(--edge); overflow: hidden; }
.party .big { margin-inline: auto; }
.parade {
  display: flex; justify-content: center; align-items: flex-end; gap: clamp(2px, 1.2vw, 16px);
  margin-top: clamp(28px, 5vw, 48px); padding: 0 12px;
  background-image:
    linear-gradient(transparent calc(100% - 34px), var(--grass) calc(100% - 34px), var(--grass) calc(100% - 10px), var(--grass-dark) calc(100% - 10px));
  padding-bottom: 22px;
}
.parade img { width: 64px; height: 64px; flex: none; animation: hop 2.4s steps(1) infinite; }
.parade img:nth-child(3n) { animation-delay: -0.8s; }
.parade img:nth-child(3n + 1) { animation-delay: -1.6s; }
@keyframes hop { 0%, 100% { transform: none; } 50% { transform: translateY(-4px); } }

/* Roadmap */
.roadmap h2 { margin-bottom: 0.8rem; }
.stages { list-style: none; margin: 2.6rem 0 0; padding: 0; display: grid; gap: 26px; position: relative; }
.stages::before {
  content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 6px;
  background: repeating-linear-gradient(var(--road) 0 14px, transparent 14px 22px);
}
.stage { position: relative; padding-left: 56px; }
.stage::before {
  content: ""; position: absolute; left: 2px; top: 2px; width: 28px; height: 28px;
  background: var(--night); border: 3px solid var(--road); border-radius: 6px;
}
.stage.is-now::before { background: var(--gold); box-shadow: 0 0 0 4px rgba(255, 203, 53, 0.3); }
.stage-when {
  display: inline-block; margin-bottom: 10px; padding: 4px 10px 3px; border-radius: 4px;
  border: 2px solid rgba(254, 248, 231, 0.4); color: rgba(254, 248, 231, 0.85);
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
}
.is-now .stage-when { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.stage-card {
  background: var(--cream); color: var(--text); border: 3px solid var(--cream);
  border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 0 rgba(0, 0, 0, 0.35);
}
.stage-art { width: 100%; height: clamp(110px, 15vw, 172px); object-fit: cover; }
.art-daily { object-position: 50% 74%; image-rendering: auto; }
.stage-text { padding: 16px 20px 18px; }
.stage-text h3 { color: var(--ink); font-size: 1.4rem; font-weight: 900; letter-spacing: -0.02em; }
.stage:not(.is-now) .stage-art { filter: saturate(0.85); }

/* Closing */
.closing { background: var(--gold); padding: clamp(48px, 7vw, 80px) 0; }
.closing-inner { display: flex; align-items: center; justify-content: center; gap: clamp(20px, 5vw, 56px); }
.emblem { width: clamp(96px, 16vw, 168px); flex: none; }
.closing h2 { margin-bottom: 0.6rem; }
.closing p { color: var(--ink); font-size: 1.1rem; }
.closing a { color: var(--ink); font-weight: 700; }
.closing .btn-play { color: #fff; }
.closing-play { margin: 1.4rem 0 1.3rem; }
.closing .closing-help { font-size: 0.98rem; }

/* Footer */
.foot { background: var(--ink); color: var(--cream); padding: 26px 0; font-size: 0.9rem; }
.foot-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot-links a { color: var(--cream); text-decoration: none; }
.foot-links a:hover { color: var(--gold); text-decoration: underline; }

/* Legal and support pages */
.legal { padding: clamp(32px, 6vw, 72px) 0 clamp(48px, 8vw, 96px); }
.legal-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: start; }
.legal-nav { display: grid; gap: 4px; position: sticky; top: 92px; }
.legal-nav a {
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.95rem;
  padding: 8px 12px; border-radius: 8px;
}
.legal-nav a:hover { background: var(--card); color: var(--teal); }
.legal-nav a[aria-current="page"] { background: var(--ink); color: var(--cream); }
.legal-nav a.sub { padding-left: 26px; font-weight: 600; font-size: 0.9rem; }
.doc { max-width: 68ch; }
.doc h1 { font-size: clamp(2.1rem, 4.6vw, 3rem); margin-bottom: 1.4rem; }
.doc h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: 0; margin: 2.2rem 0 0.7rem; }
.doc p, .doc ul { margin: 0 0 1rem; }
.doc ul { padding-left: 1.3rem; }
.doc li { margin-bottom: 0.4rem; }
.doc li::marker { color: var(--teal); }
.doc a { font-weight: 600; overflow-wrap: anywhere; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0 1rem; }
.doc hr + p { color: var(--muted); font-size: 0.9rem; }

/* Guide pages: How to play, FAQ and About share the policy layout. */
.top nav a[aria-current="page"] { background: var(--ink); color: var(--cream); }
.guide h2 { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; margin: 2.8rem 0 0.8rem; }
.guide h3 { font-size: 1.08rem; margin: 1.5rem 0 0.35rem; }
.guide ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.guide ol li::marker { color: var(--teal); font-weight: 800; }
.lead { font-size: 1.2rem; line-height: 1.5; color: var(--ink); }
.doc-toc {
  list-style: none; columns: 2; column-gap: 28px;
  background: var(--card); border: var(--edge); border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--ink); padding: 16px 20px; margin: 1.6rem 0 0.5rem;
}
.doc ul.doc-toc { padding-left: 20px; }
.doc-toc li { break-inside: avoid; }
.doc-toc a { text-decoration: none; }
.doc-toc a:hover { text-decoration: underline; }
.doc-table { width: 100%; border-collapse: collapse; margin: 0 0 1.2rem; font-size: 0.96rem; }
.doc-table th, .doc-table td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.doc-table thead th {
  background: var(--ink); color: var(--cream);
  font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase;
}
.doc-table tbody th { color: var(--ink); white-space: nowrap; }
.doc-table td:nth-child(2) { white-space: nowrap; font-weight: 700; }
/* The steps of a turn: numbered cards, one under the other. */
.doc ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 1.4rem 0; display: grid; gap: 10px; }
.steps li {
  counter-increment: step; position: relative; margin: 0; padding: 14px 16px 14px 62px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
}
.steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 14px;
  display: grid; place-items: center; width: 34px; height: 34px;
  background: var(--gold); color: var(--ink); font-weight: 900; border: 2px solid var(--ink); border-radius: 8px;
}
.steps li:nth-child(n + 3):nth-child(-n + 5)::before { background: var(--ink); color: var(--cream); }
.steps b { display: block; color: var(--ink); }
.note {
  background: var(--gold); color: var(--ink); border: var(--edge); border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--ink); padding: 16px 20px; margin: 1.6rem 0;
}
.doc .note p { margin: 0; }
.doc-play {
  margin-top: 3rem; padding-top: 2rem; border-top: var(--edge);
  display: grid; justify-items: start; gap: 18px;
}
.doc .doc-play p { margin: 0; font-weight: 700; color: var(--ink); }
.doc a.btn-play { font-weight: 900; overflow-wrap: normal; }
.more { margin-top: 2rem; }
.more a { font-weight: 800; }
.how .more a, .aside a { color: var(--gold); }

/* The Stories: each day's Daily Kwyst as a page, built from the game (tools/build_stories.py). */
.stories .story, .stories .story-all { width: min(46rem, 100% - 32px); margin-inline: auto; padding: 1.4rem 0 3rem; }
.stories .story-all { width: min(1120px, 100% - 32px); }
.stories h1 { margin: 0.5rem 0 0.6rem; font-size: clamp(2.1rem, 4.6vw, 3rem); overflow-wrap: anywhere; }
.story h2 { margin: 0 0 0.6rem; font-size: 1.5rem; letter-spacing: -0.02em; }
.story section { margin: 1.4rem 0; }
.story-banner {
  display: block; overflow: hidden; border: var(--edge); border-radius: 12px; box-shadow: var(--drop);
  background: linear-gradient(160deg, var(--night), var(--teal));
}
.story-banner img { width: 100%; image-rendering: pixelated; }
.story-banner.blank {
  aspect-ratio: 3 / 1; display: flex; align-items: center; justify-content: center;
  color: var(--gold); font: 900 3rem/1 var(--sans); text-decoration: none;
}
.story-chips {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.3rem 0 0; padding: 0; list-style: none;
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.story-chips li { padding: 0.15rem 0.6rem; border-radius: 99px; background: var(--card); border: 2px solid var(--line); color: var(--muted); }
.story-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem; margin: 1.4rem 0; padding: 0; list-style: none; text-align: center; }
.story-stats li {
  padding: 0.7rem 0.4rem; background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  color: var(--muted); font-size: 0.85rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.story-stats b {
  display: flex; align-items: center; justify-content: center; gap: 0.35rem;
  color: var(--ink); font: 900 2rem/1.1 var(--sans); letter-spacing: -0.02em;
}
.story-stats svg { width: 26px; height: 26px; }
.story .story-begins { padding: 1.2rem 1.3rem 0.6rem; background: #fff3d2; border: 2px solid #e6d3a3; border-radius: 12px; }
.story-prose p, p.story-prose { margin: 0 0 0.9rem; font: 500 1.36rem/1.38 var(--serif); }
.story-begins .story-prose p:first-child::first-letter { float: left; margin: 0.1rem 0.5rem 0 0; color: var(--play-red); font: 700 3.6rem/0.85 var(--serif); }
.story .story-goal { padding: 1rem 1.3rem; background: var(--ink); border-radius: 12px; color: var(--cream); }
.story .story-goal h2 { margin: 0 0 0.2rem; color: var(--gold); font: 800 0.82rem/1.4 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; }
.story-goal p { font: 500 1.45rem/1.3 var(--serif); }
.story-kit { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.7rem; }
.story-kit li {
  padding: 0.9rem 0.7rem; background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  text-align: center; font-size: 0.9rem; line-height: 1.35; color: var(--muted);
}
.story-kit .icon { display: block; width: 64px; height: 64px; margin: 0 auto 0.5rem; image-rendering: pixelated; }
.story-kit b { display: block; margin-bottom: 0.15rem; color: var(--ink); font-size: 1rem; }
.story-play { margin: 2.2rem 0 0; text-align: center; }
.story-play p { margin: 0 0 1rem; color: var(--muted); }
.story-play .story-help { margin: 1.4rem 0 0; }
.story-play .btn-play { font-size: clamp(1.15rem, 2.4vw, 1.4rem); padding-inline: 40px; }
.story-days { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin: 2rem 0 0; }
.story-days a { padding: 0.7rem 0.9rem; background: var(--card); border: 2px solid var(--line); border-radius: 12px; text-decoration: none; }
.story-days a.after { grid-column: 2; text-align: right; }
.story-days small { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.story-days b { color: var(--ink); font: 800 1.05rem/1.25 var(--sans); }
.story-list { margin: 1.6rem 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1.6rem 1.2rem; }
.story-list > li { display: flex; flex-direction: column; overflow: hidden; background: var(--card); border: var(--edge); border-radius: 14px; box-shadow: var(--drop); }
.story-list .story-banner { border: 0; border-bottom: var(--edge); border-radius: 0; box-shadow: none; }
.story-list .words { display: flex; flex: 1; flex-direction: column; padding: 0.9rem 1rem 1rem; }
.story-list .story-chips { margin: 0; }
.story-list h3 { margin: 0.5rem 0 0.3rem; font-size: 1.45rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.15; }
.story-list h3 a, .latest h2 a { color: var(--ink); text-decoration: none; }
.story-list h3 a:hover, .latest h2 a:hover { color: var(--teal); }
.story-list p { margin: 0 0 0.9rem; }
.story-more {
  margin-top: auto; align-self: flex-start; padding: 0.35rem 0.8rem;
  border: 2px solid var(--ink); border-radius: 8px; color: var(--ink); font-size: 0.9rem; font-weight: 700; text-decoration: none;
}
.story-more:hover { background: var(--gold); }

/* Home: the latest story, under the hero. */
.latest { padding: clamp(48px, 7vw, 88px) 0; border-bottom: var(--edge); }
.latest-card {
  display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: clamp(20px, 4vw, 48px);
  background: var(--card); border: var(--edge); border-radius: 14px; box-shadow: var(--drop); padding: clamp(16px, 3vw, 32px);
}
.latest-card .story-chips { margin: 0 0 0.8rem; }
.latest h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); margin-bottom: 0.7rem; }
.latest .latest-opening { margin: 1rem 0 0; font-size: 1.24rem; color: var(--text); }
.latest-go { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 1.5rem; }
.latest-earlier { margin: clamp(32px, 5vw, 56px) 0 0; font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; }

/* 404 */
.lost { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 48px 0; }
.lost img { width: 140px; margin: 0 auto 24px; }
.lost p { margin: 1rem 0 1.6rem; color: var(--muted); }

@media (max-width: 920px) {
  .daily-grid { grid-template-columns: 1fr; }
  .demo { max-width: 560px; width: 100%; margin-inline: auto; }
  .trail { grid-template-columns: repeat(2, 1fr); gap: 32px 20px; }
  .trail::before { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .legal-grid { grid-template-columns: 1fr; }
  .legal-nav { position: static; display: flex; flex-wrap: wrap; gap: 6px; }
  .latest-card { grid-template-columns: 1fr; }
  .legal-nav a { border: 2px solid var(--line); }
  .legal-nav a.sub { padding-left: 12px; }
  .parade img:nth-child(n + 13) { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  html { scroll-padding-top: 64px; }
  .top-inner { min-height: 56px; }
  /* Five links do not fit beside the logo on a phone: they wrap onto a second row. */
  .top nav { gap: 0; flex-wrap: wrap; justify-content: flex-end; }
  .top nav a { font-size: 0.84rem; padding: 6px 7px; }
  .brand img { width: 92px; }
  /* Phones: the tall art keeps its own size, pinned to the top, and fades
     into the grass if the box runs on below it. */
  .hero-art { inset: 0 0 auto; }
  .hero-art img {
    height: auto; object-fit: fill;
    -webkit-mask-image: linear-gradient(#000 calc(100% - 96px), transparent);
    mask-image: linear-gradient(#000 calc(100% - 96px), transparent);
  }
  .hero-box { margin-top: 96vw; }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .demo-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .closing-inner { flex-direction: column; text-align: center; }
  .prose { font-size: 1.24rem; }
  .parade img { width: 48px; height: 48px; }
  .parade img:nth-child(n + 8) { display: none; }
  .stage { padding-left: 44px; }
  .stages::before { left: 9px; }
  .stage::before { left: 0; width: 24px; height: 24px; }
}
@media (max-width: 400px) {
  .top nav a[href="/about/"] { display: none; }
  .doc-toc { columns: 1; }
  .trail { grid-template-columns: 1fr; }
}

/* Phones: everything read is at least 16px, and everything tapped is at least 48px tall.
   Ad networks and search engines check both. Kept last so it wins over the rules above. */
@media (max-width: 640px) {
  /* The bar scrolls away with the page: with links this size it is too tall to pin. */
  .top { position: static; }
  html { scroll-padding-top: 0; }
  .top-inner { padding-block: 4px; }
  .top nav a, .legal-nav a, .foot-links a {
    display: inline-flex; align-items: center; min-height: 48px; padding: 0 10px; font-size: 1rem;
  }
  .foot { font-size: 1rem; }
  .foot-links { gap: 0 8px; margin-inline: -10px; }
  .btn, .store-pill, .btn-small, .btn-play, .choices button, .freeform input, .freeform button, .skip { min-height: 48px; }
  .btn-small, .choices button, .freeform input, .freeform button { font-size: 1rem; }
  /* Text that was set a little small on a wide screen. */
  .aside, .card p, .trail p, .roll, .roll em, .demo-goal, .demo figcaption, .stats span,
  .closing .closing-help, .demo-danger, .doc hr + p, .doc-table, .verdict-score, .badges li, .kit li, .demo-bar { font-size: 1rem; }
  .story-chips, .story-stats li, .story-kit li, .story-days small, .story-more, .story .story-goal h2 { font-size: 1rem; }
  .story-chips, .story-stats li, .story-days small, .story .story-goal h2 { letter-spacing: 0.03em; }
  .story-more { display: inline-flex; align-items: center; min-height: 48px; padding: 0 1rem; }
  .story-list h3 { margin: 0.2rem 0 0; }
  .story-list h3 a { display: block; padding: 0.55rem 0; }
  .story-play .story-help a, .story-days a { display: inline-flex; flex-direction: column; justify-content: center; min-height: 48px; }
  /* The small capital labels stay labels, but no smaller than 16px either. */
  .tag, .demo-turn, .demo-goal b, .demo-place, .demo-label, .stage-when, .doc-table thead th { font-size: 1rem; letter-spacing: 0.08em; }
}
