@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(media/baloo2-600-latin.woff2) format('woff2');
}

:root {
  /* JS rewrites these as the page scrolls from dawn to night. */
  --sky-top: #ffe3b8;
  --sky-mid: #ffd6a8;
  --sky-bot: #f9c79a;
  --ink: #3a3352;
  --ink-soft: rgba(58, 51, 82, .72);
  --paper: rgba(255, 255, 255, .58);
  --paper-line: rgba(255, 255, 255, .7);
  --accent: #e9833f;
  --display: 'Baloo 2', 'Quicksand', system-ui, sans-serif;
  --body: 'Quicksand', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hand: 'Caveat', 'Comic Sans MS', cursive;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: #f9c79a;
  color: var(--ink);
  text-shadow: var(--ink-shadow, none);
  font: 500 clamp(16px, 1.05vw + 11px, 19px)/1.6 var(--body);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  /* A press-and-hold is a breath here, not a text selection. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#sky {
  position: fixed; inset: 0; z-index: -3;
  background: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-bot) 100%);
}
#bg { position: fixed; inset: 0; z-index: -2; width: 100%; height: 100%; pointer-events: none; }
#seedfx { position: fixed; inset: 0; z-index: 20; width: 100%; height: 100%; pointer-events: none; }

/* --- breath ring that follows a held press --- */
#breath {
  position: fixed; left: 0; top: 0; z-index: 30; width: 84px; height: 84px;
  margin: -42px 0 0 -42px; pointer-events: none; opacity: 0;
  transition: opacity .18s ease;
}
#breath.on { opacity: 1; }
#breath svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
#breath circle { fill: none; stroke-width: 5; stroke-linecap: round; }
#breath .track { stroke: rgba(255, 255, 255, .35); }
#breath .fill { stroke: #fff; stroke-dasharray: 276.5; stroke-dashoffset: 276.5; filter: drop-shadow(0 0 6px rgba(255, 240, 200, .9)); }

/* --- toasts (little achievements, like the game's) --- */
#toasts {
  position: fixed; top: calc(72px + var(--safe-top, 0px)); left: 50%; z-index: 40;
  transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none;
}
.toast {
  text-shadow: none;
  display: flex; align-items: center; gap: 10px;
  background: rgba(40, 34, 62, .86); color: #fff7e8;
  padding: 8px 18px 8px 10px; border-radius: 999px;
  font: 700 15px/1.2 var(--body); box-shadow: 0 8px 30px rgba(30, 20, 50, .25);
  animation: toast-in .5s cubic-bezier(.2, 1.4, .4, 1) both;
}
.toast.out { animation: toast-out .5s ease forwards; }
.toast .badge {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #ffe7a6, #f0a64a); color: #5a3510; font-size: 16px;
}
.toast small { display: block; font-weight: 500; opacity: .75; font-size: 12px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

/* --- top bar --- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 25;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) var(--gutter) 14px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.mark {
  display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none;
  font: 600 22px/1 var(--display); letter-spacing: .02em;
}
.mark img { border-radius: 9px; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.topbar nav { display: flex; gap: 6px; align-items: center; }
.topbar nav a {
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px;
  padding: 8px 12px; border-radius: 999px;
}
.topbar nav a:hover { background: var(--paper); }
.topbar nav a.pill { background: var(--ink); color: var(--sky-bot); }
.topbar nav a.pill:hover { filter: brightness(1.15); }
@media (max-width: 560px) { .topbar nav a:not(.pill) { display: none; } }

/* --- sections --- */
section { position: relative; padding: clamp(80px, 14vh, 160px) 0; }
.wrap { width: min(1160px, 100% - 2 * var(--gutter)); margin: 0 auto; position: relative; }
.wrap.narrow { width: min(820px, 100% - 2 * var(--gutter)); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.08; margin: 0; }
h2 { font-size: clamp(34px, 4.6vw, 64px); margin-bottom: .35em; }
h3 { font-size: clamp(22px, 2vw, 28px); }
.sub { color: var(--ink-soft); font-size: 1.08em; max-width: 46ch; margin: 0 0 2.2em; }
.center { text-align: center; margin-left: auto; margin-right: auto; }
p { margin: 0 0 1em; }

/* hero */
.hero { min-height: 100svh; display: flex; align-items: center; }
.eyebrow {
  font-weight: 700; letter-spacing: .18em; text-transform: uppercase; font-size: 13px;
  color: var(--ink-soft); margin-bottom: 10px;
}
.wordmark {
  font-size: clamp(84px, 15vw, 210px); line-height: .9; letter-spacing: .01em;
  color: #fffaf0;
  text-shadow: 0 2px 0 rgba(233, 131, 63, .28), 0 12px 50px rgba(233, 131, 63, .35);
}
.lede { font-size: clamp(22px, 2.4vw, 32px); font-weight: 700; margin: .5em 0 1.3em; max-width: 26ch; line-height: 1.3; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.cta.center { justify-content: center; }
.play-badge { display: inline-block; line-height: 0; transition: transform .2s ease; }
.play-badge img { height: 68px; width: auto; }
.play-badge:hover { transform: translateY(-2px) scale(1.02); }
.yt {
  display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 22px 0 16px;
  border-radius: 999px; background: var(--paper); border: 1.5px solid var(--paper-line);
  color: var(--ink); text-decoration: none; font-weight: 700;
  transition: transform .2s ease, background .2s ease;
}
.yt svg { width: 28px; height: 20px; }
.yt svg rect { fill: #ff3b30; }
.yt svg path { fill: #fff; }
.yt:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .8); }
.hint {
  margin-top: 2.4em; font-size: 15px; color: var(--ink-soft); display: flex; align-items: center; gap: 10px;
}
.hint .dot {
  width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; flex: none;
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.6); opacity: .4; } }

.hill { position: absolute; left: 0; bottom: 0; width: 100%; display: block; pointer-events: none; }

/* how */
.steps { list-style: none; padding: 0; margin: 0 0 2.4em; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.steps li {
  background: var(--paper); border: 1.5px solid var(--paper-line); border-radius: 26px;
  padding: 24px 22px 18px;
}
.steps svg { width: 56px; height: 56px; display: block; margin-bottom: 10px; }
.steps .ring { fill: none; stroke: var(--accent); stroke-width: 4; stroke-dasharray: 100 40; stroke-linecap: round; }
.steps .core { fill: var(--accent); }
.steps .arc { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.steps .faint { opacity: .45; }
.steps h3 { margin-bottom: .3em; }
.steps p { margin: 0; color: var(--ink-soft); font-size: .95em; }
.promise { font-size: clamp(20px, 2vw, 26px); line-height: 1.45; }
.promise strong { font-family: var(--display); font-weight: 600; font-size: 1.25em; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

/* trailer */
.trailer h2 { text-align: center; }
.screen {
  margin: 1.2em auto 1.4em; max-width: 980px; border-radius: 28px; overflow: hidden;
  background: #1c1a2b; box-shadow: 0 30px 80px rgba(40, 60, 100, .3), 0 0 0 8px rgba(255, 255, 255, .55);
  aspect-ratio: 16 / 9;
}
.screen video { width: 100%; height: 100%; display: block; object-fit: cover; }
.text-link { color: var(--ink); font-weight: 700; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* worlds */
.world-list { list-style: none; padding: 0; margin: 0 0 5em; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.world-list li {
  position: relative; padding: 22px 22px 18px 74px; border-radius: 22px;
  background: var(--paper); border: 1.5px solid var(--paper-line);
  transition: transform .25s ease;
}
.world-list li:hover { transform: translateY(-3px) rotate(-.4deg); }
.world-list .num {
  position: absolute; left: 18px; top: 20px; width: 40px; height: 40px; border-radius: 50%;
  background: var(--hue); display: grid; place-items: center;
  font: 600 22px/1 var(--display); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.world-list h3 { margin-bottom: .2em; }
.world-list p { margin: 0; color: var(--ink-soft); font-size: .93em; }
@media (max-width: 960px) { .world-list { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .world-list { grid-template-columns: 1fr; } }

.postcards-title { font-family: var(--hand); font-size: clamp(32px, 3.4vw, 46px); font-weight: 600; text-align: center; margin-bottom: 1em; }
.postcards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px 22px; }
.postcards figure {
  text-shadow: none;
  margin: 0; background: #fffdf7; padding: 10px 10px 4px; border-radius: 6px;
  box-shadow: 0 10px 30px rgba(60, 40, 30, .16), 0 1px 3px rgba(60, 40, 30, .12);
  transform: rotate(var(--r, -1.5deg)); transition: transform .3s cubic-bezier(.2, 1.3, .4, 1);
}
.postcards figure:nth-child(2n) { --r: 1.8deg; }
.postcards figure:nth-child(3n) { --r: -2.6deg; }
.postcards figure:nth-child(5n) { --r: 2.4deg; }
.postcards figure:hover { transform: rotate(0) scale(1.05); z-index: 2; position: relative; }
.postcards button { all: unset; display: block; cursor: zoom-in; width: 100%; }
.postcards img { width: 100%; height: auto; display: block; border-radius: 2px; aspect-ratio: 16 / 9; object-fit: cover; }
.postcards figcaption { font: 600 24px/1.4 var(--hand); color: #4a4060; text-align: center; padding: 4px 0 2px; }
@media (max-width: 960px) { .postcards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .postcards { gap: 18px 12px; } .postcards figcaption { font-size: 19px; } }

/* living */
.critters { list-style: none; padding: 0; margin: 0 0 2.4em; display: flex; flex-wrap: wrap; gap: 10px; }
.critters li {
  padding: 8px 16px; border-radius: 999px; background: var(--paper); border: 1.5px solid var(--paper-line);
  font-weight: 700;
}
.critters li.warn { background: #fff1d6; color: #7a4a14; }
.critters small { font-weight: 500; opacity: .8; }
.aside { font-family: var(--hand); font-size: clamp(26px, 2.6vw, 34px); line-height: 1.25; max-width: 30ch; }

/* promise */
.promise-sec h2 { text-align: center; }
.tiles { list-style: none; padding: 0; margin: 1em 0 2.4em; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tiles li {
  text-align: center; padding: 26px 16px; border-radius: 24px;
  background: rgba(255, 255, 255, .22); border: 1.5px solid rgba(255, 255, 255, .45);
}
.tiles b { display: block; font: 600 clamp(22px, 2vw, 28px)/1.1 var(--display); margin-bottom: .35em; }
.tiles span { color: var(--ink-soft); font-size: .9em; }
@media (max-width: 860px) { .tiles { grid-template-columns: 1fr 1fr; } }

/* finale */
.finale { min-height: 100svh; padding-top: clamp(90px, 12vh, 140px); padding-bottom: 0; display: flex; flex-direction: column; justify-content: flex-start; }
.finale-line { text-align: center; font-size: clamp(38px, 5.4vw, 76px); margin-bottom: .8em; text-shadow: 0 4px 30px rgba(10, 10, 40, .5); }
.hint.wish { justify-content: center; }
.meadow { position: relative; height: clamp(230px, 36vh, 400px); margin-top: auto; }
.night-hill { height: 100%; }
.night-hill .houses { fill: #1a242c; }
.night-hill .win { fill: #ffd98a; filter: drop-shadow(0 0 6px #ffb64a); }
.night-hill .win.off { fill: #2a3540; filter: none; }
.night-hill .lamp { fill: #fff2c4; filter: drop-shadow(0 0 10px #ffd27a); }
#puff-anchor { position: absolute; left: 82%; bottom: 43%; width: 1px; height: 1px; }
@media (max-width: 700px) { #puff-anchor { left: 66%; bottom: 52%; } }
.foot { position: relative; background: #17212a; color: rgba(246, 239, 227, .7); text-align: center; padding: 10px var(--gutter) calc(28px + env(safe-area-inset-bottom, 0px)); font-size: 14px; }
.foot a { color: rgba(246, 239, 227, .9); }
.foot .tiny { font-size: 12px; opacity: .6; margin: 0; }

/* lightbox */
#lightbox {
  border: 0; padding: 0; background: transparent; max-width: min(1400px, 94vw); overflow: visible;
}
#lightbox::backdrop { background: rgba(20, 18, 34, .82); }
#lightbox img { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
#lightbox button {
  position: absolute; top: -18px; right: -12px; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: #fffdf7; color: #3a3352; font-size: 28px; line-height: 1; cursor: pointer;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
