/* Kai and the Lantern Isle: the developer's diary page.
   Colours follow the game's "Seaglass Storybook" look (D-212) and the logo's
   palette. Pixel art scales by whole numbers with nearest-neighbour. */

:root {
  --navy: #212139;
  --plum: #3b2a40;
  --ink: #2a2440;
  --white: #fffff7;
  --cream: #fff3dc;
  --paper: #fbe8c8;
  --peach: #ffcea5;
  --gold: #efa529;
  --gold-d: #b5714a;
  --cap: #ffd65a;
  --coral: #f07c6c;
  --coral-d: #b5394a;
  --mint: #9cd6a5;
  --mint-d: #5c9e74;
  --sea: #5acec6;
  --sea-d: #31736b;
  --stone: #e7c6bd;
  --dusk: #524273;
  --tee: #42529c;
  --night: #24244d;
  --night-2: #2f3266;
  --sky-1: #3d4588;
  --sky-2: #5a5aa0;
  --sky-3: #7d68a8;
  --sky-4: #b07aa6;

  --px: 4px;                /* one chunky pixel */
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --round: "DotGothic16", system-ui, sans-serif;   /* body text: reads cleanly at length */
  --chunky: "Pixelify Sans", system-ui, sans-serif; /* short headings */
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  font: 400 1.15rem/1.6 var(--round);
  background-color: var(--night);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img.px, .hero-img, .dusk-img, .logo, .hh-screen, .entry img, .portrait img { image-rendering: pixelated; image-rendering: crisp-edges; }
a { color: var(--cap); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--cap); outline-offset: 3px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--cap); color: var(--navy); padding: 10px 14px; font-family: var(--pixel); font-size: 12px; }
.skip:focus { left: 16px; }

/* ---------- the pixel box: notched corners from four flat shadows ---------- */
.box, .talkbox, .stat, .day, .map .quest {
  --b: var(--navy);
  --bg: var(--cream);
  background: var(--bg);
  color: var(--ink);
  box-shadow:
    0 calc(-1 * var(--px)) 0 0 var(--b),
    0 var(--px) 0 0 var(--b),
    calc(-1 * var(--px)) 0 0 0 var(--b),
    var(--px) 0 0 0 var(--b),
    0 calc(3 * var(--px)) 0 0 rgba(15, 12, 35, .45);
}

/* ---------- stars ---------- */
/* The sky sits on the fixed star layer, so its bands stay put while the page scrolls. */
.stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(180deg,
    var(--night) 0 34%, #282a57 34% 52%, var(--night-2) 52% 68%, #383a75 68% 82%, var(--sky-1) 82%);
}
.stars i {
  position: absolute; width: 3px; height: 3px; background: var(--white);
  opacity: .8; animation: twinkle 3.2s steps(2, end) infinite;
}
.stars i.big { background: var(--peach);
  box-shadow: 0 -3px 0 0 var(--peach), 0 3px 0 0 var(--peach), -3px 0 0 0 var(--peach), 3px 0 0 0 var(--peach); }
@keyframes twinkle { 50% { opacity: .15; } }

/* ---------- top bar ---------- */
.topbar {
  position: relative; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px clamp(16px, 4vw, 40px);
  font-family: var(--pixel); font-size: 11px; letter-spacing: .04em;
}
.home { color: var(--cream); text-decoration: none; padding: 8px 0; }
.home:hover { color: var(--cap); }
.active {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 12px 7px; background: var(--coral); color: var(--white);
  text-transform: uppercase;
  box-shadow: 0 -3px 0 0 var(--navy), 0 3px 0 0 var(--navy), -3px 0 0 0 var(--navy), 3px 0 0 0 var(--navy), 0 7px 0 0 rgba(0,0,0,.35);
}
.led { width: 8px; height: 8px; background: var(--cap); animation: blink 1s steps(1, end) infinite; }
@keyframes blink { 50% { background: var(--coral-d); } }

/* ---------- hero ---------- */
.hero { position: relative; z-index: 1; }
.hero-art {
  position: relative; overflow: hidden;
  height: min(86vh, 860px); min-height: 520px;
  background: #6e6aa8;
  border-top: var(--px) solid var(--navy);
  border-bottom: var(--px) solid var(--navy);
  touch-action: pan-y;
}
.hero-img {
  position: absolute; left: 50%; top: 50%;
  width: calc(240px * var(--s, 6)); height: calc(134px * var(--s, 6));
  max-width: none;
  transform: translate(calc(-50% + var(--ox, 0px)), calc(-50% + var(--oy, 0px)));
}
/* The Dim, with the lantern's stepped rings (the game draws its light the same way). */
.dim {
  position: absolute; inset: 0; pointer-events: none;
  --lx: 25%; --ly: 72%; --r: 70px;
  background: radial-gradient(circle at var(--lx) var(--ly),
    rgba(26, 22, 60, 0) 0 var(--r),
    rgba(26, 22, 60, .22) var(--r) calc(var(--r) * 1.35),
    rgba(26, 22, 60, .42) calc(var(--r) * 1.35) calc(var(--r) * 1.7),
    rgba(26, 22, 60, .6) calc(var(--r) * 1.7));
  transition: none;
}
.hero-art.lit .dim { --r: 96px; }
.tag {
  position: absolute; right: 12px; top: 12px;
  font: 9px/1 var(--pixel); color: var(--white);
  background: rgba(33, 33, 57, .85); padding: 6px 8px 5px;
}
.hero-copy {
  position: absolute; z-index: 2; left: 0; right: 0; top: clamp(18px, 6vh, 64px);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 0 16px; pointer-events: none;
}
.hero-copy h1 { margin: 0; line-height: 0; }
.logo {
  width: 480px; height: auto; /* 5x */
  filter: drop-shadow(0 8px 0 rgba(33, 33, 57, .55));
  animation: bob 2.4s steps(2, end) infinite;
}
@keyframes bob { 50% { transform: translateY(-4px); } }
.hero-line {
  pointer-events: auto;
  max-width: 34ch; margin: 26px 0 0; padding: 14px 20px 12px;
  font: 400 1.2rem/1.5 var(--round);
}
.hud {
  position: absolute; z-index: 3; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 22px;
  padding: 10px 18px 9px; white-space: nowrap;
  font: 12px/1 var(--pixel); color: var(--ink); background: var(--cream);
  box-shadow: 0 -4px 0 0 var(--navy), 0 4px 0 0 var(--navy), -4px 0 0 0 var(--navy), 4px 0 0 0 var(--navy), 0 10px 0 0 rgba(0,0,0,.35);
}
.hud small { font-size: 9px; color: var(--gold-d); }
.hud-item { display: inline-flex; align-items: center; gap: 6px; }
.hearts { display: inline-flex; gap: 4px; }
.hearts i {
  width: 14px; height: 12px; display: inline-block; background: var(--coral);
  clip-path: polygon(0 17%, 14% 0, 43% 0, 50% 17%, 57% 0, 86% 0, 100% 17%, 100% 50%, 50% 100%, 0 50%);
}
.hearts i.half { background: linear-gradient(90deg, var(--coral) 50%, var(--stone) 50%); }
.coin {
  display: inline-block; width: 12px; height: 12px; background: var(--gold);
  box-shadow: inset -3px -3px 0 0 var(--gold-d), inset 3px 3px 0 0 var(--cap);
  clip-path: polygon(25% 0, 75% 0, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0 75%, 0 25%);
}
.press-start {
  position: absolute; z-index: 3; left: 50%; bottom: -46px; transform: translateX(-50%);
  font: 11px/1 var(--pixel); color: var(--cap); text-decoration: none;
  padding: 12px 10px; animation: blink-text 1.1s steps(1, end) infinite;
}
@keyframes blink-text { 60% { opacity: 0; } }

/* ---------- story ---------- */
main { position: relative; z-index: 1; }
.story {
  max-width: 1100px; margin: 0 auto; padding: 110px clamp(16px, 4vw, 40px) 40px;
  display: grid; grid-template-columns: auto 1fr; gap: clamp(32px, 6vw, 72px); align-items: center;
}
.handheld {
  --body: var(--cap);
  width: 392px; padding: 26px 26px 30px;
  background: var(--body);
  border-radius: 18px 18px 64px 18px;
  box-shadow:
    inset -8px -8px 0 0 #e4b83a,
    inset 8px 8px 0 0 #ffe592,
    0 0 0 4px var(--navy),
    0 14px 0 4px rgba(10, 8, 30, .45);
  transform: rotate(-3deg);
}
.hh-screen-wrap {
  position: relative; padding: 18px 16px 26px;
  background: #3a3756; border-radius: 10px 10px 30px 10px;
  box-shadow: inset 0 0 0 4px #2b2944;
}
.hh-power { position: absolute; left: 6px; top: 50%; width: 6px; height: 6px; background: var(--coral); box-shadow: 0 0 8px var(--coral); }
.hh-screen { display: block; width: 320px; height: 288px; margin: 0 auto; }
.hh-pad { display: flex; justify-content: space-between; align-items: center; padding: 28px 18px 0; }
.dpad { position: relative; width: 66px; height: 66px; }
.dpad::before, .dpad::after { content: ""; position: absolute; background: var(--navy); }
.dpad::before { left: 22px; top: 0; width: 22px; height: 66px; }
.dpad::after { top: 22px; left: 0; width: 66px; height: 22px; }
.ab { display: flex; gap: 14px; transform: rotate(-22deg); }
.ab i {
  width: 40px; height: 40px; border-radius: 50%; background: var(--coral);
  box-shadow: inset -4px -4px 0 0 var(--coral-d), 0 0 0 3px var(--navy);
  font: 9px/40px var(--pixel); font-style: normal; color: var(--white); text-align: center;
}
.ab i:last-child { transform: translateY(-14px); }
.hh-small { display: flex; justify-content: center; gap: 18px; padding-top: 26px; }
.hh-small i { width: 34px; height: 9px; border-radius: 6px; background: #c08f22; transform: rotate(-22deg); }

.talk { display: flex; flex-direction: column; gap: 34px; }
.talkbox {
  position: relative; padding: 22px 22px 18px 104px; min-height: 104px;
  font: 400 1.18rem/1.55 var(--round);
}
.talkbox p { margin: 0; }
.nametab {
  position: absolute; left: 96px; top: -18px;
  padding: 7px 10px 6px; background: var(--coral); color: var(--white);
  font: 10px/1 var(--pixel);
  box-shadow: 0 -3px 0 0 var(--navy), 0 3px 0 0 var(--navy), -3px 0 0 0 var(--navy), 3px 0 0 0 var(--navy);
}
.nametab--gold { background: var(--gold); color: var(--navy); }
.portrait {
  position: absolute; left: 18px; top: 18px; width: 68px; height: 68px;
  display: grid; place-items: center; overflow: hidden;
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--navy);
}
.portrait img { width: 64px; height: 64px; }
.more { position: absolute; right: 14px; bottom: 6px; font-size: .8rem; color: var(--coral-d); animation: bob 1s steps(2, end) infinite; }
.note { margin: 0; font-size: .95rem; color: var(--stone); opacity: .9; }

/* Kai's sprite: 16 x 28 frames from the game's walk.pixels, at 2x. */
.kai-idle, .kai-walk {
  display: block; width: 32px; height: 56px;
  background: url("/kai-lantern-isle/img/kai-walk-down.png") 0 0 / 128px 56px;
  image-rendering: pixelated;
  animation: walk4 .9s steps(4) infinite;
}
.kai-idle { transform: scale(1); }
@keyframes walk4 { to { background-position: -128px 0; } }
@keyframes walk4x3 { to { background-position: -192px 0; } }

/* ---------- stats ---------- */
.stats {
  max-width: 1100px; margin: 0 auto; padding: 30px clamp(16px, 4vw, 40px) 20px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px;
}
.stat { --bg: var(--navy); --b: var(--cap); color: var(--cream); padding: 18px 14px 16px; text-align: center; }
.stat-n { display: block; font: 26px/1.2 var(--pixel); color: var(--cap); }
.stat-n.stat-n--small { font-size: 13px; line-height: 2.2; }
.stat-l { display: block; margin-top: 8px; font: 9px/1.4 var(--pixel); color: var(--stone); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- section titles ---------- */
.sec-title {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 10px; font: 22px/1.3 var(--pixel); color: var(--cap);
  text-shadow: 0 4px 0 var(--plum);
}
.sec-sub { margin: 0 0 30px; max-width: 60ch; color: var(--stone); }
.sec-icon { width: 24px; height: 24px; flex: none; background: var(--gold);
  clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 78%, 20% 100%, 30% 60%, 0 38%, 38% 35%); }
.sec-icon--book { background: linear-gradient(90deg, var(--coral) 0 46%, var(--navy) 46% 54%, var(--coral) 54%); clip-path: none; box-shadow: inset 0 -4px 0 0 var(--cream); }

/* ---------- quest map ---------- */
.quests { max-width: 1100px; margin: 0 auto; padding: 70px clamp(16px, 4vw, 40px) 30px; }
.map {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 34px 26px;
  counter-reset: q;
}
.map .quest {
  position: relative; --bg: var(--night-2); --b: var(--sky-3);
  color: var(--cream); padding: 16px 10px 14px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
/* the dotted path between levels */
.map .quest:not(:nth-child(6n))::after {
  content: ""; position: absolute; top: 32px; right: -26px; width: 26px; height: 4px;
  background: repeating-linear-gradient(90deg, var(--cap) 0 4px, transparent 4px 8px);
}
.q-id { font: 11px/1 var(--pixel); color: var(--cap); }
.q-name { font: 600 1rem/1.25 var(--chunky); }
.node {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  font: 12px/1 var(--pixel); color: var(--navy);
}
.quest--done .node, .node--done { background: var(--gold); clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 78%, 20% 100%, 30% 60%, 0 38%, 38% 35%); }
.quest--now { --bg: var(--coral-d); --b: var(--cap); }
.quest--now .node, .node--now {
  background:
    linear-gradient(var(--navy), var(--navy)) 50% 0 / 12px 4px no-repeat,
    linear-gradient(var(--cap), var(--cap)) 50% 6px / 20px 22px no-repeat;
  box-shadow: 0 0 18px 4px rgba(255, 214, 90, .55);
  animation: lamp 1.2s steps(2, end) infinite;
}
@keyframes lamp { 50% { box-shadow: 0 0 6px 1px rgba(255, 214, 90, .35); } }
.quest--wait .node, .node--wait {
  background:
    linear-gradient(var(--sea), var(--sea)) 50% 4px / 20px 4px no-repeat,
    linear-gradient(var(--sea), var(--sea)) 50% 24px / 20px 4px no-repeat,
    linear-gradient(var(--peach), var(--peach)) 50% 8px / 12px 8px no-repeat,
    linear-gradient(var(--peach), var(--peach)) 50% 18px / 6px 6px no-repeat;
}
.quest--locked { opacity: .65; }
.quest--locked .node, .node--locked {
  background:
    linear-gradient(var(--stone), var(--stone)) 50% 14px / 22px 16px no-repeat,
    linear-gradient(var(--stone), var(--stone)) 7px 4px / 4px 12px no-repeat,
    linear-gradient(var(--stone), var(--stone)) 21px 4px / 4px 12px no-repeat,
    linear-gradient(var(--stone), var(--stone)) 50% 2px / 18px 4px no-repeat;
}
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 34px 0 0; padding: 0; font-size: .95rem; color: var(--stone); }
.legend li { display: inline-flex; align-items: center; gap: 10px; }
.legend .node { width: 24px; height: 24px; transform: scale(.8); }

/* ---------- diary ---------- */
.diary { max-width: 900px; margin: 0 auto; padding: 80px clamp(16px, 4vw, 40px) 60px; }
.key { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: -10px 0 46px; padding: 0; font-size: .95rem; color: var(--stone); }
.key li { display: inline-flex; align-items: center; gap: 8px; }
.key .blk { width: 14px; height: 10px; }

.day { --bg: var(--night-2); --b: var(--sky-3); color: var(--cream); padding: 26px clamp(16px, 3.5vw, 34px) 30px; margin: 0 0 64px; scroll-margin-top: 20px; }
.day-head { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 6px 18px; }
.day-num { margin: 0; font: 26px/1 var(--pixel); color: var(--cap); text-shadow: 0 4px 0 var(--plum); }
.day-num span { font-size: 11px; color: var(--peach); vertical-align: middle; }
.day-date { margin: 0; font: 600 1.35rem/1.3 var(--chunky); color: var(--cream); }
.day-count { margin: 0; display: inline-flex; align-items: center; gap: 8px; font: 10px/1 var(--pixel); color: var(--cap); white-space: nowrap; }

.day-strip { margin: 22px 0 0; padding: 14px 12px 8px; background: rgba(20, 18, 45, .55); box-shadow: inset 0 0 0 2px rgba(125, 104, 168, .5); }
.strip { display: grid; grid-template-columns: repeat(24, 1fr); grid-template-rows: 100%; gap: 3px; align-items: end; height: min(calc(var(--rows) * 11px + 4px), 112px); min-height: 26px; }
.col { display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; min-height: 0; overflow: hidden; justify-content: flex-start;
  background: linear-gradient(transparent calc(100% - 2px), rgba(255, 243, 220, .12) 0); }
.blk { display: block; flex: 0 1 9px; min-height: 3px; width: 100%; }
.key .blk { flex: none; }
.blk--code { background: var(--sea); }
.blk--docs { background: var(--sky-3); }
.blk--art { background: var(--coral); }
.blk--fix { background: var(--mint); }
.blk--merge { background: var(--stone); }
.blk--event { background: var(--cap); box-shadow: 0 0 10px 1px rgba(255, 214, 90, .7); }
.strip-axis { display: flex; justify-content: space-between; margin-top: 6px; font: 8px/1 var(--pixel); color: var(--stone); opacity: .8; }

.loot { list-style: none; display: flex; flex-wrap: wrap; gap: 12px 14px; margin: 22px 0 0; padding: 0; }
.loot li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 10px 6px; background: var(--navy); color: var(--cap);
  font: 9px/1.3 var(--pixel); text-transform: uppercase;
  box-shadow: 0 0 0 2px var(--gold);
}
.loot li::before { content: "Got"; color: var(--peach); }
.star { width: 12px; height: 12px; background: var(--cap); clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 78%, 20% 100%, 30% 60%, 0 38%, 38% 35%); order: -1; }

.entry { margin: 30px 0 0; padding: 22px clamp(16px, 3vw, 28px) 8px; font: 400 1.08rem/1.75 var(--round); }
.entry p { margin: 0 0 18px; }
.entry::after { content: ""; display: block; clear: both; }
.entry figure.inline-image {
  float: right; margin: 6px 0 16px 26px; padding: 12px 12px 24px;
  background: #3a3756; border-radius: 8px 8px 26px 8px;
  box-shadow: 0 0 0 4px var(--navy), 0 8px 0 4px rgba(10, 8, 30, .35);
  transform: rotate(1.5deg); position: relative;
}
.entry figure.inline-image::after {
  content: ""; position: absolute; left: 12px; bottom: 9px; width: 6px; height: 6px; background: var(--coral);
}
.entry figure img { display: block; max-width: 100%; height: auto; }

/* the day index: one chip per day, so the reader sees every day at once */
.day-index { margin: -22px 0 52px; }
.di-title { margin: 0 0 14px; font: 10px/1.6 var(--pixel); color: var(--peach); }
.day-index ul { list-style: none; display: flex; flex-wrap: wrap; gap: 14px; margin: 0; padding: 0; }
.day-index a {
  display: inline-flex; align-items: center; gap: 10px; padding: 9px 12px 8px;
  background: var(--navy); color: var(--cream); text-decoration: none;
  font: 600 .95rem/1 var(--chunky); box-shadow: 0 0 0 2px var(--sky-3), 0 5px 0 2px rgba(10, 8, 30, .45);
}
.day-index a:hover, .day-index a:focus-visible { box-shadow: 0 0 0 2px var(--cap), 0 5px 0 2px rgba(10, 8, 30, .45); color: var(--cap); }
.di-num { font: 11px/1 var(--pixel); color: var(--cap); }

/* the foot of a day: a text-box "next page" arrow that leads to the older day */
.day-next {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 26px 0 0;
  font: 10px/1.6 var(--pixel); color: var(--cap); text-decoration: none; text-align: right;
}
.day-next:hover span:first-child, .day-next:focus-visible span:first-child { text-decoration: underline; text-underline-offset: 4px; }
.tri { flex: none; width: 16px; height: 12px; background: var(--cap); clip-path: polygon(0 0, 100% 0, 50% 100%); animation: bob 1s steps(2, end) infinite; }
.day-end { margin: 26px 0 0; font: 10px/1.6 var(--pixel); color: var(--stone); text-align: right; }
.day-end a { color: var(--cap); }

/* ---------- footer ---------- */
.dusk { position: relative; z-index: 1; margin-top: 40px; }
.dusk-art {
  position: relative; overflow: hidden; height: 420px;
  border-top: var(--px) solid var(--navy); background: #3f3a72;
}
.dusk-img {
  position: absolute; left: 50%; top: 50%;
  width: calc(240px * var(--s, 5)); height: calc(134px * var(--s, 5)); max-width: none;
  transform: translate(calc(-50% + var(--ox, 0px)), calc(-50% + var(--oy, 0px)));
}
.walker { position: absolute; left: 0; right: 0; bottom: 14px; height: 84px; pointer-events: none; }
.kai-walk {
  position: absolute; left: -60px; bottom: 0;
  width: 48px; height: 84px; background-size: 192px 84px;
  background-image: url("/kai-lantern-isle/img/kai-walk-right.png");
  animation: walk4x3 .6s steps(4) infinite, stroll 18s linear infinite;
}
@keyframes stroll { to { left: calc(100% + 60px); } }
.dusk-copy { padding: 34px 16px 46px; text-align: center; background: var(--navy); }
.dusk-copy .box { display: inline-block; margin: 0 0 22px; padding: 12px 18px 10px; }
.foot { margin: 0; font: 10px/2 var(--pixel); }
.foot a { color: var(--cap); }

/* ---------- reveal ---------- */
/* translate, so the tilt set by transform stays */
.js .reveal { opacity: 0; translate: 0 16px; transition: opacity .5s steps(5, end), translate .5s steps(5, end); }
.js .reveal.is-in { opacity: 1; translate: none; }

/* ---------- smaller screens ---------- */
@media (min-width: 641px) and (max-width: 1200px) {
  /* keep the intro box clear of Kai and his lantern */
  .hero-line { transform: translateX(clamp(60px, 14vw, 160px)); }
}
@media (max-width: 980px) {
  .story { grid-template-columns: 1fr; justify-items: center; }
  .map { grid-template-columns: repeat(4, 1fr); }
  .map .quest:not(:nth-child(6n))::after { display: none; }
  .map .quest:not(:nth-child(4n))::after { display: block; content: ""; position: absolute; top: 32px; right: -26px; width: 26px; height: 4px;
    background: repeating-linear-gradient(90deg, var(--cap) 0 4px, transparent 4px 8px); }
}
@media (max-width: 640px) {
  body { font-size: 1.08rem; }
  .topbar { font-size: 10px; }
  .hero-art { height: 536px; min-height: 0; } /* exactly 4x the key art */
  .logo { width: 288px; } /* 3x */
  .hero-line { font-size: 1.05rem; padding: 12px 14px 10px; }
  .hud { gap: 14px; font-size: 10px; padding: 9px 12px 8px; bottom: 18px; }
  .hearts i { width: 11px; height: 10px; }
  .story { padding-top: 96px; }
  .handheld { width: 100%; max-width: 344px; padding: 18px 14px 22px; transform: rotate(-2deg); }
  .hh-screen-wrap { padding: 12px 8px 18px; }
  .hh-screen { width: 100%; height: auto; max-width: 288px; }
  .hh-pad { padding: 18px 8px 0; }
  .talkbox { padding: 86px 16px 16px; font-size: 1.1rem; }
  .portrait { left: 16px; top: 16px; width: 58px; height: 58px; }
  .portrait img { width: 52px; height: 52px; }
  .nametab { left: 16px; top: -16px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 22px; }
  .stat-n { font-size: 20px; }
  .sec-title { font-size: 16px; }
  .map { grid-template-columns: repeat(3, 1fr); gap: 22px 16px; }
  .map .quest { padding: 12px 4px 10px; }
  .q-name { font-size: .9rem; }
  .map .quest::after { display: none !important; }
  .day-head { grid-template-columns: 1fr auto; }
  .day-date { grid-column: 1 / -1; grid-row: 2; font-size: 1.15rem; }
  .day-num { font-size: 20px; }
  .strip { gap: 2px; }
  .day-index ul { gap: 10px; }
  .day-index a { padding: 8px 10px 7px; font-size: .88rem; }
  .day-next { justify-content: space-between; }
  .entry figure.inline-image { float: none; margin: 4px auto 20px; width: fit-content; max-width: 100%; transform: none; }
  .dusk-art { height: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  .stars i, .led, .logo, .press-start, .more, .quest--now .node, .node--now { animation: none; }
  .kai-idle, .kai-walk { animation: none; }
  .tri { animation: none; }
  .kai-walk { left: 46%; }
  .js .reveal { opacity: 1; translate: none; transition: none; }
}
