@font-face {
  font-family: 'Lilita One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./assets/fonts/lilita-one-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('./assets/fonts/fredoka-latin-wght-normal.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --ink: #20355f;
  --ink-soft: #4b6384;
  --paper: #fffefa;
  --blue: #51c9f5;
  --yellow: #ffda44;
  --orange: #ff9755;
  --pink: #ff83bb;
  --green: #6ddba6;
  --display: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
  --ui: 'Fredoka', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; color: var(--ink); font: 400 1rem/1.45 var(--ui); background: #78d0f3; }
button { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; cursor: pointer; }
button, a { color: inherit; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, canvas:focus-visible { outline: 4px solid white; outline-offset: 5px; box-shadow: 0 0 0 8px var(--ink); }
button:focus:not(:focus-visible), canvas:focus:not(:focus-visible) { outline: none; }
[hidden] { display: none !important; }
p, h1, h2, figure { margin: 0; }
em { font-style: normal; }
svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
#app { position: relative; isolation: isolate; width: 100%; height: 100%; min-height: 360px; }
#world-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; z-index: 1; }
.screen-grain { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: .035; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.4' filter='url(%23n)'/%3E%3C/svg%3E"); mix-blend-mode: multiply; }
.screen-frame { display: none; }
.eyebrow { font-size: .875rem; line-height: 1.4; letter-spacing: .075em; font-weight: 600; }

/* Time of day lives below the transparent game canvas. */
#sky-backdrop { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.sky-layer { position: absolute; inset: 0; opacity: 0; overflow: hidden; transition: opacity .9s ease; }
.sky-day { background: radial-gradient(ellipse at 32% 12%, #b4edff 0%, transparent 44%), linear-gradient(180deg, #50b7ee 0%, #8fddf7 70%, #cbf1fc 100%); }
.sky-sunset { background: radial-gradient(ellipse at 70% 67%, #ffd7a3 0%, transparent 47%), linear-gradient(180deg, #8176c7 0%, #d995b3 39%, #ffb19f 69%, #ffd8aa 100%); }
.sky-night { background: radial-gradient(ellipse at 73% 69%, #4e4d98 0%, transparent 58%), linear-gradient(180deg, #172651 0%, #333870 58%, #5b5796 100%); }
body[data-sky="day"] .sky-day, body[data-sky="sunset"] .sky-sunset, body[data-sky="night"] .sky-night { opacity: 1; }
.cloud { position: absolute; display: block; width: 218px; height: 63px; border-radius: 100px; background: #fff; opacity: .65; box-shadow: 0 7px 0 rgba(72,159,206,.05); }
.cloud::before, .cloud::after { content: ''; position: absolute; border-radius: 50%; background: inherit; }
.cloud::before { width: 99px; height: 99px; left: 31px; bottom: 17px; }
.cloud::after { width: 74px; height: 74px; right: 23px; bottom: 14px; }
.cloud-one { left: -45px; top: 21%; transform: scale(1.2); }
.cloud-two { right: 8%; top: 14%; transform: scale(.8); opacity: .55; }
.cloud-three { left: 43%; bottom: 9%; transform: scale(.7); opacity: .5; }
.sky-sunset .cloud { background: #ffe3ce; opacity: .27; }
.sky-sunset .cloud-one { top: 28%; }
.sky-sunset .cloud-two { top: 20%; right: 4%; }
.sky-night::before, .sky-night::after { content: ''; position: absolute; inset: 0; background-repeat: no-repeat; }
.sky-night::before { opacity: .9; background-image: radial-gradient(2px 2px at 8% 15%, #fff 99%, transparent), radial-gradient(2px 2px at 24% 8%, #fff 99%, transparent), radial-gradient(1px 1px at 38% 22%, #fff 99%, transparent), radial-gradient(2px 2px at 53% 12%, #fff 99%, transparent), radial-gradient(2px 2px at 67% 6%, #fff 99%, transparent), radial-gradient(1px 1px at 89% 22%, #fff 99%, transparent), radial-gradient(2px 2px at 95% 11%, #fff 99%, transparent), radial-gradient(1px 1px at 12% 42%, #fff 99%, transparent), radial-gradient(2px 2px at 33% 58%, #fff 99%, transparent), radial-gradient(1px 1px at 51% 44%, #fff 99%, transparent), radial-gradient(2px 2px at 77% 36%, #fff 99%, transparent), radial-gradient(1px 1px at 93% 59%, #fff 99%, transparent), radial-gradient(2px 2px at 5% 73%, #fff 99%, transparent), radial-gradient(1px 1px at 21% 86%, #fff 99%, transparent), radial-gradient(2px 2px at 45% 80%, #fff 99%, transparent), radial-gradient(1px 1px at 62% 92%, #fff 99%, transparent), radial-gradient(2px 2px at 84% 84%, #fff 99%, transparent); }
.sky-night::after { opacity: .35; background-image: radial-gradient(1px 1px at 17% 27%, #fff 99%, transparent), radial-gradient(1px 1px at 41% 5%, #fff 99%, transparent), radial-gradient(1px 1px at 60% 30%, #fff 99%, transparent), radial-gradient(1px 1px at 78% 19%, #fff 99%, transparent), radial-gradient(1px 1px at 98% 41%, #fff 99%, transparent), radial-gradient(1px 1px at 27% 71%, #fff 99%, transparent), radial-gradient(1px 1px at 71% 77%, #fff 99%, transparent); }
.sky-moon { position: absolute; top: 13%; right: 14%; width: 58px; height: 58px; border-radius: 50%; background: #fff3cf; box-shadow: 0 0 36px #fff4ce45, inset -10px -5px 0 #e9dfbb; opacity: .95; }

/* A standalone title screen. The world appears after starting. */
.intro { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: 36px 24px; background: radial-gradient(ellipse at 50% 35%, #ffe7f1 0%, transparent 65%), linear-gradient(160deg, #f6b7d3 0%, #ffcade 57%, #f6b8d4 100%); pointer-events: auto; cursor: pointer; user-select: none; }
.title-line { display: flex; gap: .18em; align-items: baseline; justify-content: center; white-space: nowrap; }
.title-line + .title-line { margin-top: .07em; }
.title-word { display: inline-flex; align-items: baseline; gap: .012em; }
.title-letter { --letter-color: #ffdb45; --letter-turn: -3deg; display: inline-block; position: relative; color: var(--letter-color); transform: rotate(var(--letter-turn)); -webkit-text-stroke: clamp(2px, .29vw, 4px) #23365e; paint-order: stroke fill; text-shadow: 1px 1px 0 #23365e, 2px 2px 0 #23365e, 3px 3px 0 #23365e, 4px 4px 0 #23365e, 5px 5px 0 #23365e, 6px 6px 0 #23365e, 7px 7px 0 #23365e, 8px 8px 0 #23365e, 9px 9px 0 #f2fbff, 11px 12px 0 #23365e28; }
.title-letter::after { content: attr(data-letter); position: absolute; inset: 0; color: #ffffff8c; -webkit-text-stroke: 0; text-shadow: none; clip-path: inset(0 0 76% 0); transform: translate(-1px, -1px); pointer-events: none; }
.title-letter:nth-child(2n) { --letter-turn: 3deg; }
.title-letter:nth-child(3n) { --letter-turn: -5deg; }
.title-line:nth-child(2) .title-letter:nth-child(2n) { --letter-turn: 5deg; }
.letter-yellow { --letter-color: #ffda42; }
.letter-orange { --letter-color: #ff9754; }
.letter-pink { --letter-color: #ff86c0; }
.letter-blue { --letter-color: #64d4ff; }
.letter-green { --letter-color: #7fe3a6; }
.button { position: relative; min-height: 49px; padding: 12px 24px; border: 2px solid var(--ink); border-radius: 16px; font-size: 1.05rem; font-weight: 600; line-height: 1.2; display: inline-flex; align-items: center; justify-content: center; gap: 12px; transition: transform .16s, background .16s, box-shadow .16s; }
.button:hover { transform: translateY(-3px); }
.button:active { transform: translateY(3px); }
.button-primary { color: var(--ink); background: var(--yellow); box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 #fff5b5; }
.button-primary:hover { background: #ffe56b; box-shadow: 0 7px 0 var(--ink), inset 0 3px 0 #fff8cf; }
.button-primary:active { box-shadow: 0 2px 0 var(--ink), inset 0 3px 0 #fff5b5; }
.button-quiet { color: var(--ink); background: #fffefa; box-shadow: 0 4px 0 #26436d; }
.button-quiet:hover { background: #dff4ff; box-shadow: 0 6px 0 #26436d; }
.button-quiet:active { box-shadow: 0 1px 0 #26436d; }
.button-spark { color: #fffaf1; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; font-size: 1.7rem; }

/* Floating game HUD. White cards and outlined headings stay readable at night. */
.hud { position: absolute; z-index: 8; top: 31px; left: 38px; right: 38px; display: flex; align-items: flex-start; justify-content: flex-end; gap: 20px; pointer-events: none; }
.hud-actions { display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.camera-controls { display: flex; align-items: center; gap: 7px; padding-right: 11px; margin-right: 1px; border-right: 2px solid #20355f38; }
.camera-controls .icon-button:disabled { cursor: default; transform: none; }
body[data-state="explore"] #world-canvas, body[data-state="arrival"] #world-canvas { cursor: grab; }
body[data-state="explore"] #world-canvas:active, body[data-state="arrival"] #world-canvas:active { cursor: grabbing; }
.collection-counter { border: 2px solid var(--ink); border-radius: 18px; background: #fffef5; display: flex; align-items: center; gap: 11px; padding: 10px 17px 10px 13px; color: var(--ink); box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 white; transition: transform .16s, background .16s; }
.collection-counter:hover { transform: translateY(-2px) rotate(1deg); background: #fff6ce; }
.collection-counter > svg { width: 30px; height: 30px; fill: #ffdc68; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.counter-copy { display: grid; text-align: left; line-height: 1.15; gap: 3px; }
.counter-copy strong { font: 400 1.6rem/1 var(--display); }
.counter-copy > span { font-size: .8125rem; font-weight: 500; color: var(--ink-soft); }
.collection-counter.pop { animation: counterPop .6s ease; }
.icon-button { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; padding: 10px; border: 2px solid var(--ink); background: #fffef5; border-radius: 15px; box-shadow: 0 4px 0 var(--ink); transition: background .16s, transform .16s; }
.icon-button:hover { background: #d9f5ff; transform: translateY(-2px); }
.icon-button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.music-button { position: relative; }
.music-button[aria-pressed="false"], .music-button[data-muted="true"] { background: #ffcedf; }
.music-button::after { content: ''; position: absolute; width: 26px; height: 2px; border-radius: 2px; background: var(--ink); box-shadow: 0 1px 0 #ffcedf; transform: rotate(-45deg) scaleX(0); opacity: 0; transition: transform .18s, opacity .18s; pointer-events: none; }
.music-button[aria-pressed="false"]::after, .music-button[data-muted="true"]::after { transform: rotate(-45deg) scaleX(1); opacity: 1; }

.touch-controls { display: none; z-index: 8; position: absolute; bottom: 31px; inset-inline: 27px; justify-content: space-between; align-items: flex-end; pointer-events: none; }
.d-pad { width: 134px; height: 134px; display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 1px; }
.d-pad button, .touch-jump { pointer-events: auto; border: 2px solid var(--ink); background: #fffef5e8; color: var(--ink); box-shadow: 0 3px 0 var(--ink); border-radius: 13px; touch-action: none; user-select: none; }
.d-pad button:active, .touch-jump:active { background: var(--yellow); transform: translateY(2px); }
.d-pad svg { width: 24px; height: 24px; margin: auto; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.d-up { grid-column: 2; grid-row: 1; }
.d-left { grid-column: 1; grid-row: 2; }
.d-down { grid-column: 2; grid-row: 3; }
.d-right { grid-column: 3; grid-row: 2; }
.touch-jump { width: 69px; height: 69px; border-radius: 50%; font-size: 1rem; font-weight: 600; background: #ffdc60; }
body[data-state="intro"] .touch-controls, body[data-state="ending"] .touch-controls, body.collecting .touch-controls { display: none; }

.arrival-panel { position: absolute; z-index: 12; width: clamp(280px, 25vw, 350px); right: 5vw; top: 52%; transform: translateY(-50%); animation: arrivalEnter .65s cubic-bezier(.19,1,.22,1) both; }
.polaroid-card { background: #fffef8; padding: 12px 12px 28px; border: 2px solid #20355f; border-radius: 5px; position: relative; transform: rotate(2deg); box-shadow: 5px 7px 0 #20355f45, 0 16px 38px #19355c20; }
.polaroid-card::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .18; border-radius: inherit; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 170 170' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.25' filter='url(%23p)'/%3E%3C/svg%3E"); mix-blend-mode: multiply; }
.polaroid-photo { aspect-ratio: 1; width: 100%; overflow: hidden; background: #d5f0f3; border: 1px solid #20355f24; border-radius: 2px; }
.polaroid-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.polaroid-card figcaption { text-align: center; padding: 13px 5px 0; }
.souvenir-title { font: 400 1.55rem/1.15 var(--display); }
.souvenir-course { font-size: .875rem; font-weight: 400; color: #54667e; margin-top: 6px; }
.arrival-actions { text-align: center; margin-top: 27px; }
.next-question { display: inline-block; font-size: .9375rem; font-weight: 500; margin-bottom: 12px; padding: 5px 9px; background: #fffef4ed; border-radius: 10px; color: var(--ink); }
.arrival-actions > .button { width: calc(100% - 20px); min-height: 50px; font-size: 1.125rem; }
.camera-flash { position: absolute; inset: 0; background: #fffdf8; pointer-events: none; z-index: 40; opacity: 0; }
.camera-flash.active, .camera-flash.flash, .camera-flash.is-active { animation: cameraFlash .7s ease-out; }
.travel-status { position: absolute; z-index: 10; bottom: 35px; left: 50%; transform: translateX(-50%); padding: 9px 20px; border: 2px solid var(--ink); border-radius: 30px; background: #fffef5ef; box-shadow: 0 3px 0 #20355f; font-size: .9375rem; font-weight: 500; white-space: nowrap; text-align: center; pointer-events: none; }
.travel-status:empty { display: none; }
.loading-status { position: absolute; z-index: 50; bottom: 26px; right: 31px; font-size: .875rem; font-weight: 500; color: var(--ink); background: #fffef5ed; padding: 8px 14px; border: 2px solid var(--ink); border-radius: 13px; }
.loading-dots { display: inline-block; animation: loadingPulse 1.1s infinite; }

.ending { position: absolute; z-index: 25; inset: 0; background: radial-gradient(ellipse at center, #182c58dc 0%, #303361c9 60%, #26345894 100%); backdrop-filter: blur(6px); overflow: auto; display: grid; place-items: center; padding: 35px 30px; animation: endingEnter .6s ease-out; }
.ending-content { width: min(100%, 850px); text-align: center; margin: auto; }
.ending-eyebrow { color: #c9e1ff; display: flex; justify-content: center; align-items: center; gap: 14px; font-size: .8125rem; }
.ending-eyebrow > span { font-size: 1.3rem; color: #ffdc68; }
.ending h2 { margin-top: 13px; font: 400 clamp(2.5rem, 4vw, 3.8rem)/1.02 var(--display); color: #fffdf3; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 2px 3px 0 var(--ink); }
.ending-thought { font-size: 1.05rem; color: #d0dfff; margin-top: 11px; }
.ending-gallery { --ending-card-size: clamp(72px, calc((100dvh - 392px) / 3 - 28px), 115px); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; width: min(100%, calc(var(--ending-card-size) * 5 + 48px)); margin: 27px auto 21px; }
.ending-gallery > * { min-width: 0; margin: 0; padding: 5px 5px 7px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 4px; box-shadow: 2px 3px 0 #20355f2e; transform: rotate(-3deg); }
.ending-gallery > :nth-child(3n) { transform: rotate(3deg); }
.ending-gallery > :nth-child(4n) { transform: rotate(1deg); }
.ending-gallery img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 1px; }
.ending-gallery .ending-souvenir > span { display: block; font-size: .75rem; font-weight: 500; line-height: 1.2; margin-top: 4px; letter-spacing: .06em; color: #4a607e; }
.ending-question { font: 400 1.85rem/1.2 var(--display); margin-top: 7px; color: #fffdf3; text-shadow: 1px 2px 0 #152549; }
.ending-actions { display: flex; justify-content: center; gap: 13px; margin-top: 16px; }
.ending-actions .button { min-width: 177px; }
.collection-modal { position: absolute; z-index: 45; inset: 0; display: grid; place-items: center; padding: 32px; background: #10264e66; backdrop-filter: blur(9px); animation: endingEnter .2s ease-out; }
.collection-sheet { position: relative; width: min(1020px, 100%); max-height: calc(100dvh - 64px); overflow-y: auto; padding: 35px 38px; background: #f5fbff; border: 3px solid var(--ink); box-shadow: 0 9px 0 #20355f, 0 24px 100px #10264e40; border-radius: 27px; }
.collection-sheet > .eyebrow { color: #53739a; padding-right: 42px; }
.collection-sheet h2 { font: 400 clamp(2rem, 3.6vw, 3rem)/1.1 var(--display); margin-top: 8px; }
.collection-subtitle { font-size: 1rem; color: #58718f; margin-top: 7px; }
.collection-close { position: absolute; top: 22px; right: 22px; background: #ffdd69; }
.collection-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 22px 16px; margin-top: 27px; }
.collection-grid > * { min-width: 0; margin: 0; }
.collection-card { background: white; padding: 7px 7px 10px; border: 2px solid #5b7191; border-radius: 7px; box-shadow: 0 3px 0 #20355f27; color: var(--ink); text-align: center; transition: transform .18s, box-shadow .18s, border-color .18s; }
.collection-card.collected:hover { transform: translateY(-4px) rotate(-2deg); border-color: #20355f; box-shadow: 3px 7px 0 #20355f27; }
.collection-card:disabled { opacity: 1; cursor: default; background: #e7f0f8; border-color: #9db1c9; border-style: dashed; box-shadow: none; }
.collection-card > span { display: block; margin: 8px 0 0; font: 400 1.05rem/1.2 var(--display); }
.collection-card > small { display: block; margin-top: 4px; min-height: 2.6em; font-size: .8125rem; line-height: 1.3; color: #536b88; overflow-wrap: anywhere; }
.uncollected-stamp { position: relative; isolation: isolate; display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 3px; background: linear-gradient(135deg, #d4e4f3, #e6eafb); color: #829abc; font: 400 clamp(1.8rem, 3.2vw, 3rem)/1 var(--display); }
.uncollected-stamp::before { content: ''; position: absolute; inset: 20%; border: 2px dashed #a8bed6; border-radius: 50%; transform: rotate(-12deg); z-index: -1; }
.uncollected-stamp::after { content: ''; position: absolute; inset: 5px; border: 1px solid #b5c9df50; border-radius: 3px; z-index: -1; }
.collection-grid img { width: 100%; aspect-ratio: 1; height: auto; display: block; object-fit: cover; border-radius: 3px; }

body:has(#arrival:not([hidden])) .touch-controls, body:has(#ending:not([hidden])) .touch-controls, body:has(#collection-modal:not([hidden])) .touch-controls { display: none; }
body[data-state="ending"] #hud, body[data-state="ending"] #controls-bar { visibility: hidden; }

@keyframes arrivalEnter { from { opacity: 0; transform: translate(45px, -46%) rotate(3deg); } to { opacity: 1; transform: translate(0, -50%) rotate(0); } }
@keyframes cameraFlash { 0% { opacity: 0; } 8% { opacity: .92; } 20% { opacity: .7; } 100% { opacity: 0; } }
@keyframes counterPop { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.12) rotate(-2deg); } }
@keyframes endingEnter { from { opacity: 0; } to { opacity: 1; } }
@keyframes loadingPulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

@media (min-width: 1600px) {
  .arrival-panel { right: 7vw; }
}
@media (max-width: 1100px) {
  .hud { left: 28px; right: 28px; }
  .arrival-panel { width: 285px; right: 4vw; }
}
@media (max-height: 760px) and (min-width: 801px) {
  .hud { top: 23px; }
  .arrival-panel { width: 253px; top: 50%; right: 5vw; }
  .polaroid-card { padding: 9px 9px 21px; }
  .polaroid-card figcaption { padding-top: 8px; }
  .souvenir-title { font-size: 1.3rem; }
  .souvenir-course { font-size: .8125rem; }
  .arrival-actions { margin-top: 18px; }
  .next-question { font-size: .875rem; margin-bottom: 9px; }
  .arrival-actions .button { min-height: 44px; }
  .ending { padding-block: 25px; }
  .ending h2 { font-size: 2.65rem; }
  .ending-gallery { gap: 9px; margin-top: 19px; margin-bottom: 16px; }
  .ending-thought { margin-top: 7px; }
  .ending-question { font-size: 1.55rem; }
  .ending-actions { margin-top: 12px; }
}
@media (max-width: 800px) {
  .title-letter { -webkit-text-stroke-width: 2.5px; text-shadow: 1px 1px 0 #23365e, 2px 2px 0 #23365e, 3px 3px 0 #23365e, 4px 4px 0 #23365e, 5px 5px 0 #23365e, 6px 6px 0 #f2fbff, 8px 9px 0 #23365e28; }
  .hud { top: 24px; left: 25px; right: 25px; gap: 10px; }
  .hud-actions { gap: 7px; }
  .camera-controls { gap: 6px; padding-right: 8px; }
  .collection-counter { padding: 8px 11px; gap: 8px; border-radius: 15px; }
  .collection-counter > svg { width: 25px; height: 25px; }
  .counter-copy strong { font-size: 1.3rem; }
  .counter-copy > span { font-size: .75rem; }
  .icon-button { width: 39px; height: 39px; padding: 8px; border-radius: 13px; }
  .icon-button svg { width: 19px; height: 19px; }
  .arrival-panel { width: 250px; right: 27px; top: 51%; }
  .polaroid-card { padding: 9px 9px 22px; }
  .souvenir-title { font-size: 1.3rem; }
  .souvenir-course { font-size: .8125rem; }
  .next-question { font-size: .875rem; }
  .collection-modal { padding: 22px; }
  .collection-sheet { padding: 29px 24px; max-height: calc(100dvh - 44px); border-radius: 22px; }
  .collection-sheet > .eyebrow { font-size: .6875rem; }
  .collection-sheet h2 { font-size: 2rem; max-width: 83%; }
  .collection-grid { gap: 18px 12px; grid-template-columns: repeat(4, 1fr); }
  .collection-card > span { font-size: 1rem; }
  .collection-card > small { font-size: .8125rem; }
  .ending { padding: 30px 25px; }
  .ending-gallery { gap: 9px; }
}
@media (max-width: 560px) {
  .cloud-one { top: 27%; opacity: .35; }
  .cloud-two { top: 12%; right: -17%; }
  .cloud-three { left: 8%; bottom: 12%; }
  .sky-moon { width: 43px; height: 43px; right: 19%; top: 17%; }
  .hud { left: 20px; right: 20px; top: 21px; align-items: flex-start; }
  .hud-actions { gap: 6px; }
  .camera-controls { gap: 5px; padding-right: 7px; margin-right: 0; }
  .collection-counter { gap: 0; padding: 7px 10px; }
  .collection-counter > svg { display: none; }
  .counter-copy strong { font-size: 1.2rem; }
  .counter-copy > span { font-size: .6875rem; }
  .icon-button { width: 35px; height: 35px; padding: 7px; border-radius: 12px; }
  #fullscreen-btn { display: none; }
  .arrival-panel { width: min(65vw, 265px); right: 22px; top: 49%; }
  .polaroid-card { padding: 8px 8px 18px; }
  .polaroid-card figcaption { padding-top: 10px; }
  .souvenir-title { font-size: 1.25rem; }
  .souvenir-course { font-size: .75rem; }
  .arrival-actions { margin-top: 20px; }
  .next-question { font-size: .8125rem; margin-bottom: 9px; padding-inline: 6px; }
  .arrival-actions > .button { min-height: 44px; font-size: 1rem; }
  .travel-status { font-size: .8125rem; max-width: calc(100% - 40px); white-space: normal; bottom: 30px; width: max-content; }
  .collection-modal { padding: 15px; }
  .collection-sheet { padding: 30px 17px 25px; max-height: calc(100dvh - 30px); border-radius: 20px; }
  .collection-sheet > .eyebrow { max-width: 83%; line-height: 1.5; font-size: .625rem; }
  .collection-sheet h2 { font-size: 1.8rem; max-width: 83%; }
  .collection-subtitle { font-size: .875rem; }
  .collection-close { top: 18px; right: 15px; }
  .collection-grid { gap: 15px 9px; grid-template-columns: repeat(3, 1fr); margin-top: 23px; }
  .collection-card { padding: 5px 5px 8px; border-width: 1.5px; }
  .collection-card > span { font-size: .875rem; }
  .collection-card > small { font-size: .75rem; }
  .ending { padding: 30px 22px; }
  .ending h2 { font-size: 2.4rem; }
  .ending-eyebrow { font-size: .625rem; letter-spacing: .05em; gap: 9px; }
  .ending-gallery { grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 24px; }
  .ending-gallery > * { padding: 3px 3px 5px; border-width: 1px; }
  .ending-gallery .ending-souvenir > span { font-size: .6875rem; }
  .ending-thought { font-size: .9375rem; }
  .ending-question { margin-top: 23px; font-size: 1.7rem; }
  .ending-actions { flex-direction: column; gap: 12px; width: min(100%, 265px); margin: 17px auto 0; }
  .ending-actions .button { min-height: 46px; }
  .loading-status { bottom: 22px; right: 22px; font-size: .75rem; max-width: 70%; }
}
@media (max-height: 620px) and (max-width: 800px) {
  .arrival-panel { width: 214px; }
  .polaroid-card { padding: 7px 7px 17px; }
  .polaroid-card figcaption { padding-top: 7px; }
  .souvenir-title { font-size: 1.1rem; }
  .souvenir-course { font-size: .6875rem; margin-top: 3px; }
  .arrival-actions { margin-top: 15px; }
  .next-question { font-size: .75rem; margin-bottom: 7px; }
  .arrival-actions > .button { min-height: 39px; }
}
@media (pointer: coarse) {
  .touch-controls { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Centered title composition, independent of the world's camera position. */
body[data-state="intro"] #world-canvas,
body[data-state="intro"] #sky-backdrop { visibility: hidden; }
.intro-copy { position: relative; width: min(100%, 850px); text-align: center; }
.game-logo { font: 400 clamp(4rem, 8.4vw, 8rem)/1.05 var(--display); letter-spacing: -.028em; width: max-content; margin: 0 auto; }
.intro-description { font-size: clamp(1.125rem, 1.65vw, 1.4rem); line-height: 1.45; font-weight: 500; margin: 32px auto 29px; color: #624669; }
.start-button { min-height: 65px; min-width: 258px; justify-content: space-between; padding: 15px 24px; border-width: 3px; border-radius: 22px; font-size: 1.45rem; box-shadow: 0 7px 0 var(--ink), inset 0 4px 0 #fff7bd; }
.start-button:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 10px 0 var(--ink), inset 0 4px 0 #fff7bd; }
.start-button:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--ink), inset 0 4px 0 #fff7bd; }
.sound-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 23px auto 0; font-size: .875rem; font-weight: 400; color: #795674; }
.sound-note svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* First-play instructions. Once hidden, this leaves no persistent navigation. */
.controls-bar { position: absolute; z-index: 10; inset: 0; display: grid; place-items: center; padding: 27px; background: #23436b1c; pointer-events: none; animation: endingEnter .35s ease-out; }
.tutorial-card { position: relative; width: min(100%, 540px); padding: 35px 36px 37px; border: 3px solid var(--ink); border-radius: 30px; background: #fffdf5f5; box-shadow: 0 8px 0 #20355f, 0 20px 65px #142e5742; backdrop-filter: blur(8px); text-align: center; pointer-events: auto; }
.tutorial-badge { width: 58px; height: 58px; display: grid; place-items: center; margin: -65px auto 17px; border: 3px solid var(--ink); border-radius: 19px; background: var(--yellow); color: #fffefa; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; font-size: 2.4rem; line-height: 1; box-shadow: 0 4px 0 var(--ink); transform: rotate(-8deg); }
.tutorial-card h2 { font: 400 clamp(1.8rem, 3vw, 2.4rem)/1.1 var(--display); color: var(--ink); }
.tutorial-description { max-width: 370px; margin: 12px auto 0; font-size: 1.05rem; line-height: 1.4; color: #5c6c83; }
.keyboard-hints { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 14px; margin: 26px auto 29px; }
.camera-hints { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: -9px 0 23px; color: #5c6c83; font-size: .875rem; line-height: 1.4; }
.key-hint { display: grid; justify-items: center; gap: 8px; font-size: 1rem; font-weight: 500; color: #435b7c; }
.tutorial-key { display: grid; place-items: center; min-height: 70px; width: 100%; }
kbd { display: inline-grid; place-items: center; min-width: 30px; height: 29px; padding: 0 5px; font: 500 .9rem/1 var(--ui); border: 2px solid #537197; border-bottom-width: 4px; border-radius: 7px; background: #e5f1ff; color: var(--ink); }
.arrow-key-cluster { display: grid; justify-items: center; gap: 3px; }
.arrow-key-cluster > span { display: flex; gap: 3px; }
.space-key, .enter-key { width: 78px; height: 39px; font-size: 1rem; }
.tutorial-card .travel-button { min-width: 235px; min-height: 53px; font-size: 1.15rem; border-radius: 16px; }

@media (max-width: 800px) {
  .game-logo { font-size: clamp(3.8rem, 11.2vw, 6rem); }
  .intro-description { font-size: 1.125rem; margin-top: 29px; }
  .tutorial-card { width: min(100%, 490px); padding-inline: 29px; }
  .tutorial-card h2 { font-size: 2.1rem; }
}
@media (max-width: 560px) {
  .intro { padding: 30px 25px; }
  .game-logo { font-size: clamp(2.75rem, 12.8vw, 4.6rem); }
  .intro-description { font-size: 1.05rem; margin: 28px auto 25px; }
  .start-button { min-height: 58px; min-width: 239px; font-size: 1.25rem; padding: 13px 20px; border-radius: 20px; }
  .sound-note { margin-top: 22px; font-size: .8125rem; }
  .controls-bar { padding: 22px; }
  .tutorial-card { padding: 28px 17px 29px; border-radius: 25px; }
  .tutorial-badge { margin-top: -59px; margin-bottom: 20px; }
  .tutorial-card h2 { font-size: 1.9rem; }
  .tutorial-description { font-size: .9375rem; }
  .keyboard-hints { gap: 7px; margin-block: 23px 25px; }
  .key-hint { font-size: .9375rem; }
  kbd { min-width: 25px; height: 26px; font-size: .8125rem; padding-inline: 3px; border-radius: 6px; }
  .space-key, .enter-key { width: 65px; height: 37px; font-size: .875rem; }
  .tutorial-card .travel-button { min-width: 219px; font-size: 1.05rem; }
}
@media (max-height: 650px) {
  .game-logo { font-size: clamp(2.8rem, 7.5vw, 5.7rem); }
  .intro-description { font-size: 1rem; margin-block: 23px; }
  .start-button { min-height: 53px; min-width: 231px; font-size: 1.2rem; padding-block: 12px; }
  .sound-note { margin-top: 18px; font-size: .75rem; }
  .tutorial-card { padding-top: 24px; padding-bottom: 27px; }
  .tutorial-badge { margin-top: -55px; margin-bottom: 14px; }
  .tutorial-card h2 { font-size: 1.9rem; }
  .tutorial-description { margin-top: 9px; font-size: .9375rem; }
  .keyboard-hints { margin-block: 17px 21px; }
}
@media (max-height: 480px) and (min-width: 561px) {
  .intro-description { margin-block: 16px; }
  .sound-note { display: none; }
  .tutorial-card { max-width: 550px; padding: 21px 30px 23px; }
  .tutorial-badge { display: none; }
  .tutorial-card h2 { font-size: 1.8rem; }
  .keyboard-hints { margin-block: 13px 16px; }
  .tutorial-key { min-height: 60px; }
}

/* A new chapter: bring all fifteen souvenirs into Vivian's pastel kitchen. */
.fridge-entry-button { margin: 18px auto 4px; min-height: 57px; padding-inline: 30px; font-size: 1.22rem; }
.collection-fridge-button { display: flex; margin: 24px auto 0; }
body[data-state="fridge"] #hud,
body[data-state="fridge"] #sky-backdrop,
body[data-state="fridge"] #controls-bar,
body[data-state="fridge"] #touch-controls { visibility: hidden; }
body[data-state="fridge"] #world-canvas { cursor: default; }
.fridge-game { position: absolute; inset: 0; z-index: 10; pointer-events: none; overflow: hidden; }
.fridge-game button, .fridge-tray { pointer-events: auto; }
.fridge-header { position: absolute; inset: 22px 24px auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.fridge-back { min-height: 44px; font-size: .95rem; padding: 10px 15px; gap: 8px; border-radius: 15px; }
.fridge-back svg { width: 23px; height: 23px; stroke: currentColor; stroke-width: 1.5; fill: none; flex: 0 0 auto; }
.fridge-heading { text-align: center; padding-top: 2px; }
.fridge-heading h2 { font: 400 clamp(1.55rem,2.7vw,2.7rem)/1.12 var(--display); color: #fffefa; -webkit-text-stroke: 1.4px var(--ink); paint-order: stroke fill; text-shadow: 2px 3px 0 var(--ink); }
.fridge-tools { display: flex; gap: 9px; }
.fridge-progress { position: absolute; top: 105px; left: 28px; display: grid; gap: 2px; padding: 13px 19px 12px; border: 3px solid var(--ink); border-radius: 20px; background: #fffdf2; box-shadow: 0 5px 0 var(--ink); text-align: center; }
.fridge-progress strong { font: 400 2rem/1 var(--display); }
.fridge-progress span { font-weight: 500; font-size: .9rem; }
.fridge-tray { position: absolute; top: 132px; right: 24px; bottom: 24px; width: clamp(300px,22vw,360px); display: flex; flex-direction: column; padding: 18px 18px 12px; border: 3px solid var(--ink); border-radius: 25px; background: #fffaf4f7; box-shadow: 0 7px 0 var(--ink), 0 15px 35px #6e39551a; }
.fridge-next { text-align: center; flex: 0 0 auto; }
.fridge-next-label { display: block; color: #69738a; font-size: .875rem; font-weight: 600; letter-spacing: .045em; }
.fridge-next h3 { margin: 3px 0 1px; font: 400 1.8rem/1.15 var(--display); }
.fridge-next > p { font-weight: 500; font-size: 1rem; line-height: 1.2; min-height: 1.2em; }
.fridge-instruction { text-align: center; margin: 10px 0 12px; font-size: .875rem; color: #52627e; line-height: 1.25; }
.fridge-rack { --rack-columns: 3; --rack-rows: 5; --rack-column-gap: 9px; --rack-row-gap: 9px; container-type: size; min-height: 0; flex: 1 1 0; display: grid; grid-template-columns: repeat(var(--rack-columns),minmax(0,1fr)); grid-template-rows: repeat(var(--rack-rows),minmax(0,1fr)); gap: var(--rack-row-gap) var(--rack-column-gap); align-items: center; justify-items: center; padding: 3px 2px 6px; }
/* Size both axes from the smaller grid-cell dimension: tall rows must never crop square art. */
.fridge-magnet { --magnet-side: min(105px,calc((100cqw - (var(--rack-columns) - 1) * var(--rack-column-gap)) / var(--rack-columns)),calc((100cqh - (var(--rack-rows) - 1) * var(--rack-row-gap)) / var(--rack-rows))); position: relative; padding: 0; width: var(--magnet-side); height: var(--magnet-side); min-width: 0; min-height: 0; aspect-ratio: 1; overflow: visible; border: 2px solid #fffdf6; border-radius: 8px; background: #bddae8; box-shadow: 0 3px 0 #23385c70, 0 5px 8px #23385c1c; touch-action: none; transition: transform .17s,opacity .2s,filter .2s; user-select: none; -webkit-user-select: none; cursor: grab; }
.fridge-magnet img { display: block; width: 100%; height: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 5px; pointer-events: none; }
.fridge-magnet:hover:not(:disabled) { transform: translateY(-3px) rotate(-3deg); box-shadow: 0 5px 0 #23385c70,0 8px 10px #23385c1c; }
.fridge-magnet:active:not(:disabled) { cursor: grabbing; transform: scale(.96); }
.fridge-magnet.is-placed { opacity: .27; filter: saturate(.25); box-shadow: none; cursor: default; }
.fridge-magnet.is-dragging { opacity: .2; }
.fridge-magnet.is-wrong { animation: fridgeShake .5s ease; box-shadow: 0 3px 0 #dc5772, 0 0 0 3px #ee88a7; }
.magnet-check { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font: 400 2.1rem/1 var(--display); text-shadow: 2px 2px 0 #20355f; opacity: 0; }
.is-placed .magnet-check { opacity: 1; }
.fridge-feedback { flex: 0 0 auto; min-height: 2.5em; margin-top: 12px; display: grid; align-content: center; text-align: center; font-size: .94rem; line-height: 1.2; font-weight: 500; color: #52627e; }
.fridge-feedback[data-mood="sad"] { color: #b34963; }
.fridge-feedback[data-mood="happy"] { color: #24745a; }
.fridge-drag-ghost { position: fixed; z-index: 100; width: clamp(65px,7.5vw,110px); height: auto; aspect-ratio: 1; object-fit: cover; border: 3px solid #fffdf6; border-radius: 10px; box-shadow: 0 12px 25px #20355f55; transform: translate(-50%,-50%) rotate(-5deg); pointer-events: none; }
.fridge-finish { position: absolute; top: 31%; right: 24px; width: clamp(300px,26vw,390px); animation: fridgeFinishIn .5s cubic-bezier(.2,.8,.2,1.1); }
.fridge-finish-card { padding: 27px 22px; text-align: center; border: 3px solid var(--ink); border-radius: 26px; background: #fffaf5f7; box-shadow: 0 7px 0 var(--ink); }
.fridge-finish-badge { display: inline-block; border-radius: 30px; background: #ffe16a; padding: 7px 17px; font: 400 1.2rem/1.2 var(--display); border: 2px solid var(--ink); }
.fridge-finish h2 { font: 400 clamp(1.6rem,2.1vw,2.1rem)/1.1 var(--display); margin: 19px 0 12px; }
.fridge-finish p { font-size: 1.05rem; line-height: 1.35; margin-bottom: 23px; }
.fridge-finish .button { width: 100%; font-size: 1rem; }
.fridge-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.fridge-confetti i { position: absolute; top: -30px; left: var(--x); width: 10px; height: 15px; border-radius: 2px; animation: fridgeConfetti var(--duration) var(--delay) cubic-bezier(.2,.5,.7,.9) both; }
@keyframes fridgeConfetti { from { transform: translate(0,-30px) rotate(0); } to { transform: translate(var(--drift),110vh) rotate(var(--spin)); } }
@keyframes fridgeShake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-6px) rotate(-4deg); } 40%,80% { transform: translateX(6px) rotate(4deg); } }
@keyframes fridgeFinishIn { from { opacity: 0; transform: translateY(20px) scale(.95); } to { opacity: 1; transform: none; } }
@media (max-height: 730px) and (min-width: 760px) {
  .fridge-header { top: 16px; }
  .fridge-tray { top: 99px; bottom: 18px; padding: 12px 15px 8px; }
  .fridge-next h3 { font-size: 1.55rem; }
  .fridge-next-label { display: none; }
  .fridge-instruction { margin: 6px 0 8px; }
  .fridge-feedback { min-height: 2.2em; margin-top: 7px; font-size: .875rem; }
  .fridge-rack { --rack-column-gap: 7px; --rack-row-gap: 7px; }
  .fridge-progress { top: 88px; }
}
@media (max-width: 759px) {
  .fridge-header { inset: 14px 14px auto; gap: 9px; align-items: center; }
  .fridge-back { width: 42px; min-height: 42px; padding: 8px; border-radius: 13px; }
  .fridge-back span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .fridge-heading h2 { font-size: clamp(1.2rem,4.9vw,1.75rem); text-shadow: 1px 2px 0 var(--ink); -webkit-text-stroke: 1px var(--ink); }
  .fridge-tools .icon-button { width: 39px; height: 39px; padding: 8px; border-radius: 12px; }
  #fridge-fullscreen { display: none; }
  .fridge-progress { top: 73px; left: 13px; padding: 7px 9px 6px; border-width: 2px; border-radius: 13px; box-shadow: 0 3px 0 var(--ink); }
  .fridge-progress strong { font-size: 1.3rem; }
  .fridge-progress span { font-size: .75rem; }
  .fridge-tray { top: auto; right: 12px; left: 12px; bottom: max(12px,env(safe-area-inset-bottom)); width: auto; height: clamp(220px,29vh,270px); padding: 10px 12px 8px; border-radius: 20px; }
  .fridge-next { display: flex; align-items: baseline; gap: 8px; justify-content: center; }
  .fridge-next-label { display: none; }
  .fridge-next h3 { flex: 0 0 auto; font-size: 1.25rem; margin: 0; }
  .fridge-next > p { font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fridge-instruction { font-size: .875rem; margin: 4px 0 7px; }
  .fridge-rack { --rack-columns: 5; --rack-rows: 3; --rack-column-gap: 10px; --rack-row-gap: 6px; padding: 0 2px 3px; }
  .fridge-magnet { border-radius: 6px; }
  .fridge-magnet img { border-radius: 4px; }
  .fridge-feedback { font-size: .875rem; min-height: 1.2em; margin-top: 7px; }
  .fridge-finish { top: auto; right: 12px; left: 12px; bottom: max(14px,env(safe-area-inset-bottom)); width: auto; }
  .fridge-finish-card { padding: 16px 20px 18px; border-radius: 23px; }
  .fridge-finish-badge { padding: 4px 14px; font-size: 1rem; }
  .fridge-finish h2 { font-size: 1.6rem; margin: 9px 0 6px; }
  .fridge-finish h2 br { display: none; }
  .fridge-finish p { font-size: .94rem; margin-bottom: 12px; }
  .fridge-finish .button { min-height: 44px; }
  .fridge-entry-button { max-width: 100%; padding: 12px 20px; font-size: 1.05rem; }
  .ending:has(.fridge-entry-button) { padding-top: 24px; padding-bottom: 20px; }
  .ending:has(.fridge-entry-button) .ending-question { margin-top: 17px; font-size: 1.25rem; }
  .ending:has(.fridge-entry-button) .ending-actions { flex-direction: row; gap: 9px; width: 100%; justify-content: center; margin-top: 17px; }
  .ending:has(.fridge-entry-button) .ending-actions .button { font-size: .875rem; padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .fridge-confetti { display: none; }
  .fridge-magnet, .fridge-finish { animation: none !important; transition: none !important; }
}
