:root {
  --ink: #141047;
  --muted: #7f8bb7;
  --pad: clamp(22px, 3.8vw, 56px);
  --snek-size: clamp(187px, min(22.1vw, 40.8vh), 289px);
  --sky-blue-op: 0;
  --ground: 89%;
}
* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body { margin: 0; color: var(--ink); background: #f2faff; font-family: 'VT323', monospace; overflow-x: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 3px solid #2867ff; outline-offset: 7px; }
[hidden] { display: none !important; }
.scroll-track { height: 460vh; pointer-events: none; }
.stage { position: fixed; inset: 0; overflow: hidden; isolation: isolate; }
.sky-base, .sky-blue, .world, .layer { position: absolute; inset: 0; }
.sky-base { background: linear-gradient(125deg, #f6fbff, #edf9ff); }
.sky-blue { background: linear-gradient(180deg, #6bbfff 0%, #9bd8ff 62%, #daf4ff 100%); opacity: var(--sky-blue-op); }
.header { position: absolute; z-index: 30; top: 27px; left: var(--pad); right: var(--pad); display: flex; align-items: flex-start; justify-content: space-between; pointer-events: none; }
.header a, .header button { pointer-events: auto; }
.wordmark { display: inline-block; font-family: 'Silkscreen', monospace; font-weight: 700; font-size: 31px; line-height: 1; letter-spacing: -2.5px; }
.tagline { font-size: 24px; letter-spacing: .35px; color: #737caf; margin: 8px 0 0; }
.header-actions { display: flex; align-items: center; gap: 34px; }
.pixel-button { position: relative; border: 0; background: var(--ink); padding: 3px; color: white; font-size: 25px; letter-spacing: .3px; min-height: 48px; clip-path: polygon(8px 0,calc(100% - 8px) 0,calc(100% - 8px) 3px,calc(100% - 3px) 3px,calc(100% - 3px) 8px,100% 8px,100% calc(100% - 8px),calc(100% - 3px) calc(100% - 8px),calc(100% - 3px) calc(100% - 3px),calc(100% - 8px) calc(100% - 3px),calc(100% - 8px) 100%,8px 100%,8px calc(100% - 3px),3px calc(100% - 3px),3px calc(100% - 8px),0 calc(100% - 8px),0 8px,3px 8px,3px 3px,8px 3px); }
.access { padding: 8px 25px; background: linear-gradient(#2875ff, #2465f6) padding-box; box-shadow: inset 0 0 0 3px var(--ink), inset 0 5px 0 #8fb7ff; }
.access:hover { filter: brightness(1.1); }
.access[aria-disabled='true'] { cursor: default; }
.access span { font-family: monospace; font-size: 24px; }
.menu-toggle { width: 32px; height: 40px; padding: 9px 2px; border: 0; background: transparent; display: flex; flex-direction: column; justify-content: space-between; }
.menu-toggle span { height: 2px; width: 26px; background: var(--ink); transition: transform .2s, opacity .2s; }
.menu-toggle[aria-expanded='true'] span:first-child { transform: translateY(10px) rotate(45deg); }
.menu-toggle[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded='true'] span:last-child { transform: translateY(-10px) rotate(-45deg); }
.menu { position: absolute; top: 90px; right: var(--pad); z-index: 35; width: 290px; padding: 18px 24px; background: #f5fbff; border: 2px solid var(--ink); box-shadow: 5px 5px 0 #14104717; }
.menu button { display: block; width: 100%; padding: 12px 0; border: 0; background: transparent; font-size: 25px; text-align: left; }
.menu button:hover { color: #2465f6; }
.menu button span { color: var(--muted); padding-right: 12px; font-size: 19px; }
.story-dialog { width: min(920px, calc(100vw - 36px)); max-height: calc(100vh - 124px); margin: 104px auto auto; padding: 28px 28px 32px; border: 2px solid var(--ink); background: #f5fbff; color: var(--ink); box-shadow: 8px 8px 0 #1410471f; overflow: auto; }
.story-dialog::backdrop { background: #14104773; }
.story-dialog-about, .story-dialog-maxi { width: min(560px, calc(100vw - 36px)); }
.story-dialog h2 { font-family: 'Silkscreen', monospace; font-weight: 700; font-size: 28px; letter-spacing: -1px; line-height: 1.15; margin: 0 40px 18px 0; }
.story-dialog p { font-size: 26px; line-height: 1.25; margin: 16px 0 0; }
.story-dialog img { display: block; width: auto; max-width: 100%; max-height: min(320px, 40vh); height: auto; margin: 4px auto 0; border: 2px solid var(--ink); }
.story-dialog a { color: #2465f6; }
.story-dialog a:hover { text-decoration: underline; text-underline-offset: 4px; }
.story-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 0; background: transparent; font-family: 'Silkscreen', monospace; font-size: 28px; line-height: 1; }
.world { touch-action: pan-y; }
.layer { pointer-events: none; }
.clouds-upper { z-index: 1; }
.clouds-lower { z-index: 2; }
.meadow-grass { position: absolute; inset: 0; z-index: 3; pointer-events: none; background: url('./assets/meadow.png') center bottom / 100% 25% no-repeat; opacity: 0; mask-image: var(--meadow-mask); -webkit-mask-image: var(--meadow-mask); }
.props-mid { z-index: 4; }
.props-back { z-index: 5; }
.props-occluders { z-index: 11; }
.props-front { z-index: 12; }
.prop { position: absolute; height: auto; transform-origin: center bottom; pointer-events: none; image-rendering: pixelated; }
.rain { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 8; pointer-events: none; }
.snek-wrap { position: absolute; left: 50%; top: var(--ground); width: var(--snek-size); height: var(--snek-size); transform: translate(-50%, -93%); z-index: 10; pointer-events: none; }
.snek-motion { position: absolute; inset: 0; transform-origin: 50% 93%; will-change: transform; }
.snek { width: 100%; height: 100%; background: url('./assets/coil-poses-v2.png') 0 0 / 200% 200% no-repeat; image-rendering: pixelated; transform-origin: 50% 93%; }
.snek[data-pose='wake'] { background-position: 100% 0; }
.snek[data-pose='rain'] { background-position: 0 100%; transform: translateY(4%); }
.snek[data-pose='play'] { background-position: 100% 100%; transform: translateY(4%); }
.stage[data-phase='sleep'] .snek:not([data-animated='true']) { animation: breathe 3.2s ease-in-out infinite; }
.snek[data-animated='true'] { background: none; transform: none; }
.character-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.shadow { position: absolute; left: 50%; top: 93%; width: 51%; height: 4%; background: #436ead; border-radius: 50%; opacity: .12; transform: translateX(-50%); }
.zzz { position: absolute; right: 11%; top: 0; width: 65px; height: 100px; color: #7d8bbd; font-family: 'Silkscreen', monospace; font-size: 24px; font-weight: 700; opacity: 0; }
.stage[data-phase='sleep'] .zzz { opacity: var(--sleep-opacity, 1); }
.zzz span { position: absolute; animation: z-float 2.8s ease-in-out infinite; }
.zzz span:nth-child(1) { left: 0; bottom: 0; font-size: 20px; }
.zzz span:nth-child(2) { left: 25px; bottom: 32px; animation-delay: -.7s; }
.zzz span:nth-child(3) { left: 52px; bottom: 65px; animation-delay: -1.4s; }
.wake-lines { position: absolute; right: 7%; top: 10%; opacity: 0; }
.stage[data-phase='wake'] .wake-lines { opacity: var(--wake-emphasis, 0); }
.wake-lines i { position: absolute; width: 16px; height: 3px; background: var(--ink); transform: rotate(-55deg); }
.wake-lines i:nth-child(2) { top: 20px; left: 15px; transform: rotate(-20deg); }
.wake-lines i:nth-child(3) { top: 42px; left: 14px; transform: rotate(25deg); width: 10px; }
.catch-feedback { position: absolute; left: 58%; top: 4%; color: #fffbea; text-shadow: 2px 2px var(--ink); font-size: 34px; opacity: 0; }
.hint { position: absolute; left: 50%; bottom: 25px; transform: translateX(-50%); z-index: 20; font-size: 19px; letter-spacing: .5px; color: #677bac; margin: 0; white-space: nowrap; }
.hint span { margin-left: 10px; }
.stage[data-phase='play'] .hint { color: #304c45; }
.tally { position: absolute; left: 50%; bottom: 54px; transform: translateX(-50%); z-index: 21; margin: 0; }
.tally ol { display: flex; align-items: center; gap: 16px; margin: 0; padding: 0; list-style: none; }
.tally li { display: flex; align-items: center; gap: 5px; color: #294a3b; font-size: 26px; line-height: 1; }
.tally .mark { width: 26px; height: 26px; display: block; image-rendering: pixelated; }
.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; }
@keyframes breathe { 50% { transform: scale(1.018,.98); } }
@keyframes z-float { 50% { transform: translate(4px,-9px); opacity: .55; } }
@media (max-width: 640px) {
  :root { --pad: 22px; --snek-size: clamp(128px, 34vw, 174px); }
  .header { top: 23px; }
  .wordmark { font-size: 27px; }
  .tagline { font-size: 19px; max-width: 180px; line-height: 1; }
  .header-actions { gap: 16px; }
  .access { position: fixed; top: 113px; left: 22px; font-size: 21px; min-height: 42px; padding: 7px 17px; }
  .menu { top: 168px; left: var(--pad); right: var(--pad); width: auto; }
  .story-dialog { margin-top: 172px; max-height: calc(100vh - 188px); padding: 22px 16px 20px; }
  .story-dialog h2 { font-size: 22px; }
  .story-dialog p { font-size: 22px; }
  .hint { bottom: 24px; font-size: 17px; }
  .tally { bottom: 22px; }
  .tally ol { gap: 10px; }
  .tally li { font-size: 22px; }
  .tally .mark { width: 22px; height: 22px; }
  .stage[data-phase='play'] .hint { display: none; }
  .meadow-grass { background-size: auto var(--meadow-depth, 31%); }
}
@media (max-height: 500px) and (min-width: 641px) {
  :root { --snek-size: 49.3vh; }
  .header { top: 23px; }
  .hint { bottom: 12px; }
  .tally { bottom: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
