* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #fbe3dc;
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
}

#stage .tap { cursor: pointer; }

.fx {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.boil {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: boil 0.5s steps(1) infinite;
}

.boil.slow { animation-duration: 0.8s; }

@keyframes boil {
  0%   { transform: rotate(-0.7deg) translateY(0); }
  33%  { transform: rotate(0.5deg) translateY(-2px); }
  66%  { transform: rotate(-0.2deg) translateY(-1px) scaleY(1.01); }
}

.bob {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-14px) rotate(2deg); }
}

.flicker {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: flicker 0.3s steps(1) infinite;
}

@keyframes flicker {
  0%  { transform: scale(1, 1) rotate(-3deg); }
  50% { transform: scale(0.9, 1.12) rotate(3deg); }
}

.pulse-mark {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* 家长入口：左上角长按 */
#parent-gate {
  position: fixed;
  left: 0;
  top: 0;
  width: 110px;
  height: 110px;
  z-index: 10;
}

#parent-gate .gate-ring {
  position: absolute;
  left: 20px;
  top: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 5px solid rgba(232, 66, 63, 0.7);
  opacity: 0;
  transform: scale(0.3);
  transition: none;
}

#parent-gate.holding .gate-ring {
  opacity: 1;
  transform: scale(1);
  transition: transform 3s linear, opacity 0.3s;
}

#parent-menu {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(60, 30, 30, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-user-select: auto;
  user-select: auto;
  touch-action: auto;
}

#parent-menu[hidden] { display: none; }

#parent-menu .panel {
  width: min(520px, 92vw);
  max-height: 92vh;
  overflow: auto;
  background: #fffaf5;
  border-radius: 24px;
  padding: 24px 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  color: #3a2a2a;
}

#parent-menu h2 { margin: 0 0 16px; font-size: 22px; }

#parent-menu label {
  display: block;
  margin: 12px 0;
  font-size: 15px;
  font-weight: 600;
}

#parent-menu .row { display: flex; gap: 8px; margin-top: 6px; }

#parent-menu input[type="text"],
#parent-menu select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font-size: 16px;
  border: 2px solid #efd6cf;
  border-radius: 12px;
  background: #fff;
}

#parent-menu .row input { margin-top: 0; flex: 1; }

#parent-menu input[type="range"] { width: 100%; margin-top: 8px; }

#parent-menu fieldset {
  border: 2px solid #efd6cf;
  border-radius: 12px;
  padding: 8px 14px;
  margin: 14px 0;
}

#parent-menu legend { font-weight: 600; font-size: 15px; padding: 0 6px; }

#parent-menu label.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 16px 6px 0;
  font-weight: 500;
}

#parent-menu button {
  padding: 10px 18px;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  background: #e8423f;
  color: #fff;
  font-weight: 600;
}

#parent-menu button.secondary { background: #efd6cf; color: #3a2a2a; }

#parent-menu .actions { display: flex; gap: 10px; margin-top: 18px; }

#parent-menu .tip { font-size: 13px; color: #8a7070; margin: 14px 0 0; }

#rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #fbe3dc;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6b4a4a;
  font-size: 20px;
}

@media (orientation: portrait) and (pointer: coarse) {
  #rotate-hint { display: flex; }
}
