:root {
  --bg: #FBF6EE;
  --ink: #1F2430;
  --muted: #6B6F7B;
  --card: #FFFFFF;
  --line: #EADFCF;
  --accent: #E8743B;
  --adv: #2F6FDB;
  --dis: #E3A21A;
  --sur: #7A4FD6;
  --radius: 28px;
  --shadow: 0 10px 30px rgba(31, 36, 48, 0.08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font-family: 'Nunito', system-ui, sans-serif; font-weight: 700; overscroll-behavior: none; user-select: none; }
h1, h2, .brand { font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 600; margin: 0; }
h1 { font-size: clamp(28px, 5vw, 44px); text-align: center; }
h2 { font-size: clamp(22px, 4vw, 32px); text-align: center; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

.screen { display: none; min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 20px 32px; flex-direction: column; align-items: center; justify-content: center; gap: 28px; position: relative; }
.screen.on { display: flex; }
.brand { font-size: 26px; letter-spacing: 0.5px; }
.brand span { color: var(--accent); margin-left: 6px; }
.lead { font-size: 20px; color: var(--muted); text-align: center; max-width: 520px; margin: 0; }
.muted { color: var(--muted); text-align: center; font-size: 18px; margin: 0; }
.big { font-size: 64px; line-height: 1; }

.back { position: absolute; top: max(18px, env(safe-area-inset-top)); left: 18px; width: 56px; height: 56px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); font-size: 26px; }
.corner-link { position: absolute; bottom: 20px; right: 22px; color: var(--muted); font-size: 15px; text-decoration: none; }

/* Who's playing */
.kids { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.kid { width: min(300px, 42vw); aspect-ratio: 1; border-radius: 40px; background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; border: 6px solid transparent; transition: transform .15s; }
.kid:active { transform: scale(.96); }
.kid .face { width: 55%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: clamp(48px, 9vw, 90px); }
.kid b { font-family: 'Fredoka'; font-size: clamp(22px, 3.5vw, 32px); font-weight: 600; }

/* Home choices */
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; width: min(920px, 100%); }
.choice { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; border-bottom: 8px solid; transition: transform .15s; }
.choice:active { transform: scale(.96); }
.choice b { font-family: 'Fredoka'; font-size: 28px; font-weight: 600; }
.choice small { color: var(--muted); font-size: 16px; }
.c-adv { border-color: var(--adv); } .c-dis { border-color: var(--dis); } .c-sur { border-color: var(--sur); }
@media (max-width: 640px) { .choices { grid-template-columns: 1fr; } .choice { flex-direction: row; justify-content: flex-start; padding: 20px; } .choice .big { font-size: 44px; } .choice small { display: none; } }

/* Missions */
.missions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; width: min(920px, 100%); }
.mission { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; font-family: 'Fredoka'; font-size: 22px; font-weight: 600; transition: transform .15s; }
.mission:active { transform: scale(.96); }
.mission .big { font-size: 54px; }

/* Call */
#call { justify-content: space-between; }
.call-top { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.timer { color: var(--muted); font-size: 16px; min-width: 60px; }
.stop { background: var(--card); box-shadow: var(--shadow); border-radius: 999px; padding: 12px 22px; font-size: 17px; }
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; width: 100%; }
.status { font-size: 22px; color: var(--muted); margin: 0; min-height: 30px; text-align: center; }

.orb { --c: var(--accent); width: min(300px, 60vw); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%); transition: transform .3s; }
.orb-core { width: 62%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 55%, white), var(--c)); box-shadow: 0 18px 50px color-mix(in srgb, var(--c) 45%, transparent); transition: transform .25s; }
.orb[data-state="connecting"] .orb-core { animation: pulse 1.2s ease-in-out infinite; opacity: .6; }
.orb[data-state="listening"] .orb-core { animation: breathe 3s ease-in-out infinite; }
.orb[data-state="speaking"] .orb-core { animation: talk .45s ease-in-out infinite alternate; }
.orb[data-state="paused"] .orb-core { filter: grayscale(.6); opacity: .5; }
@keyframes breathe { 50% { transform: scale(1.06); } }
@keyframes talk { from { transform: scale(1); } to { transform: scale(1.14); } }
@keyframes pulse { 50% { transform: scale(.9); } }

.picture { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 30px; text-align: center; animation: pop .3s ease-out; max-width: 90vw; }
.pic-emoji { font-size: clamp(48px, 10vw, 84px); letter-spacing: 6px; }
.pic-caption { font-family: 'Fredoka'; font-size: 24px; margin-top: 8px; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }

.overlay { position: fixed; inset: 0; background: rgba(251, 246, 238, .94); display: grid; place-items: center; padding: 20px; z-index: 5; }
.overlay[hidden] { display: none; }
.card { background: var(--card); border-radius: 36px; box-shadow: var(--shadow); padding: 34px 28px; width: min(520px, 100%); display: flex; flex-direction: column; align-items: center; gap: 18px; }

.primary { background: var(--accent); color: #fff; border-radius: 999px; padding: 18px 40px; font-family: 'Fredoka'; font-size: 24px; font-weight: 600; box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 40%, transparent); }
.primary:active { transform: scale(.97); }
.huge { font-size: 34px; padding: 26px 56px; }
.link { color: var(--muted); text-decoration: underline; font-size: 16px; }

/* PIN pad */
.pinpad { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pin-dots { display: flex; gap: 12px; height: 18px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots i.f { background: var(--ink); }
.pin-keys { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; }
.pin-keys button { height: 64px; border-radius: 20px; background: var(--bg); font-size: 26px; }
.pin-keys button:active { background: var(--line); }
.pin-err { color: #C2412D; font-size: 15px; min-height: 18px; margin: 0; }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
