:root {
  color-scheme: light;
  --ink: #5b4335;
  --muted: #8a7667;
  --paper: #fff8ea;
  --cream: #f8ecd7;
  --green: #b98b55;
  --green-dark: #785337;
  --coral: #d9926d;
  --gold: #efd28e;
  --line: #e5d4b9;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; width: 100%; height: 100%; overflow: hidden; background: #f4ead8; color: var(--ink); }
body { overscroll-behavior: none; }
button { font: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid #b56f53; outline-offset: 3px; }
[hidden] { display: none !important; }

.app {
  position: relative;
  isolation: isolate;
  width: min(100vw, 540px, 56.25dvh);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #f6e9c7;
  box-shadow: 0 0 54px #76512b20;
}

.illustration { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; }
.motion-sprite { position: absolute; z-index: 1; display: block; pointer-events: none; height: auto; }
.car-sprite { width: 28%; left: 57%; top: 46%; }
.car-sprite.is-rolling { animation: car-roll .82s ease-in forwards; }
.plane-sprite { width: 26%; left: 52%; top: 35%; }
.plane-sprite.is-gliding { animation: plane-glide .88s ease-out forwards; }
.plane-sprite.is-landing { animation: plane-land .72s ease-in forwards; }
.rocket-sprite { width: 100%; height: 100%; left: 0; top: 0; object-fit: contain; transform: translate(28%, 22%); }
.rocket-sprite.is-launching { animation: rocket-launch 1s ease-in forwards; }
.illustration.is-entering { animation: scene-in .55s ease both; }
.illustration.is-quick { animation: quick-cut .13s ease-out both; }
.illustration.is-crouching, .illustration.is-lifting, .illustration.is-landing,
.illustration.is-tossing, .illustration.is-rocket-lifting { animation: none; }
.caption-layer, .question-bubble { position: absolute; z-index: 3; left: 6%; right: 6%; bottom: calc(16% + env(safe-area-inset-bottom)); min-height: 58px; display: grid; place-items: center; padding: 10px 12px; border: 1px solid #fffaf0bd; border-radius: 18px; color: #563d30; background: #fff9e8dc; box-shadow: 0 7px 25px #4d36251f; backdrop-filter: blur(7px); text-align: center; }
.caption-layer p { margin: 0; font-size: 17px; line-height: 1.4; font-weight: 650; }
.question-bubble { left: 11%; right: 11%; bottom: calc(19% + env(safe-area-inset-bottom)); min-height: 74px; font-size: clamp(19px, 5.2vw, 24px); font-weight: 700; line-height: 1.4; cursor: pointer; animation: bubble-in .32s ease-out both; }
.question-bubble::after { content: ''; position: absolute; top: -10px; left: 47%; width: 17px; height: 17px; transform: rotate(45deg); background: #fff9e8e8; border-top: 1px solid #fffaf0bd; border-left: 1px solid #fffaf0bd; }
.tap-hotspot { position: absolute; z-index: 2; left: 15%; top: 30%; width: 70%; height: 47%; border: 0; border-radius: 45%; background: transparent; cursor: pointer; }
.tap-ring { position: absolute; left: 50%; top: 52%; width: 74px; height: 74px; border: 2px solid #fff9e8bd; border-radius: 50%; transform: translate(-50%, -50%); background: #fff8dc1c; box-shadow: 0 0 0 8px #fff8dc26; animation: tap-breathe 2s ease-in-out infinite; }
.compare-board { position: absolute; z-index: 1; inset: 14% 5% 29%; display: grid; gap: 9px; padding: 10px; border: 1px solid #fff9e8c7; border-radius: 22px; background: #fff8e8e5; box-shadow: 0 10px 32px #5b3e2d3b; }
.compare-board[data-count="1"] { grid-template-columns: 1fr; }
.compare-board[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compare-board[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compare-board[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.compare-board img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover; object-position: center; border-radius: 13px; }
.top-controls {
  position: absolute;
  z-index: 3;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.mom-cue { position: absolute; z-index: 3; top: calc(57px + env(safe-area-inset-top)); left: 10px; right: 10px; width: fit-content; max-width: calc(100% - 20px); margin: 0; padding: 5px 9px; border-radius: 10px; color: #5a5048; background: #fff9e8bb; box-shadow: 0 2px 9px #4d362511; font-size: 12px; line-height: 1.35; opacity: .9; transition: opacity .2s ease; }
.app[data-animating="true"] .mom-cue { opacity: 0; }
.question-mark { position: absolute; z-index: 2; top: 18%; left: auto; right: 3%; color: #d96650; font-family: "Microsoft YaHei", sans-serif; font-size: clamp(68px, 18vw, 90px); line-height: 1; font-weight: 900; text-shadow: 0 3px 0 #fff4d5, 0 5px 12px #7d46364d; animation: question-pop .58s cubic-bezier(.2,1.3,.5,1) both, question-breathe 4.5s ease-in-out .58s infinite; pointer-events: none; }
.reflection-button { position: absolute; z-index: 3; left: 50%; bottom: calc(8% + env(safe-area-inset-bottom)); width: 78px; height: 78px; padding: 0; transform: translateX(-50%); overflow: hidden; border: 4px solid #fffdf8; outline: 3px solid #fffdf8; border-radius: 50%; background: #fffdf6; box-shadow: 0 3px 12px #4d362526; cursor: pointer; animation: reflection-breathe 3.8s ease-in-out infinite; }
.reflection-button img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 34%; }
.reflection-button:disabled { opacity: .72; animation: none; cursor: default; }
.icon-button, .parent-access {
  display: grid;
  min-width: 40px;
  min-height: 40px;
  place-items: center;
  border: 1px solid #a882594d;
  border-radius: 50%;
  color: #785337;
  background: #fff8e9dc;
  box-shadow: 0 2px 7px #76512b20;
  cursor: pointer;
}
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.parent-access { min-width: 46px; border-radius: 999px; font-size: 12px; color: #785337; opacity: .92; }
.icon-button:active, .parent-access:active { transform: scale(.96); }
.icon-button.is-muted { opacity: .55; }

.start-target {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: calc(34px + env(safe-area-inset-bottom));
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  transform: translateX(-50%);
  border: 1px solid #fbf7e9;
  border-radius: 50%;
  color: #815837;
  background: #fff3d7;
  box-shadow: 0 5px 0 #d7b47d, 0 11px 23px #76512b33;
  cursor: pointer;
  animation: breathe 2.7s ease-in-out infinite;
}
.start-target svg { width: 34px; height: 34px; margin-left: 3px; }
.app[data-mode="locked"] .start-target { display: grid; }
.app:not([data-mode="locked"]) .start-target { display: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.parent-panel {
  position: absolute;
  z-index: 5;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 10px;
  max-height: min(92svh, 710px);
  overflow: auto;
  padding: 6px 12px max(10px, env(safe-area-inset-bottom));
  border: 1px solid #e9d9bd;
  border-radius: 22px;
  background: #fff9ee;
  box-shadow: 0 14px 42px #5b3e2d42;
  overscroll-behavior: contain;
}
.panel-grip { width: 36px; height: 4px; margin: 1px auto 6px; border-radius: 9px; background: #c7c9bc; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; }
.panel-eyebrow { margin: 0 0 1px; color: var(--muted); font-size: 12px; }
.panel-heading h1 { margin: 0; color: #664832; font-size: 20px; line-height: 1.25; }
.current-experiment { margin: 4px 0 5px; color: #664832; font-size: 16px; font-weight: 750; }
.parent-tip { margin: 0 0 10px; padding: 7px 10px; border-radius: 10px; color: #655a4b; background: #f5ecd9; font-size: 13px; line-height: 1.4; }
.experiment-picker { margin: 5px 0 8px; }
.experiment-picker h2 { margin: 0 0 5px; font-size: 14px; }
.experiment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.experiment-grid button { min-height: 78px; overflow: hidden; border: 1px solid #dcc7a8; border-radius: 12px; padding: 0; color: #5a4234; background: #fff8eb; text-align: left; cursor: pointer; }
.experiment-grid img { display: block; width: 100%; height: 53px; object-fit: cover; object-position: center 58%; }
.experiment-grid button[data-experiment="jump"] img { object-position: center 58%; }
.experiment-grid button[data-experiment="ball"] img { object-position: center 52%; }
.experiment-grid button[data-experiment="car"] img { object-position: center 54%; transform: scale(1.28); transform-origin: 77% 54%; }
.experiment-grid button[data-experiment="plane"] img { object-position: center 36%; }
.experiment-grid span { display: block; padding: 2px 8px 3px; font-size: 13px; font-weight: 700; }
.experiment-grid button[aria-current="true"] { border-color: #ad7a50; box-shadow: inset 0 0 0 2px #d8ac75; }
.panel-close { width: 36px; height: 36px; border: 0; border-radius: 50%; color: #66756e; background: #eeece2; font-size: 23px; line-height: 1; cursor: pointer; }
.stage-note { margin: 12px 0 14px; color: #5e716a; font-size: 14px; line-height: 1.55; }
.parent-actions, .prompt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.parent-actions button, .prompt-actions button { min-height: 39px; border-radius: 11px; font-size: 13px; font-weight: 650; cursor: pointer; }
.primary-action { grid-column: 1 / -1; border: 1px solid #9b7048; color: #fffdf6; background: #9b7048; }
.parent-actions #reviewButton { grid-column: 1 / -1; }
.secondary-action { border: 1px solid #d8d2c0; color: #536760; background: #f5f1e5; }
.stop-action { border: 1px solid #e0cfc3; color: #895b4e; background: #f8eee8; }
.panel-actions button:disabled, .parent-actions button:disabled { opacity: .48; cursor: wait; }
.prompt-actions { margin: 0 0 9px; }
.parent-actions #chooseButton { display: none !important; }
.more-tips { margin: 8px 2px 0; color: #7c6d60; font-size: 12px; }
.more-tips summary { cursor: pointer; }
.more-tips p { margin: 6px 0 0; line-height: 1.5; }
.more-tips .gravity-tip { margin-top: 6px; padding: 6px; width: 100%; }
.panel-footnote { margin: 13px 0 0; color: #859087; font-size: 11px; line-height: 1.45; }

@keyframes scene-in { from { opacity: .35; } to { opacity: 1; } }
@keyframes question-pop { 0% { opacity: 0; transform: scale(.65) rotate(-8deg); } 70% { opacity: 1; transform: scale(1.1) rotate(2deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes question-breathe { 50% { transform: scale(1.045) rotate(1deg); } }
@keyframes reflection-breathe { 50% { box-shadow: 0 4px 16px #4d362533; } }
@keyframes car-roll { from { left: 57%; top: 46%; transform: scale(.86) rotate(0); } to { left: 73%; top: 69%; transform: scale(1.02) rotate(11deg); } }
@keyframes plane-glide { from { left: 52%; top: 35%; transform: rotate(-7deg); } to { left: 70%; top: 18%; transform: rotate(4deg); } }
@keyframes plane-land { from { left: 70%; top: 18%; transform: rotate(4deg); } to { left: 73%; top: 70%; transform: rotate(28deg); } }
@keyframes rocket-launch { from { transform: translate(28%, 22%) scale(.85); } to { transform: translate(28%, -31%) scale(.73); } }
@keyframes quick-cut { from { opacity: .78; } to { opacity: 1; } }
@keyframes tap-breathe { 50% { transform: translate(-50%, -50%) scale(1.13); box-shadow: 0 0 0 15px #fff8dc15; } }
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes breathe { 50% { box-shadow: 0 5px 0 #d7b47d, 0 11px 25px #76512b45; } }

@media (max-height: 680px) {
  .start-target { bottom: calc(20px + env(safe-area-inset-bottom)); width: 58px; height: 58px; }
  .caption-layer { bottom: calc(12% + env(safe-area-inset-bottom)); }
  .caption-layer p { font-size: 16px; }
  .question-bubble { bottom: calc(15% + env(safe-area-inset-bottom)); }
  .compare-board { inset: 11% 5% 29%; }
  .parent-panel { max-height: 94svh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
