:root {
  --bg: #fff4e0;
  --ink: #2b2d42;
  --radius: 32px;
  --shadow: 0 8px 0 rgba(0, 0, 0, 0.15);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#app {
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
           max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  position: relative;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0; text-align: center; }

/* ---------- Big kid buttons ---------- */
.big-btn {
  --c: #ffb627;
  min-width: 96px;
  min-height: 96px;
  padding: 20px 28px;
  border-radius: var(--radius);
  background: var(--c);
  color: #fff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}
.big-btn:active { transform: translateY(6px) scale(0.98); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); }
.big-btn .emoji { font-size: clamp(3.5rem, 10vmin, 6.5rem); line-height: 1; text-shadow: none; }
.big-btn .label { font-size: clamp(1.4rem, 3.5vmin, 2rem); font-weight: 800; }
.big-btn.small .emoji { font-size: clamp(2.5rem, 7vmin, 4rem); }
.big-btn.small { min-width: 160px; }

.home-btn {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #fff;
  font-size: 3rem;
  box-shadow: var(--shadow);
  z-index: 5;
}
.home-btn:active { transform: translateY(4px); }

/* ---------- Home ---------- */
.hello-btn {
  min-height: 96px;
  background: none;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 900;
  padding: 12px 24px;
  border-radius: var(--radius);
}
.energy-row, .extra-row, .menu-grid {
  display: grid;
  gap: 24px;
  width: min(100%, 1000px);
}
.energy-row { grid-template-columns: repeat(3, 1fr); }
.energy-row .big-btn { aspect-ratio: 1; }
.extra-row { grid-template-columns: repeat(2, 1fr); }
.menu-grid { grid-template-columns: repeat(2, 1fr); }
.menu-grid .big-btn { aspect-ratio: 4 / 3; }
@media (max-width: 700px) and (orientation: portrait) {
  .energy-row { grid-template-columns: 1fr; }
  .energy-row .big-btn { aspect-ratio: auto; }
}

.parent-gate {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  font-size: 1.8rem;
  overflow: hidden;
  opacity: 0.6;
}
.parent-gate span { position: relative; z-index: 1; }
.parent-gate::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #ffb627;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.2s ease;
}
.parent-gate.holding { opacity: 1; }
.parent-gate.holding::before { transform: scaleY(1); transition: transform 3s linear; }

/* ---------- Spinner ---------- */
.spin-screen { display: flex; flex-direction: column; align-items: center; gap: 24px; width: 100%; }
@media (orientation: landscape) {
  .spin-screen { flex-direction: row; justify-content: center; gap: 48px; }
}
.wheel-wrap {
  --size: min(70vmin, 560px);
  position: relative;
  width: var(--size);
  height: var(--size);
}
.pointer {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3rem;
  color: var(--ink);
  z-index: 2;
}
.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 10px solid #fff;
  box-shadow: var(--shadow), inset 0 0 0 6px var(--c);
  position: relative;
}
.slice {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: calc(var(--size) * 0.13);
  line-height: 1;
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(var(--size) * -0.32));
}
.spin-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: #fff;
  font-size: calc(var(--size) * 0.12);
  box-shadow: 0 0 0 8px var(--c), var(--shadow);
  z-index: 3;
}
.spin-btn:active { transform: translate(-50%, -50%) scale(0.94); }
.result { min-height: 120px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.winner { display: flex; flex-direction: column; align-items: center; animation: pop 0.4s ease; }
.winner .emoji { font-size: 6rem; }
.winner .title { font-size: 2.4rem; font-weight: 900; text-align: center; }
.result-actions { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }

/* ---------- Activity card ---------- */
.card-screen { width: min(100%, 900px); }
.face {
  background: #fff;
  border-radius: 48px;
  border: 10px solid var(--c);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow);
  animation: flip-in 0.35s ease;
}
.giant-emoji { background: none; font-size: clamp(7rem, 22vmin, 12rem); line-height: 1; }
.timer-row { display: flex; gap: 16px; }
.timer-btn {
  min-width: 96px;
  min-height: 96px;
  border-radius: 24px;
  background: #f1f3f5;
  font-size: 2.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.timer-btn .dots { font-size: 1rem; color: var(--c); letter-spacing: 2px; }
.pie {
  width: min(40vmin, 280px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p, 1) * 360deg), #f1f3f5 0);
  box-shadow: inset 0 0 0 8px #fff, 0 0 0 6px var(--c);
}
.card-actions { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.dad { align-items: stretch; text-align: left; font-size: 1.25rem; line-height: 1.5; }
.dad h2 { margin: 0; font-size: 1.8rem; }
.dad p { margin: 0; }
.dad h2 small { font-size: 1rem; font-weight: 500; opacity: 0.7; }
.dad .big-btn { align-self: center; }
.howto { margin: 0; padding-left: 1.4em; }
.howto li { margin-bottom: 8px; }
.tip { margin: 0; padding: 14px 18px; border-radius: 18px; }
.harder { background: #fff0eb; }
.pride { background: #fff6e0; }

/* ---------- Messages / celebrate ---------- */
.message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  max-width: 700px;
}
.giant { font-size: clamp(7rem, 25vmin, 14rem); line-height: 1; }
.pop { animation: pop 0.6s cubic-bezier(.2, 1.6, .4, 1); }
.big-text { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 900; margin: 0; text-align: center; }
.message.dark {
  color: #fff;
  background: #1d1b33;
  padding: 48px;
  border-radius: 48px;
}

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.confetti span { position: absolute; top: -10%; animation: fall 2.8s ease-in forwards; }

/* ---------- Stickers ---------- */
.stickers-screen { width: min(100%, 1000px); display: flex; flex-direction: column; align-items: center; gap: 24px; }
.trophies { font-size: 3rem; }
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
  width: 100%;
}
.sticker {
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  font-size: 3.5rem;
  box-shadow: var(--shadow);
  border: 6px dashed #ffd166;
}

/* ---------- Hide & seek ---------- */
.menu-screen { width: min(100%, 900px); display: flex; flex-direction: column; align-items: center; gap: 28px; }
.count-screen { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.count-number {
  font-size: clamp(9rem, 35vmin, 20rem);
  font-weight: 900;
  line-height: 1;
  color: #7b6cf6;
}
.bump { animation: pop 0.35s ease; }

.hotcold-screen {
  --hue: 126;
  position: fixed;
  inset: 0;
  background: hsl(var(--hue) 85% 62%);
  transition: background 0.5s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.hc-face { font-size: clamp(10rem, 40vmin, 22rem); line-height: 1; }
.hc-hint { margin: 0; font-weight: 700; color: rgba(0, 0, 0, 0.5); }
.hc-buttons { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }

.torch {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 0;
}
.torch.warm { background: #ffe8a3; }

/* ---------- Parent corner (grown-up text sizes) ---------- */
.parent-screen {
  width: min(100%, 900px);
  font-size: 1.1rem;
  line-height: 1.5;
  padding-top: 90px;
  align-self: stretch;
  margin: 0 auto;
}
.parent-screen section {
  background: #fff;
  border-radius: 24px;
  padding: 20px 24px;
  margin: 20px 0;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.08);
}
.parent-screen h2 { margin: 0 0 12px; font-size: 1.4rem; }
.parent-screen h2 small { font-weight: 500; opacity: 0.7; font-size: 0.95rem; }
.parent-screen h3 { margin: 16px 0 8px; }
.parent-screen input[type="text"] {
  font: inherit;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 2px solid #dee2e6;
  user-select: text;
  -webkit-user-select: text;
}
.toggle { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.toggle input { width: 28px; height: 28px; }
.tips { margin: 0; padding-left: 1.2em; }
.tips li { margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  padding: 12px 16px;
  min-height: 48px;
  border-radius: 999px;
  background: #e9f7ef;
  border: 2px solid #06d6a0;
}
.chip.off { background: #f1f3f5; border-color: #ced4da; opacity: 0.55; text-decoration: line-through; }
.parent-screen .chip:not(.on)[data-action="own"] { background: #f1f3f5; border-color: #ced4da; }
.chip small { opacity: 0.7; }
.small-print { font-size: 0.95rem; opacity: 0.75; }

/* ---------- Motion ---------- */
@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes flip-in {
  from { transform: perspective(800px) rotateY(80deg); opacity: 0; }
  to { transform: perspective(800px) rotateY(0); opacity: 1; }
}
@keyframes fall {
  to { transform: translateY(115vh) rotate(540deg); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .parent-gate.holding::before { transition-duration: 3s !important; }
}
