:root {
  --ink: #151515; --paper: #fff8e8; --yellow: #ffd23f; --red: #ff5d73; --blue: #4db8ff; --green: #7ed321;
  --font: "Marker Felt", "Chalkboard SE", "Comic Sans MS", "Comic Neue", "Segoe Print", cursive, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fd8ff; color: var(--ink); font-family: var(--font); }
body { user-select: none; -webkit-user-select: none; touch-action: manipulation; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

/* ── ad placeholders ── */
.ad-slot { display: flex; align-items: center; justify-content: center; border: 3px dashed rgba(21, 21, 21, .45); background: rgba(255, 255, 255, .45); color: rgba(21, 21, 21, .55); font-size: 13px; letter-spacing: .12em; border-radius: 10px; flex: none; }
#ad-top { height: clamp(44px, 9vh, 90px); width: min(728px, calc(100% - 16px)); margin: 6px auto 0; }
#ad-box { width: 300px; height: 250px; }

/* ── HUD ── */
#hud { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
#hud-title { flex: 1; min-width: 0; font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
#hud-fails { font-size: 15px; background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 3px 12px; white-space: nowrap; }
#hud-fails b { color: #e8202c; font-size: 19px; margin-left: 2px; }
#hud-fails.bump { animation: bump .5s; }
.btn { background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 6px 14px; font-size: 16px; box-shadow: 3px 4px 0 var(--ink); white-space: nowrap; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translate(3px, 4px); box-shadow: 0 0 0 var(--ink); }
.btn.yellow { background: var(--yellow); }
.btn.big { font-size: 22px; padding: 10px 22px; }
.btn.off { background: #d8d8d8; color: #777; }
#btn-skip .short, #btn-prev .short { display: none; line-height: 1; }
.link { background: none; border: 0; text-decoration: underline; font-size: 14px; opacity: .7; padding: 6px; }

/* ── stage: a fixed 900×600 world scaled to fit ── */
#stage-wrap { flex: 1; min-height: 0; position: relative; margin: 0 8px 8px; }
#stage { position: absolute; left: 50%; top: 50%; width: 900px; height: 600px; transform-origin: center; overflow: hidden; background: #fff; border: 5px solid var(--ink); border-radius: 22px; cursor: pointer; }
#scene, .scene, .world { position: absolute; inset: 0; }
.scene { --amp: 7px; }
.scene.shaking { animation: shake .4s linear; }
.bg { position: absolute; top: 0; width: 900px; height: 600px; }
.bg img, img.cover { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.shade { position: absolute; inset: 0; background: #1b2150; opacity: 0; transition: opacity .4s; pointer-events: none; z-index: 80; }
.flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; z-index: 90; }

/* sprites: fixed boxes, art is contained inside whatever its aspect ratio */
.spr { position: absolute; transform-origin: 50% 100%; pointer-events: none; }
.spr.clickable { pointer-events: auto; }
.spr.draggable, .spr.draggable img { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.spr.draggable { cursor: grab; }
.spr.draggable:active { cursor: grabbing; }
.spr-center { transform-origin: 50% 50%; }
.spr-in, .spr-art { width: 100%; height: 100%; transform-origin: 50% 100%; }
.spr-center .spr-in { transform-origin: 50% 50%; }
.spr-art img, .art img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; display: block; pointer-events: none; -webkit-user-drag: none; }
.spr-center .spr-art img { object-position: center; }
.spr-art.flipped { transform: scaleX(-1); transform-origin: 50% 50%; }
.spr.soot { filter: brightness(.28) saturate(.4); }
.clickable:active .spr-in { filter: brightness(.92); }

/* placeholder shapes for missing art */
.ph { width: 100%; height: 100%; border: 4px dashed var(--ink); border-radius: 18px; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; padding: 4px; }
.ph span { font-size: 15px; line-height: 1.05; text-transform: uppercase; }
.ph-otto { border-radius: 46% 46% 40% 40%; border-style: solid; }
.ph-bg { border: 0; border-radius: 0; align-items: flex-start; padding-top: 14px; }
.ph-bg span { font-size: 22px; opacity: .45; }

/* sprite animations (on the inner box so they never fight with movement) */
.a-bob { animation: bob 1.6s ease-in-out infinite; }
.a-buzz { animation: buzz .32s linear infinite; }
.a-orbit { animation: orbit 3.4s ease-in-out infinite; }
.a-ring { animation: ring .09s linear infinite; }
.a-sway { animation: sway 2.4s ease-in-out infinite; }
.a-float { animation: floaty 2.2s ease-in-out infinite; }
.a-wiggle { animation: wiggle .5s ease-in-out infinite; }
.a-jiggle { animation: jiggle .16s linear infinite; }
.a-jiggle-fast { animation: jiggle .07s linear infinite; }
.a-fidget { animation: fidget 1.1s ease-in-out infinite; }
.a-walk { animation: walk .22s ease-in-out infinite; }
.a-rub { animation: rub .18s ease-in-out infinite; }
.a-dance { animation: dance .5s ease-in-out infinite; }
.a-inhale { animation: inhale 2.2s ease-in infinite; }
.a-flicker { animation: flicker .3s ease-in-out infinite; }
.a-squash { animation: squash .3s ease-out; }
.a-hop { animation: hop .3s ease-out; }
.a-pop { animation: popin .3s ease-out; }
.a-no { animation: no .7s ease-in-out; }
.a-flip { animation: flipx .5s ease-in-out; }
.a-pulse { animation: pulse .5s ease-in-out; }
@keyframes bob { 50% { transform: scale(1.02, .975); } }
@keyframes buzz { 0% { transform: translate(0, 0) rotate(-3deg); } 25% { transform: translate(3px, -4px) rotate(3deg); } 50% { transform: translate(-2px, -1px) rotate(-2deg); } 75% { transform: translate(2px, 3px) rotate(4deg); } 100% { transform: translate(0, 0) rotate(-3deg); } }
@keyframes orbit { 0%, 100% { transform: translate(-110px, 0) rotate(-8deg); } 25% { transform: translate(0, -60px) rotate(6deg); } 50% { transform: translate(120px, 10px) rotate(10deg); } 75% { transform: translate(10px, 50px) rotate(-6deg); } }
@keyframes ring { 0% { transform: rotate(-5deg) translateX(-2px); } 50% { transform: rotate(5deg) translateX(2px); } 100% { transform: rotate(-5deg) translateX(-2px); } }
@keyframes sway { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-12px) rotate(4deg); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-3px); } }
@keyframes jiggle { 0%, 100% { transform: translateX(-3px); } 50% { transform: translateX(3px); } }
@keyframes fidget { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg) scaleY(.98); } }
@keyframes walk { 0%, 100% { transform: rotate(-5deg) translateY(0); } 50% { transform: rotate(5deg) translateY(-8px); } }
@keyframes rub { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes dance { 0%, 100% { transform: translateY(0) rotate(-7deg); } 50% { transform: translateY(-22px) rotate(7deg); } }
@keyframes inhale { 0% { transform: scale(1) rotate(0); } 70% { transform: scale(1.1, 1.14) rotate(-7deg); } 78% { transform: scale(1.12, 1.16) rotate(-8deg); } 86%, 100% { transform: scale(.98, .96) rotate(2deg); } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-3deg); } 50% { transform: scale(1.08, 1.14) rotate(4deg); } }
@keyframes squash { 0% { transform: scale(1); } 35% { transform: scale(1.22, .76); } 70% { transform: scale(.92, 1.1); } 100% { transform: scale(1); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-34px) scale(.96, 1.06); } }
@keyframes popin { 0% { transform: scale(.3); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes no { 0%, 100% { transform: rotate(0); } 15%, 45%, 75% { transform: rotate(-11deg); } 30%, 60%, 90% { transform: rotate(11deg); } }
@keyframes flipx { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.22) rotate(-4deg); } }
@keyframes shake { 0%, 100% { transform: translate(0, 0); } 10% { transform: translate(calc(var(--amp) * -1), var(--amp)); } 25% { transform: translate(var(--amp), calc(var(--amp) * -.8)) rotate(.4deg); } 40% { transform: translate(calc(var(--amp) * -.8), calc(var(--amp) * -.6)); } 55% { transform: translate(var(--amp), var(--amp)) rotate(-.4deg); } 70% { transform: translate(calc(var(--amp) * -.6), calc(var(--amp) * .5)); } 85% { transform: translate(calc(var(--amp) * .4), calc(var(--amp) * -.3)); } }
@keyframes bump { 30% { transform: scale(1.35) rotate(-6deg); background: #ffd0d0; } }

/* particles */
.pt { position: absolute; z-index: 70; pointer-events: none; border: 3px solid var(--ink); border-radius: 50%; animation: pt .65s ease-out forwards; }
.pt-chip { border-radius: 3px; border-width: 2.5px; }
.pt-leaf { border-radius: 70% 8% 70% 8%; }
.pt-drop { border-radius: 50% 50% 50% 8%; border-width: 2.5px; }
.pt-line { border: 0; border-radius: 99px; opacity: .9; }
.pt-spark { border: 0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.pt-star { border: 0; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); filter: drop-shadow(0 0 0 var(--ink)); }
.pt-puff { border-width: 3px; animation-name: puff; }
@keyframes pt { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--r)) scale(1); opacity: 0; } }
@keyframes puff { 0% { transform: translate(-50%, -50%) scale(.2); opacity: .95; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.3); opacity: 0; } }
.glyph { position: absolute; z-index: 75; pointer-events: none; font-weight: bold; line-height: 1; transform: translate(-50%, -50%); animation: glyph 1.1s ease-out forwards; text-shadow: -3px 0 #fff, 3px 0 #fff, 0 -3px #fff, 0 3px #fff, -2px -2px #fff, 2px 2px #fff, -2px 2px #fff, 2px -2px #fff; }
.glyph[style*="#fff"] { text-shadow: -3px 0 var(--ink), 3px 0 var(--ink), 0 -3px var(--ink), 0 3px var(--ink), -2px -2px var(--ink), 2px 2px var(--ink), -2px 2px var(--ink), 2px -2px var(--ink); }
@keyframes glyph { 0% { transform: translate(-50%, -30%) scale(.3) rotate(-10deg); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1.2) rotate(6deg); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%, -130%) scale(1) rotate(-4deg); opacity: 0; } }
.smoke-ring { position: absolute; z-index: 75; width: 26px; height: 16px; margin: -8px 0 0 -13px; border: 6px solid #cfcfd6; outline: 3px solid var(--ink); outline-offset: 0; border-radius: 50%; pointer-events: none; animation: smokering 1.7s ease-out forwards; }
@keyframes smokering { 0% { transform: scale(.3); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(70px, -150px) scale(2.6); opacity: 0; } }
.rain { position: absolute; left: 0; top: 78%; width: 100%; height: 130px; pointer-events: none; }
.rain i { position: absolute; top: 0; width: 6px; height: 16px; background: var(--blue); border: 2px solid var(--ink); border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%; animation: raindrop .9s linear infinite; }
@keyframes raindrop { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateY(118px); opacity: 0; } }

/* stage overlays */
#hint { position: absolute; left: 50%; top: 14px; z-index: 110; max-width: 80%; transform: translate(-50%, -160%) rotate(-1.5deg); background: var(--yellow); border: 4px solid var(--ink); border-radius: 16px; box-shadow: 5px 6px 0 var(--ink); padding: 12px 22px; font-size: 26px; text-align: center; transition: transform .28s cubic-bezier(.3, 1.5, .5, 1); }
#hint.on { transform: translate(-50%, 0) rotate(-1.5deg); }
#intro { position: absolute; left: 50%; top: 42%; z-index: 105; transform: translate(-50%, -50%); background: #fff; border: 5px solid var(--ink); border-radius: 22px; box-shadow: 6px 8px 0 var(--ink); padding: 14px 34px 18px; font-size: 44px; text-align: center; white-space: nowrap; opacity: 0; pointer-events: none; }
#intro small { display: block; font-size: 20px; letter-spacing: .2em; color: #e8202c; }
#intro.on { animation: intro 1.5s ease-in-out forwards; }
#intro em { display: block; margin-top: 6px; font-size: 22px; font-style: normal; }
#intro.long.on { animation-duration: 3.2s; }
@keyframes intro { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6) rotate(-6deg); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05) rotate(-2deg); } 75% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-2deg); } 100% { opacity: 0; transform: translate(-50%, -90%) scale(.9) rotate(-2deg); } }
#stamp { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px; z-index: 120; opacity: 0; pointer-events: none; }
#stamp i { position: absolute; left: 50%; top: 50%; width: 300px; height: 52px; margin: -26px 0 0 -150px; background: #ff2d3d; border: 6px solid var(--ink); border-radius: 26px; transform: rotate(45deg); }
#stamp i + i { transform: rotate(-45deg); }
#stamp.on { animation: stamp .62s ease-out; }
@keyframes stamp { 0% { opacity: 0; transform: scale(2.4) rotate(-20deg); } 25% { opacity: 1; transform: scale(.9) rotate(6deg); } 40% { transform: scale(1.05) rotate(-3deg); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }

/* ── full-screen screens ── */
.screen { position: fixed; inset: 0; z-index: 200; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
.art { position: relative; }
#menu { background: #8fd8ff; }
#menu > :not(.deco) { position: relative; z-index: 1; }
.menu-head { display: flex; align-items: center; justify-content: center; gap: 4px; flex: none; margin: auto 0 6px; }
#menu-otto { width: clamp(90px, 16vw, 170px); height: clamp(120px, 21vw, 220px); animation: drop-in .7s cubic-bezier(.3,1.5,.5,1) .1s backwards, bob 1.6s ease-in-out .8s infinite; transform-origin: 50% 100%; cursor: pointer; }
#menu-otto.hop { animation: hop .5s ease-out, bob 1.6s ease-in-out .5s infinite; }
#menu-logo { width: clamp(200px, 44vw, 440px); height: clamp(100px, 22vw, 220px); animation: drop-in .8s cubic-bezier(.3,1.5,.5,1) backwards, wobble 3.4s ease-in-out .8s infinite; }
#menu-logo img { object-position: center; }
.hero { flex: none; display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 2px 0 22px; text-align: center; }
.tagline { margin: 0; font-size: clamp(19px, 3.2vw, 26px); animation: rise-in .6s ease-out .35s backwards; }
.play-big { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: min(360px, 86vw); background: var(--yellow); border: 5px solid var(--ink); border-radius: 26px; box-shadow: 6px 8px 0 var(--ink); padding: 12px 34px 14px; animation: drop-in .7s cubic-bezier(.3,1.5,.5,1) .45s backwards, cta 1.8s ease-in-out 1.3s infinite; transition: transform .12s, box-shadow .12s; }
.play-big b { font-size: clamp(38px, 7vw, 56px); line-height: 1; font-weight: normal; letter-spacing: .04em; }
.play-big small { font-size: clamp(15px, 2.4vw, 19px); }
.play-big:active { animation: none; transform: translate(6px, 8px); box-shadow: 0 0 0 var(--ink); }
@media (hover: hover) { .play-big:hover { animation: none; transform: rotate(-2deg) scale(1.05); } }
.season-card { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; background: #fff; border: 4px solid var(--ink); border-radius: 18px; box-shadow: 4px 5px 0 var(--ink); padding: 14px 20px; font-size: 20px; text-align: left; animation: drop-in .5s cubic-bezier(.3,1.5,.5,1) .25s backwards; transition: transform .15s; }
.season-card .count b { font-size: 28px; font-weight: normal; }
.season-card .bar { flex: 1; height: 16px; border: 3px solid var(--ink); border-radius: 99px; background: #eef3f7; overflow: hidden; }
.season-card .bar i { display: block; height: 100%; background: #7ed321; }
.season-card .more { font-size: 15px; white-space: nowrap; }
@media (hover: hover) { .season-card:hover { transform: translateY(-3px) rotate(-.6deg); } }
#seasons { width: min(820px, 100%); flex: none; display: flex; flex-direction: column; gap: 18px; }
.season { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.season-head { margin: 4px 0 0; align-self: flex-start; font-size: 26px; line-height: 1; font-weight: normal; background: var(--yellow); border: 4px solid var(--ink); border-radius: 16px; box-shadow: 4px 5px 0 var(--ink); padding: 6px 18px 8px; transform: rotate(-2deg); animation: drop-in .6s cubic-bezier(.3,1.5,.5,1) .15s backwards; }
.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; width: 100%; }
.soon-card { grid-column: 1 / -1; background: #fff; border: 4px dashed var(--ink); border-radius: 18px; padding: 22px 12px; text-align: center; font-size: 26px; color: #6b7684; animation: drop-in .5s cubic-bezier(.3,1.5,.5,1) .25s backwards; }
.level-btn { background: #fff; border: 4px solid var(--ink); border-radius: 18px; box-shadow: 4px 5px 0 var(--ink); padding: 10px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 96px; transition: transform .08s, box-shadow .08s; }
.level-btn b { font-size: 34px; line-height: 1; }
.level-btn span { font-size: 14px; line-height: 1.1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.level-btn { min-width: 0; }
.level-btn.done { background: #c8f7a6; }
.level-btn { animation: drop-in .5s cubic-bezier(.3,1.5,.5,1) backwards; animation-delay: calc(var(--i, 0) * 35ms + 250ms); }
.level-btn:not(.locked):not(.done) { background: var(--yellow); animation: drop-in .5s cubic-bezier(.3,1.5,.5,1) calc(var(--i, 0) * 35ms + 250ms) backwards, sway 1.6s ease-in-out calc(var(--i, 0) * 35ms + 800ms) infinite; }
.level-btn:not(.locked) { transition: transform .15s cubic-bezier(.3,1.6,.5,1), box-shadow .15s; }
@media (hover: hover) { .level-btn.done:hover { transform: translateY(-5px) rotate(-2deg); box-shadow: 6px 9px 0 var(--ink); } }
.level-btn.locked { background: #d9e2ea; color: #8794a1; border-color: #8794a1; box-shadow: 4px 5px 0 #8794a1; cursor: default; }
.level-btn:not(.locked):active { transform: translate(4px, 5px); box-shadow: 0 0 0 var(--ink); }
.menu-foot { margin: 14px 0 0; display: flex; gap: 14px; align-items: center; font-size: 16px; flex: none; }
/* homepage text + footer (under the level grid) */
.site-copy { transition: opacity .6s, transform .6s cubic-bezier(.3,1.4,.5,1); width: min(820px, 100%); flex: none; margin: 26px 0 0; background: var(--paper); border: 4px solid var(--ink); border-radius: 18px; box-shadow: 4px 5px 0 var(--ink); padding: 6px 22px; font-size: 18px; line-height: 1.5; user-select: text; -webkit-user-select: text; }
.site-foot { flex: none; margin: 18px 0 auto; padding-bottom: 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; font-size: 17px; }
.site-foot a { display: inline-block; color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
@media (hover: hover) { .site-foot a:hover { animation: link-wiggle .45s ease-in-out; color: #e8202c; } }
.site-copy.hide { opacity: 0; transform: translateY(34px) rotate(-1.5deg); }
.site-copy p:first-child { font-size: 1.3em; }

#complete { background: rgba(143, 216, 255, .93); justify-content: center; }
.card { margin: auto; background: var(--paper); border: 5px solid var(--ink); border-radius: 26px; box-shadow: 7px 9px 0 var(--ink); padding: 18px 22px; display: flex; gap: 22px; align-items: center; animation: popin .35s ease-out; }
.card-main { display: flex; flex-direction: column; align-items: center; text-align: center; }
#complete-otto { width: 150px; height: 150px; animation: dance .5s ease-in-out infinite; transform-origin: 50% 100%; }
.card h2 { margin: 6px 0 2px; font-size: 34px; color: #e8202c; -webkit-text-stroke: 1px var(--ink); }
.card p { margin: 2px 0; font-size: 20px; }
.card .muted { font-size: 16px; opacity: .7; }
.row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; justify-content: center; align-items: center; }

#end { justify-content: center; background: #ffc9a3; overflow: hidden auto; }
#end-bg { position: absolute; inset: 0; }
.end-inner { position: relative; margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center; background: rgba(255, 248, 232, .93); border: 5px solid var(--ink); border-radius: 26px; box-shadow: 7px 9px 0 var(--ink); padding: 16px 30px 22px; animation: popin .4s ease-out; }
.end-duo { position: relative; width: 170px; height: 170px; animation: dance .5s ease-in-out infinite; transform-origin: 50% 100%; }
#end-otto { width: 100%; height: 100%; }
#end-fly { position: absolute; width: 56px; height: 48px; left: 40px; top: -30px; }
#end h1 { margin: 6px 0 0; font-size: clamp(44px, 9vw, 76px); line-height: 1; color: var(--yellow); -webkit-text-stroke: 3px var(--ink); text-shadow: 4px 5px 0 var(--ink); }
.end-line { font-size: clamp(18px, 3.4vw, 28px); margin: 10px 0 4px; }
#end-fails { font-size: clamp(18px, 3.4vw, 26px); margin: 0 0 16px; color: #e8202c; }

#loading { position: fixed; inset: 0; z-index: 300; background: var(--yellow); display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; font-size: 40px; }
#loading .bar { width: 220px; height: 22px; border: 4px solid var(--ink); border-radius: 99px; background: #fff; overflow: hidden; }
#loading-bar { height: 100%; width: 0; background: var(--red); }
#selftest, #crash { position: fixed; left: 0; top: 0; z-index: 999; background: #fff; margin: 0; padding: 8px; font: 12px monospace; }

/* ── small screens ── */
@media (max-width: 640px) {
  #hud { gap: 5px; padding: 6px; }
  #hud-title { font-size: 15px; }
  .btn { font-size: 12px; padding: 5px 8px; border-radius: 10px; }
  .btn.big { font-size: 18px; padding: 8px 16px; }
  #hud-fails { font-size: 11px; padding: 3px 8px; } #hud-fails b { font-size: 14px; }
  #btn-skip .full, #btn-prev .full { display: none; } #btn-skip .short, #btn-prev .short { display: inline; }
  .level-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .season-head { font-size: 21px; }
  .level-btn { min-height: 0; flex-direction: row; gap: 10px; padding: 8px 12px; text-align: left; }
  .level-btn b { font-size: 26px; }
  .card { flex-direction: column; gap: 12px; padding: 14px; }
  #complete-otto { width: 96px; height: 96px; }
  .card h2 { font-size: 26px; }
  .site-copy { font-size: 16px; padding: 4px 16px; }
  .season-card { flex-wrap: wrap; gap: 8px 12px; font-size: 17px; } .season-card .bar { flex-basis: 100%; order: 3; }
}
@media (max-height: 520px) {
  #ad-top { height: 36px; margin-top: 3px; }
  #hud { padding: 4px 8px; }
  #hud-title { font-size: 16px; }
  .btn { font-size: 13px; padding: 3px 10px; }
  #stage-wrap { margin: 0 6px 4px; }
  .level-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .level-btn { min-height: 0; padding: 6px 4px; flex-direction: column; text-align: center; gap: 0; }
  .level-btn b { font-size: 22px; } .level-btn span { font-size: 11px; }
  #menu-otto { width: 70px; height: 90px; } #menu-logo { width: 190px; height: 92px; }
  .card { flex-direction: row; padding: 10px 14px; }
  #complete-otto { width: 70px; height: 70px; }
  #ad-box { transform: scale(.82); margin: -22px -27px; }
  .end-duo { width: 90px; height: 90px; } #end-fly { width: 34px; height: 30px; left: 20px; top: -18px; }
}

/* ── doodle background: drifting clouds, twinkling stars, a buzzing fly ── */
.deco { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.deco i { position: absolute; display: block; }
.deco svg, .deco img { display: block; width: 100%; height: 100%; }
.deco .cloud { width: 150px; height: 75px; left: 0; opacity: .9; animation: drift linear infinite; }
.deco .c1 { top: 6%; animation-duration: 46s; animation-delay: -12s; }
.deco .c2 { top: 38%; width: 110px; height: 55px; opacity: .7; animation-duration: 64s; animation-delay: -40s; }
.deco .c3 { top: 74%; width: 190px; height: 95px; opacity: .8; animation-duration: 56s; animation-delay: -26s; }
.deco .star { width: 30px; height: 30px; animation: twinkle 2.6s ease-in-out infinite; }
.deco .s1 { left: 6%; top: 20%; }
.deco .s2 { left: 88%; top: 14%; width: 22px; height: 22px; animation-delay: -.8s; }
.deco .s3 { left: 93%; top: 58%; animation-delay: -1.6s; }
.deco .s4 { left: 3%; top: 66%; width: 24px; height: 24px; animation-delay: -1.1s; }
.deco .s5 { left: 52%; top: 90%; width: 20px; height: 20px; animation-delay: -2s; }
.deco .fly { width: 46px; height: 40px; left: 0; top: 0; animation: flypath 18s ease-in-out infinite; }
.deco .fly img { animation: buzz .14s linear infinite; }
@keyframes drift { from { transform: translateX(-220px); } to { transform: translateX(calc(100vw + 40px)); } }
@keyframes twinkle { 0%, 100% { transform: scale(.75) rotate(-12deg); opacity: .65; } 50% { transform: scale(1.12) rotate(14deg); opacity: 1; } }
@keyframes flypath {
  0%   { transform: translate(8vw, 18vh) rotate(-8deg); }
  15%  { transform: translate(30vw, 9vh) rotate(12deg); }
  30%  { transform: translate(64vw, 24vh) rotate(-6deg) scaleX(1); }
  45%  { transform: translate(86vw, 12vh) rotate(10deg) scaleX(-1); }
  60%  { transform: translate(72vw, 46vh) rotate(-12deg) scaleX(-1); }
  75%  { transform: translate(40vw, 30vh) rotate(8deg) scaleX(-1); }
  90%  { transform: translate(14vw, 44vh) rotate(-8deg) scaleX(1); }
  100% { transform: translate(8vw, 18vh) rotate(-8deg); }
}
@keyframes buzz { 0%, 100% { translate: 0 0; } 25% { translate: 1px -2px; } 50% { translate: -1px 1px; } 75% { translate: 2px 0; } }
@keyframes drop-in { 0% { transform: translateY(-60px) scale(.6) rotate(-8deg); opacity: 0; } 60% { transform: translateY(6px) scale(1.06) rotate(2deg); opacity: 1; } 100% { transform: none; } }
@keyframes rise-in { 0% { transform: translateY(26px) rotate(-1.5deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes wobble { 0%, 100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(2deg) scale(1.03); } }
@keyframes link-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg) translateY(-2px); } 75% { transform: rotate(6deg) translateY(-2px); } }
@keyframes peek-up { 0% { transform: translateY(70px); } 70% { transform: translateY(-8px); } 100% { transform: none; } }
@keyframes peek-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes cta { 0%, 100% { transform: rotate(-3deg) scale(1); } 50% { transform: rotate(3deg) scale(1.07); } }

@media (prefers-reduced-motion: reduce) {
  .deco, #menu-otto, #menu-logo, .level-btn, .level-btn:not(.locked):not(.done), .season-head, .soon-card, .tagline, .play-big, .season-card { animation: none !important; }
  .deco .fly { display: none; }
  .site-copy.hide { opacity: 1; transform: none; }
}

/* a locked level someone opened by link: its tile wiggles and glows */
.level-btn.nudge { animation: drop-in .5s cubic-bezier(.3,1.5,.5,1) backwards, no 0.9s ease-in-out .6s 2 !important; outline: 4px dashed #e8202c; outline-offset: 4px; }
/* a level's own page text (pre-rendered for search engines; only shown on that level's address) */
.level-copy h1 { margin: 10px 0 0; font-size: 30px; line-height: 1.1; }
.level-copy .kicker { margin: 10px 0 0; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: #6b7684; }
.level-copy .links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.level-copy a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.level-copy .locked-note { color: #e8202c; }
