:root {
  color-scheme: light;
  --ink: #3b3029;
  --paper: #f6edda;
  --night: #22363c;
  --moss: #74856f;
  --clay: #9a8a78;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 15%, #fff9e9 0 2px, transparent 3px),
    linear-gradient(135deg, #d9caa9, #eee3cb 45%, #d0bfa0);
}

button, select { font: inherit; }

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px clamp(12px, 3vw, 32px) 26px;
}

.titlebar, .hud, .controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 3px;
  color: #7a6759;
  font: 700 11px/1.2 system-ui, sans-serif;
  letter-spacing: .16em;
}

h1 {
  margin: 0;
  font-size: clamp(21px, 3vw, 34px);
  font-weight: 800;
}

.difficulty {
  display: grid;
  gap: 4px;
  font: 700 12px/1.2 system-ui, sans-serif;
}

select {
  max-width: 250px;
  padding: 7px 10px;
  border: 2px solid #776b5e;
  border-radius: 10px;
  color: var(--ink);
  background: #fff9ec;
}

.hud {
  min-height: 47px;
  margin-top: 14px;
  padding: 8px 14px;
  border: 2px solid #68594b;
  border-bottom: 0;
  border-radius: 15px 15px 0 0;
  background: rgba(255, 249, 234, .92);
  font: 700 14px/1.35 system-ui, sans-serif;
}

.objective { white-space: nowrap; }
#message { flex: 1; text-align: center; }

.health {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.health.is-hidden { display: none; }

.health > span {
  margin-right: 2px;
}

.health-heart {
  color: #ca544e;
  font-style: normal;
  font-size: 19px;
  line-height: 1;
  filter: drop-shadow(0 2px 0 rgba(88, 48, 43, .18));
  transition: transform .18s, color .18s, opacity .18s;
}

.health-heart.is-empty {
  color: #ad9f91;
  opacity: .36;
  transform: scale(.78);
}

.health.is-hit { animation: shake .18s linear 2; }

.voice-limit {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.voice-limit.is-hidden { display: none; }

.voice-dot {
  width: 18px;
  height: 18px;
  border: 2px solid #6c5145;
  border-radius: 50%;
  background: #fae8bc;
  transition: .15s;
}

.voice-dot.is-used {
  transform: scale(.72);
  background: #80695d;
  opacity: .45;
}

.voice-limit.is-blocked { animation: shake .18s linear 2; }

.long-voice-wave {
  position: absolute;
  z-index: 8;
  height: 74px;
  overflow: hidden;
  border: 4px double rgba(107,81,127,.62);
  border-radius: 999px;
  color: #563f68;
  background: radial-gradient(ellipse, rgba(255,250,220,.78), rgba(213,190,230,.28) 65%, transparent 72%);
  box-shadow: 0 0 18px rgba(161,121,188,.25);
  font: 900 24px/66px system-ui, sans-serif;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.food-item {
  position: absolute;
  z-index: 6;
  width: 62px;
  height: 48px;
  transform: translate(-50%, 0);
  filter: drop-shadow(0 5px 3px rgba(57,44,35,.24));
  animation: food-bob 1.1s ease-in-out infinite alternate;
}
.food-item::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 32px;
  width: 31px;
  height: 7px;
  border-radius: 50%;
  background: rgba(63,48,39,.22);
}
.food-fish .food-shape {
  position: absolute;
  left: 9px;
  top: 9px;
  width: 42px;
  height: 25px;
  border: 3px solid #52666a;
  border-radius: 55% 48% 48% 55%;
  background: #93bec0;
}
.food-fish .food-shape::before {
  content: "";
  position: absolute;
  right: -16px;
  top: 3px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 15px solid #719da0;
}
.food-meat .food-shape {
  position: absolute;
  left: 8px;
  top: 7px;
  width: 47px;
  height: 31px;
  border: 3px solid #82564f;
  border-radius: 46% 54% 50% 50%;
  background: radial-gradient(circle at 32% 35%, #f0a68d 0 18%, #cc796b 20% 100%);
}

.game {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 8.5;
  overflow: hidden;
  border: 2px solid #68594b;
  border-radius: 0 0 20px 20px;
  outline: none;
  background: #31484d;
  box-shadow: 0 18px 45px rgba(48, 35, 25, .22);
  touch-action: none;
}

.game:focus-visible { box-shadow: 0 0 0 4px #f6ca72, 0 18px 45px rgba(48,35,25,.22); }

.world {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3200px;
  transform: translate3d(0,0,0);
  background:
    radial-gradient(ellipse at 18% 67%, rgba(173,199,175,.18), transparent 24%),
    radial-gradient(ellipse at 60% 50%, rgba(237,211,150,.12), transparent 25%),
    linear-gradient(#2b4146 0 58%, #455d59 58% 72%, #595a49 72%);
  will-change: transform;
}

.world.chapter-two {
  background:
    radial-gradient(ellipse at 18% 44%, rgba(225,200,128,.2), transparent 23%),
    radial-gradient(ellipse at 72% 58%, rgba(142,174,183,.22), transparent 28%),
    linear-gradient(#647b88 0 58%, #4d656b 58% 72%, #595a49 72%);
}

.world.chapter-two .back { background: #364b53; }
.world.chapter-two .ground { border-top-color: #a09b71; }

.world.chapter-three {
  background:
    radial-gradient(ellipse at 19% 35%, rgba(246,220,228,.32), transparent 22%),
    radial-gradient(ellipse at 67% 46%, rgba(207,228,215,.26), transparent 30%),
    linear-gradient(#708693 0 58%, #66807a 58% 72%, #62604d 72%);
}
.world.chapter-three .back { background: #516c6a; }
.world.chapter-three .ground { border-top-color: #aaa477; }

.world.chapter-four {
  background:
    radial-gradient(ellipse at 20% 38%, rgba(215,226,235,.26), transparent 25%),
    radial-gradient(ellipse at 72% 49%, rgba(181,205,219,.23), transparent 29%),
    linear-gradient(#778b98 0 58%, #647a7c 58% 72%, #5d5c4d 72%);
}
.world.chapter-four .back { background: #596e73; }
.world.chapter-four .ground { border-top-color: #a19e82; }

.wind-spirit {
  position: absolute;
  z-index: 7;
  bottom: 38%;
  width: 230px;
  height: 150px;
  transform: translateX(-50%);
  opacity: .92;
  pointer-events: none;
  transition: opacity .35s, transform .35s;
}
.wind-spirit.is-hidden { display: none; }
.wind-spirit i {
  position: absolute;
  left: 10px;
  width: 190px;
  height: 48px;
  border-top: 7px solid rgba(220,236,232,.86);
  border-radius: 50%;
  filter: drop-shadow(0 2px 1px rgba(52,73,72,.25));
  animation: wind-breathe .72s ease-in-out infinite alternate;
}
.wind-spirit i:nth-child(1) { top: 18px; }
.wind-spirit i:nth-child(2) { top: 61px; left: 34px; width: 165px; animation-delay: -.21s; }
.wind-spirit i:nth-child(3) { top: 104px; left: 3px; width: 205px; animation-delay: -.43s; }
.wind-spirit b {
  position: absolute;
  color: #f3c8d3;
  font-size: 25px;
  animation: petal-float 1.15s ease-in-out infinite alternate;
}
.wind-spirit b:nth-of-type(1) { right: 29px; top: 23px; }
.wind-spirit b:nth-of-type(2) { right: 2px; top: 86px; animation-delay: -.55s; }
.wind-spirit.is-soft { opacity: .5; transform: translateX(-50%) scale(.9); }

.rain-cloud {
  position: absolute;
  z-index: 7;
  bottom: 53%;
  width: 250px;
  height: 180px;
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity .35s, bottom .5s, transform .5s;
}
.rain-cloud.is-hidden { display: none; }
.cloud-puff {
  position: absolute;
  bottom: 67px;
  border-radius: 50%;
  background: linear-gradient(#aebec8, #7f949f);
  box-shadow: inset 0 8px rgba(255,255,255,.16), 0 5px 5px rgba(36,55,62,.22);
}
.puff-one { left: 17px; width: 105px; height: 78px; }
.puff-two { left: 76px; width: 124px; height: 102px; }
.puff-three { left: 155px; width: 82px; height: 70px; }
.rain-drop {
  position: absolute;
  top: 108px;
  width: 7px;
  height: 19px;
  border-radius: 60% 40% 60% 40%;
  background: #a8d1e5;
  transform: rotate(18deg);
  animation: rain-fall .72s linear infinite;
}
.drop-one { left: 45px; }
.drop-two { left: 91px; animation-delay: -.2s; }
.drop-three { left: 145px; animation-delay: -.43s; }
.drop-four { left: 196px; animation-delay: -.61s; }
.rain-cloud.is-waiting { bottom: 62%; transform: translateX(-50%) scale(.92); opacity: .72; }
.rain-cloud.is-waiting .rain-drop { animation-play-state: paused; opacity: 0; }

.back {
  position: absolute;
  bottom: 27%;
  width: 740px;
  height: 38%;
  border-radius: 48% 52% 0 0;
  background: #283f41;
  clip-path: polygon(0 100%, 9% 43%, 18% 72%, 29% 24%, 41% 66%, 54% 16%, 68% 66%, 79% 32%, 90% 73%, 100% 45%, 100% 100%);
  opacity: .78;
}

.back-one { left: 120px; }
.back-two { left: 1700px; transform: scaleX(1.2); }

.paper-cloud {
  position: absolute;
  width: 360px;
  height: 76px;
  border-radius: 50%;
  background: rgba(238, 226, 188, .13);
  filter: blur(2px);
}
.cloud-one { left: 530px; top: 12%; }
.cloud-two { left: 2210px; top: 20%; }

.crow {
  position: absolute;
  z-index: 8;
  width: 118px;
  height: 74px;
  pointer-events: none;
  filter: drop-shadow(0 4px 2px rgba(0,0,0,.22));
}
.crow.is-hidden { display: none; }
.crow-body {
  position: absolute;
  left: 38px;
  top: 26px;
  width: 52px;
  height: 31px;
  border-radius: 55% 45% 52% 48%;
  background: #293133;
}
.crow-body::after {
  content: "";
  position: absolute;
  right: -15px;
  top: 7px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 18px solid #d2ad62;
}
.crow-wing {
  position: absolute;
  width: 59px;
  height: 49px;
  border-radius: 90% 12% 90% 12%;
  background: linear-gradient(135deg, #3e494a, #1f2729);
  transform-origin: 86% 84%;
}
.wing-back { left: 8px; top: 13px; animation: crow-flap-back .42s ease-in-out infinite alternate; }
.wing-front { left: 44px; top: 6px; transform: rotate(27deg); animation: crow-flap-front .42s ease-in-out infinite alternate; }
.crow.is-escaping .crow-wing { animation-duration: .17s; }

.ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  background:
    repeating-linear-gradient(8deg, transparent 0 29px, rgba(255,255,255,.025) 30px 32px),
    linear-gradient(#6e6a4e 0 5%, #655c46 6% 100%);
  border-top: 7px solid #929071;
}

.ground::after {
  content: "";
  position: absolute;
  inset: 11% 0 0;
  background-image: radial-gradient(circle, rgba(43,46,37,.25) 0 2px, transparent 3px);
  background-size: 48px 31px;
}

.stone {
  position: absolute;
  bottom: 23%;
  width: 120px;
  height: 45px;
  border-radius: 55% 50% 42% 48%;
  background: #7a786c;
  box-shadow: inset 0 8px rgba(255,255,255,.08);
}
.stone-one { left: 670px; transform: scale(.7); }
.stone-two { left: 2380px; transform: scale(1.15); }

.leaf-pile {
  position: absolute;
  bottom: 22%;
  width: 150px;
  height: 75px;
}
.leaf-one { left: 1470px; }
.leaf-two { left: 2490px; transform: scale(.9); }
.leaf-pile i {
  position: absolute;
  bottom: 0;
  width: 70px;
  height: 45px;
  border-radius: 90% 10% 80% 20%;
  background: #8a7650;
  transform: rotate(-18deg);
}
.leaf-pile i:nth-child(2) { left: 42px; background:#a08655; transform: rotate(18deg); }
.leaf-pile i:nth-child(3) { left: 82px; background:#716246; transform: rotate(-4deg); }

.player {
  --face: -1;
  position: absolute;
  left: 140px;
  bottom: 22%;
  z-index: 10;
  width: 230px;
  height: 176px;
  transform: translate(-50%, 0);
  will-change: left, bottom;
}

.player img {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  filter:
    drop-shadow(0 0 1px rgba(255, 250, 231, .42))
    drop-shadow(0 5px 5px rgba(0,0,0,.34));
  transform: scaleX(var(--face));
}

.player.is-speaking img {
  animation: nyaa-motion .26s ease-out;
}

.player.is-eating img {
  transform-origin: 50% 92%;
  animation: munch-motion .42s ease-in-out 2;
}
.player.is-eating::after {
  content: "もぐもぐ♪";
  position: absolute;
  z-index: 3;
  left: 50%;
  top: -16px;
  padding: 5px 10px;
  border: 2px solid #705d50;
  border-radius: 999px;
  color: #554136;
  background: #fff7d9;
  box-shadow: 0 3px 0 rgba(88,67,53,.18);
  font: 900 16px/1 system-ui, sans-serif;
  white-space: nowrap;
  transform: translateX(-50%);
  animation: munch-label .42s ease-in-out 2;
}

.player.is-hurt {
  filter: drop-shadow(0 0 12px rgba(255, 214, 107, .9));
}

.player.is-invulnerable {
  animation: damage-blink .18s steps(2, end) infinite;
}

.player.is-airborne { width: 250px; height: 205px; }

.player-shadow {
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 65%;
  height: 18px;
  border-radius: 50%;
  background: rgba(22,25,21,.35);
  transform: translateX(-50%);
  filter: blur(3px);
}

.player.is-airborne .player-shadow {
  transform: translateX(-50%) scale(.72);
  opacity: .55;
}

.voice-wave {
  position: absolute;
  z-index: 9;
  min-width: 84px;
  padding: 8px 12px 9px;
  border: 3px solid #76503f;
  border-radius: 52% 48% 46% 54%;
  color: #4e352c;
  background: #ffe69a;
  box-shadow:
    inset 0 2px rgba(255,255,255,.55),
    0 4px 0 rgba(73,48,38,.3),
    0 0 12px rgba(255,225,133,.55);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.06em;
  text-align: center;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  animation: flying-word .38s ease-in-out infinite alternate;
}

.voice-wave::after {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 14px;
  height: 16px;
  border-left: 3px solid #76503f;
  border-bottom: 3px solid #76503f;
  background: #ffe69a;
  transform: translateY(-50%) rotate(45deg);
  z-index: -1;
}

.voice-wave.is-left::after {
  left: auto;
  right: -12px;
  transform: translateY(-50%) rotate(225deg);
}

.pillbug {
  position: absolute;
  z-index: 7;
  width: 104px;
  height: 94px;
  transform: translate(-50%, 0);
  transform-origin: 50% 90%;
}

.pillbug-body {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 4px solid #4e4d49;
  border-radius: 49% 51% 47% 53%;
  background: linear-gradient(145deg, #b2a796, #877e73 63%, #746d65);
  box-shadow: inset 10px 12px rgba(255,255,255,.11), 0 6px 5px rgba(0,0,0,.2);
}

.pillbug-band {
  position: absolute;
  top: -8%;
  width: 25px;
  height: 116%;
  border-right: 4px solid rgba(68,65,61,.66);
  border-radius: 50%;
  transform: rotate(5deg);
}
.pillbug-band:nth-child(1) { left: 15px; }
.pillbug-band:nth-child(2) { left: 32px; }
.pillbug-band:nth-child(3) { left: 49px; }
.pillbug-band:nth-child(4) { left: 66px; }
.pillbug-band:nth-child(5) { left: 81px; }

.pillbug-eye {
  position: absolute;
  z-index: 2;
  top: 31px;
  width: 7px;
  height: 8px;
  border-radius: 50%;
  background: #282624;
}
.pillbug-eye.eye-one { right: 16px; }
.pillbug-eye.eye-two { right: 30px; }

.obstacle-leafball .pillbug-body {
  border-color: #5d6746;
  background:
    radial-gradient(circle at 30% 28%, #d9df9a 0 12%, transparent 13%),
    radial-gradient(circle at 68% 70%, #6f8951 0 20%, transparent 21%),
    linear-gradient(145deg, #c2cd88, var(--obstacle-color) 58%, #6d7351);
}

.leaf-mark {
  position: absolute;
  width: 25px;
  height: 14px;
  border: 2px solid rgba(70,83,51,.74);
  border-radius: 90% 12% 90% 12%;
  background: rgba(239,224,150,.64);
  transform: rotate(28deg);
}
.leaf-one { left: 15px; top: 18px; }
.leaf-two { left: 42px; top: 8px; transform: rotate(-34deg); }
.leaf-three { left: 20px; top: 52px; transform: rotate(58deg); }
.leaf-four { left: 54px; top: 59px; transform: rotate(-12deg); }

.obstacle-sportsball { width: 112px; height: 104px; }
.obstacle-sportsball .pillbug-body {
  border-color: #74443d;
  border-radius: 50%;
  background: linear-gradient(90deg, #f8e8d2 0 30%, var(--obstacle-color) 31% 68%, #f8e8d2 69%);
}
.ball-stripe {
  position: absolute;
  inset: 12px 0;
  border-top: 5px solid rgba(255,255,255,.58);
  border-bottom: 5px solid rgba(255,255,255,.58);
  border-radius: 50%;
}
.ball-star {
  position: absolute;
  left: 20px;
  top: 31px;
  color: #f4c84e;
  font-size: 27px;
  text-shadow: 0 2px #87584b;
}

.pillbug.is-moving .pillbug-body { animation: amble .9s ease-in-out infinite; }
.pillbug.is-startled { animation: pop .28s ease-out; }
.pillbug.is-escaping .pillbug-body { animation: roll .48s linear infinite; }
.pillbug.is-safe { opacity: .82; transform: translate(-50%, 15px) scale(.72); }

.goal {
  position: absolute;
  left: 2950px;
  bottom: 23%;
  width: 165px;
  height: 235px;
  border: 7px solid #8d7555;
  border-bottom: 0;
  border-radius: 90px 90px 0 0;
  background: rgba(238,213,153,.08);
  box-shadow: inset 0 0 45px rgba(255,223,143,.2);
}
.goal-light {
  position: absolute;
  inset: 10px;
  border-radius: inherit;
  background: radial-gradient(ellipse at 50% 80%, #ffe8a6, rgba(239,207,135,.1) 70%);
  opacity: .7;
}
.goal span {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: max-content;
  transform: translateX(-50%);
  color: #fff0be;
  font-weight: 800;
}

.screen-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .08;
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, #fff 4px);
  mix-blend-mode: soft-light;
}

.title-overlay {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 78% 24%, rgba(255, 238, 168, .34), transparent 22%),
    linear-gradient(145deg, rgba(22, 47, 50, .94), rgba(52, 74, 65, .88));
  backdrop-filter: blur(4px);
}

.title-overlay.is-hidden { display: none; }

.title-card {
  width: min(720px, 100%);
  padding: clamp(22px, 4.5vw, 48px);
  border: 4px solid #dbc88f;
  border-radius: 28px;
  text-align: center;
  color: #3d3128;
  background:
    radial-gradient(circle at 16% 18%, rgba(255,255,255,.82) 0 2px, transparent 3px),
    linear-gradient(145deg, #fff5d4, #e7d4a5);
  box-shadow: 0 14px 0 rgba(17, 30, 29, .38), 0 30px 70px rgba(8, 18, 18, .34);
}

.title-kicker {
  margin: 0 0 9px;
  color: #786652;
  font: 800 11px/1.2 system-ui, sans-serif;
  letter-spacing: .18em;
}

.title-card h2 {
  margin: 0;
  font-size: clamp(32px, 6vw, 58px);
  line-height: 1.08;
}

.title-copy {
  margin: 14px 0 22px;
  font: 700 15px/1.5 system-ui, sans-serif;
}

.mode-select {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mode-button {
  display: flex;
  min-height: 112px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  border: 3px solid #9d8b72;
  border-radius: 18px;
  color: #3e322a;
  background: #fffaf0;
  box-shadow: 0 5px #8b7965;
  cursor: pointer;
  transition: transform .16s, border-color .16s, background .16s;
}

.mode-button strong {
  font-size: 22px;
}

.mode-button span,
.mode-button small {
  font: 700 12px/1.35 system-ui, sans-serif;
}

.mode-button small {
  color: #7c625b;
}

.mode-button:hover,
.mode-button:focus-visible,
.mode-button.is-selected {
  border-color: #cf6e4f;
  background: #fff0c8;
  transform: translateY(-2px);
}

.mode-button-hard {
  background: #f2e9ef;
}

.mode-button-hard:hover,
.mode-button-hard:focus-visible,
.mode-button-hard.is-selected {
  border-color: #8a5772;
  background: #ead8e6;
}

.title-hint {
  margin: 20px 0 0;
  color: #715f50;
  font: 700 12px/1.5 system-ui, sans-serif;
}

.page-overlay {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(26, 38, 40, .68);
  backdrop-filter: blur(3px);
}

.page-overlay.is-hidden { display: none; }

.page-card {
  width: min(520px, 100%);
  padding: clamp(24px, 5vw, 48px);
  border: 4px solid #70594a;
  border-radius: 26px;
  text-align: center;
  color: #43342b;
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.7) 0 2px, transparent 3px),
    linear-gradient(135deg, #fff6d8, #e9d6a9);
  box-shadow: 0 12px 0 rgba(32,29,24,.35);
}

.page-kicker {
  margin: 0 0 6px;
  color: #76634e;
  font: 800 12px/1.2 system-ui, sans-serif;
  letter-spacing: .16em;
}

.page-card h2 { margin: 0; font-size: clamp(25px, 5vw, 40px); }
.page-card p:not(.page-kicker) { margin: 12px 0 22px; font: 700 16px/1.5 system-ui, sans-serif; }
.page-card .page-hint {
  margin: -7px 0 18px;
  color: #6f5a48;
  font-size: 12px;
}
.page-hint kbd { min-width: auto; padding: 2px 5px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.page-actions button {
  min-height: 46px;
  padding: 9px 15px;
  border: 2px solid #625448;
  border-radius: 12px;
  color: #3f3028;
  font: 800 14px/1.2 system-ui, sans-serif;
  cursor: pointer;
}
.page-next { background: #f3cd6e; }
.page-next.is-hidden { display: none; }
.page-retry { background: #fdf7e7; }

.controls {
  margin-top: 14px;
  flex-wrap: wrap;
  font: 700 13px/1.3 system-ui, sans-serif;
}

.keyboard-help { display: flex; flex-wrap: wrap; gap: 14px; }
kbd {
  display: inline-block;
  min-width: 26px;
  margin-right: 3px;
  padding: 4px 7px;
  border: 1px solid #8b7968;
  border-bottom-width: 3px;
  border-radius: 6px;
  text-align: center;
  background: #fff9ec;
}

.touch-controls { display: flex; flex-wrap: wrap; gap: 7px; }
.touch-controls button, .restart, .bgm-toggle {
  min-height: 43px;
  padding: 8px 14px;
  border: 2px solid #625448;
  border-radius: 11px;
  color: var(--ink);
  background: #fff8e7;
  box-shadow: 0 3px #796b5e;
  cursor: pointer;
}
.touch-controls button:active, .touch-controls button.is-held, .restart:active, .bgm-toggle:active {
  transform: translateY(2px);
  box-shadow: 0 1px #796b5e;
}
.voice-button { background: #f9d982 !important; }
.long-voice-button { background: #e2ccec !important; }
.jump-button { background: #d7e4ce !important; }
.restart { white-space: nowrap; }
.bgm-toggle {
  min-width: 112px;
  white-space: nowrap;
  background: #e8dfc7;
}
.bgm-toggle[aria-pressed="false"] { opacity: .72; }

.prototype-note {
  margin: 12px 0 0;
  color: #6a5b4e;
  font: 12px/1.5 system-ui, sans-serif;
  text-align: right;
}

@keyframes pop {
  0% { transform:translate(-50%,0) scale(1); }
  50% { transform:translate(-50%,-11px) scale(1.08,.88); }
  100% { transform:translate(-50%,0) scale(1); }
}
@keyframes roll { to { rotate: 360deg; } }
@keyframes amble { 50% { transform: translateY(-3px) rotate(2deg); } }
@keyframes shake { 25% { transform:translateX(-3px); } 75% { transform:translateX(3px); } }
@keyframes food-bob {
  from { transform: translate(-50%, 0); }
  to { transform: translate(-50%, -7px); }
}
@keyframes flying-word {
  from { margin-top: -3px; rotate: -3deg; }
  to { margin-top: 3px; rotate: 3deg; }
}
@keyframes nyaa-motion {
  0% { transform: scaleX(var(--face)) translateX(0) scale(1); }
  34% { transform: scaleX(var(--face)) translateX(-5px) scale(1.09, .88) rotate(-2deg); }
  68% { transform: scaleX(var(--face)) translateX(4px) scale(.96, 1.06) rotate(1deg); }
  100% { transform: scaleX(var(--face)) translateX(0) scale(1); }
}
@keyframes munch-motion {
  0%, 100% { transform: scaleX(var(--face)) translateY(0) scale(1); }
  40% { transform: scaleX(var(--face)) translateY(9px) rotate(2deg) scale(1.03,.92); }
  70% { transform: scaleX(var(--face)) translateY(2px) rotate(-1deg) scale(.98,1.04); }
}
@keyframes munch-label {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(.95); }
  50% { transform: translateX(-50%) translateY(-5px) scale(1.05); }
}
@keyframes damage-blink {
  50% { opacity: .32; }
}
@keyframes crow-flap-back { to { transform: rotate(-31deg) translateY(-7px); } }
@keyframes crow-flap-front { to { transform: rotate(61deg) translateY(-8px); } }
@keyframes wind-breathe { to { transform: translateX(20px) scaleX(.92); } }
@keyframes petal-float { to { transform: translate(17px, -10px) rotate(35deg); } }
@keyframes rain-fall {
  from { translate: 0 -9px; opacity: 0; }
  25% { opacity: .9; }
  to { translate: -12px 48px; opacity: 0; }
}

@media (max-width: 760px) {
  .shell { padding-inline: 8px; }
  .titlebar { align-items: end; }
  .difficulty label, .keyboard-help { display:none; }
  .hud { flex-wrap:wrap; }
  #message { order:3; flex-basis:100%; }
  .game { height: min(66svh, 520px); min-height: 430px; aspect-ratio: auto; }
  .title-overlay { padding: 12px; }
  .title-card { padding: 18px 14px; border-radius: 20px; }
  .title-card h2 { font-size: clamp(30px, 10vw, 42px); }
  .title-copy { margin: 9px 0 12px; font-size: 12px; }
  .mode-select { gap: 8px; }
  .mode-button { min-height: 98px; padding: 9px 7px; }
  .mode-button strong { font-size: 18px; }
  .mode-button span, .mode-button small { font-size: 10px; }
  .title-hint { margin-top: 12px; font-size: 10px; }
  .controls { align-items:flex-end; }
  .touch-controls { flex:1; }
  .touch-controls button { flex:1; padding-inline:6px; }
  .player { width: 185px; height: 145px; }
  .player.is-airborne { width: 205px; height: 165px; }
  .voice-wave { min-width: 70px; font-size: 18px; }
}
