/* ==========================================================================
   Dinesh Kumar S — portfolio, "Two-player mode"
   Story: the site is a game. Paper = the game-dev side (sketchbook, ink),
   screen = the front-end side (dark editor, code). Sections switch between
   the two, and the hero seam shows the same thing as both.
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../assets/fonts/bricolage-grotesque-var.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../assets/fonts/jetbrains-mono-var.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("../assets/fonts/caveat-var.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  /* desk (dark) */
  --desk: #121017;
  --desk-2: #19161f;
  --desk-3: #221e2a;
  --chalk: #f3eee3;
  --chalk-muted: #bdb7c7;
  --chalk-dim: #8f8a99;
  /* paper (light) */
  --paper: #f4ecda;
  --paper-2: #eadfc6;
  --ink: #1c1822;
  --ink-muted: #4f4857;
  --ink-dim: #756d7c;
  /* accents */
  --yellow: #ffc83d;
  --coral: #ff6a45;
  --coral-ink: #bb3d1c;
  --mint: #4be0a0;
  --mint-ink: #127a50;
  --blue-ink: #2d55c8;
  --code-bg: #0c0b11;

  /* context tokens: dark by default, flipped on paper */
  --fg: var(--chalk);
  --fg-muted: var(--chalk-muted);
  --fg-dim: var(--chalk-dim);
  --line: rgba(243, 238, 227, 0.12);
  --line-strong: rgba(243, 238, 227, 0.24);
  --surface: var(--desk-2);
  --accent: var(--yellow);

  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --font-hand: "Caveat", "Segoe Print", "Comic Sans MS", cursive;

  --gutter: clamp(16px, 4vw, 36px);
  --hud-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow: 0 26px 60px -26px rgba(0, 0, 0, 0.75);
  --shadow-paper: 0 2px 0 rgba(28, 24, 34, 0.06), 0 22px 44px -22px rgba(0, 0, 0, 0.6);
}

.paper-ctx,
.sheet,
.game,
.card-char,
.paper-note,
.continue,
.venn-sheet {
  --fg: var(--ink);
  --fg-muted: var(--ink-muted);
  --fg-dim: var(--ink-dim);
  --line: rgba(28, 24, 34, 0.14);
  --line-strong: rgba(28, 24, 34, 0.3);
  --surface: rgba(255, 255, 255, 0.45);
  color: var(--fg);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--hud-h) + 16px);
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background:
    radial-gradient(circle at 1px 1px, rgba(243, 238, 227, 0.06) 1px, transparent 0) 0 0 / 22px 22px,
    var(--desk);
  color: var(--fg);
  font: 400 1.0625rem/1.62 var(--font-display);
  -webkit-font-smoothing: antialiased;
}
main { overflow-x: clip; }
img, svg, canvas, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
b, strong { font-weight: 650; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 750;
  line-height: 1.06;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
code {
  padding: 0.08em 0.4em;
  border-radius: 6px;
  background: rgba(255, 200, 61, 0.14);
  color: inherit;
  font: 500 0.86em var(--font-mono);
  white-space: nowrap;
}
code.is-long { white-space: normal; }
sup { font-size: 0.7em; line-height: 0; }
kbd {
  padding: 1px 6px;
  border: 1px solid currentColor;
  border-radius: 5px;
  font: 600 0.72em var(--font-mono);
  opacity: 0.7;
}
::selection { background: var(--yellow); color: var(--ink); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 6px; }
.paper-ctx :focus-visible, .sheet :focus-visible, .game :focus-visible, .continue :focus-visible { outline-color: var(--blue-ink); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: 10px; left: 10px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform 0.2s;
}
.skip-link:focus { transform: none; }

.container {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- buttons ---------- */
.btn {
  --b: transparent;
  --t: var(--fg);
  --s: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  min-height: 48px;
  padding: 0 1.3em;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--b);
  color: var(--t);
  box-shadow: 0 4px 0 var(--s);
  font: 700 1rem/1 var(--font-display);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s, background-color 0.2s, border-color 0.2s;
}
.btn svg { width: 1.05em; height: 1.05em; fill: currentColor; flex: none; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--s); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--s); }
.btn--yellow { --b: var(--yellow); --t: var(--ink); --s: #a7801a; border-color: var(--ink); }
.btn--coral { --b: var(--coral); --t: var(--ink); --s: #99351d; border-color: var(--ink); }
.btn--mint { --b: var(--mint); --t: var(--ink); --s: #1e8a5e; border-color: var(--ink); }
.btn--ink { --b: var(--ink); --t: var(--paper); --s: rgba(0, 0, 0, 0.35); }
.btn--ghost { border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--fg); }
.btn--ghost svg { fill: currentColor; }
.btn--link {
  padding: 0 0.3em;
  box-shadow: none;
  color: var(--fg-muted);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 6px;
}
.btn--link:hover { box-shadow: none; color: var(--fg); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 6px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  font: 500 0.82rem/1.3 var(--font-mono);
  color: var(--fg);
}
.chips li.is-core { border-color: var(--ink); background: var(--yellow); color: var(--ink); font-weight: 700; }
.chips--dark li { border-color: rgba(243, 238, 227, 0.24); color: var(--chalk); }

.ticks { display: grid; gap: 10px; }
.ticks li {
  position: relative;
  padding-left: 26px;
  color: var(--fg-muted);
  font-size: 0.98rem;
  line-height: 1.55;
}
.ticks li::before {
  content: "";
  position: absolute;
  left: 2px; top: 0.35em;
  width: 14px; height: 14px;
  border: 2px solid var(--fg);
  border-radius: 4px;
}
.ticks li::after {
  content: "";
  position: absolute;
  left: 6px; top: 0.42em;
  width: 6px; height: 11px;
  border: solid var(--accent-tick, var(--coral));
  border-width: 0 3px 3px 0;
  transform: rotate(40deg);
}

/* ---------- handwritten notes & doodles ---------- */
.note {
  font: 600 1.45rem/1.15 var(--font-hand);
  color: var(--yellow);
}
.doodle {
  display: inline-block;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

/* ==========================================================================
   HUD header
   ========================================================================== */
.hud {
  position: fixed;
  inset: 0 0 auto;
  z-index: 90;
  height: var(--hud-h);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s, border-color 0.3s;
}
.hud.is-scrolled {
  background: rgba(18, 16, 23, 0.86);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
          backdrop-filter: blur(14px) saturate(1.3);
  border-bottom-color: rgba(243, 238, 227, 0.1);
}
.hud__inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.logo__mark {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--yellow);
  box-shadow: 0 3px 0 #a7801a;
  transition: transform 0.4s var(--ease-back);
}
.logo__mark svg { width: 20px; height: 20px; fill: var(--yellow); stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.logo:hover .logo__mark { transform: rotate(-12deg) translateY(-2px); }
.logo__text { display: flex; flex-direction: column; font-weight: 750; line-height: 1.05; letter-spacing: -0.01em; }
.logo__text span { font-weight: 450; font-size: 0.8rem; color: var(--chalk-muted); }

.hud__level {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 5px;
  min-width: 0;
  margin-left: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(243, 238, 227, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  font: 600 0.7rem/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hud__lvl { color: var(--yellow); }
.hud__name { color: var(--chalk); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 17ch; }
.hud__xp {
  position: relative;
  grid-column: span 2;
  height: 4px;
  border-radius: 4px;
  background: rgba(243, 238, 227, 0.12);
}
.hud__xp-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--progress, 0) * 100%);
  border-radius: 4px;
  background: linear-gradient(90deg, var(--yellow), var(--coral));
}
.hud__xp-plane {
  position: absolute;
  top: -6px;
  left: calc(var(--progress, 0) * 100%);
  width: 14px; height: 14px;
  margin-left: -7px;
  fill: var(--yellow);
  stroke: var(--desk);
  stroke-width: 1.4;
  transform: rotate(45deg);
}

.hud__nav { display: flex; gap: 2px; margin-left: auto; }
.hud__nav a {
  position: relative;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--chalk-muted);
  font-size: 0.93rem;
  font-weight: 550;
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}
.hud__nav a:hover { color: var(--chalk); background: rgba(243, 238, 227, 0.07); }
.hud__nav a.is-active { color: var(--chalk); }
.hud__nav a.is-active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 3px;
  height: 3px;
  border-radius: 3px;
  background: var(--yellow);
}
.hud__actions { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn, .menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1.5px solid rgba(243, 238, 227, 0.24);
  border-radius: 12px;
  background: transparent;
  color: var(--chalk);
  font: 650 0.9rem/1 var(--font-display);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; }
.icon-btn:hover, .menu-btn:hover { border-color: var(--yellow); color: var(--yellow); }
.menu-btn { display: none; background: var(--yellow); border-color: var(--ink); color: var(--ink); box-shadow: 0 3px 0 #a7801a; }
.menu-btn:hover { color: var(--ink); }
.menu-btn__bars { display: grid; gap: 4px; width: 16px; }
.menu-btn__bars i { height: 2px; border-radius: 2px; background: currentColor; }

/* ---------- pause menu ---------- */
.pause {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 20px var(--gutter);
  background: rgba(10, 9, 13, 0.72);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  overflow-y: auto;
}
.pause[hidden] { display: none; }
.pause__card {
  --fg: var(--ink); --fg-muted: var(--ink-muted); --line: rgba(28, 24, 34, 0.14); --line-strong: rgba(28, 24, 34, 0.3);
  width: min(100%, 520px);
  padding: 24px clamp(18px, 4vw, 30px) 22px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background:
    linear-gradient(rgba(28, 24, 34, 0.05) 1px, transparent 1px) 0 0 / 100% 28px,
    var(--paper);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  animation: pop 0.35s var(--ease-back);
}
.pause__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pause__title { font: 800 clamp(2.2rem, 7vw, 3rem)/1 var(--font-display); letter-spacing: -0.04em; color: var(--coral-ink); }
.pause__close {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: var(--yellow); color: var(--ink);
  font: 700 0.9rem/1 var(--font-display); cursor: pointer;
}
.pause__hint { margin-top: 10px; color: var(--ink-dim); font: 600 0.75rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; }
.pause__list { display: grid; gap: 2px; margin-top: 12px; }
.pause__list a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 12px 11px 34px;
  border-radius: 12px;
  font-size: 1.12rem;
  font-weight: 650;
  text-decoration: none;
  transition: background-color 0.15s, padding-left 0.2s var(--ease);
}
.pause__list a span { color: var(--ink-dim); font: 600 0.8rem/1 var(--font-mono); }
.pause__list a::before {
  content: "▶";
  position: absolute;
  left: 10px;
  color: var(--coral-ink);
  font-size: 0.85rem;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.15s, transform 0.2s var(--ease);
}
.pause__list a:hover, .pause__list a:focus-visible { background: rgba(255, 200, 61, 0.4); padding-left: 40px; outline: none; }
.pause__list a:hover::before, .pause__list a:focus-visible::before { opacity: 1; transform: none; }
.pause__foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 2px dashed rgba(28, 24, 34, 0.2); }
.chip-link {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px;
  border: 2px solid var(--ink); border-radius: 12px;
  font-weight: 650; font-size: 0.92rem; text-decoration: none;
}
.chip-link svg { width: 16px; height: 16px; fill: currentColor; }
.chip-link:hover { background: var(--ink); color: var(--paper); }

/* ---------- share popover ---------- */
.share {
  position: fixed;
  z-index: 160;
  top: calc(var(--hud-h) + 8px);
  right: var(--gutter);
  width: min(300px, calc(100vw - 32px));
  padding: 16px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  animation: pop 0.3s var(--ease-back);
}
.share[hidden] { display: none; }
.share__title { font: 700 1.3rem/1 var(--font-hand); color: var(--coral-ink); }
.share__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.share__grid > * {
  display: grid; place-items: center;
  min-height: 42px; padding: 0 10px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: #fff8e6; color: var(--ink);
  font: 650 0.9rem/1 var(--font-display); text-decoration: none; cursor: pointer;
}
.share__grid > :first-child { grid-column: span 2; background: var(--yellow); }
.share__grid > *:hover { background: var(--ink); color: var(--paper); }

/* ==========================================================================
   00 · Title screen
   ========================================================================== */
.title {
  position: relative;
  padding: calc(var(--hud-h) + clamp(36px, 6vw, 80px)) 0 clamp(40px, 6vw, 72px);
}
.title::before {
  content: "";
  position: absolute;
  inset: 0 0 -120px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 50% 60% at 78% 40%, rgba(255, 200, 61, 0.1), transparent 70%),
    radial-gradient(ellipse 40% 50% at 15% 20%, rgba(255, 106, 69, 0.08), transparent 70%);
}
.title__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: center;
}
.status {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 12px;
  border: 1.5px solid rgba(75, 224, 160, 0.4);
  border-radius: 999px;
  background: rgba(75, 224, 160, 0.08);
  color: var(--mint);
  font: 600 0.8rem/1.3 var(--font-mono);
}
.status__dot, .card-char__status dd span {
  width: 8px; height: 8px; flex: none;
  border-radius: 50%;
  background: var(--mint);
  animation: ping 2.4s infinite;
}
.title__player {
  margin-top: 22px;
  color: var(--chalk-dim);
  font: 600 0.82rem/1 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.title__player strong { color: var(--chalk); }
.title__h1 {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 16px;
  font-size: clamp(2.2rem, 4.4vw, 3.7rem);
  line-height: 1;
  letter-spacing: -0.045em;
}
.role { position: relative; display: inline-block; white-space: nowrap; padding: 0.06em 0.22em 0.12em; border-radius: 0.16em; }
.role--game {
  background: var(--paper);
  color: var(--ink);
  transform: rotate(-1.5deg);
  box-shadow: 5px 5px 0 var(--yellow);
}
.role--game::after {
  /* graph paper texture on the word */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(rgba(28, 24, 34, 0.07) 1px, transparent 1px) 0 0 / 100% 0.36em,
    linear-gradient(90deg, rgba(28, 24, 34, 0.07) 1px, transparent 1px) 0 0 / 0.36em 100%;
  pointer-events: none;
}
.role--web {
  background: var(--code-bg);
  color: var(--mint);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78em;
  letter-spacing: -0.06em;
  border: 2px solid rgba(75, 224, 160, 0.4);
  transform: rotate(1deg);
  box-shadow: 5px 5px 0 rgba(75, 224, 160, 0.25);
}
.role__tag { color: var(--chalk-dim); font-weight: 500; }
.role__plus {
  margin: -0.08em 0 -0.12em 0.3em;
  color: var(--coral);
  font: 700 1.1em/1 var(--font-hand);
  transform: rotate(-8deg);
}
.title__lead {
  margin-top: 26px;
  max-width: 33em;
  color: var(--chalk-muted);
  font-size: clamp(1.05rem, 1.4vw, 1.18rem);
}
.title__lead b { color: var(--chalk); }
.title__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 30px; }

/* ---------- the seam (game ⇄ code) ---------- */
.seam { position: relative; }
.seam__stage {
  position: relative;
  border: 3px solid var(--ink);
  border-radius: 22px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.45);
  isolation: isolate;
}
.seam__game { position: relative; z-index: 1; }
.seam__code {
  position: absolute;
  inset: 0;
  z-index: 2;
  clip-path: inset(0 0 0 var(--split));
  background: var(--code-bg);
  overflow: hidden;
  pointer-events: none;
}
.seam.is-code-wide .seam__code { pointer-events: auto; }
/* the editor starts exactly at the seam, so the code is always readable from its first character */
.editor { height: 100%; display: flex; flex-direction: column; padding-left: var(--split); }
.editor__bar {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(243, 238, 227, 0.08);
  background: #16141d;
  color: var(--chalk-dim);
  font: 500 0.74rem/1 var(--font-mono);
}
.editor__bar i { width: 9px; height: 9px; border-radius: 50%; background: #3a3544; }
.editor__bar i:first-child { background: var(--coral); }
.editor__bar i:nth-child(2) { background: var(--yellow); }
.editor__bar i:nth-child(3) { background: var(--mint); }
.editor__bar span { margin-left: 8px; white-space: nowrap; }
.editor__code {
  flex: 1;
  margin: 0;
  padding: 16px 18px;
  overflow: hidden;
  color: #d9d4e4;
  font: 500 clamp(0.72rem, 1.05vw, 0.86rem)/1.75 var(--font-mono);
  counter-reset: ln;
}
.editor__code code { padding: 0; background: none; font: inherit; white-space: pre; }
.editor__code b[data-live] {
  font-weight: 700;
  color: var(--yellow);
  background: rgba(255, 200, 61, 0.12);
  border-radius: 4px;
  padding: 0 2px;
}
.seam[data-state="crashed"] .editor__code b[data-live="crash"],
.seam[data-state="crashed"] .editor__code b[data-live="state"] { color: var(--coral); background: rgba(255, 106, 69, 0.15); }
.seam[data-state="cashed"] .editor__code b[data-live="state"] { color: var(--mint); background: rgba(75, 224, 160, 0.14); }
.t-k { color: #c9a7ff; }
.t-f { color: var(--yellow); }
.t-n { color: #ff9b7f; }
.t-s { color: var(--mint); }
.t-c { color: #7d7789; font-style: italic; }

.seam__handle {
  position: absolute;
  z-index: 3;
  top: 0; bottom: 0;
  left: var(--split);
  width: 44px;
  /* keep the knob grabbable at 0% and 100% */
  --knob-shift: calc((50 - var(--split-n, 55)) * 1.2px);
  margin-left: -22px;
  cursor: ew-resize;
  touch-action: none;
  outline: none;
}
.seam__handle::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 3px;
  margin-left: -1.5px;
  background: var(--ink);
  box-shadow: 0 0 0 1px rgba(255, 200, 61, 0.6);
}
.seam__knob {
  position: absolute;
  top: 50%; left: calc(50% + var(--knob-shift, 0px));
  display: flex;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 0 var(--ink);
  font: 700 0.7rem/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: transform 0.2s var(--ease-back);
}
.seam__knob span { padding: 8px 8px; }
.seam__knob span:first-child { background: var(--yellow); color: var(--ink); }
.seam__knob span:last-child { background: var(--code-bg); color: var(--mint); }
.seam__handle:hover .seam__knob, .seam__handle.is-dragging .seam__knob { transform: translate(-50%, -50%) scale(1.08); }
.seam__handle::before { transition: none; }
.seam__handle:focus-visible .seam__knob { outline: 3px solid var(--yellow); outline-offset: 3px; }
.seam.is-animating .seam__code { transition: clip-path 0.7s var(--ease); }
.seam.is-animating .seam__handle { transition: left 0.7s var(--ease); }

.seam__switch {
  display: flex;
  gap: 6px;
  margin-top: 16px;
  padding: 5px;
  width: fit-content;
  border: 1.5px solid rgba(243, 238, 227, 0.16);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.2);
}
.seam__switch button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--chalk-muted);
  font: 650 0.86rem/1 var(--font-display);
  cursor: pointer;
}
.seam__switch button:hover { color: var(--chalk); background: rgba(243, 238, 227, 0.07); }
.note--seam {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 10px;
  font-size: 1.35rem;
  transform: rotate(-1.5deg);
}
.note--seam .doodle { width: 26px; height: 26px; margin-top: -10px; }

/* ---------- mini crash game (paper skin) ---------- */
.crash {
  --c-line: #1c1822;
  --c-fill: #ffc83d;
  --c-crash: #bb3d1c;
  --c-cash: #127a50;
  --c-label: #6f6776;
  --c-grid: rgba(28, 24, 34, 0.08);
  --c-axis: rgba(28, 24, 34, 0.3);
  --c-plane: #ffc83d;
  --c-plane-ink: #1c1822;
  color: var(--ink);
  background:
    linear-gradient(rgba(28, 24, 34, 0.045) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, rgba(28, 24, 34, 0.045) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--paper);
}
.crash__bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px;
  border-bottom: 2px solid rgba(28, 24, 34, 0.12);
  color: var(--ink-dim);
  font: 600 0.72rem/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.crash__live { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-muted); }
.crash__live span { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); animation: blink 1.6s steps(2, start) infinite; }
.crash__round b { color: var(--ink); }
.crash__stage { position: relative; aspect-ratio: 16 / 10; }
.crash__canvas { width: 100%; height: 100%; }
.crash__readout {
  position: absolute; top: 14px; left: 20px;
  display: flex; flex-direction: column; gap: 2px;
  pointer-events: none;
}
.crash__mult {
  font: 800 clamp(2.2rem, 4.8vw, 3.2rem)/1 var(--font-display);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  text-shadow: 3px 3px 0 var(--yellow);
}
.crash[data-state="crashed"] .crash__mult { color: var(--coral-ink); text-shadow: 3px 3px 0 rgba(255, 106, 69, 0.3); }
.crash[data-state="cashed"] .crash__mult { color: var(--mint-ink); text-shadow: 3px 3px 0 rgba(75, 224, 160, 0.4); }
.crash__status { color: var(--ink-muted); font: 700 1.15rem/1.2 var(--font-hand); }
.crash[data-state="crashed"] .crash__status { color: var(--coral-ink); }
.crash[data-state="cashed"] .crash__status { color: var(--mint-ink); }
.crash__controls {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px 10px;
  border-top: 2px solid rgba(28, 24, 34, 0.12);
}
.crash__btn {
  flex: none;
  min-width: 11em; min-height: 50px;
  padding: 0 1.1em;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  font: 800 1rem/1.1 var(--font-display);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s;
}
.crash__btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 0 var(--ink); }
.crash__btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.crash__btn:disabled { background: var(--paper-2); color: var(--ink-dim); box-shadow: none; border-color: rgba(28, 24, 34, 0.3); cursor: default; }
.crash[data-state="flying"] .crash__btn { background: var(--mint); }
.crash__score {
  display: flex; flex-direction: column; gap: 2px;
  margin-left: auto; text-align: right;
  color: var(--ink-dim);
  font: 600 0.76rem/1.4 var(--font-mono);
}
.crash__score b { color: var(--ink); }
.crash__history {
  display: flex; gap: 6px;
  min-height: 42px;
  padding: 0 18px 14px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 78%, transparent);
          mask-image: linear-gradient(90deg, #000 78%, transparent);
}
.crash__history li {
  flex: none;
  padding: 4px 9px;
  border: 1.5px solid rgba(28, 24, 34, 0.2);
  border-radius: 8px;
  font: 700 0.74rem/1.2 var(--font-mono);
  color: var(--ink-muted);
  animation: pop 0.35s var(--ease-back);
}
.crash__history li.is-high { background: var(--yellow); border-color: var(--ink); color: var(--ink); }
.crash__history li.is-low { color: var(--coral-ink); border-color: rgba(187, 61, 28, 0.4); }

/* ==========================================================================
   Level select (project cartridges)
   ========================================================================== */
.levels { padding: clamp(24px, 4vw, 48px) 0 0; }
.levels__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; }
.levels__title {
  font: 700 clamp(1.8rem, 3.6vw, 2.4rem)/1 var(--font-hand);
  color: var(--yellow);
  letter-spacing: 0;
  transform: rotate(-1.5deg);
}
.filter {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 4px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
}
.filter button {
  min-height: 36px; padding: 0 14px;
  border: 0; border-radius: 10px;
  background: transparent;
  color: var(--fg-muted);
  font: 650 0.86rem/1 var(--font-display);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.filter button:hover { color: var(--fg); }
.filter button[aria-pressed="true"] { background: var(--yellow); color: var(--ink); }

.carts {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}
.cart { --c: var(--yellow); transition: opacity 0.3s, transform 0.3s var(--ease); }
.cart.is-dim { opacity: 0.22; transform: scale(0.96); }
.cart--keno { --c: var(--coral); }
.cart--ui { --c: #b99bff; }
.cart--studio { --c: #7fc8ff; }
.cart--spine, .cart--site { --c: var(--mint); }
.cart a {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 18px 12px 14px;
  border: 2.5px solid var(--ink);
  border-radius: 14px 14px 18px 18px;
  background: var(--c);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 6px 0 var(--ink);
  transition: transform 0.25s var(--ease-back), box-shadow 0.25s;
}
.cart:nth-child(odd) a { transform: rotate(-1.2deg); }
.cart:nth-child(even) a { transform: rotate(1.2deg); }
.cart a:hover, .cart a:focus-visible { transform: translateY(-8px) rotate(0deg); box-shadow: 0 14px 0 var(--ink); }
.cart__grip {
  position: absolute;
  top: 6px; left: 50%;
  width: 46%; height: 6px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(90deg, rgba(28, 24, 34, 0.45) 0 3px, transparent 3px 7px);
  border-radius: 2px;
}
.cart__label {
  display: block;
  aspect-ratio: 16 / 11;
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}
.cart__label img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.cart a:hover .cart__label img { transform: scale(1.08); }
.cart__label--icons { display: flex; align-items: center; justify-content: center; gap: 6%; background: var(--paper); }
.cart__label--icons svg { width: 26%; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cart__label--tool { display: grid; place-items: center; background: var(--code-bg); color: var(--mint); font: 800 clamp(1.3rem, 2.4vw, 1.9rem)/1 var(--font-mono); }
.cart__label--site {
  display: grid;
  grid-template-columns: 1fr 0.55fr 0.3fr;
  align-items: end;
  gap: 8%;
  padding: 14% 14% 12%;
  background: var(--code-bg);
}
.cart__label--site span { border: 2px solid var(--mint); border-radius: 4px; }
.cart__label--site span:nth-child(1) { height: 70%; }
.cart__label--site span:nth-child(2) { height: 85%; }
.cart__label--site span:nth-child(3) { height: 100%; }
.cart__meta { display: flex; justify-content: space-between; gap: 6px; margin-top: 12px; font: 700 0.64rem/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.cart__type { padding: 3px 6px; border-radius: 5px; background: var(--ink); color: var(--c); }
.cart__no { padding-top: 3px; opacity: 0.7; }
.cart__name { margin-top: 10px; font-weight: 800; font-size: 1.02rem; line-height: 1.15; letter-spacing: -0.02em; }
.cart__sub { margin-top: 4px; font-size: 0.8rem; line-height: 1.3; opacity: 0.8; }

/* ==========================================================================
   Shared section structure
   ========================================================================== */
.section { padding: clamp(84px, 11vw, 140px) 0 0; }
.section-head { max-width: 760px; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head--center { margin-inline: auto; text-align: center; }
.kicker {
  display: flex; align-items: center; gap: 10px;
  color: var(--fg-muted);
  font: 600 0.78rem/1 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.section-head--center .kicker { justify-content: center; }
.kicker span { padding: 5px 8px; border: 2px solid var(--ink); border-radius: 7px; background: var(--yellow); color: var(--ink); font-weight: 800; letter-spacing: 0.02em; }
.section-head h2 { margin-top: 16px; font-size: clamp(2.2rem, 5vw, 3.6rem); letter-spacing: -0.045em; }
.section-head > p:not(.kicker) { margin-top: 14px; color: var(--fg-muted); font-size: 1.1rem; }

/* world section headings */
.world__head {
  max-width: 820px;
  margin-bottom: clamp(30px, 4vw, 52px);
}
.world__title { margin-top: 14px; font-size: clamp(2.2rem, 5vw, 3.6rem); letter-spacing: -0.045em; }
.world__lead { margin-top: 12px; max-width: 42em; color: var(--fg-muted); font-size: 1.08rem; }
.world__lead b { color: var(--fg); }

/* paper sheet */
.sheet {
  position: relative;
  padding: clamp(22px, 4vw, 44px);
  border: 3px solid var(--ink);
  border-radius: 24px;
  background:
    linear-gradient(rgba(28, 24, 34, 0.05) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(90deg, rgba(28, 24, 34, 0.05) 1px, transparent 1px) 0 0 / 26px 26px,
    var(--paper);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   01 · Player profile
   ========================================================================== */
.profile__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: start;
}
.card-char {
  position: relative;
  padding: 16px 16px 20px;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 10px 10px 0 var(--yellow);
  transform: rotate(-2deg);
  transition: transform 0.5s var(--ease);
}
.card-char:hover { transform: rotate(0deg); }
.card-char__frame {
  position: relative;
  border: 3px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, #ffe3a3, #ffc1ad);
}
.card-char__frame img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.card-char__class {
  position: absolute; z-index: 2;
  left: 12px; top: 12px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: var(--ink);
  color: var(--yellow);
  font: 700 0.72rem/1 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card-char__class b { color: var(--mint); }
.tape {
  position: absolute; z-index: 3;
  width: 38%; height: 12%;
  background: rgba(255, 200, 61, 0.8);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.tape--a { top: -3%; right: -8%; transform: rotate(38deg); }
.tape--b { bottom: -3%; left: -8%; transform: rotate(32deg); background: rgba(255, 106, 69, 0.75); }
.card-char__name {
  margin-top: 16px;
  font: 800 1.6rem/1 var(--font-display);
  letter-spacing: -0.03em;
  text-align: center;
}
.card-char__stats { margin: 14px 0 0; display: grid; }
.card-char__stats div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 9px 4px;
  border-bottom: 2px dotted rgba(28, 24, 34, 0.22);
}
.card-char__stats div:last-child { border-bottom: 0; }
.card-char__stats dt { color: var(--ink-dim); font: 700 0.72rem/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.card-char__stats dd { margin: 0; font-weight: 650; font-size: 0.95rem; text-align: right; }
.card-char__status dd { display: inline-flex; align-items: center; gap: 8px; color: var(--mint-ink); }

.profile__copy .section-head { margin-bottom: 20px; }
.profile__text { display: grid; gap: 14px; max-width: 38em; color: var(--chalk-muted); font-size: 1.08rem; }
.profile__text b { color: var(--chalk); }
.notes { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 34px; }
.notes__title {
  grid-column: 1 / -1;
  font: 700 1.6rem/1 var(--font-hand);
  color: var(--yellow);
  transform: rotate(-1.5deg);
}
.paper-note {
  position: relative;
  padding: 18px 16px 18px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #fffaf0;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.4s var(--ease-back);
}
.paper-note:nth-of-type(1) { transform: rotate(-2.5deg); }
.paper-note:nth-of-type(2) { transform: rotate(1.5deg) translateY(10px); }
.paper-note:nth-of-type(3) { transform: rotate(-1deg); }
.paper-note:hover { transform: rotate(0) translateY(-6px); }
.paper-note h3 { font: 700 1.55rem/1.05 var(--font-hand); letter-spacing: 0; color: var(--ink); }
.paper-note p { margin-top: 8px; color: var(--ink-muted); font-size: 0.92rem; line-height: 1.5; }
.paper-note--lined {
  background:
    linear-gradient(90deg, transparent 22px, rgba(187, 61, 28, 0.5) 22px 24px, transparent 24px),
    linear-gradient(transparent 23px, rgba(45, 85, 200, 0.2) 23px 24px) 0 10px / 100% 24px,
    #fffaf0;
  padding-left: 34px;
}
.paper-note--grid {
  background:
    linear-gradient(rgba(28, 24, 34, 0.07) 1px, transparent 1px) 0 0 / 14px 14px,
    linear-gradient(90deg, rgba(28, 24, 34, 0.07) 1px, transparent 1px) 0 0 / 14px 14px,
    #e9e2d4;
}
.paper-note--sticky { background: #ffe07a; }
.paper-note--sticky::before {
  content: "";
  position: absolute;
  top: -12px; left: 50%;
  width: 60px; height: 20px;
  margin-left: -30px;
  background: rgba(243, 238, 227, 0.7);
  transform: rotate(-4deg);
}

/* ==========================================================================
   02 · Quest log
   ========================================================================== */
.quest__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px 28px; }
.quest__head h3 { margin-top: 8px; font-size: clamp(1.5rem, 3vw, 2.2rem); }
.quest__save { color: var(--ink-dim); font: 700 0.76rem/1.3 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.quest__org { margin-top: 8px; color: var(--coral-ink); font-weight: 700; }
.quest__stamp {
  padding: 10px 16px;
  border: 3px solid var(--mint-ink);
  border-radius: 10px;
  color: var(--mint-ink);
  font: 800 0.9rem/1.05 var(--font-mono);
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(8deg);
  opacity: 0.85;
}
.quest__grid {
  display: grid;
  grid-template-columns: 1.2fr 1.1fr 0.9fr;
  gap: 18px;
  margin-top: 26px;
}
.quest__col {
  padding: 20px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}
.quest__col h4 { display: flex; align-items: center; gap: 10px; font-size: 1.12rem; letter-spacing: -0.015em; margin-bottom: 14px; }
.quest__num {
  display: grid; place-items: center;
  width: 30px; height: 30px; flex: none;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
  font: 800 0.9rem/1 var(--font-mono);
}
.quest__col .ticks li { font-size: 0.95rem; color: var(--ink-muted); }
.badges { margin-top: 26px; }
.badges__title, .ui-skills__title, .toolbelt h3, .wishlist__title {
  color: var(--fg-dim);
  font: 700 0.76rem/1.3 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.badges__list { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.badges__list li {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px 12px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fffaf0;
  font: 700 0.8rem/1.2 var(--font-display);
  text-align: center;
  transition: transform 0.3s var(--ease-back), background-color 0.2s;
}
.badges__list li:hover { transform: translateY(-5px) rotate(-3deg); background: var(--yellow); }
.badges__list svg { width: 34px; height: 34px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.quest__edu { margin-top: 22px; padding-top: 18px; border-top: 2px dashed rgba(28, 24, 34, 0.2); }
.quest__edu p + p { margin-top: 6px; color: var(--ink-muted); }
.quest__edu b { color: var(--ink); }
.hl { padding: 0 6px; background: var(--yellow); border-radius: 4px; color: var(--ink); font-weight: 700; }

/* ==========================================================================
   03 · World 1 · Games (each game is its own paper world)
   ========================================================================== */
.game {
  --accent: var(--yellow);
  --accent-tick: var(--coral-ink);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  padding: clamp(18px, 3.4vw, 40px);
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.45);
  overflow: hidden;
  isolation: isolate;
}
.game + .game { margin-top: clamp(32px, 5vw, 56px); }
.game--plane {
  background:
    linear-gradient(rgba(28, 24, 34, 0.05) 1px, transparent 1px) 0 0 / 30px 30px,
    linear-gradient(90deg, rgba(28, 24, 34, 0.05) 1px, transparent 1px) 0 0 / 30px 30px,
    linear-gradient(170deg, #cfe6f2 0%, #f7e7cf 45%, #f8d5bf 100%);
}
.game--keno {
  --accent: var(--coral);
  background:
    linear-gradient(90deg, transparent 38px, rgba(187, 61, 28, 0.35) 38px 40px, transparent 40px),
    linear-gradient(rgba(45, 85, 200, 0.12) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(170deg, #fbeee0 0%, #f8dde0 60%, #efe2f3 100%);
}
.game__world { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.doodle-cloud, .doodle-balloon { position: absolute; fill: rgba(255, 255, 255, 0.55); stroke: rgba(28, 24, 34, 0.35); stroke-width: 2.4; stroke-linejoin: round; }
.doodle-cloud--a { width: 130px; top: -26px; right: 4%; animation: drift 14s ease-in-out infinite; }
.doodle-cloud--b { width: 100px; bottom: 30px; left: 44%; animation: drift 18s ease-in-out infinite reverse; }
.doodle-balloon--a { width: 40px; top: -14px; right: 4%; fill: rgba(255, 106, 69, 0.35); animation: bob 5s ease-in-out infinite; }
.doodle-balloon--b { width: 34px; bottom: 40px; left: 47%; fill: rgba(127, 200, 255, 0.45); animation: bob 6s ease-in-out infinite 1s; }

.game__media { min-width: 0; }
@media (min-width: 961px) and (min-height: 821px) {
  .game__media { position: sticky; top: calc(var(--hud-h) + 28px); }
}
.shot {
  position: relative;
  display: block;
  border: 3px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 6px 6px 0 var(--ink);
  text-decoration: none;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.4s var(--ease);
}
.shot.is-tilting { transition: transform 0.08s linear; }
.shot__chrome { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-bottom: 2px solid var(--ink); background: #fffaf0; }
.shot__chrome i { width: 10px; height: 10px; border: 1.5px solid var(--ink); border-radius: 50%; }
.shot__chrome i:first-child { background: var(--coral); }
.shot__chrome i:nth-child(2) { background: var(--yellow); }
.shot__chrome i:nth-child(3) { background: var(--mint); }
.shot__chrome span { margin-left: 8px; color: var(--ink-dim); font: 600 0.74rem/1 var(--font-mono); }
.shot img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; transition: transform 0.6s var(--ease), opacity 0.25s; }
.shot img.is-swapping { opacity: 0; }
.shot::after { content: ""; position: absolute; inset: 0; background: rgba(28, 24, 34, 0.28); opacity: 0; transition: opacity 0.25s; }
.shot__play {
  position: absolute; z-index: 2;
  left: 50%; top: 55%;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  font: 800 1.05rem/1 var(--font-display);
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  transition: opacity 0.25s, transform 0.35s var(--ease-back);
}
.shot__play svg { width: 18px; height: 18px; fill: currentColor; }
.shot:hover img, .shot:focus-visible img { transform: scale(1.03); }
.shot:hover::after, .shot:focus-visible::after { opacity: 1; }
.shot:hover .shot__play, .shot:focus-visible .shot__play { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.thumbs { display: flex; gap: 10px; margin-top: 14px; }
.thumb {
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.25s var(--ease-back), box-shadow 0.2s;
}
.thumb img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.thumb:hover { opacity: 0.95; transform: translateY(-3px); }
.thumb[aria-pressed="true"] { opacity: 1; box-shadow: 0 4px 0 var(--ink); transform: translateY(-3px); outline: 3px solid var(--accent); outline-offset: -6px; }

.code {
  margin: 20px 0 0;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--code-bg);
  overflow: hidden;
  color: #d9d4e4;
}
.code__bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 12px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(243, 238, 227, 0.1);
  color: var(--chalk-dim);
  font: 500 0.72rem/1.2 var(--font-mono);
}
.code__bar span:last-child { font: 600 1.1rem/1 var(--font-hand); color: var(--accent); }
.code pre {
  margin: 0;
  padding: 12px 16px 10px;
  overflow-x: auto;
  font: 500 0.78rem/24px var(--font-mono);
  background: repeating-linear-gradient(transparent 0 23px, rgba(243, 238, 227, 0.05) 23px 24px) 0 12px / 100% 24px local;
}
.code code { padding: 0; background: none; font: inherit; white-space: pre; color: inherit; }
.mark {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px;
  margin-left: 10px;
  border: 1.5px solid var(--accent);
  border-radius: 50% 45% 55% 48%;
  color: var(--accent);
  font: 700 0.95rem/1 var(--font-hand);
  vertical-align: middle;
  transform: rotate(-8deg);
}
.code__notes {
  display: grid; gap: 4px;
  padding: 10px 16px 14px;
  border-top: 1px dashed rgba(243, 238, 227, 0.2);
  font: 600 1.18rem/1.25 var(--font-hand);
  color: var(--accent);
}
.code__notes li { display: flex; align-items: baseline; gap: 10px; }
.code__notes .mark { margin: 0; flex: none; }

.game__genre {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font: 700 0.78rem/1.3 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.game__genre span { padding: 4px 8px; border: 2px solid var(--ink); border-radius: 7px; background: var(--accent); color: var(--ink); }
.game__body h3 { margin-top: 14px; font-size: clamp(2rem, 3.8vw, 3rem); letter-spacing: -0.04em; }
.game__tagline { margin-top: 4px; font: 700 1.7rem/1.1 var(--font-hand); color: var(--coral-ink); }
.game--keno .game__tagline { color: var(--blue-ink); }
.game__summary { margin-top: 14px; color: var(--fg-muted); }
.game__body .chips { margin-top: 18px; }
.game__body .chips li { background: rgba(255, 255, 255, 0.55); }
.game__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 20px 0 0; }
.game__stats div {
  display: flex; flex-direction: column-reverse; justify-content: flex-end;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
}
.game__stats dt { color: var(--fg-dim); font: 600 0.7rem/1.3 var(--font-mono); }
.game__stats dd { margin: 0 0 4px; font: 800 1.6rem/1 var(--font-display); letter-spacing: -0.03em; }
.game__stats--dark div { border-color: rgba(243, 238, 227, 0.2); background: rgba(243, 238, 227, 0.04); }
.game__stats--dark dd { color: var(--mint); }

.tabs { margin-top: 22px; border: 2.5px solid var(--ink); border-radius: 16px; background: rgba(255, 255, 255, 0.7); overflow: hidden; }
.tabs__list { display: flex; gap: 4px; padding: 5px; border-bottom: 2px solid var(--ink); background: rgba(28, 24, 34, 0.05); }
.tabs__list button {
  flex: 1 1 0;
  min-height: 40px; padding: 0 8px;
  border: 0; border-radius: 10px;
  background: transparent;
  color: var(--ink-muted);
  font: 700 0.9rem/1.1 var(--font-display);
  cursor: pointer;
}
.tabs__list button:hover { color: var(--ink); background: rgba(28, 24, 34, 0.06); }
.tabs__list button[aria-selected="true"] { background: var(--ink); color: var(--accent); }
.tabs__panel { padding: 16px 18px 18px; }
.tabs__panel:focus-visible { outline-offset: -4px; }
.tabs__panel ul { display: grid; gap: 10px; }
.tabs__panel li { position: relative; padding-left: 22px; color: var(--ink-muted); font-size: 0.97rem; line-height: 1.55; }
.tabs__panel li::before {
  content: "";
  position: absolute; left: 2px; top: 0.6em;
  width: 9px; height: 9px;
  border: 2px solid var(--ink);
  background: var(--accent);
  transform: rotate(45deg);
}
.game__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* ==========================================================================
   04 · World 2 · Game UI lab
   ========================================================================== */
.world--ui { --accent: #b99bff; }
.lab {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(18px, 2.6vw, 32px);
  align-items: start;
}
.lab__stage { min-width: 0; }
.lab__toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.lab__orient { display: flex; gap: 4px; padding: 4px; border: 1.5px solid rgba(243, 238, 227, 0.18); border-radius: 12px; }
.lab__orient button {
  min-height: 34px; padding: 0 12px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--chalk-muted);
  font: 650 0.84rem/1 var(--font-display); cursor: pointer;
}
.lab__orient button[aria-pressed="true"] { background: #b99bff; color: var(--ink); }
.lab__credits { color: var(--chalk-dim); font: 600 0.74rem/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }

/* device frame: landscape fills the column, portrait is phone-width */
.lab__device {
  margin: 0 auto;
  padding: 10px;
  border: 1.5px solid rgba(243, 238, 227, 0.16);
  border-radius: 28px;
  background: #0b0a10;
  box-shadow: var(--shadow);
  transition: max-width 0.5s var(--ease);
  max-width: 100%;
  /* the slot layout responds to this frame, not the window */
  container: slot / inline-size;
}
.lab__device[data-orient="portrait"] { max-width: 360px; border-radius: 34px; padding: 12px 10px; }

/* ---------- the slot (paper skin) ---------- */
.slot {
  --line: rgba(28, 24, 34, 0.14);
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  color: var(--ink);
  background:
    linear-gradient(rgba(28, 24, 34, 0.05) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, rgba(28, 24, 34, 0.05) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(165deg, #f7ecd8, #f4dfe6);
  outline: none;
  overflow: hidden;
}
.slot__hud { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.slot__logo { font: 800 1.25rem/1 var(--font-display); letter-spacing: -0.03em; }
.slot__logo span { color: var(--coral-ink); font: 700 1.45rem/1 var(--font-hand); letter-spacing: 0; }
.slot__meters { display: flex; gap: 6px; margin: 0; }
.slot__meters div {
  min-width: 74px;
  padding: 5px 10px 6px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fffaf0;
  box-shadow: 0 3px 0 var(--ink);
  text-align: center;
}
.slot__meters dt { color: var(--ink-dim); font: 700 0.6rem/1.2 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.slot__meters dd { margin: 0; font: 800 1.12rem/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.slot__meter-win { transition: background-color 0.3s; }
.slot.has-win .slot__meter-win { background: var(--yellow); }

.slot__board { position: relative; min-width: 0; }
.slot__reels {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--ink);
}
.slot-reel {
  position: relative;
  aspect-ratio: 1 / 3;
  max-height: 330px;
  border-radius: 10px;
  overflow: hidden;
  background: #fffaf0;
  transition: box-shadow 0.3s;
}
.slot-reel::after {
  /* soft shading top and bottom, like a curved drum */
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(28, 24, 34, 0.18), transparent 18%, transparent 82%, rgba(28, 24, 34, 0.18));
}
.slot-reel.is-spinning .slot-strip { filter: blur(1.2px); }
.slot-reel.is-anticipating { box-shadow: 0 0 0 3px var(--yellow), 0 0 26px 4px rgba(255, 200, 61, 0.7); animation: pulse 0.5s ease-in-out infinite alternate; }
.slot-reel.is-landed .slot-strip { animation: land 0.3s var(--ease-back); }
.slot-strip { display: flex; flex-direction: column; will-change: transform; }
.slot-cell { position: relative; flex: 1 1 0; display: grid; place-items: center; min-height: 0; }
.slot-cell + .slot-cell { border-top: 1.5px dashed rgba(28, 24, 34, 0.12); }
.slot-cell svg { width: 66%; height: 66%; transition: transform 0.3s var(--ease-back); }
.slot-cell.is-win { background: rgba(255, 200, 61, 0.35); }
.slot-cell.is-win svg { animation: bounce 0.6s var(--ease-back) infinite alternate; }
.slot__lines { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; overflow: visible; }
.slot__lines polyline { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; stroke-dasharray: 600; stroke-dashoffset: 600; animation: drawline 0.5s var(--ease) forwards; filter: drop-shadow(0 0 2px #fff); }

.slot__msg { margin-top: 8px; min-height: 1.4em; text-align: center; color: var(--ink-muted); font: 700 1.25rem/1.2 var(--font-hand); }
.slot[data-state="WIN"] .slot__msg { color: var(--coral-ink); }
.slot__free {
  position: absolute; top: -6px; left: 50%;
  padding: 4px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  font: 700 0.8rem/1.2 var(--font-display);
  transform: translate(-50%, -50%);
  white-space: nowrap;
  z-index: 3;
}
.slot__free[hidden] { display: none; }

/* big win / free spin banner */
.slot__banner {
  position: absolute; inset: -4px;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  border-radius: 16px;
  background: rgba(28, 24, 34, 0.82);
  color: var(--paper);
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  animation: pop 0.35s var(--ease-back);
}
.slot__banner[hidden] { display: none; }
.slot__banner-title {
  font: 800 clamp(1.8rem, 9cqi, 3.4rem)/1 var(--font-display);
  letter-spacing: -0.03em;
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--coral-ink);
  transform: rotate(-4deg);
  animation: wobble 0.9s ease-in-out infinite alternate;
}
.slot__banner[data-tier="mega"] .slot__banner-title { color: var(--coral); text-shadow: 3px 3px 0 var(--yellow); }
.slot__banner[data-tier="feature"] .slot__banner-title { color: var(--mint); text-shadow: 3px 3px 0 var(--blue-ink); }
.slot__banner-amount { font: 800 clamp(1.4rem, 6cqi, 2.4rem)/1 var(--font-display); font-variant-numeric: tabular-nums; }
.slot__banner-hint { color: rgba(243, 238, 227, 0.65); font: 600 1.05rem/1 var(--font-hand); }
.slot__confetti i {
  position: absolute; top: -10%;
  width: 8px; height: 12px;
  background: var(--yellow);
  animation: fall 1.8s linear infinite;
}
.slot__confetti i:nth-child(3n) { background: var(--coral); }
.slot__confetti i:nth-child(3n + 1) { background: var(--mint); }
.slot__confetti i:nth-child(1) { left: 6%; animation-delay: 0s; }
.slot__confetti i:nth-child(2) { left: 16%; animation-delay: 0.6s; }
.slot__confetti i:nth-child(3) { left: 27%; animation-delay: 0.2s; }
.slot__confetti i:nth-child(4) { left: 38%; animation-delay: 1.1s; }
.slot__confetti i:nth-child(5) { left: 49%; animation-delay: 0.4s; }
.slot__confetti i:nth-child(6) { left: 60%; animation-delay: 0.9s; }
.slot__confetti i:nth-child(7) { left: 70%; animation-delay: 0.1s; }
.slot__confetti i:nth-child(8) { left: 80%; animation-delay: 1.3s; }
.slot__confetti i:nth-child(9) { left: 89%; animation-delay: 0.5s; }
.slot__confetti i:nth-child(10) { left: 95%; animation-delay: 0.8s; }

/* controls */
.slot__controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.slot__bet { display: flex; align-items: center; gap: 8px; }
.slot__bet-label { font: 700 0.72rem/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.slot__round {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: #fffaf0;
  color: var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  font: 800 1.3rem/1 var(--font-display);
  cursor: pointer;
}
.slot__round:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.slot__spin {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 8.5em; min-height: 58px;
  padding: 0 20px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--coral);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  font: 800 1.25rem/1 var(--font-display);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s;
}
.slot__spin svg { width: 22px; height: 22px; }
.slot__spin:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.slot__spin:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.slot[data-state="SPINNING"] .slot__spin svg, .slot[data-state="ANTICIPATION"] .slot__spin svg, .slot[data-state="FREE_SPINS"] .slot__spin svg { animation: spinicon 0.7s linear infinite; }
.slot__extra { display: flex; gap: 6px; }
.slot__toggle {
  min-height: 38px; padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fffaf0;
  color: var(--ink);
  font: 700 0.82rem/1 var(--font-display);
  cursor: pointer;
}
.slot__toggle[aria-pressed="true"] { background: var(--mint); }
.slot__toggle[hidden] { display: none; }
.slot button:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.slot button:focus-visible { outline: 3px solid var(--blue-ink); outline-offset: 2px; }

/* wide container (landscape): controls sit in a column beside the reels */
@container slot (min-width: 600px) {
  .slot { grid-template-columns: minmax(0, 1fr) 150px; grid-template-areas: "hud hud" "board controls"; align-items: center; column-gap: 16px; }
  .slot__hud { grid-area: hud; }
  .slot__board { grid-area: board; }
  .slot__controls { grid-area: controls; flex-direction: column; justify-content: center; gap: 14px; }
  .slot__spin { min-width: 0; width: 132px; height: 132px; padding: 0; flex-direction: column; border-radius: 50%; font-size: 1.3rem; }
  .slot__spin svg { width: 30px; height: 30px; }
  .slot__extra { flex-direction: column; width: 100%; }
  .slot-reel { aspect-ratio: 1 / 1.25; max-height: none; }
}
@container slot (max-width: 480px) {
  .slot { padding: 10px; }
  .slot__meters div { min-width: 0; flex: 1; padding: 4px 6px 5px; }
  .slot__meters { width: 100%; }
  .slot__controls { flex-wrap: wrap; justify-content: center; }
  .slot__spin { order: -1; flex: 1 1 100%; }
  .slot__msg { font-size: 1.1rem; }
}

.lab__paytable { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 14px; }
.lab__paytable li { display: flex; align-items: center; gap: 6px; color: var(--chalk-muted); font-size: 0.84rem; }
.lab__paytable svg { width: 24px; height: 24px; }
.lab__paytable b { color: var(--chalk); font-family: var(--font-mono); font-size: 0.8rem; }

/* ---------- under the hood (screen skin) ---------- */
.hood {
  min-width: 0;
  border: 1.5px solid rgba(185, 155, 255, 0.3);
  border-radius: 20px;
  background: var(--code-bg);
  overflow: hidden;
  font-family: var(--font-mono);
}
.hood__bar { display: flex; align-items: center; gap: 6px; padding: 11px 14px; border-bottom: 1px solid rgba(243, 238, 227, 0.08); background: #16141d; color: var(--chalk-dim); font-size: 0.74rem; }
.hood__bar i { width: 9px; height: 9px; border-radius: 50%; background: #3a3544; }
.hood__bar i:first-child { background: var(--coral); }
.hood__bar i:nth-child(2) { background: var(--yellow); }
.hood__bar i:nth-child(3) { background: var(--mint); }
.hood__bar span { margin-left: 8px; }
.hood__body { padding: 16px 16px 18px; }
.hood__title { margin: 18px 0 10px; color: #cdb8ff; font: 700 0.72rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; }
.hood__title:first-child { margin-top: 0; }
.fsm { display: flex; flex-wrap: wrap; gap: 6px; }
.fsm li {
  position: relative;
  padding: 6px 9px;
  border: 1.5px solid rgba(243, 238, 227, 0.14);
  border-radius: 8px;
  color: var(--chalk-dim);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.25s var(--ease-back);
}
.fsm li.is-on { border-color: #b99bff; background: #b99bff; color: var(--ink); transform: translateY(-2px); box-shadow: 0 0 16px rgba(185, 155, 255, 0.5); }
.fsm li[data-state-node="ANTICIPATION"].is-on { background: var(--yellow); border-color: var(--yellow); box-shadow: 0 0 16px rgba(255, 200, 61, 0.6); }
.fsm li[data-state-node="FREE_SPINS"].is-on { background: var(--mint); border-color: var(--mint); box-shadow: 0 0 16px rgba(75, 224, 160, 0.5); }
.hood__log { display: grid; gap: 4px; min-height: 12.5em; font-size: 0.76rem; line-height: 1.45; color: var(--chalk-muted); }
.hood__log li { display: flex; gap: 10px; padding: 3px 0; border-bottom: 1px dashed rgba(243, 238, 227, 0.07); animation: logIn 0.3s var(--ease); }
.hood__log li:first-child { color: var(--chalk); }
.hood__log li > span:first-child { flex: none; color: #6f6979; }
.hood__log li > span:last-child { min-width: 0; }
.hood__log b { color: var(--yellow); font-weight: 700; }
.hood__log li.is-win b { color: var(--mint); }
.hood__log li.is-feature { color: var(--mint); }
.hood__math { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; }
.hood__math div { padding: 8px 10px; border: 1px solid rgba(243, 238, 227, 0.1); border-radius: 10px; }
.hood__math dt { color: var(--chalk-dim); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; }
.hood__math dd { margin: 2px 0 0; color: var(--chalk); font: 700 1rem/1.2 var(--font-mono); }

.lab__notes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: clamp(24px, 3.5vw, 36px); }
.lab-note { padding: 16px; border: 1.5px solid rgba(243, 238, 227, 0.12); border-radius: 16px; background: var(--desk-2); }
.lab-note h3 { font-size: 1.05rem; letter-spacing: -0.01em; color: var(--chalk); }
.lab-note h3::before { content: "▸ "; color: #b99bff; }
.lab-note p { margin-top: 6px; color: var(--chalk-muted); font-size: 0.9rem; line-height: 1.5; }
.lab__footnote { margin-top: 16px; color: var(--chalk-dim); font-size: 0.88rem; }
.lab__footnote code { background: rgba(185, 155, 255, 0.14); }

@keyframes pulse { to { box-shadow: 0 0 0 3px var(--yellow), 0 0 40px 10px rgba(255, 200, 61, 0.9); } }
@keyframes land { 0% { transform: translateY(-4%); } 100% { transform: translateY(0); } }
@keyframes bounce { to { transform: scale(1.12) rotate(-4deg); } }
@keyframes drawline { to { stroke-dashoffset: 0; } }
@keyframes wobble { to { transform: rotate(3deg) scale(1.06); } }
@keyframes fall { to { transform: translateY(520px) rotate(540deg); } }
@keyframes spinicon { to { transform: rotate(360deg); } }
@keyframes logIn { from { opacity: 0; transform: translateX(-8px); } }

/* ==========================================================================
   05 · World 3 · Web (screen side)
   ========================================================================== */
.world--web {
  position: relative;
  --accent: var(--mint);
  --accent-tick: var(--mint);
}
.world--web::before {
  content: "";
  position: absolute;
  inset: 60px 0 -40px;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(75, 224, 160, 0.05) 1px, transparent 1px) 0 0 / 100% 4px,
    radial-gradient(ellipse 70% 50% at 50% 30%, rgba(75, 224, 160, 0.07), transparent 70%);
}
.world--web .kicker span { background: var(--mint); }
.web-card {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding: clamp(18px, 3.2vw, 36px);
  border: 1.5px solid rgba(75, 224, 160, 0.28);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(75, 224, 160, 0.06), transparent 40%), var(--desk-2);
}
.web-card + .web-card { margin-top: clamp(24px, 4vw, 40px); }
.web-card__info h3 { margin-top: 14px; font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: -0.04em; }
.web-card__info > p:not(.game__genre) { margin-top: 12px; color: var(--chalk-muted); }
.web-card__info .ticks, .web-card__info .game__stats { margin-top: 18px; }
.web-card .game__genre span { border-color: var(--mint); background: rgba(75, 224, 160, 0.15); color: var(--mint); }
.ticks--dark li { color: var(--chalk-muted); }
.ticks--dark li::before { border-color: rgba(243, 238, 227, 0.5); }
.web-card__note { margin-top: 16px !important; font: 600 1.15rem/1.25 var(--font-hand) !important; color: var(--yellow) !important; }
.web-card--tools { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }

/* live responsive preview: the real site in a device frame, auto-touring */
.device { min-width: 0; }
.device__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.device__tabs, .device__play { display: flex; gap: 4px; padding: 4px; border: 1.5px solid rgba(243, 238, 227, 0.18); border-radius: 12px; }
.device__tabs button, .device__btn {
  min-height: 34px; padding: 0 12px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--chalk-muted);
  font: 650 0.84rem/1 var(--font-display); cursor: pointer;
  white-space: nowrap;
}
.device__tabs button:hover, .device__btn:hover { color: var(--chalk); }
.device__tabs button[aria-pressed="true"] { background: var(--mint); color: var(--ink); }
.device.is-controlled [data-take-control] { background: var(--yellow); color: var(--ink); }
.device__btn[hidden] { display: none; }
.device__viewport {
  position: relative;
  height: clamp(420px, 46vw, 540px);
  border: 1.5px solid rgba(243, 238, 227, 0.14);
  border-radius: 18px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 55%, rgba(75, 224, 160, 0.12), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(243, 238, 227, 0.08) 1px, transparent 0) 0 0 / 16px 16px,
    var(--code-bg);
  overflow: hidden;
}
.device__frame {
  position: absolute;
  top: 16px; left: 50%;
  display: flex;
  flex-direction: column;
  width: calc(var(--dw, 390) * 1px);
  height: calc((100% - 32px) / var(--scale, 1));
  border: 10px solid #26222e;
  border-radius: 38px;
  background: #26222e;
  box-shadow: 0 0 0 2px #3a3544, 0 30px 60px -20px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  transform: translateX(-50%) scale(var(--scale, 1));
  transform-origin: top center;
  transition: width 0.5s var(--ease), transform 0.5s var(--ease), height 0.5s var(--ease), border-radius 0.4s, border-width 0.4s;
}
.device__chrome { position: relative; flex: none; display: flex; align-items: center; justify-content: center; height: 26px; background: #26222e; }
.device__notch { width: 110px; height: 22px; border-radius: 0 0 14px 14px; background: #0c0b11; margin-top: -6px; }
.device__dots, .device__url { display: none; }
.device__screen { position: relative; flex: 1; min-height: 0; border-radius: 26px; background: var(--desk); overflow: hidden; }
.device__screen iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  pointer-events: none;           /* page scrolling passes over the preview while it tours */
  opacity: 0;
  transition: opacity 0.6s;
}
.device.is-ready .device__screen iframe { opacity: 1; }
.device.is-controlled .device__screen iframe { pointer-events: auto; }
.device.is-controlled .device__frame { box-shadow: 0 0 0 3px var(--yellow), 0 30px 60px -20px rgba(0, 0, 0, 0.8); }

/* tablet: slim even bezel with a camera dot */
.device[data-kind="tablet"] .device__frame { border-width: 14px; border-radius: 30px; }
.device[data-kind="tablet"] .device__chrome { height: 10px; }
.device[data-kind="tablet"] .device__notch { width: 8px; height: 8px; margin: -12px 0 0; border-radius: 50%; background: #3a3544; }
.device[data-kind="tablet"] .device__screen { border-radius: 12px; }

/* desktop: browser window */
.device[data-kind="desktop"] .device__frame { border-width: 0; border-radius: 14px; background: #1b1822; }
.device[data-kind="desktop"] .device__chrome { justify-content: flex-start; gap: 16px; height: 44px; padding: 0 16px; border-bottom: 1px solid #3a3544; }
.device[data-kind="desktop"] .device__notch { display: none; }
.device[data-kind="desktop"] .device__dots { display: flex; gap: 8px; }
.device[data-kind="desktop"] .device__dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--coral); }
.device[data-kind="desktop"] .device__dots i:nth-child(2) { background: var(--yellow); }
.device[data-kind="desktop"] .device__dots i:nth-child(3) { background: var(--mint); }
.device[data-kind="desktop"] .device__url {
  display: block; flex: 1; max-width: 640px;
  padding: 7px 16px;
  border-radius: 10px;
  background: #0c0b11;
  color: var(--chalk-dim);
  font: 500 15px/1.2 var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.device[data-kind="desktop"] .device__screen { border-radius: 0; }

/* loading skeleton (shown until the iframe has painted) */
.device__skeleton { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px; padding: 26px 22px; }
.device.is-ready .device__skeleton { opacity: 0; transition: opacity 0.4s 0.3s; }
.sk {
  display: block;
  border-radius: 10px;
  background: linear-gradient(90deg, #1f1b27 0%, #2c2736 40%, #1f1b27 80%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
.sk--bar { height: 36px; }
.sk--pill { width: 55%; height: 22px; border-radius: 999px; margin-top: 18px; }
.sk--title { width: 88%; height: 54px; background-color: #3a3222; }
.sk--short { width: 70%; }
.sk--text { width: 94%; height: 14px; }
.sk--card { flex: 1; min-height: 80px; margin-top: 8px; border-radius: 18px; }

.device__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; margin-top: 12px; }
.device__now { display: inline-flex; align-items: center; gap: 10px; color: var(--chalk); font: 600 0.84rem/1.3 var(--font-mono); }
.device__live { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--chalk-dim); }
.device.is-ready .device__live { background: var(--coral); box-shadow: 0 0 0 0 rgba(255, 106, 69, 0.6); animation: live 1.8s infinite; }
.device.is-ready.is-touring .device__live { background: var(--mint); animation-name: ping; }
.note--device {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 8px;
  color: var(--mint);
  font-size: 1.3rem;
  transform: rotate(-1.5deg);
}
.note--device .doodle { width: 26px; height: 26px; margin-top: -10px; }
@keyframes shimmer { to { background-position: -300% 0; } }
@keyframes live { 70%, 100% { box-shadow: 0 0 0 8px rgba(255, 106, 69, 0); } }

/* spine tool flow illustration */
.flow { display: grid; gap: 16px; min-width: 0; }
.flow__app { border: 1.5px solid rgba(243, 238, 227, 0.16); border-radius: 16px; overflow: hidden; background: var(--code-bg); }
.flow__bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid rgba(243, 238, 227, 0.08); background: #16141d; color: var(--chalk-dim); font: 500 0.74rem/1 var(--font-mono); }
.flow__bar i { width: 9px; height: 9px; border-radius: 50%; background: #3a3544; }
.flow__bar span { margin-left: 8px; }
.flow__body { display: grid; grid-template-columns: 1fr 1.4fr; grid-template-rows: auto auto; gap: 12px; padding: 14px; }
.flow__drop {
  display: flex; flex-direction: column; gap: 8px; justify-content: center;
  padding: 12px;
  border: 2px dashed rgba(243, 238, 227, 0.2);
  border-radius: 12px;
  transition: border-color 0.3s, background-color 0.3s;
}
.flow__file {
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(243, 238, 227, 0.07);
  color: var(--chalk-muted);
  font: 600 0.72rem/1.2 var(--font-mono);
  opacity: 0; transform: translateY(-14px);
  transition: opacity 0.4s, transform 0.5s var(--ease-back), background-color 0.3s, color 0.3s;
}
.flow__stage {
  position: relative;
  display: grid; place-items: center;
  min-height: 130px;
  border-radius: 12px;
  background:
    linear-gradient(rgba(243, 238, 227, 0.05) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, rgba(243, 238, 227, 0.05) 1px, transparent 1px) 0 0 / 16px 16px,
    #15131b;
}
.flow__rig { position: relative; width: 70px; height: 90px; opacity: 0.25; transition: opacity 0.4s; }
.flow__rig i { position: absolute; left: 50%; border: 3px solid var(--mint); border-radius: 50%; }
.flow__rig i:nth-child(1) { top: 0; width: 34px; height: 34px; margin-left: -17px; }
.flow__rig i:nth-child(2) { top: 36px; width: 12px; height: 38px; margin-left: -6px; border-radius: 6px; }
.flow__rig i:nth-child(3) { top: 44px; width: 64px; height: 8px; margin-left: -32px; border-radius: 4px; transform-origin: center; }
.flow__meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.flow__meta span { padding: 5px 9px; border-radius: 7px; background: rgba(243, 238, 227, 0.06); color: var(--chalk-dim); font: 600 0.72rem/1.2 var(--font-mono); opacity: 0.35; transition: opacity 0.4s; }
.flow__meta b { color: var(--mint); }
.flow__controls { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.flow__btn { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: rgba(243, 238, 227, 0.08); color: var(--chalk); font-size: 0.8rem; }
.flow__scrub { position: relative; flex: 1; height: 5px; border-radius: 5px; background: rgba(243, 238, 227, 0.12); overflow: hidden; }
.flow__scrub i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--mint); }
.flow__steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; counter-reset: st; }
.flow__steps li {
  padding: 10px 10px 12px;
  border: 1.5px solid rgba(243, 238, 227, 0.14);
  border-radius: 12px;
  color: var(--chalk-dim);
  font-size: 0.84rem;
  line-height: 1.35;
  counter-increment: st;
  transition: border-color 0.3s, color 0.3s, background-color 0.3s;
}
.flow__steps li::before { content: "0" counter(st); display: block; margin-bottom: 4px; font: 700 0.7rem/1 var(--font-mono); color: var(--chalk-dim); }
.flow__steps b { display: block; color: var(--chalk-muted); }
.flow__steps li.is-on { border-color: var(--mint); background: rgba(75, 224, 160, 0.08); color: var(--chalk-muted); }
.flow__steps li.is-on b, .flow__steps li.is-on::before { color: var(--mint); }
/* flow states set from JS: data-step 0..3 */
.flow[data-step="0"] .flow__drop, .flow[data-step] .flow__drop { border-color: rgba(75, 224, 160, 0.4); }
.flow:is([data-step="0"], [data-step="1"], [data-step="2"], [data-step="3"]) .flow__file { opacity: 1; transform: none; }
.flow:is([data-step="1"], [data-step="2"], [data-step="3"]) .flow__file { background: rgba(75, 224, 160, 0.16); color: var(--mint); }
.flow:is([data-step="2"], [data-step="3"]) .flow__rig { opacity: 1; animation: sway 1.2s ease-in-out infinite; }
.flow:is([data-step="2"], [data-step="3"]) .flow__rig i:nth-child(3) { animation: flap 0.6s ease-in-out infinite alternate; }
.flow:is([data-step="2"], [data-step="3"]) .flow__scrub i { animation: scrub 2.4s linear infinite; }
.flow[data-step="3"] .flow__meta span { opacity: 1; }

/* ==========================================================================
   06 · Inventory (venn)
   ========================================================================== */
.venn {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 0.9fr 1fr;
  gap: 20px;
  align-items: center;
  min-height: 460px;
  padding: 44px 5%;
}
.venn__rings {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  max-width: none;
  fill: none;
  stroke-width: 3;
  stroke-dasharray: 2 10;
  stroke-linecap: round;
  pointer-events: none;
}
.venn__rings ellipse:first-child { stroke: var(--yellow); fill: rgba(255, 200, 61, 0.05); }
.venn__rings ellipse:last-child { stroke: var(--mint); fill: rgba(75, 224, 160, 0.05); }
.venn__set { position: relative; }
.venn__set h3 {
  margin-bottom: 14px;
  font: 700 2rem/1 var(--font-hand);
  letter-spacing: 0;
}
.venn__set--game h3 { color: var(--yellow); }
.venn__set--web h3 { color: var(--mint); text-align: right; }
.venn__set--both h3 { color: var(--chalk); text-align: center; }
.venn__set--both .chips { justify-content: center; }
.venn__set--web .chips { justify-content: flex-end; }
.venn__set--game .chips li.is-core { background: var(--yellow); }
.venn__set--web .chips li.is-core { background: var(--mint); }
.venn__set--both .chips li.is-core { background: var(--chalk); }
.toolbelt {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}
.toolbelt > div { padding: 18px; border: 1.5px solid rgba(243, 238, 227, 0.14); border-radius: 18px; background: var(--desk-2); }
.toolbelt .chips { margin-top: 12px; }

/* ==========================================================================
   07 · Continue? (contact)
   ========================================================================== */
.contact { padding-bottom: clamp(60px, 9vw, 110px); }
.continue {
  position: relative;
  padding: clamp(26px, 5vw, 60px);
  border: 3px solid var(--ink);
  border-radius: 30px;
  background:
    linear-gradient(rgba(28, 24, 34, 0.05) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(28, 24, 34, 0.05) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--paper);
  box-shadow: 12px 12px 0 var(--yellow);
}
.continue__title {
  margin-top: 14px;
  font-size: clamp(3.2rem, 11vw, 7.5rem);
  line-height: 0.9;
  letter-spacing: -0.06em;
}
.continue__q { display: inline-block; color: var(--coral-ink); animation: nod 1.6s var(--ease) infinite; }
.continue__lead { margin-top: 16px; max-width: 34em; color: var(--ink-muted); font-size: 1.12rem; }
.continue__grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); margin-top: 30px; align-items: start; }
.continue__email { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.continue__email a {
  font: 800 clamp(1.1rem, 3.4vw, 2.1rem)/1.15 var(--font-display);
  letter-spacing: -0.03em;
  text-decoration: underline;
  text-decoration-color: var(--yellow);
  text-decoration-thickness: 5px;
  text-underline-offset: 6px;
  overflow-wrap: break-word;
  min-width: 0;
}
.continue__email a:hover { text-decoration-color: var(--coral); }
.copy-btn {
  min-height: 40px; padding: 0 16px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: #fffaf0; color: var(--ink);
  font: 700 0.86rem/1 var(--font-mono); cursor: pointer;
}
.copy-btn:hover { background: var(--ink); color: var(--paper); }
.copy-btn.is-done { background: var(--mint); }
.continue__buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.continue__buttons .btn--ghost { background: #fffaf0; border-color: var(--ink); }
.continue__list { display: flex; flex-wrap: wrap; gap: 14px 36px; margin-top: 24px; padding-top: 18px; border-top: 2px dashed rgba(28, 24, 34, 0.2); }
.continue__list li { display: flex; flex-direction: column; gap: 4px; }
.continue__list li > span:first-child { color: var(--ink-dim); font: 700 0.72rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; }
.continue__list a, .continue__list li > span + span { font-weight: 700; text-decoration: none; }
.continue__list a:hover { text-decoration: underline; }
.wishlist {
  position: relative;
  padding: 22px 20px 20px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #ffe07a;
  box-shadow: 6px 6px 0 rgba(28, 24, 34, 0.2);
  transform: rotate(2deg);
}
.wishlist__title { color: var(--ink-muted); }
.wishlist ul { display: grid; gap: 10px; margin-top: 14px; }
.wishlist li {
  position: relative;
  padding-left: 34px;
  font: 700 1.55rem/1.1 var(--font-hand);
}
.wishlist li::before {
  content: "";
  position: absolute; left: 0; top: 2px;
  width: 22px; height: 22px;
  border: 2.5px solid var(--ink);
  border-radius: 4px;
}
.wishlist li::after {
  content: "";
  position: absolute; left: 6px; top: -2px;
  width: 9px; height: 18px;
  border: solid var(--coral-ink);
  border-width: 0 4px 4px 0;
  transform: rotate(40deg);
}
.note--hi {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 16px;
  color: var(--coral-ink);
  font-size: 1.6rem;
  transform: rotate(-4deg);
}
.note--hi .doodle { width: 44px; height: 22px; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid rgba(243, 238, 227, 0.1); }
.footer__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 24px;
  padding-block: 26px;
  color: var(--chalk-dim);
  font: 500 0.82rem/1.5 var(--font-mono);
}
.footer__sign { font: 700 2rem/1 var(--font-hand); color: var(--yellow); transform: rotate(-4deg); }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--yellow); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 180;
  padding: 12px 20px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  font: 700 0.95rem/1.2 var(--font-display);
  transform: translate(-50%, 160%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s var(--ease-back), opacity 0.3s;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

/* ---------- reveal + heading letters ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: var(--delay, 0s); }
.js .reveal.is-in { opacity: 1; transform: none; }
.js .card-char.reveal.is-in { transform: rotate(-2deg); }
.js .card-char.reveal.is-in:hover { transform: rotate(0); }
.split .word { display: inline-block; white-space: nowrap; }
.split .char { display: inline-block; transition: transform 0.6s var(--ease), opacity 0.6s var(--ease), color 0.2s; transition-delay: calc(var(--i) * 22ms); }
.js .reveal:not(.is-in) .split .char { opacity: 0; transform: translateY(0.7em) rotate(10deg); }
.split.is-done .char { transition-delay: 0s; transition-duration: 0.25s; }
.split.is-done .char:hover { transform: translateY(-0.14em) rotate(-8deg); color: var(--yellow); }
.sheet .split.is-done .char:hover, .continue .split.is-done .char:hover { color: var(--coral-ink); }

/* ---------- keyframes ---------- */
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(75, 224, 160, 0.55); } 70%, 100% { box-shadow: 0 0 0 9px rgba(75, 224, 160, 0); } }
@keyframes blink { to { visibility: hidden; } }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
@keyframes ring { 0% { transform: scale(0.7); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
@keyframes drift { 50% { transform: translateX(-18px); } }
@keyframes bob { 50% { transform: translateY(-10px) rotate(4deg); } }
@keyframes nod { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-14deg); } 85% { transform: rotate(10deg); } }
@keyframes sway { 50% { transform: rotate(6deg) translateY(-4px); } }
@keyframes flap { to { transform: rotate(-18deg); } }
@keyframes scrub { to { width: 100%; } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1180px) {
  .hud__nav { display: none; }
  .menu-btn { display: inline-flex; }
  .hud__level { margin-left: auto; }
  .carts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 16px; }
  .quest__grid { grid-template-columns: 1fr 1fr; }
  .quest__col:first-child { grid-column: span 2; }
  .badges__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .title__grid, .profile__grid, .game, .lab, .web-card, .web-card--tools, .continue__grid { grid-template-columns: 1fr; }
  .lab__notes { grid-template-columns: 1fr 1fr; }
  .seam { max-width: 640px; }
  .card-char { max-width: 420px; }
  .game__media { max-width: 640px; }
  .device, .flow { max-width: 640px; }
  .venn { grid-template-columns: 1fr; min-height: 0; padding: 0; gap: 16px; }
  .venn__rings { display: none; }
  .venn__set { padding: 20px; border: 2px dashed rgba(243, 238, 227, 0.2); border-radius: 20px; }
  .venn__set--game { border-color: rgba(255, 200, 61, 0.5); }
  .venn__set--web { border-color: rgba(75, 224, 160, 0.5); }
  .venn__set--web h3, .venn__set--both h3 { text-align: left; }
  .venn__set--web .chips, .venn__set--both .chips { justify-content: flex-start; }
  .wishlist { max-width: 420px; }
}

@media (max-width: 720px) {
  .hud__level { display: none; }
  .hud__actions { margin-left: auto; }
  .icon-btn { padding: 0 11px; }
  .icon-btn__label { display: none; }
  .carts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes { grid-template-columns: 1fr; gap: 16px; }
  .paper-note:nth-of-type(2) { transform: rotate(1.5deg); }
  .quest__grid { grid-template-columns: 1fr; }
  .quest__col:first-child { grid-column: auto; }
  .flow__steps { grid-template-columns: 1fr 1fr; }
  .toolbelt { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .role { white-space: normal; }
  .role--web { font-size: 0.74em; }
  .title__h1 { font-size: clamp(2.1rem, 10.5vw, 2.8rem); }
  .title__actions .btn--yellow, .title__actions .btn--ghost { flex: 1 1 auto; }
  .seam__stage { border-radius: 18px; box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45); }
  .seam__switch { width: 100%; }
  .seam__switch button { flex: 1; padding: 0 6px; }
  .editor__code { padding: 12px; font-size: 0.66rem; }
  .crash__bar { padding: 10px 14px; }
  .crash__readout { top: 10px; left: 14px; }
  .crash__controls { flex-wrap: wrap; padding: 12px 14px 8px; }
  .crash__btn { flex: 1 1 100%; }
  .crash__score { flex-direction: row; gap: 16px; margin: 0; text-align: left; }
  .crash__history { padding: 0 14px 12px; }
  .cart a { padding: 16px 10px 12px; }
  .cart__name { font-size: 0.94rem; }
  .badges__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .badges__list li:last-child { grid-column: span 3; }
  .game { padding: 14px; border-radius: 22px; box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.45); }
  .game__stats { gap: 6px; }
  .game__stats div { padding: 10px 8px; }
  .game__stats dd { font-size: 1.25rem; }
  .game__stats dt { font-size: 0.64rem; }
  .game__actions .btn { flex: 1 1 auto; }
  .tabs__list button { font-size: 0.82rem; padding: 0 4px; }
  .tabs__panel { padding: 14px 12px 16px; }
  .code pre { padding: 12px; font-size: 0.7rem; }
  .code__notes { font-size: 1.05rem; padding: 10px 12px 12px; }
  .sheet { padding: 18px 16px; border-radius: 20px; box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4); }
  .quest__col { padding: 16px; }
  .quest__stamp { display: none; }
  .lab__notes { grid-template-columns: 1fr; }
  .lab__toolbar { justify-content: center; }
  .lab__orient { display: none; } /* a phone screen already is the portrait preview */
  .lab__device { padding: 6px; border-radius: 22px; }
  .web-card { padding: 16px; }
  .device__viewport { height: 460px; }
  .device__bar { gap: 8px; }
  .device__tabs, .device__play { flex: 1 1 100%; }
  .device__tabs button, .device__btn { flex: 1; padding: 0 6px; }
  .continue { padding: 24px 18px; border-radius: 24px; box-shadow: 7px 7px 0 var(--yellow); }
  .continue__buttons .btn { flex: 1 1 calc(50% - 10px); }
  .continue__buttons .btn--yellow { flex-basis: 100%; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 380px) {
  .logo__text span { display: none; }
  .menu-btn { padding: 0 11px; }
  .cart__sub { display: none; }
  .game__stats dd { font-size: 1.1rem; }
  .editor__code { font-size: 0.6rem; }
  .flow__body { grid-template-columns: 1fr; }
}

/* phones held sideways: short screens */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --hud-h: 56px; }
  .title { padding-top: calc(var(--hud-h) + 28px); }
  .seam { max-width: 560px; }
  .crash__stage { aspect-ratio: 16 / 7.5; }
  .game__media { max-width: 480px; }
  .card-char { max-width: 340px; }
  .section { padding-top: 72px; }
  .pause { place-items: start center; padding-block: 10px; }
  .pause__card { width: min(100%, 680px); padding: 14px 20px; background-size: 100% 24px; }
  .pause__title { font-size: 1.8rem; }
  .pause__list { grid-template-columns: 1fr 1fr; column-gap: 12px; margin-top: 8px; }
  .pause__list a { padding: 7px 10px 7px 30px; font-size: 0.95rem; line-height: 1.25; }
  .pause__list a:hover, .pause__list a:focus-visible { padding-left: 34px; }
  .pause__foot { margin-top: 10px; padding-top: 10px; }
  .device__viewport { height: 300px; }
  .slot-reel { aspect-ratio: auto; height: 44vh; }
  .lab__device[data-orient="portrait"] { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .js .reveal { opacity: 1; transform: none; }
  .js .reveal:not(.is-in) .split .char { opacity: 1; transform: none; }
}
