:root {
  --cream: #fff8e8;
  --paper: #fffdf8;
  --ink: #4e5144;
  --soft-ink: #747365;
  --peach: #ee987d;
  --peach-dark: #b95f55;
  --sun: #f2c269;
  --mint: #a8cd9a;
  --leaf: #5f8d60;
  --lavender: #c8b5db;
  --shadow: rgba(102, 78, 48, 0.16);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #f7d59d; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(255,255,255,.75) 0 4px, transparent 5px),
    radial-gradient(circle at 87% 19%, rgba(255,255,255,.65) 0 3px, transparent 4px),
    linear-gradient(145deg, #f8dda7, #f5c486 52%, #edb47c);
  background-size: 70px 70px, 95px 95px, auto;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button, a { font: inherit; }
button { color: inherit; }

.background-doodles span {
  position: fixed;
  z-index: 0;
  color: rgba(255,255,255,.48);
  font-size: clamp(22px, 4vw, 54px);
  pointer-events: none;
}
.background-doodles span:nth-child(1) { top: 8%; left: 3%; transform: rotate(-18deg); }
.background-doodles span:nth-child(2) { top: 32%; right: 4%; }
.background-doodles span:nth-child(3) { bottom: 8%; left: 5%; }
.background-doodles span:nth-child(4) { top: 5%; right: 28%; }
.background-doodles span:nth-child(5) { right: 2%; bottom: 6%; transform: rotate(16deg); }

.game-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.game-header {
  display: grid;
  min-height: 76px;
  grid-template-columns: 108px 1fr 108px;
  align-items: center;
  gap: 12px;
}

.title-lockup { text-align: center; }
.title-lockup p { margin: 0 0 3px; color: #855b3c; font-size: 12px; font-weight: 900; letter-spacing: .16em; }
.title-lockup h1 { margin: 0; font-family: KaiTi, STKaiti, serif; font-size: clamp(30px, 4vw, 46px); line-height: 1; }
.header-actions { display: flex; justify-content: flex-end; gap: 9px; }

.round-button {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
  border: 3px solid rgba(255,255,255,.78);
  border-radius: 50%;
  background: rgba(255,252,238,.88);
  box-shadow: 0 5px 0 rgba(122,79,48,.11), 0 9px 20px rgba(122,79,48,.11);
  color: #6f6a4f;
  cursor: pointer;
  text-decoration: none;
  font-size: 24px;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.round-button:hover { transform: translateY(-2px) rotate(-4deg); }
.round-button:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(122,79,48,.13); }

.game-stage {
  display: grid;
  min-height: min(710px, calc(100vh - 116px));
  overflow: hidden;
  grid-template-columns: minmax(410px, 1.05fr) minmax(420px, .95fr);
  border: 7px solid rgba(255,253,245,.88);
  border-radius: 40px;
  background: var(--paper);
  box-shadow: 0 24px 65px var(--shadow), 0 8px 0 rgba(122,79,48,.09);
}

.story-scene {
  position: relative;
  min-height: 650px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.2) 1px, transparent 1px),
    linear-gradient(180deg, #bbe1d1 0 64%, #e6b884 64% 100%);
  background-size: 28px 28px, 28px 28px, auto;
}
.story-scene::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 34%;
  content: "";
  background: repeating-linear-gradient(90deg, rgba(134,81,44,.08) 0 2px, transparent 2px 62px);
}

.scene-sun {
  position: absolute;
  top: 48px;
  right: 50px;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: rgba(255,234,157,.78);
  box-shadow: 0 0 0 20px rgba(255,242,194,.22);
}
.curtain { position: absolute; z-index: 3; top: 0; width: 98px; height: 230px; background: #ef9b8a; box-shadow: inset -12px 0 rgba(171,87,80,.12); }
.curtain::after { position: absolute; bottom: -38px; width: 100%; height: 60px; content: ""; border-radius: 0 0 80% 30%; background: inherit; }
.curtain-left { left: 0; border-radius: 0 0 72% 0; }
.curtain-right { right: 0; border-radius: 0 0 0 72%; transform: scaleX(-1); }

.child {
  position: absolute;
  z-index: 4;
  top: 76px;
  left: 50%;
  width: 218px;
  height: 370px;
  transform: translateX(-50%);
  transition: transform 350ms cubic-bezier(.2,.8,.3,1);
}
.child-face {
  position: absolute;
  z-index: 3;
  top: 47px;
  left: 38px;
  width: 142px;
  height: 150px;
  border: 4px solid rgba(125,79,56,.16);
  border-radius: 48% 48% 44% 44%;
  background: #ffd9bd;
  box-shadow: inset 0 -10px rgba(239,157,135,.11), 0 10px 0 rgba(96,68,47,.08);
}
.child-hair {
  position: absolute;
  z-index: 5;
  top: 25px;
  left: 34px;
  width: 151px;
  height: 83px;
  border-radius: 58% 48% 38% 20%;
  background: #59483d;
  transform: rotate(-3deg);
}
.child-hair::before, .child-hair::after { position: absolute; content: ""; background: inherit; }
.child-hair::before { right: -4px; bottom: -63px; width: 25px; height: 91px; border-radius: 50%; }
.child-hair::after { top: -19px; left: 17px; width: 55px; height: 55px; border-radius: 50%; }
.eye { position: absolute; top: 68px; width: 9px; height: 12px; border-radius: 50%; background: #54463e; transition: height 180ms; }
.eye-left { left: 41px; } .eye-right { right: 41px; }
.cheek { position: absolute; top: 91px; width: 21px; height: 10px; border-radius: 50%; background: rgba(235,121,120,.28); }
.cheek-left { left: 18px; } .cheek-right { right: 18px; }
.mouth { position: absolute; top: 100px; left: 61px; width: 22px; height: 15px; border-bottom: 4px solid #9a635b; border-radius: 0 0 50% 50%; }
.child-neck { position: absolute; z-index: 2; top: 183px; left: 91px; width: 37px; height: 42px; border-radius: 0 0 16px 16px; background: #ffd9bd; }
.child-body { position: absolute; z-index: 2; top: 205px; left: 27px; width: 166px; height: 165px; border-radius: 52px 52px 25px 25px; background: #f4b85e; box-shadow: inset 0 -13px rgba(180,112,47,.1); }
.child-body::before, .child-body::after { position: absolute; top: 21px; width: 42px; height: 132px; content: ""; border-radius: 28px; background: #ffd9bd; }
.child-body::before { left: -22px; transform: rotate(13deg); }
.child-body::after { right: -22px; transform: rotate(-13deg); }
.shirt-star { position: absolute; top: 30px; left: 63px; color: rgba(255,250,219,.9); font-size: 38px; }
.tummy-ripple { position: absolute; display: none; bottom: 30px; left: 58px; color: #a7634d; font-size: 30px; font-weight: 900; }
.speech-bubble { position: absolute; z-index: 8; top: 5px; right: -70px; max-width: 150px; padding: 10px 13px; border: 3px solid rgba(255,255,255,.8); border-radius: 19px 19px 19px 5px; background: #fffaf0; box-shadow: 0 7px 14px rgba(91,65,46,.12); font-size: 13px; font-weight: 900; text-align: center; }

.child.is-eating { transform: translateX(-50%) translateY(-5px) scale(1.03); }
.child.is-eating .mouth { height: 22px; border: 4px solid #9a635b; border-radius: 50%; background: #d97e78; }
.child[data-mood="bloated"] { animation: tummy-wobble 1.2s ease-in-out infinite; }
.child[data-mood="bloated"] .mouth { top: 108px; border-top: 4px solid #9a635b; border-bottom: 0; border-radius: 50% 50% 0 0; }
.child[data-mood="bloated"] .tummy-ripple { display: block; }
.child[data-mood="thinking"] .mouth { width: 15px; height: 7px; border: 3px solid #9a635b; border-radius: 50%; }
.child[data-mood="balanced"] .eye { height: 5px; border-radius: 50% 50% 0 0; }
.child[data-mood="sweet"] { animation: tiny-head-shake .9s ease-in-out infinite; }
.child[data-mood="sweet"] .mouth { top: 108px; width: 24px; height: 4px; border: 0; border-top: 4px solid #9a635b; border-radius: 50%; }

.table { position: absolute; z-index: 6; right: -50px; bottom: 74px; left: -50px; height: 155px; border-radius: 50% 50% 0 0; background: #d98c65; box-shadow: inset 0 12px rgba(255,213,164,.18), 0 -9px 0 rgba(112,70,46,.1); }
.plate { position: absolute; top: 26px; left: 50%; width: 305px; height: 98px; border: 9px solid #f8efe0; border-radius: 50%; background: #d7e8de; box-shadow: 0 8px 0 rgba(94,68,48,.12), inset 0 0 0 5px rgba(117,154,135,.12); transform: translateX(-50%); }
.meal-foods { display: flex; position: absolute; inset: 8px 26px; align-items: center; justify-content: center; gap: 2px; }
.meal-food { font-size: 38px; filter: drop-shadow(0 4px 2px rgba(65,56,43,.13)); animation: food-land 380ms cubic-bezier(.2,1.5,.4,1); }

.tummy-card { position: absolute; z-index: 8; right: 17px; bottom: 17px; display: grid; width: 150px; padding: 11px 12px; grid-template-columns: 1fr auto; gap: 5px 8px; border: 3px solid rgba(255,255,255,.7); border-radius: 18px; background: rgba(255,249,232,.9); box-shadow: 0 6px 0 rgba(100,65,44,.11); font-size: 11px; font-weight: 900; }
.tummy-card > span { color: var(--soft-ink); }
.tummy-card > b { color: #9c6653; }
.fullness-meter { display: flex; grid-column: 1 / -1; gap: 4px; }
.fullness-dot { width: 15px; height: 15px; border: 2px solid #dfc7a4; border-radius: 50%; background: #fff; }
.fullness-dot.is-filled { border-color: #e58f6f; background: #f4a783; }
.fullness-dot.is-over { animation: tummy-wobble 650ms infinite; background: #d66e67; }

.play-panel { display: grid; padding: clamp(27px, 4vw, 52px); align-items: center; background: radial-gradient(circle at 100% 0, #fff0c4, transparent 38%), var(--paper); }
.choice-view, .result-view { width: 100%; }
.round-progress { display: flex; align-items: end; justify-content: space-between; gap: 15px; }
.eyebrow { margin: 0 0 8px; color: var(--peach-dark); font-size: 12px; font-weight: 900; letter-spacing: .13em; }
.round-progress h2, .result-view h2 { margin: 0; font-family: KaiTi, STKaiti, serif; font-size: clamp(30px, 4vw, 43px); line-height: 1.12; }
#bite-count { flex: none; padding: 8px 12px; border: 2px solid #efdfc9; border-radius: 999px; background: #fff8e9; font-size: 13px; font-weight: 900; }
#bite-count b { color: var(--peach-dark); font-size: 22px; }

.group-ribbon { display: flex; min-height: 58px; margin: 18px 0 12px; align-items: center; gap: 8px; }
.group-token { display: grid; width: 58px; height: 58px; place-items: center; border: 3px solid rgba(255,255,255,.8); border-radius: 18px; box-shadow: 0 4px 0 rgba(83,68,49,.09); color: #fff; font-size: 25px; animation: food-land 340ms ease-out; }
.empty-meal { color: #999382; font-size: 13px; font-weight: 800; }

.body-signal {
  display: grid;
  min-height: 58px;
  margin-bottom: 15px;
  padding: 9px 12px;
  grid-template-columns: 40px 1fr;
  gap: 9px;
  align-items: center;
  border: 2px dashed #d9c5a7;
  border-radius: 18px;
  background: #fff8e8;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.body-signal-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: #dcebd8; font-size: 22px; }
.body-signal b { display: block; margin-bottom: 2px; font-size: 12px; }
.body-signal p { margin: 0; color: var(--soft-ink); font-size: 11px; font-weight: 800; line-height: 1.35; }
.body-signal[data-level="1"] { background: #fff3d3; }
.body-signal[data-level="2"] { border-color: #e0aa7d; background: #ffe3c7; transform: rotate(-.35deg); }
.body-signal[data-level="3"] { border-color: #d47b78; background: #ffd4cf; transform: rotate(.45deg) scale(1.015); }
.body-signal[data-level="3"] .body-signal-icon { background: #f3aca8; animation: signal-pop 650ms ease-in-out infinite; }

.food-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.food-card {
  position: relative;
  min-width: 0;
  min-height: 150px;
  padding: 13px 7px 10px;
  overflow: hidden;
  border: 4px solid rgba(255,255,255,.86);
  border-radius: 27px;
  background: var(--card-color, #f4e4bf);
  box-shadow: 0 7px 0 color-mix(in srgb, var(--card-color) 72%, #715c48), 0 13px 25px rgba(87,66,46,.12);
  cursor: pointer;
  transition: transform 170ms cubic-bezier(.2,.8,.3,1), filter 170ms ease;
}
.food-card::before { position: absolute; top: -30px; right: -25px; width: 85px; height: 85px; content: ""; border-radius: 50%; background: rgba(255,255,255,.24); }
.food-card:hover { transform: translateY(-6px) rotate(-1deg); filter: saturate(1.06); }
.food-card:nth-child(2):hover { transform: translateY(-6px) rotate(1deg); }
.food-card:active { transform: translateY(3px); box-shadow: 0 3px 0 color-mix(in srgb, var(--card-color) 72%, #715c48); }
.food-card[disabled] { pointer-events: none; opacity: .55; }
.food-emoji { display: block; margin-bottom: 6px; filter: drop-shadow(0 6px 2px rgba(85,61,45,.13)); font-size: clamp(45px, 5vw, 61px); line-height: 1; }
.food-name { display: block; overflow: hidden; font-size: 15px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.food-group { display: block; margin-top: 6px; color: rgba(67,65,56,.72); font-size: 11px; font-weight: 800; }
.portion-note { display: inline-block; margin-top: 6px; padding: 3px 7px; border-radius: 999px; background: rgba(255,255,255,.48); color: #9b5f58; font-size: 10px; font-weight: 900; }
.food-card.is-picked { z-index: 2; animation: picked 430ms ease both; }

.gentle-hint { margin: 24px 0 0; color: #858174; font-size: 13px; font-weight: 800; text-align: center; }
.gentle-hint span { display: inline-grid; width: 26px; height: 26px; margin-right: 5px; place-items: center; border-radius: 50%; background: #f6e3ae; }

.result-view { text-align: center; }
.result-stamp { display: grid; width: 112px; height: 112px; margin: 0 auto 18px; place-items: center; border: 6px double rgba(255,255,255,.76); border-radius: 50%; background: var(--mint); box-shadow: 0 8px 0 rgba(83,103,66,.13); color: #fff; font-family: KaiTi, STKaiti, serif; font-size: 22px; font-weight: 900; transform: rotate(-5deg); }
.result-view > p:not(.eyebrow) { max-width: 33em; margin: 14px auto; color: var(--soft-ink); font-weight: 700; line-height: 1.7; }
.meal-summary { display: flex; min-height: 64px; margin: 20px 0; justify-content: center; gap: 8px; flex-wrap: wrap; }
.summary-food { display: grid; width: 58px; height: 58px; place-items: center; border: 3px solid #fff; border-radius: 18px; background: #f5e6c6; box-shadow: 0 4px 0 rgba(100,73,49,.1); font-size: 31px; }
.safety-tip { display: grid; margin: 20px 0; padding: 14px; grid-template-columns: 48px 1fr; gap: 10px; align-items: center; border: 2px dashed #ddc8a7; border-radius: 20px; background: #fff8e7; text-align: left; }
.safety-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; background: #dce9cf; font-size: 24px; }
.safety-tip b { display: block; margin-bottom: 2px; }
.safety-tip p { margin: 0; color: var(--soft-ink); font-size: 12px; font-weight: 700; line-height: 1.45; }
.primary-button { min-height: 56px; padding: 0 30px; border: 3px solid rgba(255,255,255,.75); border-radius: 999px; background: var(--peach); box-shadow: 0 6px 0 #b86c5d; color: #fff; cursor: pointer; font-size: 17px; font-weight: 900; }
.primary-button:active { transform: translateY(4px); box-shadow: 0 2px 0 #b86c5d; }

.food-note { display: grid; max-width: 880px; margin: 24px auto 0; padding: 19px 24px; grid-template-columns: auto 1fr; gap: 15px; align-items: center; border: 2px solid rgba(121,82,54,.1); border-radius: 26px; background: rgba(255,250,235,.75); }
.food-note > span { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 50%; background: #f5d990; font-size: 24px; }
.food-note h2 { margin: 0 0 5px; font-size: 16px; }
.food-note p { margin: 0; color: #756e61; font-size: 12px; font-weight: 700; line-height: 1.65; }

.round-button:focus-visible, .food-card:focus-visible, .primary-button:focus-visible { outline: 5px solid rgba(95,115,177,.65); outline-offset: 4px; }
[hidden] { display: none !important; }

@keyframes food-land { from { opacity: 0; transform: translateY(-18px) scale(.6) rotate(-10deg); } to { opacity: 1; transform: none; } }
@keyframes picked { 0% { transform: none; } 42% { transform: translateY(-16px) scale(1.08) rotate(4deg); } 100% { transform: translateY(26px) scale(.7); opacity: 0; } }
@keyframes tummy-wobble { 0%,100% { transform: translateX(-50%) rotate(-1deg); } 50% { transform: translateX(-50%) rotate(1.5deg); } }
@keyframes tiny-head-shake { 0%,100% { transform: translateX(-50%) rotate(-.5deg); } 50% { transform: translateX(-50%) rotate(.8deg); } }
@keyframes signal-pop { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }

@media (max-width: 900px) {
  .game-stage { grid-template-columns: 1fr; }
  .story-scene { min-height: 570px; }
  .play-panel { min-height: 500px; }
}

@media (max-width: 580px) {
  .game-shell { width: min(100% - 14px, 1180px); padding-top: 8px; }
  .game-header { min-height: 66px; grid-template-columns: 96px 1fr 96px; }
  .round-button { width: 43px; height: 43px; font-size: 21px; }
  .title-lockup p { display: none; }
  .title-lockup h1 { font-size: 24px; white-space: nowrap; }
  .game-stage { border-width: 5px; border-radius: 28px; }
  .story-scene { min-height: 500px; }
  .child { top: 48px; transform: translateX(-50%) scale(.88); transform-origin: top center; }
  .child.is-eating { transform: translateX(-50%) translateY(-5px) scale(.92); }
  .curtain { width: 60px; height: 170px; }
  .speech-bubble { right: -44px; max-width: 132px; }
  .table { bottom: 55px; }
  .tummy-card { right: 10px; bottom: 9px; width: 136px; }
  .play-panel { min-height: 480px; padding: 30px 17px 36px; }
  .food-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .food-card { min-height: 138px; padding: 11px 5px 8px; border-width: 3px; border-radius: 21px; }
  .food-emoji { font-size: 45px; }
  .food-name { font-size: 15px; }
  .food-note { margin-top: 14px; padding: 16px; grid-template-columns: 1fr; }
  .food-note > span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
