/* Pip, big buttons, dialogs and calm mode. The home page and every game use these. */
.pip, .big-btn, .round-btn { margin: 0; border: 0; padding: 0; background: none; color: var(--ink); font-family: var(--font); cursor: pointer; touch-action: manipulation; }

/* ---------- Top buttons ---------- */
.round-btn {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cream); box-shadow: 0 6px 0 rgb(43 34 51 / .3); transition: transform .1s, box-shadow .1s;
}
.round-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgb(43 34 51 / .3); }
.icon { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon .solid { fill: currentColor; stroke-width: 2; }
.home-btn, .sound-btn { position: absolute; z-index: 12; top: max(16px, env(safe-area-inset-top)); }
.home-btn { left: max(20px, env(safe-area-inset-left)); }
.sound-btn { right: max(20px, env(safe-area-inset-right)); }
.big-btn {
  min-height: 68px; padding: 10px 28px; border-radius: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--accent); color: #fff; font-size: 24px; font-weight: 700; box-shadow: 0 7px 0 #43188f; transition: transform .1s, box-shadow .1s;
}
.big-btn.plain { background: var(--cream); color: var(--ink); box-shadow: 0 7px 0 rgb(43 34 51 / .3); }
.big-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 rgb(43 34 51 / .3); }
.big-btn .icon { width: 36px; height: 36px; }

/* ---------- Pip ---------- */
.pip { display: block; width: 100%; border-radius: 45%; }
.pip-svg { display: block; width: 100%; overflow: visible; }
.pip-body { transform-box: fill-box; transform-origin: 50% 100%; animation: pip-breathe 3.2s ease-in-out infinite; }
.pip-look { transition: transform .25s ease-out; }
.pip-eyes { transform-box: fill-box; transform-origin: center; animation: pip-blink 4.6s infinite; }
.pip .arms, .pip .mouth, .pip-lids, .pip-glow { opacity: 0; }
.pip .arms-rest, .pip .mouth-happy { opacity: 1; }
.pip[data-mood="cheer"] :is(.arms-rest, .mouth-happy), .pip[data-mood="point"] .arms-rest,
.pip[data-mood="wonder"] .mouth-happy, .pip[data-mood="oops"] :is(.arms-rest, .mouth-happy),
.pip[data-mood="sleepy"] .arms-rest { opacity: 0; }
.pip[data-mood="cheer"] :is(.arms-up, .mouth-cheer), .pip[data-mood="point"] .arms-point,
.pip[data-mood="wonder"] .mouth-o, .pip[data-mood="oops"] :is(.arms-down, .mouth-o),
.pip[data-mood="sleepy"] :is(.arms-down, .pip-lids) { opacity: 1; }
.pip[data-mood="cheer"] .pip-glow { opacity: .75; }
.pip[data-mood="cheer"] .pip-body { animation: pip-hop .5s ease-out 2; }
.pip[data-mood="point"] .pip-body { animation: pip-lean .4s ease-out forwards; }
.pip[data-mood="oops"] .pip-body { animation: pip-tilt .6s ease-in-out; }
.pip[data-mood="wonder"] .pip-body { animation: pip-tilt .7s ease-in-out; }
.pip[data-mood="sleepy"] .pip-body { animation: pip-breathe 5s ease-in-out infinite; }
.pip[data-mood="sleepy"] .pip-eyes { animation: none; }
@keyframes pip-breathe { 50% { transform: scale(1.025, .975); } }
@keyframes pip-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes pip-hop { 0%, 100% { transform: scale(1.05, .93); } 45% { transform: translateY(-13px) scale(.97, 1.05); } }
@keyframes pip-lean { to { transform: rotate(4deg); } }
@keyframes pip-tilt { 50% { transform: rotate(-7deg); } }

/* ---------- Dialogs ---------- */
dialog { border: 0; border-radius: 36px; padding: 28px; color: var(--ink); background: var(--butter); max-width: min(92vw, 520px); max-height: 92vh; overflow: auto; box-shadow: 0 12px 0 rgb(43 34 51 / .35); -webkit-user-select: none; user-select: none; font-family: var(--font); }
dialog::backdrop { background: rgb(43 34 51 / .55); }
dialog.leave[open] { display: grid; justify-items: stretch; gap: 20px; }
.leave-pip { width: 130px; justify-self: center; }
dialog.grown { background: var(--cream); font-size: 18px; line-height: 1.45; }
dialog.grown h2 { font-size: 28px; margin: 0 0 16px; }
dialog.grown p { margin: 0 0 14px; font-size: 17px; text-wrap: pretty; }
dialog.grown .field { display: block; font-weight: 700; margin-bottom: 6px; }
dialog.grown input:not([type]) { width: 100%; height: 52px; padding: 0 16px; border: 3px solid #7d6f86; border-radius: 16px; background: #fff; color: var(--ink); font: inherit; font-size: 20px; -webkit-user-select: text; user-select: text; }
dialog.ages[open] { display: grid; justify-items: center; gap: 18px; padding: 24px clamp(22px, 4vw, 44px) 40px; }
.ages-pip { width: 120px; }
dialog.ages h2 { margin: 0; font-size: clamp(28px, 5vw, 40px); line-height: 1.2; text-align: center; }
.ages-row { display: flex; gap: clamp(14px, 3vw, 32px); }
.age-btn { width: min(24vw, 120px); aspect-ratio: 1; border: 0; padding: 0; border-radius: 50%; background: var(--gold); color: var(--ink); font-family: var(--font); font-size: clamp(44px, 9vw, 64px); font-weight: 700; line-height: 1; cursor: pointer; box-shadow: 0 8px 0 var(--gold-edge); transition: transform .1s, box-shadow .1s; }
.age-btn:nth-child(2) { background: #7fe3d0; box-shadow: 0 8px 0 #0f857b; }
.age-btn:nth-child(3) { background: #ffb3c2; box-shadow: 0 8px 0 var(--coral-deep); }
.age-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 rgb(43 34 51 / .4); }
.age-btn[aria-pressed="true"] { outline: 6px solid var(--accent); outline-offset: 4px; }
.age-chip { min-height: 52px; padding: 6px 22px; border: 0; border-radius: 26px; background: var(--cream); color: var(--ink); font-family: var(--font); font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: 0 5px 0 rgb(43 34 51 / .3); transition: transform .1s, box-shadow .1s; }
.age-chip:active { transform: translateY(4px); box-shadow: 0 1px 0 rgb(43 34 51 / .3); }

dialog.grown h2:focus { outline: 0; box-shadow: none; }
dialog.grown h3 { margin: 18px 0 4px; font-size: 20px; }
dialog.grown ol { margin: 0 0 14px; padding-left: 24px; font-size: 17px; }
dialog.grown li + li { margin-top: 8px; }
dialog.turn-me { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; border-radius: 0; box-shadow: none; background: var(--butter); outline: 0; }
dialog.turn-me[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; text-align: center; }
.turn-pip { width: min(34vw, 260px); }
.turn-art { width: min(40vw, 300px); animation: turn-hint 3s ease-in-out infinite; }
@keyframes turn-hint { 0%, 20% { transform: rotate(-90deg); } 60%, 100% { transform: none; } }
dialog.turn-me h2 { margin: 0; font-size: 52px; line-height: 1.15; outline: 0; box-shadow: none; }
dialog.turn-me p { margin: 0; max-width: 420px; font-size: 18px; line-height: 1.45; text-wrap: balance; }

@media (max-height: 500px) {
  .ages-pip { display: none; }
  .leave-pip { width: 90px; }
}

.checks { margin: 14px 0; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; }
.check input { width: 26px; height: 26px; margin: 0; accent-color: var(--accent); flex: none; }
dialog.grown { padding-bottom: 0; }
/* Done stays in view while the rest scrolls. */
dialog.grown .big-btn { position: sticky; bottom: 20px; width: 100%; min-height: 60px; margin: 6px 0 20px; padding: 10px 28px; background: var(--accent); color: #fff; box-shadow: 0 7px 0 #43188f, 0 0 0 14px var(--cream), 0 24px 0 14px var(--cream); }

/* ---------- Calm mode: by choice, or when the device asks for less motion ---------- */
.calm *, .calm *::before, .calm *::after { animation: none !important; transition-duration: .01ms !important; }
