:root {
  --ink: #171319;
  --cream: #fff8de;
  --yellow: #ffe16b;
  --orange: #ff8f3f;
  --red: #ef3d4f;
  --blue: #3b63ee;
  --mint: #79dfbd;
  --skin: #f3b788;
  --skin-dark: #d98b61;
  --diaper: #f8fbff;
  --shadow: 5px 5px 0 var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; }
body {
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: #88d8ee;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  touch-action: none;
  user-select: none;
}
button, a { -webkit-tap-highlight-color: transparent; }

.game-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 15% 0%, rgba(255,255,255,.6), transparent 25%),
    linear-gradient(#7ed7ef 0 64%, #f8cf76 64% 100%);
}
.game-shell.hit { animation: shell-hit .22s steps(2); }
.game-shell.ending { animation: ending-rumble .18s linear infinite; }

.hud {
  width: min(100%, 980px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  position: relative;
  z-index: 20;
}
.back {
  justify-self: start;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  border: 3px solid var(--ink);
  background: var(--cream);
  padding: 7px 10px;
  box-shadow: 3px 3px 0 var(--ink);
}
.score-card, .combo-card {
  min-width: 142px;
  border: 3px solid var(--ink);
  background: var(--ink);
  color: white;
  box-shadow: 4px 4px 0 rgba(255,255,255,.65);
  padding: 5px 11px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: baseline;
  transform: rotate(-.5deg);
}
.combo-card { min-width: 98px; background: var(--yellow); color: var(--ink); transform: rotate(1deg); }
.combo-card.hot { background: var(--red); color: white; animation: combo-pulse .35s ease infinite alternate; }
.score-card span, .combo-card span { font-size: 8px; letter-spacing: .18em; text-transform: uppercase; opacity: .75; }
.score-card strong, .combo-card strong { font-family: "Black Han Sans", sans-serif; font-size: 21px; letter-spacing: .04em; font-weight: 400; }

.meters {
  width: min(100%, 820px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(210px, 1fr);
  gap: 16px;
  position: relative;
  z-index: 20;
}
.meter-copy { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; font-size: 9px; letter-spacing: .13em; text-transform: uppercase; font-weight: 700; }
.meter-copy strong { color: #a91d32; }
.meter { height: 17px; border: 3px solid var(--ink); background: white; box-shadow: 3px 3px 0 var(--ink); overflow: hidden; }
.meter-fill {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(45deg, var(--orange) 0 11px, var(--yellow) 11px 22px);
  border-right: 3px solid var(--ink);
  transition: width .35s cubic-bezier(.2,.8,.2,1), background .2s ease;
}
.meter-fill.danger { background: repeating-linear-gradient(45deg, var(--red) 0 11px, #ff8792 11px 22px); animation: danger-bar .22s steps(2) infinite; }
.mess-pips { height: 17px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.mess-pips span { border: 3px solid var(--ink); background: rgba(255,255,255,.85); box-shadow: 2px 2px 0 var(--ink); }
.mess-pips span.on { background: var(--red); transform: rotate(var(--tilt, 2deg)) scale(1.05); }

.stage {
  width: min(100%, 1000px);
  min-height: 390px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  border: 4px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  background:
    linear-gradient(transparent 78%, rgba(255,255,255,.3) 78%),
    linear-gradient(#8edff2 0 72%, #f5ce76 72% 100%);
  isolation: isolate;
}
.wall-pattern {
  position: absolute;
  inset: 0 0 27%;
  opacity: .25;
  background-image:
    radial-gradient(circle at 20px 20px, white 0 3px, transparent 4px),
    radial-gradient(circle at 60px 60px, #276b91 0 3px, transparent 4px);
  background-size: 80px 80px;
}
.mobile { position: absolute; left: 5%; top: 4%; display: flex; gap: 22px; font-family: "Black Han Sans"; font-size: clamp(20px, 4vw, 38px); color: rgba(255,255,255,.78); transform: rotate(-7deg); }
.mobile span:nth-child(2) { transform: translateY(18px); }
.mobile span:nth-child(3) { transform: translateY(-4px); }
.floor { position: absolute; left: 0; right: 0; bottom: 0; height: 27%; background: repeating-linear-gradient(90deg, #f7d782 0 70px, #f0c86e 70px 140px); border-top: 4px solid var(--ink); z-index: 1; }
.floor::before { content: ""; position: absolute; inset: 13px 0 auto; border-top: 3px dashed rgba(23,19,25,.28); }
.floor span { position: absolute; left: 50%; bottom: 15%; width: 62%; height: 30%; border: 3px solid var(--ink); border-radius: 50%; background: rgba(255,248,222,.42); transform: translateX(-50%); }

.drop-layer, .splat-layer, .speed-lines, .stink-layer, .popups { position: absolute; inset: 0; pointer-events: none; }
.drop-layer { z-index: 8; }
.splat-layer { z-index: 3; }
.speed-lines { z-index: 6; overflow: hidden; opacity: 0; }
.speed-lines.on { opacity: .35; background: repeating-linear-gradient(90deg, transparent 0 90px, white 90px 94px, transparent 94px 180px); animation: speed-fall .28s linear infinite; }

.drop {
  position: absolute;
  width: 64px;
  height: 64px;
  transform: translate3d(0,0,0);
  display: grid;
  place-items: center;
  font-size: 43px;
  filter: drop-shadow(3px 4px 0 rgba(23,19,25,.7));
  will-change: transform;
}
.drop::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 3px solid var(--ink);
  background: rgba(255,255,255,.72);
  border-radius: 45% 55% 52% 48%;
  z-index: -1;
  transform: rotate(var(--spin, 7deg));
}
.drop.junk::before { background: #ffb1bd; border-radius: 10px; }
.drop.bonus::before { background: var(--yellow); animation: bonus-glow .35s ease infinite alternate; }
.drop.swatted { animation: swatted .55s ease-out forwards; }
.drop.eaten { animation: eaten .24s ease-in forwards; }

.splat {
  position: absolute;
  width: 54px;
  height: 22px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--splat, var(--orange));
  opacity: .78;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  animation: splat-in .28s ease-out;
}
.splat::before, .splat::after { content: ""; position: absolute; width: 12px; height: 12px; border: 3px solid var(--ink); background: inherit; border-radius: 50%; }
.splat::before { left: -8px; top: 1px; }.splat::after { right: -7px; top: -5px; }

.baby {
  --body-width: 172px;
  --body-height: 170px;
  --head-scale: 1;
  --diaper-scale: 1;
  position: absolute;
  left: 0;
  bottom: 28px;
  width: 250px;
  height: 315px;
  z-index: 7;
  transform: translate3d(0,0,0);
  transform-origin: 50% 100%;
  will-change: transform;
}
.baby.running { animation: baby-bob .22s ease-in-out infinite alternate; }
.baby.chomp .head { transform: translateX(-50%) scale(var(--head-scale)) rotate(-2deg); }
.baby.chomp .mouth { width: 72px; height: 72px; border-radius: 50%; border-top-width: 5px; top: 104px; background: #73182a; }
.baby.chomp .mouth .tongue { opacity: 1; }
.baby.chomp .brow-left { transform: rotate(13deg); }.baby.chomp .brow-right { transform: rotate(-13deg); }
.baby.chomp .arm-left { animation: swat-left .17s ease-in-out infinite alternate; }
.baby.chomp .arm-right { animation: swat-right .17s ease-in-out infinite alternate; }
.baby.chomp .eye span { transform: translate(0, 4px) scaleY(.7); }
.baby.celebrate { animation: baby-celebrate .42s ease infinite alternate; }
.baby.bonked .head { animation: bonk .3s steps(2); }
.baby.diaper-critical .diaper { animation: diaper-critical .18s steps(2) infinite; }
.baby.diaper-filled .diaper { height: 105px; width: calc(var(--body-width) * .98); bottom: -12px; background: #d0b56e; border-radius: 35% 35% 46% 46%; animation: diaper-fill .65s cubic-bezier(.2,1.7,.3,1) both; }
.baby.diaper-filled .diaper-load { opacity: 1; transform: scale(1); }
.baby.diaper-filled .leg { transform: rotate(var(--leg-rot)) translateY(7px); }

.baby-shadow { position: absolute; left: 50%; bottom: 2px; width: calc(var(--body-width) * 1.06); height: 28px; border: 3px solid var(--ink); border-radius: 50%; background: rgba(23,19,25,.25); transform: translateX(-50%); }
.body {
  position: absolute;
  left: 50%;
  bottom: 36px;
  width: var(--body-width);
  height: var(--body-height);
  border: 5px solid var(--ink);
  border-radius: 48% 48% 43% 43%;
  background:
    radial-gradient(circle at 48% 68%, rgba(255,255,255,.25) 0 24%, transparent 25%),
    var(--skin);
  transform: translateX(-50%);
  box-shadow: inset -12px -8px 0 rgba(217,139,97,.27);
  transition: width .45s cubic-bezier(.2,1.3,.3,1), height .45s cubic-bezier(.2,1.3,.3,1);
  z-index: 2;
}
.body::before, .body::after { content: ""; position: absolute; left: 50%; width: 35%; height: 5px; border-radius: 50%; background: rgba(166,84,56,.3); transform: translateX(-50%); }
.body::before { top: 49%; }.body::after { top: 60%; width: 45%; }
.belly-button { position: absolute; left: 50%; top: 47%; width: 13px; height: 10px; border: 3px solid var(--ink); border-top-width: 2px; border-radius: 50%; transform: translateX(-50%); background: var(--skin-dark); z-index: 3; }
.diaper {
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: calc(var(--body-width) * .9);
  height: 68px;
  border: 5px solid var(--ink);
  border-radius: 22% 22% 44% 44%;
  background: repeating-linear-gradient(45deg, #fff 0 13px, #dcecff 13px 26px);
  transform: translateX(-50%) scale(var(--diaper-scale));
  transform-origin: 50% 80%;
  box-shadow: inset 0 -9px 0 rgba(59,99,238,.12);
  transition: width .35s ease, transform .35s ease, background .2s ease;
  z-index: 5;
}
.diaper-tab { position: absolute; top: 4px; width: 28px; height: 16px; border: 3px solid var(--ink); background: var(--yellow); }
.tab-left { left: -11px; transform: rotate(-8deg); }.tab-right { right: -11px; transform: rotate(8deg); }
.diaper-badge { position: absolute; left: 50%; top: 12px; transform: translateX(-50%) rotate(-2deg); font-family: "Black Han Sans"; font-size: 13px; color: var(--blue); }
.diaper-load { position: absolute; left: 50%; bottom: 5px; width: 75%; height: 50%; border-radius: 50%; background: rgba(105,78,22,.32); filter: blur(4px); opacity: 0; transform: translateX(-50%) scale(.2); transition: .2s ease; }

.head {
  position: absolute;
  left: 50%;
  top: 3px;
  width: 184px;
  height: 170px;
  border: 5px solid var(--ink);
  border-radius: 48% 52% 45% 46%;
  background: var(--skin);
  transform: translateX(-50%) scale(var(--head-scale));
  transform-origin: 50% 85%;
  box-shadow: inset -12px -9px 0 rgba(217,139,97,.28), 4px 5px 0 rgba(23,19,25,.18);
  transition: transform .18s ease;
  z-index: 6;
}
.ear { position: absolute; top: 66px; width: 37px; height: 48px; border: 5px solid var(--ink); border-radius: 50%; background: var(--skin); z-index: -1; }
.ear::after { content: ""; position: absolute; inset: 10px 8px; border: 3px solid rgba(137,61,45,.55); border-radius: 50%; }
.ear-left { left: -27px; transform: rotate(-8deg); }.ear-right { right: -27px; transform: rotate(8deg); }
.hair { position: absolute; left: 50%; top: -28px; font-family: "Black Han Sans"; font-size: 51px; transform: translateX(-50%) rotate(-13deg); }
.eye { position: absolute; top: 62px; width: 30px; height: 35px; border: 4px solid var(--ink); border-radius: 50%; background: white; overflow: hidden; }
.eye-left { left: 40px; }.eye-right { right: 40px; }
.eye span { position: absolute; left: 50%; top: 45%; width: 14px; height: 18px; border-radius: 50%; background: var(--ink); transform: translate(-50%,-50%); transition: transform .12s ease; }
.brow { position: absolute; top: 48px; width: 38px; height: 6px; border-radius: 999px; background: var(--ink); transition: transform .12s ease; }
.brow-left { left: 35px; transform: rotate(-5deg); }.brow-right { right: 35px; transform: rotate(5deg); }
.nose { position: absolute; left: 50%; top: 93px; width: 17px; height: 12px; border: 3px solid var(--ink); border-top: 0; border-left-color: transparent; border-radius: 0 0 50% 50%; transform: translateX(-50%); }
.cheek { position: absolute; top: 104px; width: 36px; height: 24px; border-radius: 50%; background: rgba(239,61,79,.35); }
.cheek-left { left: 15px; }.cheek-right { right: 15px; }
.mouth { position: absolute; left: 50%; top: 118px; width: 57px; height: 27px; border: 5px solid var(--ink); border-top-width: 4px; border-radius: 10% 10% 50% 50%; background: var(--red); transform: translateX(-50%); overflow: hidden; transition: width .12s ease, height .12s ease, top .12s ease, border-radius .12s ease; }
.tongue { position: absolute; left: 50%; bottom: -4px; width: 38px; height: 20px; border: 3px solid var(--ink); border-radius: 50%; background: #ff8090; transform: translateX(-50%); opacity: .2; }
.tooth { position: absolute; left: 50%; top: -2px; width: 16px; height: 15px; border: 3px solid var(--ink); background: white; transform: translateX(-50%); }
.chin { position: absolute; left: 50%; bottom: 8px; width: 42px; height: 7px; border-bottom: 3px solid rgba(137,61,45,.45); border-radius: 50%; transform: translateX(-50%); }

.arm { position: absolute; top: 146px; width: 78px; height: 39px; border: 5px solid var(--ink); border-radius: 50%; background: var(--skin); transform-origin: 85% 50%; z-index: 5; }
.arm-left { left: 9px; transform: rotate(31deg); }.arm-right { right: 9px; transform: scaleX(-1) rotate(31deg); }
.hand { position: absolute; left: -28px; top: -22px; font-size: 45px; filter: drop-shadow(2px 2px 0 var(--ink)); }
.leg { --leg-rot: 5deg; position: absolute; bottom: 25px; width: 55px; height: 75px; border: 5px solid var(--ink); border-radius: 48%; background: var(--skin); z-index: 1; }
.leg-left { left: 50px; --leg-rot: 7deg; transform: rotate(7deg); }.leg-right { right: 50px; --leg-rot: -7deg; transform: rotate(-7deg); }
.foot { position: absolute; left: -8px; bottom: -17px; width: 65px; height: 38px; border: 5px solid var(--ink); border-radius: 50%; background: var(--skin); }

.speech {
  position: absolute;
  z-index: 12;
  top: 17%;
  left: 50%;
  max-width: min(70%, 380px);
  padding: 9px 15px;
  border: 4px solid var(--ink);
  background: white;
  box-shadow: 4px 4px 0 var(--ink);
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(15px, 3vw, 25px);
  letter-spacing: .04em;
  text-align: center;
  transform: translateX(-50%) rotate(-1deg);
  opacity: 0;
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
}
.speech::after { content: ""; position: absolute; left: 50%; bottom: -15px; width: 22px; height: 22px; border-right: 4px solid var(--ink); border-bottom: 4px solid var(--ink); background: white; transform: translateX(-50%) rotate(45deg); }
.speech.show { opacity: 1; transform: translateX(-50%) rotate(-1deg) scale(1); }
.speech.big { top: 25%; font-size: clamp(28px, 7vw, 65px); color: var(--red); -webkit-text-stroke: 1px var(--ink); }

.slam { position: absolute; left: 50%; top: 42%; z-index: 15; width: 95%; transform: translate(-50%,-50%); text-align: center; pointer-events: none; opacity: 0; font-family: "Black Han Sans"; font-size: clamp(31px, 8vw, 84px); line-height: .9; color: var(--yellow); -webkit-text-stroke: 3px var(--ink); text-shadow: 6px 6px 0 var(--red); }
.slam.on { animation: slam .9s cubic-bezier(.2,.85,.25,1) both; }
.popup { position: absolute; z-index: 16; font-family: "Black Han Sans"; font-size: clamp(19px, 4vw, 34px); color: white; -webkit-text-stroke: 2px var(--ink); text-shadow: 3px 3px 0 var(--ink); animation: popup-rise .75s ease-out forwards; white-space: nowrap; }
.popup.bad { color: var(--red); }.popup.good { color: var(--yellow); }
.stink { position: absolute; bottom: 16%; font-size: clamp(34px, 7vw, 72px); opacity: 0; animation: stink-rise 2.1s ease-out forwards; filter: drop-shadow(3px 3px 0 var(--ink)); }

.controls {
  width: min(100%, 820px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  position: relative;
  z-index: 25;
}
.control { display: flex; align-items: center; gap: 6px; font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
kbd { min-width: 32px; padding: 5px 7px; border: 3px solid var(--ink); border-radius: 4px; background: white; box-shadow: 2px 2px 0 var(--ink); font: inherit; text-align: center; }
.action-button { border: 4px solid var(--ink); background: var(--red); color: white; box-shadow: 5px 5px 0 var(--ink); padding: 7px 22px; font-family: inherit; cursor: pointer; transform: rotate(-.6deg); }
.action-button:active, .action-button.active { transform: translate(4px,4px) rotate(-.6deg); box-shadow: 1px 1px 0 var(--ink); background: #be2437; }
.action-button span { display: block; font-size: 8px; letter-spacing: .15em; opacity: .8; }.action-button strong { display: block; font-family: "Black Han Sans"; font-size: 17px; font-weight: 400; letter-spacing: .05em; }
.touch-copy { justify-self: end; text-align: right; opacity: .65; }

.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(255,225,107,.96); overflow: auto; }
.overlay::before { content: ""; position: fixed; inset: 0; opacity: .16; background: repeating-radial-gradient(circle at 50% 50%, transparent 0 15px, var(--ink) 16px 18px); pointer-events: none; }
.overlay-card { position: relative; width: min(100%, 580px); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.eyebrow { margin: 0; border: 3px solid var(--ink); background: var(--cream); padding: 6px 12px; box-shadow: 3px 3px 0 var(--ink); font-size: 10px; font-weight: 700; letter-spacing: .18em; transform: rotate(-2deg); }
.overlay h1 { margin: 0; font-family: "Black Han Sans"; font-size: clamp(47px, 12vw, 92px); line-height: .78; letter-spacing: -.02em; color: var(--red); -webkit-text-stroke: 3px var(--ink); text-shadow: 7px 7px 0 var(--blue); transform: rotate(-2deg); }
.overlay h1 span { color: white; }
.poster-baby { font-size: clamp(62px, 15vw, 110px); line-height: .8; filter: drop-shadow(5px 5px 0 var(--ink)); transform: rotate(5deg); }
.lede { max-width: 500px; margin: 0; font-family: "Black Han Sans"; font-size: clamp(14px, 3vw, 20px); line-height: 1.25; }
.rules { width: min(100%, 490px); border: 4px solid var(--ink); background: var(--cream); box-shadow: var(--shadow); padding: 10px 14px; transform: rotate(.5deg); }
.rules p { margin: 5px 0; font-size: 11px; line-height: 1.45; }.rules b { color: var(--red); }
.overlay button { border: 4px solid var(--ink); background: var(--red); color: white; box-shadow: 6px 6px 0 var(--ink); padding: 13px 24px; font: 400 17px "Black Han Sans"; letter-spacing: .08em; cursor: pointer; }
.overlay button:hover { transform: translate(-2px,-2px); box-shadow: 8px 8px 0 var(--ink); }
.fineprint { margin: 0; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.finale-overlay { background: rgba(121,223,189,.96); }
.finale-card { border: 5px solid var(--ink); background: var(--cream); box-shadow: 10px 10px 0 var(--ink); padding: 24px; transform: rotate(-.5deg); }
.finale-card h1 { font-size: clamp(45px, 10vw, 80px); text-shadow: 7px 7px 0 var(--yellow); }
.final-score { margin: 5px 0 0; font: 400 clamp(28px,6vw,48px) "Black Han Sans"; color: var(--blue); }
.finale-card > p:not(.eyebrow):not(.final-score) { margin: 0; max-width: 450px; font-size: 12px; line-height: 1.55; font-weight: 700; }

@keyframes baby-bob { to { margin-bottom: 3px; } }
@keyframes swat-left { from { transform: rotate(28deg); } to { transform: rotate(-42deg) translate(-16px,-15px); } }
@keyframes swat-right { from { transform: scaleX(-1) rotate(28deg); } to { transform: scaleX(-1) rotate(-42deg) translate(-16px,-15px); } }
@keyframes baby-celebrate { from { margin-bottom: 0; filter: brightness(1); } to { margin-bottom: 12px; filter: brightness(1.14); } }
@keyframes bonk { 25% { transform: translateX(-56%) scale(var(--head-scale)) rotate(-7deg); } 75% { transform: translateX(-44%) scale(var(--head-scale)) rotate(7deg); } }
@keyframes diaper-critical { 50% { background: #fff0a3; transform: translateX(-50%) scale(calc(var(--diaper-scale) + .03)); } }
@keyframes diaper-fill { 0% { transform: translateX(-50%) scale(var(--diaper-scale)); } 60% { transform: translateX(-50%) scale(calc(var(--diaper-scale) + .22)); } 100% { transform: translateX(-50%) scale(calc(var(--diaper-scale) + .14)); } }
@keyframes shell-hit { 25% { transform: translate(-5px,3px); } 75% { transform: translate(5px,-2px); } }
@keyframes ending-rumble { 50% { transform: translate(1px,1px); } }
@keyframes combo-pulse { to { transform: rotate(-2deg) scale(1.08); } }
@keyframes danger-bar { 50% { filter: brightness(1.35); } }
@keyframes speed-fall { to { background-position: 0 70px; } }
@keyframes bonus-glow { to { filter: drop-shadow(3px 4px 0 rgba(23,19,25,.7)) drop-shadow(0 0 10px white); } }
@keyframes swatted { to { opacity: 0; transform: translate3d(var(--swat-x), var(--swat-y), 0) rotate(540deg) scale(.4); } }
@keyframes eaten { to { opacity: 0; transform: translate3d(var(--eat-x), var(--eat-y), 0) rotate(90deg) scale(.05); } }
@keyframes splat-in { from { transform: translate(-50%,-50%) scale(.2); } 70% { transform: translate(-50%,-50%) scale(1.25); } }
@keyframes slam { 0% { opacity: 0; transform: translate(-50%,-50%) scale(3.2) rotate(-6deg); } 18%,70% { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(-2deg); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(.7) rotate(2deg); } }
@keyframes popup-rise { 0% { opacity: 0; transform: translate(-50%,0) scale(.5); } 20% { opacity: 1; transform: translate(-50%,-8px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%,-70px) scale(.9); } }
@keyframes stink-rise { 0% { opacity: 0; transform: translate(0,0) scale(.4) rotate(-8deg); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--drift), -230px) scale(1.7) rotate(10deg); } }

[hidden] { display: none !important; }

@media (max-width: 700px) {
  .game-shell { gap: 6px; padding: 7px; }
  .hud { grid-template-columns: auto 1fr auto; gap: 6px; }
  .back { font-size: 0; padding: 7px 9px; }.back::after { content: "←"; font-size: 16px; }
  .score-card { min-width: 0; }.combo-card { min-width: 77px; }
  .score-card strong, .combo-card strong { font-size: 17px; }
  .meters { grid-template-columns: 1fr; gap: 5px; }
  .mess-group { display: grid; grid-template-columns: 145px 1fr; gap: 8px; align-items: end; }.mess-group .meter-copy { margin: 0; }
  .stage { min-height: 410px; }
  .baby { width: 220px; height: 285px; transform-origin: 50% 100%; }
  .controls { grid-template-columns: 1fr; }.controls > .control:first-child, .touch-copy { display: none; }
  .action-button { justify-self: stretch; padding: 6px 12px; }
  .action-button strong { font-size: 15px; }
}

@media (max-height: 690px) and (min-width: 701px) {
  .stage { min-height: 340px; }
  .baby { transform-origin: 50% 100%; scale: .83; bottom: 14px; }
  .controls { min-height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .game-shell.ending, .baby.running, .baby.diaper-critical, .combo-card.hot, .speed-lines.on,
  .game-shell.detonated, .game-shell.charging, .game-shell.levelup, .debris, .shockwave, .flash { animation: none; }
}


/* Mobile arcade pass. */
@supports (height: 100dvh) {
  .game-shell { min-height: 100dvh; height: 100dvh; }
}
@media (max-width: 700px) {
  .game-shell {
    min-height: 100svh;
    height: 100dvh;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    padding: max(7px, env(safe-area-inset-top)) max(7px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
  }
  .stage { min-height: 0; height: 100%; box-shadow: 4px 4px 0 var(--ink); }
  .action-button { min-height: 54px; touch-action: manipulation; }
  .overlay { padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .overlay-card { max-height: 100%; overflow-y: auto; padding: 4px 6px 12px; }
  .overlay button { min-height: 52px; }
}
@media (max-width: 430px) {
  .score-card span, .combo-card span { display: none; }
  .score-card, .combo-card { padding-inline: 8px; justify-content: center; }
  .meters { gap: 3px; }
  .meter-copy { font-size: 8px; }
  .baby { scale: .92; }
  .speech { top: 12%; max-width: 84%; }
}
@media (max-width: 700px) and (max-height: 700px) {
  .meters { grid-template-columns: 1fr 1fr; align-items: end; }
  .mess-group { display: block; }
  .mess-group .meter-copy { margin-bottom: 4px; }
  .baby { scale: .78; bottom: 0; }
  .action-button { min-height: 46px; }
  .action-button span { display: none; }
}

/* ---- levels ---------------------------------------------------------- */
.level-card { display: grid; gap: 2px; padding: 7px 14px; border: 3px solid var(--ink); border-radius: 12px; background: var(--blue, #63c7ff); box-shadow: 4px 4px 0 var(--ink); text-align: center; }
.level-card span { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
.level-card strong { font-family: "Black Han Sans"; font-size: 22px; line-height: 1; }
.level-card::after { content: attr(data-name); display: block; font-size: 7px; letter-spacing: .1em; opacity: .75; }
.game-shell.levelup { animation: levelup-pop .6s cubic-bezier(.2,1.6,.3,1); }
@keyframes levelup-pop { 40% { transform: scale(1.014); } }

/* ---- detonation ------------------------------------------------------ */
/* The pause before. Everything tightens, then lets go. */
.game-shell.charging { animation: charging .55s ease-in both; }
@keyframes charging { 0% { transform: scale(1); filter: none; } 100% { transform: scale(.985); filter: saturate(1.5) contrast(1.12); } }

.game-shell.detonated { animation: detonate-shake .07s linear 26; }
@keyframes detonate-shake {
  0%   { transform: translate(-9px, 5px) rotate(-.5deg); }
  25%  { transform: translate(8px, -6px) rotate(.45deg); }
  50%  { transform: translate(-6px, -4px) rotate(.3deg); }
  75%  { transform: translate(7px, 6px) rotate(-.35deg); }
  100% { transform: translate(0, 0) rotate(0); }
}

.flash { position: absolute; inset: 0; z-index: 14; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 62%, #fff8dc 0%, #ffd43b 28%, #b06a12 55%, transparent 72%); }
.flash.on { animation: flash-blow .9s ease-out forwards; }
@keyframes flash-blow { 0% { opacity: 0; transform: scale(.2); } 12% { opacity: .95; } 100% { opacity: 0; transform: scale(2.6); } }

.shockwave { position: absolute; left: 50%; bottom: 18%; width: 40px; height: 40px; margin: -20px 0 0 -20px; z-index: 13; pointer-events: none; border: 8px solid rgba(255,240,180,.9); border-radius: 50%; animation: shock 1.1s cubic-bezier(.1,.7,.2,1) forwards; }
@keyframes shock { 0% { transform: scale(.2); opacity: 1; border-width: 12px; } 100% { transform: scale(26); opacity: 0; border-width: 1px; } }

.debris { position: absolute; left: 50%; bottom: 18%; z-index: 13; pointer-events: none; opacity: 0; filter: drop-shadow(2px 2px 0 var(--ink)); animation: debris-fly 1.9s cubic-bezier(.15,.6,.4,1) forwards; }
@keyframes debris-fly {
  0%   { opacity: 1; transform: translate(0,0) rotate(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 420px)) rotate(var(--spin)); }
}

/* Stink now drifts sideways as it climbs. */
.stink { --drift: 0px; }

.colophon { padding: 14px 0 4px; text-align: center; color: #7a6a5a; font-size: 8px; letter-spacing: .15em; text-transform: uppercase; }

/* ---------- arcade shell integration ---------- */
:root { --as-line: rgba(90, 60, 40, .3); --as-dim: #8a6f5e; --as-btn-a: rgba(255, 138, 92, .8); }
@media (hover: none) {
  .game-shell { width: 100%; max-width: none; margin: 0; padding: 0; }
  /* score row floats top-right, meters top-center — transparent, over the game */
  .hud { position: fixed; top: max(5px, env(safe-area-inset-top)); right: 8px; z-index: 7; display: flex; gap: 6px; padding: 0; background: none; border: 0; pointer-events: none; }
  .hud .back { display: none; }
  .hud > div { padding: 2px 8px; background: rgba(255, 248, 230, .55); border: 2px solid rgba(46, 26, 12, .5); box-shadow: none; backdrop-filter: blur(2px); }
  .hud span { font-size: 6px; }
  .hud strong { font-size: 11px; }
  .meters { position: fixed; top: max(5px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 7; display: flex; gap: 10px; padding: 0; background: none; pointer-events: none; width: min(46vw, 420px); }
  .meter-group { flex: 1; }
  .meter-copy span, .meter-copy strong { font-size: 6px; }
  .meter { height: 7px; background: rgba(255,255,255,.4); }
  .stage { min-height: 0; height: 100%; }
  .as-screen[data-fit="fill"] { overflow: hidden; }
  /* start / finale screens: fit one landscape viewport */
  .overlay { place-items: start center; padding: max(8px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom)); }
  .rules { flex-wrap: wrap; justify-content: center; }
  .final-score { margin: 0; font-size: 13px; }
  #again { min-height: 42px; }
  .overlay-card { margin: auto; gap: 7px; width: min(100%, 620px); }
  .overlay h1 { font-size: clamp(30px, 13vh, 54px); -webkit-text-stroke-width: 2px; }
  .poster-baby, .fineprint { display: none; }
  .eyebrow { font-size: 8px; padding: 4px 9px; }
  .lede { margin: 0; font-size: 11px; }
  .rules { display: flex; gap: 8px; }
  .rules p { margin: 0; font-size: 9px; line-height: 1.4; }
  .overlay button { padding: 10px 20px; font-size: 14px; }
}

/* Shared mobile controls are supplied by /assets/arcade-control-library.css. */
@media (hover: none), (pointer: coarse) {
  #feed-baby-move-control { --arc-place-x: max(18px, env(safe-area-inset-left)); }
  #feed-baby-action-control { --arc-place-x: max(20px, env(safe-area-inset-right)); }
}

/* Desktop cabinet: let the nursery consume the available viewport instead of
   stopping at the old 1000px / 390px presentation size. Touch layouts remain
   entirely governed by the signed-off mobile rules above. */
@media (min-width: 701px) and (hover: hover) and (pointer: fine) {
  .game-shell {
    height: 100vh;
    min-height: 100vh;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    gap: 6px;
    padding: 8px 12px;
  }

  .hud {
    width: min(100%, 1280px);
  }

  .meters,
  .controls {
    width: min(100%, 1120px);
  }

  .as-play,
  .as-stage,
  .as-screen[data-fit="fill"] {
    min-height: 0;
    height: 100%;
  }

  .stage {
    width: min(100%, 1280px);
    min-height: 0;
    height: 100%;
  }

  .colophon {
    padding: 2px 0 0;
  }
}
