/* =====================================================================
   Nehemiah & Nathania's Speech Adventure – styles
   Mobile-first, big touch targets, a colour theme per child
   ===================================================================== */

:root {
  --font: 'Fredoka', 'Nunito', 'Segoe UI Rounded', 'Comic Sans MS', system-ui, -apple-system, sans-serif;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.10), 0 10px 24px rgba(0, 0, 0, 0.10);
  --shadow-sm: 0 3px 0 rgba(0, 0, 0, 0.10);
  --text: #1f2937;
  --muted: #6b7280;
  --card: #ffffff;
  --ok: #22c55e;
  --bad: #f87171;
  --star: #fbbf24;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* guest / default theme */
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --accent: #14b8a6;
  --accent-2: #f59e0b;
  --bg-1: #ede9fe;
  --bg-2: #ccfbf1;
  --pattern: "✨";
}

/* A colour per child, picked by a parent (body.theme-<colour>) */
body.theme-blue { --primary: #2f6fed; --primary-dark: #1d4ed8; --accent: #22c55e; --accent-2: #f97316; --bg-1: #dbeafe; --bg-2: #dcfce7; --pattern: "🚀"; }
body.theme-pink { --primary: #ec4899; --primary-dark: #be185d; --accent: #f97316; --accent-2: #a855f7; --bg-1: #fce7f3; --bg-2: #ffedd5; --pattern: "🦋"; }
body.theme-green { --primary: #16a34a; --primary-dark: #15803d; --accent: #0ea5e9; --accent-2: #f59e0b; --bg-1: #dcfce7; --bg-2: #e0f2fe; --pattern: "🌱"; }
body.theme-orange { --primary: #ea580c; --primary-dark: #c2410c; --accent: #eab308; --accent-2: #2f6fed; --bg-1: #ffedd5; --bg-2: #fef9c3; --pattern: "🦊"; }
body.theme-teal { --primary: #0d9488; --primary-dark: #0f766e; --accent: #6366f1; --accent-2: #f97316; --bg-1: #ccfbf1; --bg-2: #e0e7ff; --pattern: "🐬"; }
body.theme-red { --primary: #dc2626; --primary-dark: #b91c1c; --accent: #f59e0b; --accent-2: #2f6fed; --bg-1: #fee2e2; --bg-2: #fef3c7; --pattern: "🏎️"; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------ top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + var(--safe-top)) 12px 8px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.topbar-logo { width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); flex: none; }
.topbar-logo[hidden] { display: none; }
.topbar .title {
  flex: 1;
  font-weight: 700;
  font-size: 1.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn, .avatar-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 1.4rem;
  display: grid; place-items: center;
}
.avatar-btn { font-size: 1.5rem; background: #fff; }
.star-chip {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 1rem;
}
.star-chip.bump { animation: bump 0.5s ease; }
@keyframes bump { 30% { transform: scale(1.3); } }

/* ------------------------------------------------------------ view */
.view {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 14px calc(90px + var(--safe-bottom));
}

/* ------------------------------------------------------- bottom nav */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  background: #fff;
  border-top: 2px solid rgba(0, 0, 0, 0.06);
  padding: 6px 4px calc(6px + var(--safe-bottom));
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08);
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 0;
  border-radius: 14px;
  min-height: 56px;
  justify-content: center;
}
.bottom-nav a .nav-emoji { font-size: 1.6rem; line-height: 1; }
.bottom-nav a.active { color: var(--primary); background: var(--bg-1); }

/* ------------------------------------------------------------ typography */
h1, h2, h3 { margin: 0 0 10px; line-height: 1.15; }
h1 { font-size: 1.7rem; font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
.subtitle { color: var(--muted); margin: 0 0 16px; font-size: 1rem; }
.section { margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.section h2 { margin: 0; flex: 1; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ----------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
  padding: 10px 20px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 5px 0 var(--primary-dark);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--primary); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.12); }
.btn.accent { background: var(--accent); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18); }
.btn.accent2 { background: var(--accent-2); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18); }
.btn.danger { background: var(--bad); box-shadow: 0 5px 0 #b91c1c; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 0.95rem; }
.btn.big { min-height: 64px; font-size: 1.3rem; padding: 12px 28px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 14px 0; }
.btn-row.left { justify-content: flex-start; }

.round-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: none;
  background: #fff;
  font-size: 1.8rem;
  box-shadow: var(--shadow-sm), 0 8px 18px rgba(0, 0, 0, 0.08);
  display: grid; place-items: center;
}
.round-btn.primary { background: var(--primary); color: #fff; }
.round-btn.rec { background: #ef4444; color: #fff; }
.round-btn.rec.on { animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0.25); } }
.round-btn:active { transform: scale(0.94); }
.round-label { font-size: 0.75rem; color: var(--muted); margin-top: 4px; text-align: center; font-weight: 600; }
.tool { display: flex; flex-direction: column; align-items: center; }

/* ------------------------------------------------------------- cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card { margin-top: 14px; }

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.grid.two { grid-template-columns: repeat(2, 1fr); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 420px) {
  .grid.three { grid-template-columns: repeat(2, 1fr); }
  .grid.four { grid-template-columns: repeat(3, 1fr); }
}

.tile {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 10px 12px;
  text-align: center;
  border: 3px solid transparent;
  text-decoration: none;
  color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 120px;
  transition: transform 0.1s ease, border-color 0.1s ease;
  cursor: pointer;
}
.tile:active { transform: scale(0.96); }
.tile .emoji { font-size: 3rem; line-height: 1.1; }
.tile .label { font-weight: 700; font-size: 1.05rem; }
.tile .sub { font-size: 0.8rem; color: var(--muted); }
.tile.selected { border-color: var(--primary); }
.tile.correct { border-color: var(--ok); background: #ecfdf5; animation: pop 0.4s ease; }
.tile.wrong { border-color: var(--bad); animation: shake 0.4s ease; }
.tile.done { opacity: 0.4; pointer-events: none; }
.tile.locked { opacity: 0.55; filter: grayscale(0.6); }
.tile .badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--accent-2); color: #fff;
  border-radius: 999px; padding: 2px 8px; font-size: 0.75rem; font-weight: 700;
}
.tile.colorful { color: #fff; }
.tile.colorful .sub { color: rgba(255,255,255,0.85); }

@keyframes pop { 40% { transform: scale(1.08); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* picture inside tiles / cards */
.pic {
  display: grid; place-items: center;
  width: 100%;
  aspect-ratio: 1;
  max-height: 180px;
  font-size: 4rem;
  line-height: 1;
}
.pic img, .pic svg { width: 100%; height: 100%; max-height: inherit; object-fit: contain; border-radius: var(--radius-sm); }
.pic.photo img { object-fit: cover; }
.pic .emoji { font-size: inherit; }
.tile .pic { font-size: 3.2rem; max-height: 110px; }
.tile .pic img { max-height: 110px; }
.pic.huge { font-size: clamp(5rem, 28vw, 11rem); max-height: 300px; }
.pic.huge img { max-height: 300px; }

.app-logo { display: block; width: min(220px, 55vw); margin: 8px auto 0; }

/* -------------------------------------------------------- hero / home */
.hero {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: var(--pattern);
  position: absolute; right: -10px; bottom: -18px;
  font-size: 7rem; opacity: 0.18; transform: rotate(-12deg);
}
.hero .big-emoji { font-size: 3.4rem; }
.hero h1 { font-size: 1.45rem; margin: 0 0 4px; }
.hero p { margin: 0; opacity: 0.92; font-size: 0.95rem; }
.hero .progress { margin-top: 8px; }

.progress { height: 12px; background: rgba(0, 0, 0, 0.12); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--star); border-radius: 99px; transition: width 0.4s ease; }

/* ----------------------------------------------------------- profile */
.profile-pick { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 10px; }
@media (min-width: 560px) { .profile-pick { grid-template-columns: 1fr 1fr 1fr; } }
.profile-card {
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  color: #fff;
  box-shadow: var(--shadow);
  border: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.profile-card h2 { color: #fff; margin: 0; }
.profile-card:active { transform: scale(0.97); }
.profile-avatar { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 5px solid #fff; background: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18); }
.profile-card.c-blue { background: linear-gradient(135deg, #2f6fed, #22c55e); }
.profile-card.c-pink { background: linear-gradient(135deg, #ec4899, #f97316); }
.profile-card.c-purple { background: linear-gradient(135deg, #7c3aed, #14b8a6); }
.profile-card.c-green { background: linear-gradient(135deg, #16a34a, #0ea5e9); }
.profile-card.c-orange { background: linear-gradient(135deg, #ea580c, #eab308); }
.profile-card.c-teal { background: linear-gradient(135deg, #0d9488, #6366f1); }
.profile-card.c-red { background: linear-gradient(135deg, #dc2626, #f59e0b); }
@media (min-width: 560px) and (max-width: 759px) { .profile-pick { grid-template-columns: 1fr 1fr; } }
.welcome-faces { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; }
.welcome-faces img { width: clamp(46px, 13vw, 72px); height: clamp(46px, 13vw, 72px); border-radius: 50%; border: 4px solid #fff; box-shadow: var(--shadow-sm); object-fit: cover; }
.welcome-faces img:nth-child(odd) { transform: translateY(8px) rotate(-4deg); }

.hero-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; background: #fff; flex: none; z-index: 1; }
.emoji-face { display: grid; place-items: center; font-size: 2.6rem; background: #fff; }
.avatar-btn { overflow: hidden; padding: 0; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

/* --------------------------------------------------------------- game */
.game-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.game-head .progress { flex: 1; height: 14px; }
.game-head .count { font-weight: 700; color: var(--muted); font-size: 0.95rem; }

.prompt {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  margin: 8px 0 14px;
}
.prompt .word { color: var(--primary); font-size: 1.8rem; }

.stage {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 14px;
  text-align: center;
  margin-bottom: 14px;
}
.stage .word-big {
  font-size: clamp(2rem, 9vw, 3.2rem);
  font-weight: 700;
  color: var(--primary);
  margin: 8px 0 2px;
  letter-spacing: 0.02em;
}
.stage .sentence { color: var(--muted); font-size: 1.1rem; margin: 4px 0 10px; }
.syllables { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.syl {
  background: var(--bg-1); color: var(--primary-dark);
  border-radius: 12px; padding: 6px 12px;
  font-weight: 700; font-size: 1.15rem;
  border: none; min-height: 44px;
}
.syl.hit { animation: pop 0.3s ease; background: var(--star); color: #78350f; }
.sound-pill {
  display: inline-block; background: var(--accent-2); color: #fff;
  border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 0.9rem; margin: 6px 0;
}

.tools { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin: 12px 0 4px; }
.heard { margin-top: 10px; min-height: 1.5em; font-size: 1.05rem; }
.heard b { color: var(--primary); }

.options { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.options.three { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 640px) { .options.six { grid-template-columns: repeat(3, 1fr); } }
.option {
  min-height: 64px;
  border-radius: var(--radius);
  border: 3px solid transparent;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 1.3rem; font-weight: 700;
  padding: 10px;
  color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.option .emoji { font-size: 3rem; }
.option:active { transform: scale(0.97); }
.option.correct { border-color: var(--ok); background: #ecfdf5; animation: pop 0.4s ease; }
.option.wrong { border-color: var(--bad); animation: shake 0.4s ease; opacity: 0.7; }
.option.dim { opacity: 0.35; }

/* spelling */
.slots { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.slot {
  width: 48px; height: 58px;
  border-radius: 12px;
  border: 3px dashed rgba(0, 0, 0, 0.15);
  display: grid; place-items: center;
  font-size: 1.7rem; font-weight: 700;
  background: #fff;
  text-transform: uppercase;
}
.slot.filled { border-style: solid; border-color: var(--primary); color: var(--primary); }
.slot.space { border: none; background: transparent; width: 18px; }
.slot.correct { border-color: var(--ok); background: #ecfdf5; }
.letters { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.letter {
  width: 54px; height: 60px;
  border-radius: 14px;
  border: none;
  background: var(--accent-2);
  color: #fff;
  font-size: 1.8rem; font-weight: 700;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
  text-transform: uppercase;
}
.letter:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.2); }
.letter.used { visibility: hidden; }
.letter.hint { animation: wiggle 0.6s ease infinite; }
@keyframes wiggle { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }

/* memory */
.memory { display: grid; gap: 10px; grid-template-columns: repeat(4, 1fr); }
.memory.cols3 { grid-template-columns: repeat(3, 1fr); }
.mcard {
  aspect-ratio: 1;
  perspective: 600px;
  border: none; background: transparent; padding: 0;
}
.mcard .inner {
  position: relative; width: 100%; height: 100%;
  transition: transform 0.4s;
  transform-style: preserve-3d;
}
.mcard.flipped .inner, .mcard.matched .inner { transform: rotateY(180deg); }
.mcard .face {
  position: absolute; inset: 0;
  border-radius: 16px;
  display: grid; place-items: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-size: clamp(1.8rem, 8vw, 3rem);
  box-shadow: var(--shadow-sm);
}
.mcard .front { background: var(--primary); color: #fff; font-size: 1.8rem; }
.mcard .back { background: #fff; transform: rotateY(180deg); border: 3px solid var(--bg-1); }
.mcard .back img { width: 80%; height: 80%; object-fit: contain; border-radius: 10px; }
.mcard.matched .back { border-color: var(--ok); background: #ecfdf5; }

/* counting */
.count-field {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  font-size: clamp(2.2rem, 10vw, 3.6rem);
  padding: 10px; min-height: 120px;
}
.count-field .emoji { transition: transform 0.15s; }
.count-field .emoji.tapped { transform: scale(0.8); opacity: 0.4; }
.number-big { font-size: 5rem; font-weight: 700; color: var(--primary); line-height: 1; }

/* sentence builder */
.sentence-strip {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px;
  font-size: 1.5rem; font-weight: 700; min-height: 64px; padding: 10px;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px;
}
.sentence-strip .blank {
  display: inline-grid; place-items: center;
  min-width: 90px; height: 50px; border-radius: 12px;
  border: 3px dashed rgba(0,0,0,0.15); color: var(--muted); font-size: 1rem;
}
.sentence-strip .blank.filled { border-style: solid; border-color: var(--primary); color: var(--primary); font-size: 1.4rem; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.chip {
  border: none; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow-sm), 0 6px 14px rgba(0,0,0,0.08);
  padding: 10px 16px; font-size: 1.2rem; font-weight: 700; min-height: 52px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip .emoji { font-size: 1.6rem; }
.chip.color-chip { color: #fff; }
.chip:active { transform: scale(0.96); }

/* ------------------------------------------------------------ results */
.result {
  text-align: center; padding: 20px 10px;
}
.result .trophy { font-size: 5rem; animation: bounce 1s ease infinite; }
@keyframes bounce { 50% { transform: translateY(-12px); } }
.result h2 { font-size: 1.6rem; }
.stars-earned { font-size: 2rem; letter-spacing: 4px; }

/* -------------------------------------------------------------- gifts */
.gift-box {
  width: 180px; height: 180px; margin: 10px auto;
  display: grid; place-items: center; font-size: 7rem;
  cursor: pointer;
  animation: wobble 1.2s ease infinite;
}
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg) scale(1.04); } 75% { transform: rotate(6deg) scale(1.04); } }
.gift-box.opened { animation: none; }
.gift-reveal { font-size: 7rem; animation: reveal 0.7s cubic-bezier(0.2, 1.5, 0.5, 1); }
@keyframes reveal { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.sticker {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-sm);
  font-size: 2.4rem; position: relative;
}
.sticker .n { position: absolute; bottom: 4px; right: 8px; font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.sticker .nm { font-size: 0.65rem; color: var(--muted); font-weight: 600; margin-top: 2px; text-align: center; }
.sticker.locked { background: rgba(255,255,255,0.5); filter: grayscale(1); opacity: 0.5; }
/* Sticker books: the same pictures in a new finish, book after book */
.st-badge { position: absolute; top: 4px; left: 6px; font-size: 0.85rem; line-height: 1; }
.sticker .st-pic { line-height: 1.1; }
.sticker.st-gold:not(.locked) { background: linear-gradient(145deg, #fff7c2, #fbbf24 55%, #f59e0b); box-shadow: 0 0 0 2px #f59e0b inset, var(--shadow-sm); }
.sticker.st-gold:not(.locked) .nm { color: #78350f; }
.sticker.st-rainbow:not(.locked) { background: linear-gradient(135deg, #fecaca, #fde68a, #bbf7d0, #bfdbfe, #e9d5ff); box-shadow: 0 0 0 2px #fff inset, var(--shadow-sm); }
.sticker.st-rainbow:not(.locked) .nm { color: #4c1d95; }
.sticker.st-sparkle:not(.locked) { background: radial-gradient(circle at 20% 20%, #fff 0 6%, transparent 7%), radial-gradient(circle at 80% 30%, #fff 0 4%, transparent 5%), radial-gradient(circle at 60% 85%, #fff 0 5%, transparent 6%), linear-gradient(145deg, #fbcfe8, #f472b6); }
.sticker.st-sparkle:not(.locked) .nm { color: #831843; }
.sticker.st-galaxy:not(.locked) { background: radial-gradient(circle at 25% 25%, #fff 0 2%, transparent 3%), radial-gradient(circle at 70% 20%, #fff 0 1.5%, transparent 2.5%), radial-gradient(circle at 80% 75%, #fff 0 2%, transparent 3%), radial-gradient(circle at 35% 80%, #fff 0 1.5%, transparent 2.5%), linear-gradient(145deg, #1e1b4b, #6d28d9); }
.sticker.st-galaxy:not(.locked) .nm { color: #ddd6fe; }
.sticker.st-frost:not(.locked) { background: linear-gradient(145deg, #f0f9ff, #bae6fd 60%, #7dd3fc); box-shadow: 0 0 0 2px #e0f2fe inset, var(--shadow-sm); }
.sticker.st-frost:not(.locked) .nm { color: #075985; }
.sticker.st-fire:not(.locked) { background: linear-gradient(0deg, #fde047, #fb923c 55%, #ef4444); }
.sticker.st-fire:not(.locked) .nm { color: #7f1d1d; }
.sticker.st-candy:not(.locked) { background: repeating-linear-gradient(135deg, #fff 0 10px, #fbcfe8 10px 20px); box-shadow: 0 0 0 2px #f9a8d4 inset, var(--shadow-sm); }
.sticker.st-candy:not(.locked) .nm { color: #9d174d; }
.sticker.st-jungle:not(.locked) { background: linear-gradient(145deg, #dcfce7, #4ade80 60%, #16a34a); }
.sticker.st-jungle:not(.locked) .nm { color: #14532d; }
.sticker.st-royal:not(.locked) { background: linear-gradient(145deg, #ede9fe, #a78bfa 55%, #7c3aed); box-shadow: 0 0 0 2px #fbbf24 inset, var(--shadow-sm); }
.sticker.st-royal:not(.locked) .nm { color: #2e1065; }
.sticker:not(.locked)[class*='st-'] .st-pic { filter: drop-shadow(0 2px 2px rgba(0,0,0,0.25)); }
.gift-reveal { position: relative; display: inline-block; }
.gift-reveal[class*='st-'] { filter: drop-shadow(0 0 14px #fbbf24); }
.gift-reveal .st-badge { top: -4px; left: auto; right: -14px; font-size: 2.2rem; }
.book-tabs { margin: 0 0 10px; }
.book-full { margin-top: 10px; padding: 10px 14px; border-radius: 16px; background: #fef3c7; color: #78350f; font-weight: 700; }

/* ------------------------------------------------------------ scenes */
.scene {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #bae6fd;
}
.scene svg, .scene img { width: 100%; height: 100%; display: block; object-fit: cover; }
/* Phones: the picture is the page – run it edge to edge. */
@media (max-width: 600px) {
  .scene { width: calc(100% + 28px); max-width: none; margin: -4px -14px 0; border-radius: 0 0 var(--radius) var(--radius); }
}
/* A finished painting cannot walk. The camera drifts across it, the way a picture book is read aloud. */
.scene-still { position: relative; }
.scene-still video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: transparent; }
.scene-still.has-clip img { animation: none; left: 0; top: 0; width: 100%; height: 100%; }
.scene-still img {
  position: absolute;
  left: -4%; top: -4%;
  width: 108%;
  height: 108%;
  max-width: none;
  object-fit: cover;
  animation: scene-fade 0.7s ease both, scene-pan 26s ease-in-out infinite alternate;
}
.scene-still.pan-1 img { animation-name: scene-fade, scene-pan-b; }
.scene-still.pan-2 img { animation-name: scene-fade, scene-pan-c; }
.scene-still.pan-3 img { animation-name: scene-fade, scene-pan-d; }
@keyframes scene-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes scene-pan { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.06) translate(-1.5%, -1%); } }
@keyframes scene-pan-b { from { transform: scale(1.05) translate(-1.5%, 0); } to { transform: scale(1) translate(1%, 0.5%); } }
@keyframes scene-pan-c { from { transform: scale(1.01) translate(0, 1%); } to { transform: scale(1.06) translate(0, -1.5%); } }
@keyframes scene-pan-d { from { transform: scale(1.04) translate(1.5%, 0.5%); } to { transform: scale(1.07) translate(-1%, -0.5%); } }
.scene-credit { margin: 8px 0 0; text-align: center; font-size: 0.75rem; color: var(--muted); }
.scene-credit a { color: inherit; }
.scene text { font-family: var(--font); }
.scene .emj { font-size: 36px; }
.caption {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; font-size: 1.25rem; line-height: 1.45; margin-top: 12px; text-align: center;
}
.caption .fill { display: inline-block; min-width: 70px; border-bottom: 3px dashed var(--primary); color: var(--primary); font-weight: 700; }
.story-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.dots { display: flex; gap: 6px; justify-content: center; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: rgba(0,0,0,0.15); }
.dots span.on { background: var(--primary); }

/* SVG animations (used via class on <g>) */
.scene .anim { transform-box: fill-box; transform-origin: center; }
.scene .bob { animation: s-bob 2.4s ease-in-out infinite; }
.scene .sway { animation: s-sway 3s ease-in-out infinite; }
.scene .float { animation: s-float 4s ease-in-out infinite; }
.scene .spin { animation: s-spin 6s linear infinite; }
.scene .pulse { animation: s-pulse 1.6s ease-in-out infinite; }
.scene .rain { animation: s-rain 1s linear infinite; }
.scene .snow { animation: s-snow 3.2s linear infinite; }
.scene .drift { animation: s-drift 9s ease-in-out infinite alternate; }
.scene .rock { animation: s-rock 3s ease-in-out infinite; }
.scene .flash { animation: s-flash 2.6s ease-in-out infinite; }
.scene .puff { animation: s-puff 1.2s ease-out infinite; }
.scene .tear { animation: s-tear 1.6s ease-in infinite; }
.scene .zzz { animation: s-zzz 2s ease-out infinite; }
.scene .blink { animation: s-blink 4.2s ease-in-out infinite; }

/* movement layer (outer group) – travels; --dx / --from / --to / --dur set inline */
.scene .mv-walk { animation: s-walk var(--dur, 5s) ease-in-out infinite; }
.scene .mv-run { animation: s-walk var(--dur, 2.6s) ease-in-out infinite; }
.scene .mv-drive, .scene .mv-swim { animation: s-walk var(--dur, 4.5s) ease-in-out infinite; }
.scene .mv-fly, .scene .mv-hover { animation: s-hover 6s ease-in-out infinite; }
/* body layer (inner) – what the actor does while it travels */
.scene .hop { animation: s-hop 0.55s ease-in-out infinite; }
.scene .hop-fast { animation: s-hop-fast 0.3s ease-in-out infinite; }
.scene .rattle { animation: s-rattle 0.22s linear infinite alternate; }
.scene .wiggle { animation: s-wiggle 0.9s ease-in-out infinite; }
.scene .flutter { animation: s-flutter 1s ease-in-out infinite; }
/* mouths move while the narrator is speaking */
.scene.talking .mouth { animation: s-talk 0.26s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }

@keyframes s-walk {
  0% { transform: translateX(0) scaleX(1); }
  46% { transform: translateX(var(--dx, 60px)) scaleX(1); }
  50% { transform: translateX(var(--dx, 60px)) scaleX(-1); }
  96% { transform: translateX(0) scaleX(-1); }
  100% { transform: translateX(0) scaleX(1); }
}
@keyframes s-cross { from { transform: translateX(var(--from, -300px)); } to { transform: translateX(var(--to, 300px)); } }
@keyframes s-hover {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(var(--dx, 40px), -14px); }
  50% { transform: translate(calc(var(--dx, 40px) * 1.6), 2px); }
  75% { transform: translate(var(--dx, 40px), 12px); }
}
@keyframes s-hop { 50% { transform: translateY(-5px) rotate(-3deg); } }
@keyframes s-hop-fast { 50% { transform: translateY(-8px) rotate(-6deg); } }
@keyframes s-rattle { to { transform: translateY(-1.6px); } }
@keyframes s-wiggle { 25% { transform: rotate(-5deg) translateY(-2px); } 75% { transform: rotate(5deg) translateY(2px); } }
@keyframes s-flutter { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes s-talk { to { transform: scaleY(0.35); } }
@keyframes s-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.08); } }
@keyframes s-tear { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(10px); opacity: 0; } }
@keyframes s-zzz { 0% { transform: translate(0, 0); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(6px, -12px); opacity: 0; } }
@keyframes s-snow { 0% { transform: translate(0, -20px); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(-14px, 80px); opacity: 0; } }
@keyframes s-drift { to { transform: translateX(28px); } }
@keyframes s-rock { 0%, 100% { transform: rotate(-2deg) translateY(0); } 50% { transform: rotate(2deg) translateY(-4px); } }
@keyframes s-flash { 0%, 60%, 100% { opacity: 0; } 62%, 66% { opacity: 1; } 64% { opacity: 0.2; } }
@keyframes s-puff { 0% { transform: translateX(0) scale(0.4); opacity: 0.6; } 100% { transform: translateX(-30px) scale(1.4); opacity: 0; } }
.scene .wave { animation: s-wave 3s ease-in-out infinite; }
.scene .twinkle { animation: s-twinkle 1.8s ease-in-out infinite; }
.scene .appear { animation: s-appear 0.8s ease both; }
.scene .throw { animation: s-throw 2.5s ease-in-out infinite; }
.scene .grow { animation: s-grow 3s ease-in-out infinite alternate; }
.scene .shake { animation: s-shake 0.6s ease-in-out infinite; }
.scene .rise { animation: s-rise 6s ease-in-out infinite alternate; }
@keyframes s-bob { 50% { transform: translateY(-6px); } }
@keyframes s-sway { 50% { transform: rotate(4deg); } }
@keyframes s-float { 50% { transform: translateY(-10px) rotate(2deg); } }
@keyframes s-spin { to { transform: rotate(360deg); } }
@keyframes s-pulse { 50% { transform: scale(1.08); } }
@keyframes s-rain { to { transform: translateY(60px); opacity: 0; } }
@keyframes s-wave { 50% { transform: translateX(-20px); } }
@keyframes s-twinkle { 50% { opacity: 0.2; transform: scale(0.7); } }
@keyframes s-appear { from { opacity: 0; transform: scale(0.6); } }
@keyframes s-throw { 0% { transform: translate(0, 0); opacity: 1; } 40% { transform: translate(120px, -50px); opacity: 1; } 60% { transform: translate(200px, -10px); opacity: 1; } 61% { opacity: 0; } 100% { opacity: 0; } }
@keyframes s-grow { to { transform: scaleY(1.15); } }
@keyframes s-shake { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
@keyframes s-rise { to { transform: translateY(-40px); } }
@media (prefers-reduced-motion: reduce) {
  .scene .anim, .scene-still img, .gift-box, .result .trophy { animation: none !important; }
  .scene-still img { left: 0; top: 0; width: 100%; height: 100%; }
}

/* ------------------------------------------------------------- family */
.family-photo {
  width: 100%; aspect-ratio: 1; max-width: 320px; margin: 0 auto;
  border-radius: var(--radius); object-fit: cover; box-shadow: var(--shadow); display: block;
  background: var(--bg-1);
}
.family-ph { display: grid; place-items: center; font-size: 6rem; }
.relation-pill { background: var(--accent); color: #fff; border-radius: 999px; padding: 4px 14px; font-weight: 700; display: inline-block; margin-top: 6px; }

/* -------------------------------------------------------------- admin */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; }
.form input[type=text], .form input[type=email], .form input[type=password], .form select, .form textarea, .form input[type=number] {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border-radius: 14px; border: 2px solid rgba(0,0,0,0.12); background: #fff; font-size: 1rem;
}
.form input[type=file] { font-size: 0.9rem; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.list { display: grid; gap: 10px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: var(--radius-sm); padding: 10px; box-shadow: var(--shadow-sm);
}
.list-item img, .list-item .ph { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; background: var(--bg-1); display: grid; place-items: center; font-size: 2rem; }
.list-item .info { flex: 1; min-width: 0; }
.list-item .info b { display: block; }
.list-item .info small { color: var(--muted); }
.preview { width: 120px; height: 120px; border-radius: 16px; object-fit: cover; background: var(--bg-1); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: #fff; border-radius: var(--radius-sm); padding: 12px; text-align: center; box-shadow: var(--shadow-sm); }
.stat b { display: block; font-size: 1.6rem; color: var(--primary); }
.stat small { color: var(--muted); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.switch input { width: 24px; height: 24px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.tabs button { flex: 0 0 auto; border: none; border-radius: 999px; padding: 8px 14px; background: #fff; font-weight: 700; color: var(--muted); min-height: 42px; }
.tabs button.on { background: var(--primary); color: #fff; }

/* -------------------------------------------------------------- misc */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(17, 24, 39, 0.55);
  display: grid; place-items: center;
  padding: 16px;
}
.modal {
  width: 100%; max-width: 440px;
  background: #fff; border-radius: 26px;
  padding: 22px 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  text-align: center;
  animation: reveal 0.35s ease;
  max-height: 90dvh; overflow: auto;
}
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-bottom)); transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-weight: 600; z-index: 70; box-shadow: 0 10px 30px rgba(0,0,0,0.3); max-width: 90vw; text-align: center;
}
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.pin-pad button { min-height: 56px; border-radius: 16px; border: none; background: var(--bg-1); font-size: 1.4rem; font-weight: 700; }
.pin-dots { font-size: 1.6rem; letter-spacing: 8px; min-height: 2rem; }

.tip {
  background: #fffbeb; border-left: 5px solid var(--star);
  border-radius: 12px; padding: 10px 14px; margin: 10px 0; font-size: 0.95rem; color: #78350f;
}
.tip b { color: #92400e; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row .chip { font-size: 1rem; min-height: 44px; padding: 6px 14px; }
.chip-row .chip.on { background: var(--primary); color: #fff; }

.story-cover { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.story-cover .cover { width: 96px; height: 72px; border-radius: 14px; display: grid; place-items: center; font-size: 2.6rem; flex-shrink: 0; object-fit: cover; background: var(--bg-1); }
.story-cover h3 { margin-bottom: 4px; }
.story-cover .play-arrow { font-size: 1.4rem; color: var(--primary); }
.mini-pill { display: inline-block; margin-top: 4px; font-size: 0.75rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--bg-1); color: var(--primary-dark); }
.card + .story-cover, .story-cover + .story-cover { margin-top: 0; }

.tile .heart { position: absolute; top: 6px; left: 8px; font-size: 1rem; }
.tile.liked { border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.quick .tile .pic img { object-fit: cover; border-radius: 12px; aspect-ratio: 4 / 3; }
.quick .tile .pic { aspect-ratio: 4 / 3; }

/* ------------------------------------------------- grown-ups gate */
.modal.gate { max-width: 360px; }
.gate-lock { font-size: 2.4rem; }
.gate-q { font-size: 2.2rem; font-weight: 700; color: var(--primary); margin: 8px 0; }
.gate-input { width: 140px; min-height: 52px; text-align: center; font-size: 1.6rem; font-weight: 700; border-radius: 14px; border: 3px solid var(--bg-1); margin: 0 auto; display: block; }
.gate-msg { min-height: 1.4em; color: #b91c1c; font-weight: 600; margin: 6px 0; }
.gate-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 14px; }
.gate-key { min-height: 54px; border-radius: 14px; border: none; background: var(--bg-1); font-size: 1.4rem; font-weight: 700; color: var(--text); }
.gate-key.ok { background: var(--primary); color: #fff; }
.gate-key:active { transform: scale(0.95); }

/* ------------------------------------------------------ parent zone */
.pz-body .card + .card { margin-top: 12px; }
.kid-face { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; background: var(--bg-1); }
.list-item img.kid-face { width: 56px; height: 56px; border-radius: 50%; }
.list-item .kid-face.emoji-face { font-size: 2rem; }
a.list-item { text-decoration: none; color: inherit; }
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-left: 8px; vertical-align: middle; }
.field { display: grid; gap: 8px; }
.field-label { font-weight: 600; font-size: 0.95rem; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; }
.avatar-opt, .face-opt { border: 4px solid transparent; border-radius: 50%; padding: 0; background: #fff; aspect-ratio: 1; overflow: hidden; box-shadow: var(--shadow-sm); }
.avatar-opt img, .face-opt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-opt.on, .face-opt.on { border-color: var(--primary); transform: scale(1.06); }
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.face-opt { font-size: 1.8rem; display: grid; place-items: center; }
.color-row { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 4px solid #fff; box-shadow: var(--shadow-sm); }
.swatch.on { outline: 3px solid var(--text); }
.like-row .chip { font-size: 0.95rem; }
.kid-chip { padding-left: 6px; }
.chip-face { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.chip-row .chip.on .chip-face { border: 2px solid #fff; }
.small-select { min-height: 40px; border-radius: 999px; border: 2px solid rgba(0,0,0,0.12); padding: 4px 12px; background: #fff; }
.family-code { font-size: clamp(1.8rem, 9vw, 2.6rem); font-weight: 700; letter-spacing: 0.12em; color: var(--primary); font-family: ui-monospace, 'SF Mono', Menlo, monospace; text-align: center; padding: 10px; background: var(--bg-1); border-radius: 16px; user-select: all; -webkit-user-select: all; }
.code-input { text-transform: uppercase; letter-spacing: 0.15em; font-weight: 700; text-align: center; font-size: 1.4rem !important; }
.setup-card { margin-top: 16px; text-align: center; }
.setup-card .form { text-align: left; }
.switch b { flex: 1; }
.form label.switch { display: flex; }
input, textarea { -webkit-user-select: text; user-select: text; }

/* ---------------------------------------------------------- reports */
.report .stat b { font-size: 1.4rem; }
.rhead { margin: 20px 0 8px; }
.rtable-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.rtable { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.rtable th, .rtable td { padding: 8px 10px; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.06); white-space: nowrap; }
.rtable th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.rtable td:last-child { width: 30%; min-width: 80px; }
.rbar { height: 10px; border-radius: 99px; background: rgba(0,0,0,0.08); overflow: hidden; }
.rbar span { display: block; height: 100%; border-radius: 99px; }
.rbar.good span, .daychart .col.good { background: #22c55e; }
.rbar.ok span, .daychart .col.ok { background: #f59e0b; }
.rbar.low span, .daychart .col.low { background: #ef4444; }
.daychart .col.none { background: #a5b4fc; }
.daychart { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding: 10px; background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); overflow-x: auto; }
.daychart .day { flex: 1 0 14px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.daychart .col { width: 100%; border-radius: 4px 4px 0 0; }
.daychart small { font-size: 0.6rem; color: var(--muted); }
.chip.warn { background: #fef3c7; color: #92400e; }

/* --------------------------------------------------- owner dashboard */
.code-pill { font-size: 0.8rem; background: var(--bg-1); color: var(--primary-dark); padding: 2px 8px; border-radius: 8px; letter-spacing: 0.08em; }
.owner-search { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 2px solid rgba(0,0,0,0.12); font-size: 1rem; }
.owner-login { max-width: 420px; margin: 20px auto; }
.fam-card .list-item { box-shadow: none; background: var(--bg-1); }

/* -------------------------------------------------------- sort it */
.sort-bins { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sort-bin { min-height: 110px; border-radius: var(--radius); border: 3px dashed color-mix(in srgb, var(--primary) 45%, transparent); background: #fff; box-shadow: var(--shadow); font-size: 1.3rem; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text); }
.sort-bin .emoji { font-size: 2.6rem; }
.sort-bin.correct { border-style: solid; border-color: var(--ok); background: #ecfdf5; animation: pop 0.4s ease; }
.sort-bin.wrong { border-color: var(--bad); animation: shake 0.4s ease; }
.sort-bin.dim { opacity: 0.4; }
.sort-item { transition: transform 0.6s ease, opacity 0.6s ease; }
.sort-item.to-left { transform: translate(-25%, 40%) scale(0.5); opacity: 0.4; }
.sort-item.to-right { transform: translate(25%, 40%) scale(0.5); opacity: 0.4; }
.stage .sort-item .pic.huge { max-height: 200px; }
.sort-item .word-big { text-transform: capitalize; }

/* ----------------------------------------------------- voice games */
.voice-intro { text-align: center; }
.voice-intro-emoji { font-size: 5rem; animation: bounce 1.6s ease infinite; }
.voice-intro-text { font-size: 1.2rem; margin: 6px 0 16px; }
.racer-pick { justify-content: center; margin-bottom: 14px; }
.racer-pick .chip .emoji { font-size: 2rem; }
.voice-wrap { display: flex; gap: 10px; align-items: stretch; }
.voice-stage { position: relative; flex: 1; aspect-ratio: 4 / 3; max-height: 58dvh; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: linear-gradient(180deg, #bae6fd, #e0f2fe 60%, #bbf7d0); }
.meter { width: 22px; border-radius: 99px; background: rgba(0,0,0,0.1); position: relative; overflow: hidden; }
.meter span { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(0deg, #22c55e, #eab308, #ef4444); background-size: 100% 300px; background-position: bottom; border-radius: 99px; transition: height 0.08s linear; }
.voice-status { text-align: center; font-size: 1.4rem; font-weight: 700; color: var(--primary); min-height: 2.2rem; margin: 10px 0; }
.voice-count { position: absolute; top: 10px; left: 12px; background: rgba(255,255,255,0.85); border-radius: 999px; padding: 4px 12px; font-weight: 700; z-index: 2; }
.hold-btn { touch-action: none; -webkit-touch-callout: none; }
.hold-btn:active { background: var(--primary-dark); }

/* bubble */
.vs-bubble { background: radial-gradient(circle at 50% 110%, #fde68a, #bae6fd 60%, #e0f2fe); }
.wand { position: absolute; left: 50%; bottom: -30px; width: 90px; height: 130px; transform: translateX(-50%); }
.wand::before { content: ''; position: absolute; left: 15px; top: 0; width: 60px; height: 60px; border-radius: 50%; border: 8px solid #ec4899; }
.wand::after { content: ''; position: absolute; left: 41px; top: 66px; width: 8px; height: 70px; border-radius: 4px; background: #ec4899; }
.bubble { position: absolute; left: 50%; bottom: 40px; width: min(62%, 300px); aspect-ratio: 1; border-radius: 50%; transform: translateX(-50%) scale(var(--s, 0.12)) rotate(var(--wob, 0deg)); transform-origin: 50% 100%;
  background: radial-gradient(circle at 30% 28%, rgba(255,255,255,0.95) 0 8%, transparent 9%), radial-gradient(circle at 50% 50%, rgba(255,255,255,0.05) 55%, rgba(167,139,250,0.35) 68%, rgba(56,189,248,0.45) 80%, rgba(244,114,182,0.5) 100%);
  border: 2px solid rgba(255,255,255,0.7); transition: transform 0.08s linear; }
.bubble.flying { transform: translateX(-50%) scale(0.5); animation: bubble-away 2.6s ease-in forwards; }
@keyframes bubble-away { to { transform: translate(calc(-50% + var(--x, 0%)), -160%) scale(0.35); opacity: 0; } }

/* candles */
.vs-candles { background: linear-gradient(180deg, #312e81, #6d28d9 70%, #a78bfa); }
.cake { position: absolute; left: 50%; bottom: 8%; width: min(78%, 420px); transform: translateX(-50%); }
.candles { display: flex; justify-content: space-around; align-items: flex-end; padding: 0 12%; }
.candle { position: relative; width: 14px; height: var(--h, 50px); border-radius: 4px 4px 0 0; background: repeating-linear-gradient(135deg, #fff 0 6px, #f472b6 6px 12px); }
.flame { position: absolute; left: 50%; bottom: 100%; width: 18px; height: 30px; margin-left: -9px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff7ad, #fbbf24 45%, #f97316 75%); box-shadow: 0 0 18px 6px rgba(251,191,36,0.55); transform-origin: 50% 100%; transform: skewX(calc(var(--lean, 0deg) * -1)); animation: flicker 0.18s ease-in-out infinite alternate; }
@keyframes flicker { to { height: 26px; opacity: 0.9; } }
.candle.out .flame { animation: none; opacity: 0; transition: opacity 0.3s; }
.candle.out::after { content: '💨'; position: absolute; left: 50%; bottom: 110%; transform: translateX(-50%); font-size: 1.6rem; animation: s-rise 1.4s ease-out forwards; opacity: 0.8; }
.cake-top { height: 26px; background: #fbcfe8; border-radius: 14px 14px 0 0; border-bottom: 6px solid #f9a8d4; }
.cake-body { height: 90px; background: linear-gradient(180deg, #fde68a, #fbbf24); border-radius: 0 0 14px 14px; display: grid; place-items: center; font-size: 1.6rem; letter-spacing: 6px; }

/* race */
.vs-race { display: flex; flex-direction: column; justify-content: center; gap: 12%; padding: 0 4%; background: linear-gradient(180deg, #bae6fd 0 30%, #86efac 30%); }
.lane { position: relative; height: 26%; background: #6b7280; border-radius: 14px; border-top: 4px dashed #fff; border-bottom: 4px dashed #fff; }
.racer { position: absolute; top: 50%; transform: translateY(-50%); font-size: clamp(2.4rem, 9vw, 4rem); line-height: 1; transition: left 0.1s linear; }
.racer > span { display: inline-block; }
.racer.moving { animation: s-rattle 0.12s linear infinite alternate; }
.finish { position: absolute; right: 2%; top: 50%; transform: translateY(-50%); font-size: clamp(1.8rem, 7vw, 3rem); }

/* loud & quiet */
.vs-loudquiet { display: flex; align-items: center; justify-content: center; gap: 8%; background: linear-gradient(180deg, #fef3c7, #fde68a); }
.lq-animal { font-size: clamp(6rem, 30vw, 11rem); line-height: 1; transition: transform 0.15s; }
.lq-animal.loud.active { transform: scale(1.25) rotate(-6deg); }
.lq-animal.quiet { font-size: clamp(4rem, 18vw, 7rem); }
.lq-animal.quiet.active { transform: scale(1.12); }
.lq-bar { position: relative; width: 44px; height: 80%; border-radius: 22px; background: rgba(0,0,0,0.12); overflow: hidden; }
.lq-bar > span { position: absolute; left: 0; right: 0; bottom: 0; background: var(--primary); opacity: 0.85; }
.lq-zone { position: absolute; left: 0; right: 0; background: rgba(34,197,94,0.45); border-top: 3px solid #16a34a; border-bottom: 3px solid #16a34a; }

/* say & go */
.sg-track { position: relative; margin: 6px auto 12px; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.sg-track.v { height: 210px; background: linear-gradient(0deg, #1e3a8a, #0f172a); display: flex; flex-direction: column-reverse; justify-content: space-between; align-items: center; padding: 18px 0 40px; }
.sg-track.h { height: 110px; background: linear-gradient(180deg, #86efac 0 25%, #6b7280 25% 75%, #86efac 75%); display: flex; justify-content: space-between; align-items: center; padding: 0 56px 0 18px; }
.sg-stop { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,0.4); }
.sg-stop.passed { background: #fbbf24; }
.sg-goal { position: absolute; font-size: 2.6rem; }
.sg-track.v .sg-goal { top: 4px; right: 18%; }
.sg-track.h .sg-goal { right: 8px; top: 50%; transform: translateY(-50%); }
.sg-ride { position: absolute; font-size: 2.8rem; line-height: 1; transition: all 1s cubic-bezier(0.5, 0, 0.3, 1.3); }
.sg-track.v .sg-ride { left: calc(50% - 1.4rem); bottom: calc(6px + var(--p, 0) * 150px); }
.sg-track.h .sg-ride { top: 50%; left: calc(6px + var(--p, 0) * (100% - 110px)); transform: translateY(-50%) scaleX(-1); }
.sg-card .pic { max-height: 150px; }

/* peekaboo */
.vs-peekaboo { background: linear-gradient(180deg, #bfdbfe, #dbeafe 55%, #86efac 55%, #4ade80); }
/* centred with text-align, not translateX: the animations below set `transform` themselves */
.pk-friend, .pk-cover { position: absolute; left: 0; right: 0; bottom: 14%; line-height: 1; text-align: center; }
.pk-friend { font-size: clamp(5rem, 26vw, 10rem); transform: translateY(30%) scale(0.3); opacity: 0; transition: transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1), opacity 0.15s; }
.pk-friend.out { transform: translateY(-18%) scale(1); opacity: 1; }
.pk-cover { font-size: clamp(6rem, 30vw, 12rem); z-index: 1; animation: wiggle 1.1s ease-in-out infinite; transition: transform 0.5s ease-in, opacity 0.4s 0.15s; }
.pk-cover.away { animation: none; transform: translateY(60%) rotate(18deg); opacity: 0; }

/* popcorn */
.vs-popcorn { background: linear-gradient(180deg, #fecaca, #fee2e2 70%, #fca5a5); }
.pc-pot { position: absolute; left: 50%; bottom: 0; width: min(46%, 220px); transform: translateX(-50%); z-index: 2; }
.pc-pot.jump { animation: pc-jump 0.25s ease; }
@keyframes pc-jump { 40% { transform: translateX(-50%) translateY(-10px) rotate(-3deg); } }
.pc-lid { height: 14px; margin: 0 6%; border-radius: 12px 12px 0 0; background: #475569; position: relative; }
.pc-lid::before { content: ''; position: absolute; left: 50%; top: -10px; width: 26px; height: 12px; margin-left: -13px; border-radius: 8px 8px 0 0; background: #1e293b; }
.pc-body { height: clamp(60px, 16vw, 96px); border-radius: 0 0 26px 26px; background: linear-gradient(180deg, #ef4444, #b91c1c); display: grid; place-items: center; font-size: clamp(1.8rem, 7vw, 3rem); box-shadow: inset 0 -8px 0 rgba(0,0,0,0.15); }
.pc-piece { position: absolute; left: var(--x); bottom: var(--y); font-size: clamp(1.8rem, 8vw, 3.2rem); line-height: 1; transform: rotate(var(--r)); animation: pc-fly 0.55s cubic-bezier(0.2, 0.9, 0.4, 1.2) backwards; }
@keyframes pc-fly { from { left: 46%; bottom: 12%; transform: scale(0.2) rotate(0); opacity: 0.4; } }

/* butterfly */
.vs-butterfly { background: linear-gradient(180deg, #7dd3fc, #e0f2fe 70%); }
.bf-hill { position: absolute; left: -10%; right: -10%; bottom: -8%; height: 22%; border-radius: 50% 50% 0 0; background: linear-gradient(180deg, #4ade80, #16a34a); }
.bf-fly { position: absolute; left: 18%; bottom: 10%; font-size: clamp(2.8rem, 12vw, 5rem); line-height: 1; z-index: 2; animation: s-flutter 0.5s ease-in-out infinite; }
.bf-fly.up { animation-duration: 0.18s; }
.bf-flower { position: absolute; left: 108%; font-size: clamp(2.2rem, 10vw, 4rem); line-height: 1; transition: transform 0.4s, opacity 0.4s; }
.bf-flower.got { transform: scale(2) rotate(40deg); opacity: 0; }

/* rainbow */
.vs-rainbow { background: linear-gradient(180deg, #bae6fd, #f0f9ff 75%, #bbf7d0); }
.rb-svg { position: absolute; left: 4%; right: 4%; bottom: 6%; width: 92%; height: 88%; }
.rb-band { stroke-linecap: round; transition: stroke-dashoffset 0.1s linear; }
.rb-svg.done { animation: s-pulse 0.8s ease 3; transform-origin: 50% 100%; }
.rb-cloud { position: absolute; bottom: 2%; font-size: clamp(3rem, 14vw, 6rem); line-height: 1; z-index: 1; }
.rb-cloud.l { left: 0; }
.rb-cloud.r { right: 0; }
.rb-brush { position: absolute; right: 10px; top: 8px; font-size: 2.4rem; z-index: 2; }
.rb-brush.on { animation: wiggle 0.3s linear infinite; }
.rb-sun { position: absolute; left: 0; right: 0; bottom: 8%; text-align: center; font-size: clamp(3rem, 14vw, 6rem); line-height: 1; animation: bounce 0.6s ease 3; }

/* wake up */
.vs-wakeup { --day: 0; background: linear-gradient(180deg, #1e1b4b, #4338ca 70%, #6366f1); }
.vs-wakeup::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, #7dd3fc, #fef3c7 70%, #fde68a); opacity: var(--day); }
.wk-sun { position: absolute; left: 0; right: 0; text-align: center; bottom: calc(-12% + var(--day) * 78%); font-size: clamp(3rem, 14vw, 6rem); line-height: 1; opacity: calc(0.35 + var(--day) * 0.65); }
.wk-bed { position: absolute; left: 12%; right: 12%; bottom: 0; height: 26%; border-radius: 40px 40px 0 0; background: linear-gradient(180deg, #a78bfa, #7c3aed); z-index: 1; }
.wk-animal { position: absolute; left: 0; right: 0; text-align: center; bottom: 12%; transform: rotate(-14deg); font-size: clamp(5rem, 24vw, 9rem); line-height: 1; z-index: 2; filter: brightness(calc(0.65 + var(--day) * 0.35)); transition: transform 0.3s; }
.wk-animal.stir { animation: s-shake 0.3s linear infinite; }
.awake .wk-animal { transform: translateY(-22%); filter: none; }
.wk-zzz { position: absolute; left: 62%; bottom: 52%; font-size: clamp(2rem, 9vw, 3.6rem); z-index: 2; animation: s-float 2s ease-in-out infinite; opacity: calc(1 - var(--day)); }
.awake .wk-zzz { display: none; }

/* blast off */
.vs-blastoff { background: linear-gradient(180deg, #0f172a, #1e3a8a 75%, #3b82f6); }
.bo-stars { position: absolute; left: 0; right: 0; top: 12%; text-align: center; font-size: 1.6rem; letter-spacing: 8vw; opacity: 0.8; animation: s-twinkle 2.4s ease-in-out infinite; }
.bo-moon { position: absolute; right: 10%; top: 6%; font-size: clamp(2.4rem, 10vw, 4rem); }
.bo-pad { position: absolute; left: 30%; right: 30%; bottom: 0; height: 7%; border-radius: 12px 12px 0 0; background: #64748b; }
.bo-ship { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%) rotate(-45deg); font-size: clamp(4rem, 20vw, 8rem); line-height: 1; z-index: 2; }
.bo-ship.rumble { animation: bo-rumble 0.1s linear infinite alternate; }
@keyframes bo-rumble { to { transform: translateX(calc(-50% + 3px)) translateY(-2px) rotate(-45deg); } }
.bo-ship.fly { animation: bo-fly 1.6s cubic-bezier(0.6, 0, 0.9, 0.5) forwards; }
@keyframes bo-fly { to { transform: translateX(-50%) translateY(-130vh) rotate(-45deg) scale(0.6); } }
.bo-ship.fly::after { content: '🔥'; position: absolute; left: -18%; bottom: -18%; font-size: 0.5em; transform: rotate(225deg); }
.bo-tank { position: absolute; left: 10%; bottom: 10%; width: clamp(34px, 9vw, 54px); height: 62%; border-radius: 28px; background: rgba(255,255,255,0.18); border: 3px solid rgba(255,255,255,0.7); overflow: hidden; z-index: 2; }
.bo-tank span { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(0deg, #f97316, #facc15); transition: height 0.1s linear; }
.bo-tank b { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: 1.2rem; }

/* copy me */
.vs-copy1, .vs-copy2, .vs-copy3, .vs-copy4 { display: grid; place-items: center; background: linear-gradient(180deg, #fef9c3, #fde68a); }
.vs-copy2 { background: linear-gradient(180deg, #dcfce7, #86efac); }
.vs-copy3 { background: linear-gradient(180deg, #dbeafe, #93c5fd); }
.vs-copy4 { background: linear-gradient(180deg, #fce7f3, #f9a8d4); }
.cm-dots { position: absolute; top: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; z-index: 2; }
.cm-dots span { width: 16px; height: 16px; border-radius: 50%; background: rgba(255,255,255,0.7); box-shadow: inset 0 0 0 2px rgba(0,0,0,0.12); }
.cm-dots span.yes { background: var(--star); box-shadow: none; }
.cm-dots span.no { background: #cbd5e1; box-shadow: none; }
.cm-card { display: grid; justify-items: center; gap: 2px; }
.cm-pic { font-size: clamp(5.5rem, 28vw, 11rem); line-height: 1.1; }
.cm-pic.in { animation: reveal 0.5s ease backwards, act 0.9s ease-in-out 0.5s infinite; }
.cm-pic.dance { animation: buddy-dance 0.5s ease-in-out infinite; }
.cm-word { font-size: clamp(1.8rem, 8vw, 3.2rem); font-weight: 700; color: #1f2937; background: rgba(255,255,255,0.8); border-radius: 999px; padding: 2px 22px; }
.cm-ring { position: absolute; right: 12px; bottom: 12px; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; background: rgba(255,255,255,0.6); opacity: 0.35; transition: opacity 0.2s; z-index: 2; }
.cm-ring.on { opacity: 1; background: #fff; box-shadow: 0 0 0 calc(4px + var(--v, 0) * 22px) rgba(34, 197, 94, 0.45); animation: pulse 1.2s ease infinite; }
.cm-star { position: absolute; left: var(--x); bottom: 20%; font-size: 2rem; animation: cm-star 1.3s ease-out var(--d) forwards; opacity: 0; z-index: 3; }
@keyframes cm-star { 0% { transform: translateY(0) scale(0.4); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-220px) scale(1.3) rotate(40deg); opacity: 0; } }

/* Picture Talk */
.pt-board { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin: 6px auto 10px; max-width: min(100%, 78dvh); background: #e5e7eb; aspect-ratio: 4 / 3; -webkit-tap-highlight-color: transparent; }
.pt-board img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.pt-board.find { cursor: pointer; touch-action: manipulation; }
.pt-ring { position: absolute; width: 24%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); border: 6px solid var(--star); box-shadow: 0 0 0 4px rgba(255,255,255,0.9), 0 0 24px 8px rgba(251,191,36,0.7); pointer-events: none; display: none; }
.pt-ring.show, .pt-ring.reveal { display: block; animation: pt-ring 0.7s ease 2; background: none; }
.pt-ring.miss { display: block; width: 12%; border-color: #94a3b8; box-shadow: none; opacity: 0.8; animation: fadein 0.2s ease; }
@keyframes pt-ring { 50% { transform: translate(-50%, -50%) scale(1.18); } }
.talk-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.talk-card { display: grid; border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; }
.talk-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.talk-card b { padding: 8px 10px 2px; }
.talk-card small { padding: 0 10px 10px; color: var(--muted); }
@media (min-width: 760px) { .talk-grid { grid-template-columns: repeat(4, 1fr); } }

/* the Copy Me ladder page */
.ladder { display: grid; gap: 12px; }
.ladder a { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--card, #fff); box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; border-left: 10px solid var(--c, var(--primary)); }
.ladder .l-num { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.3rem; color: #fff; background: var(--c, var(--primary)); flex: none; }
.ladder .l-pic { font-size: 2.6rem; line-height: 1; }
.ladder .l-info { flex: 1; display: grid; }
.ladder .l-info small { color: var(--muted); }
.ladder .l-stars { font-size: 0.95rem; white-space: nowrap; }
.memory.few { grid-template-columns: repeat(3, 1fr); max-width: 520px; margin-inline: auto; }

@media (min-width: 760px) {
  .voice-stage { max-height: 62dvh; }
}

.emoji img.emoji, img.emoji { height: 1em; width: 1em; vertical-align: -0.1em; display: inline-block; }

.fade-in { animation: fadein 0.3s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } }

@media (min-width: 760px) {
  .view { padding-top: 24px; }
  .tile .pic { font-size: 3.6rem; }
}


/* ------------------------------------------------ today's adventure path */
.path { display: flex; flex-direction: column; gap: 10px; }
.path-step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; position: relative; }
.path-step.later { opacity: 0.55; }
.path-step.done { background: rgba(255, 255, 255, 0.7); }
.path-step.now { background: var(--primary); color: #fff; box-shadow: var(--shadow); padding: 18px 16px; animation: path-nudge 2.4s ease-in-out infinite; }
.path-num { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--bg-1); color: var(--primary-dark); }
.path-step.done .path-num { background: var(--ok); color: #fff; }
.path-step.now .path-num { background: rgba(255, 255, 255, 0.25); color: #fff; }
.path-pic { font-size: 2rem; line-height: 1; }
.path-step.now .path-pic { font-size: 2.8rem; }
.path-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.path-info b { font-size: 1.1rem; }
.path-step.now .path-info b { font-size: 1.35rem; }
.path-info small { opacity: 0.8; }
.path-go { flex: 0 0 auto; background: #fff; color: var(--primary-dark); font-weight: 700; padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow-sm); }
.path-mark { font-size: 1.3rem; }
.path-finished { margin-top: 12px; }
@keyframes path-nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.link-btn { background: none; border: none; font: inherit; text-decoration: underline; cursor: pointer; padding: 8px 12px; }
.limit-chip { display: inline-block; margin: 0 0 12px; padding: 6px 14px; border-radius: 999px; background: #fff; box-shadow: var(--shadow-sm); font-weight: 600; color: var(--primary-dark); font-size: 0.95rem; }
.done-card .trophy { font-size: 4rem; }
.limit-card { margin-bottom: 12px; }

/* --------------------------------------------- Say It: big "your turn" mic */
.turn-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; max-width: 440px; margin: 14px auto 0; min-height: 72px; padding: 12px 20px; border: none; border-radius: 999px; background: #ef4444; color: #fff; font: inherit; font-weight: 700; font-size: 1.2rem; box-shadow: var(--shadow); cursor: pointer; overflow: hidden; }
.turn-btn .turn-icon { font-size: 2rem; line-height: 1; position: relative; }
.turn-btn .turn-text { position: relative; }
.turn-btn .turn-level { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.28); transform-origin: left center; transform: scaleX(var(--lvl, 0)); transition: transform 0.08s linear; }
.turn-btn.listening { background: var(--ok); animation: turn-pulse 1.1s ease-in-out infinite; }
.turn-btn.good { background: var(--star); color: #5b3a00; }
.turn-btn:active { transform: scale(0.97); }
@keyframes turn-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55), var(--shadow); } 50% { box-shadow: 0 0 0 16px rgba(34, 197, 94, 0), var(--shadow); } }
.heard { text-align: center; }

/* ------------------------------------------------------- mouth pictures */
.mouth-slot { margin-top: 12px; }
.mouth-card { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px; margin-bottom: 14px; }
.mouth-pic { flex: 1 1 200px; max-width: 300px; margin: 0 auto; }
.mouth-how { flex: 2 1 240px; min-width: 0; }
.mouth-how h3 { margin: 0 0 6px; }
.mouth-how ol { margin: 0 0 8px; padding-left: 1.3em; font-size: 1.05rem; }
.mouth-how li { margin-bottom: 4px; }
.mouth-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.mouth-badges .mini-pill.on { background: #fef3c7; color: #92400e; }
.mouth-svg { width: 100%; height: auto; display: block; }
.m-face { fill: #f3e8ff; stroke: #c4b5fd; stroke-width: 3; stroke-linejoin: round; }
.m-cave { fill: #5b2038; }
.m-tooth { fill: #fff; stroke: #cbd5e1; stroke-width: 1.5; }
.m-tongue { fill: #fb7185; stroke: #e11d48; stroke-width: 2; stroke-linejoin: round; }
.m-lip { fill: #f43f5e; }
.m-air { fill: none; stroke: #0ea5e9; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 8 8; animation: m-air 0.9s linear infinite; }
.m-air.pop { stroke-dasharray: 3 9; }
.m-air-head { fill: none; stroke: #0ea5e9; stroke-width: 5; stroke-linecap: round; }
.m-voice path { fill: none; stroke: #f59e0b; stroke-width: 4; stroke-linecap: round; animation: m-buzz 0.35s ease-in-out infinite alternate; }
@keyframes m-air { to { stroke-dashoffset: 16; } }
@keyframes m-buzz { from { opacity: 0.35; } to { opacity: 1; } }

/* ------------------------------------------------------ owner overview */
.owner-overview { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.chart-card { padding: 12px 14px; }
.chart-head { display: flex; flex-direction: column; margin-bottom: 8px; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 64px; }
.spark span { flex: 1; min-width: 2px; background: var(--primary); border-radius: 3px 3px 0 0; }
.spark span.zero { background: rgba(0, 0, 0, 0.08); }
.tip.warn { background: #fef3c7; color: #78350f; }
.owner-overview .list-item { text-decoration: none; color: inherit; }
@media (prefers-reduced-motion: reduce) { .path-step.now, .turn-btn.listening { animation: none; } }

/* A step that has been answered: ignore further taps until the next one shows */
.locked { pointer-events: none; }

/* Say It: keep picture, word and microphone together on one screen */
.sayit-stage .pic.huge, .sayit-stage .pic.huge img { max-height: min(300px, 30vh); }
.sayit-stage .turn-btn { margin: 10px auto 4px; }
.sayit-stage .heard { margin-top: 6px; }
.mouth-key { display: block; text-align: center; font-size: 0.8rem; }

/* ---- simple "doors" page, fold-away extras, letters A–Z */
.grid.doors { gap: 14px; }
.grid.doors .tile { min-height: 132px; }
.grid.doors .tile .emoji { font-size: 3rem; }
.more-box { margin: 14px 0; }
.more-box > summary { list-style: none; cursor: pointer; text-align: center; font-weight: 700; color: var(--muted); padding: 10px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.6); }
.more-box > summary::-webkit-details-marker { display: none; }
.more-box[open] > summary { margin-bottom: 12px; }
.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
.letter-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; aspect-ratio: 1; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--primary); }
.letter-tile b { font-size: 2.1rem; line-height: 1; }
.letter-tile span { font-size: 1.3rem; }
.letter-tile:active { transform: translateY(2px); }
.letter-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.letter-big { flex: none; width: 128px; height: 128px; border: 0; border-radius: 32px; background: var(--primary); color: #fff; font: 700 5rem/1 var(--font); box-shadow: var(--shadow); cursor: pointer; display: flex; align-items: baseline; justify-content: center; gap: 4px; padding-top: 22px; }
.letter-big small { font-size: 2.4rem; opacity: 0.85; }
.letter-say { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.letter-say b { font-size: 2rem; color: var(--primary); line-height: 1; }
.letter-words { margin-bottom: 12px; }
.chip.big { font-size: 1.05rem; padding: 10px 16px; }
.chip.big .emoji { font-size: 1.6rem; }

/* Parent guide */
.guide p, .guide li { line-height: 1.5; }
.guide ul, .guide ol { padding-left: 1.2rem; margin: 8px 0; }
.guide li { margin: 6px 0; }
.guide summary { cursor: pointer; min-height: 32px; }
.guide-point { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; }
.guide-point .ico { font-size: 1.9rem; line-height: 1.1; flex: none; }
.guide-point b { display: block; }
.guide-point span { line-height: 1.45; }
.form textarea { width: 100%; resize: vertical; min-height: 110px; }
.tip a { color: #92400e; font-weight: 700; }
/* Owner: notes from parents */
.fb-item { display: grid; gap: 6px; }
.fb-item.new { border-left: 5px solid var(--primary); }
.fb-item p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- Buddy */
.buddy { display: inline-block; line-height: 0; flex: none; --lvl: 0; }
.buddy svg { width: 100%; height: auto; display: block; overflow: visible; }
.buddy .b-all, .buddy .b-wing, .buddy .b-eye, .buddy .b-beak-low { transform-box: fill-box; transform-origin: center; }
.buddy .b-wing { transform-origin: 50% 12%; }
.buddy .b-all { transform-origin: 50% 100%; animation: buddy-bob 3.2s ease-in-out infinite; }
.buddy .b-eye { animation: buddy-blink 4.6s infinite; }
.buddy .b-smile-eye { display: none; }
.buddy .b-beak-low { transform: translateY(calc(var(--lvl) * 9px)); transition: transform 0.08s linear; }
.buddy.is-listen .b-all { animation: none; transform: rotate(-7deg) scale(calc(1 + var(--lvl) * 0.07)); transition: transform 0.1s linear; }
.buddy.is-listen .b-eye { animation: none; transform: scale(1.1); }
.buddy.is-talk .b-all { animation: none; transform: scale(calc(1 + var(--lvl) * 0.1)); transition: transform 0.08s linear; }
.buddy.is-talk .b-wing-l { transform: rotate(calc(var(--lvl) * 38deg)); }
.buddy.is-talk .b-wing-r { transform: rotate(calc(var(--lvl) * -38deg)); }
.buddy.is-happy .b-all { animation: buddy-dance 0.5s ease-in-out infinite; }
.buddy.is-happy .b-eye { display: none; }
.buddy.is-happy .b-smile-eye { display: inline; }
.buddy.is-happy .b-wing-l { animation: buddy-flap-l 0.25s ease-in-out infinite alternate; }
.buddy.is-happy .b-wing-r { animation: buddy-flap-r 0.25s ease-in-out infinite alternate; }
.buddy.is-happy .b-beak-low { transform: translateY(7px); }
.buddy.is-try .b-all { animation: buddy-nod 0.7s ease-in-out 2; }
@keyframes buddy-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5%); } }
@keyframes buddy-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
@keyframes buddy-dance { 0%, 100% { transform: translateY(0) rotate(-9deg); } 50% { transform: translateY(-9%) rotate(9deg); } }
@keyframes buddy-flap-l { from { transform: rotate(0); } to { transform: rotate(46deg); } }
@keyframes buddy-flap-r { from { transform: rotate(0); } to { transform: rotate(-46deg); } }
@keyframes buddy-nod { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(6deg); } 70% { transform: rotate(-4deg); } }
.hero-buddy { flex: none; z-index: 1; align-self: flex-end; margin: -6px -6px -12px 0; text-decoration: none; }
.stage { position: relative; }
.stage-buddy { position: absolute; top: 8px; right: 8px; z-index: 1; pointer-events: none; }
.buddy-stage { display: grid; justify-items: center; gap: 10px; }
.buddy-meter { width: min(100%, 320px); height: 16px; }
.closet { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.outfit { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border: 3px solid transparent; border-radius: 18px; background: var(--card); box-shadow: var(--shadow-sm); min-height: 104px; color: inherit; }
.outfit .emoji { font-size: 2rem; line-height: 1.2; }
.outfit b { font-size: 0.9rem; }
.outfit small { color: var(--muted); font-size: 0.75rem; }
.outfit.on { border-color: var(--primary); background: #fff; }
.outfit.locked { opacity: 0.6; }

/* ------------------------------------------------------- Days in a row */
.streak-card { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 12px 16px; margin-bottom: 14px; }
.streak-flame { position: relative; flex: none; width: 62px; height: 62px; display: grid; place-items: center; font-size: 2.6rem; line-height: 1; filter: grayscale(0.7); opacity: 0.75; }
.streak-card.lit .streak-flame { filter: none; opacity: 1; animation: flame 1.6s ease-in-out infinite; }
.streak-flame b { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); font-size: 1.05rem; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); }
.streak-info { display: grid; gap: 2px; min-width: 0; flex: 1; }
.streak-info small { color: var(--muted); }
.streak-week { display: flex; gap: 6px; margin-top: 6px; }
.streak-day { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.07); color: var(--muted); font-size: 0.75rem; font-weight: 700; flex: none; }
.streak-day.on { background: #fef3c7; font-size: 0.95rem; }
.streak-day.today { box-shadow: 0 0 0 3px var(--primary); }
@keyframes flame { 0%, 100% { transform: scale(1) rotate(-3deg); } 50% { transform: scale(1.1) rotate(3deg); } }
.streak-pop { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 60; display: grid; justify-items: center; gap: 2px; padding: 12px 22px; border-radius: 22px; background: linear-gradient(135deg, #f97316, #facc15); color: #fff; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28); font-size: 1.05rem; text-align: center; max-width: calc(100vw - 32px); animation: streak-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
.streak-pop b { font-size: 1.25rem; }
.streak-pop.bye { opacity: 0; transition: opacity 0.5s; }
@keyframes streak-in { from { transform: translate(-50%, -140%); } to { transform: translate(-50%, 0); } }

/* -------------------------------------------------------- Action rhymes */
.rhyme-top { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 8px; }
.rhyme-action { display: grid; justify-items: center; gap: 2px; padding: 10px 18px; border-radius: 22px; background: #fef3c7; color: #78350f; min-width: 150px; }
.rhyme-action-emoji { font-size: 3.6rem; line-height: 1.1; display: inline-block; }
.rhyme-action.moving .rhyme-action-emoji { animation: act 0.7s ease-in-out infinite; }
@keyframes act { 0%, 100% { transform: translateY(0) rotate(-8deg) scale(1); } 50% { transform: translateY(-10px) rotate(8deg) scale(1.12); } }
.rhyme-lines { display: grid; gap: 4px; margin: 10px 0; }
.rhyme-line { font-size: 1.05rem; color: var(--muted); }
.rhyme-line.now { font-size: 1.45rem; font-weight: 700; color: var(--text, inherit); line-height: 1.35; }
.rhyme-line .fill.filled { color: var(--primary); text-decoration: underline; }
.rhyme-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 4px; }
.rhyme-choice { display: grid; justify-items: center; gap: 2px; padding: 12px 6px; border: none; border-radius: 20px; background: var(--bg-1); font-weight: 700; font-size: 1.05rem; min-height: 96px; color: inherit; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1); }
.rhyme-choice .emoji { font-size: 2.4rem; line-height: 1.15; }
.rhyme-choice.wrong { opacity: 0.45; animation: shake 0.4s; }
.rhyme-choice:active { transform: translateY(3px); box-shadow: none; }
.rhyme-all { display: grid; gap: 8px; margin: 12px 0; text-align: left; }
.rhyme-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 16px; font-size: 1.15rem; font-weight: 600; transition: background 0.2s, transform 0.2s; }
.rhyme-row-emoji { font-size: 1.9rem; flex: none; }
.rhyme-row.on { background: #fef3c7; transform: scale(1.03); }
.rhyme-row.on .rhyme-row-emoji { animation: act 0.7s ease-in-out infinite; }

/* Rhyme Time: listen and look before any question is asked */
.rhyme-steps { display: flex; justify-content: center; gap: 8px; margin: 2px 0 10px; }
.rhyme-steps span { width: 34px; height: 8px; border-radius: 99px; background: rgba(0, 0, 0, 0.12); }
.rhyme-steps span.done { background: var(--ok); }
.rhyme-steps span.now { background: var(--primary); }
.rhyme-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 6px 0 10px; }
.rhyme-cards.n3 { grid-template-columns: repeat(3, 1fr); }
.rhyme-card { display: grid; justify-items: center; gap: 4px; padding: 14px 6px 10px; border-radius: 22px; background: var(--bg-1); border: 4px solid transparent; transition: transform 0.2s, border-color 0.2s, background 0.2s; cursor: pointer; }
.rhyme-card .pic { font-size: clamp(3rem, 16vw, 5.5rem); line-height: 1.1; }
.rhyme-card.on { transform: scale(1.1); border-color: var(--primary); background: #fff; }
.rhyme-card.all { border-color: var(--star); background: #fffbeb; animation: rhyme-hop 0.6s ease 2; }
.rhyme-cards .rhyme-card.all:nth-child(2) { animation-delay: 0.12s; }
.rhyme-cards .rhyme-card.all:nth-child(3) { animation-delay: 0.24s; }
@keyframes rhyme-hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.rhyme-word { font-size: clamp(1.4rem, 6vw, 2.2rem); font-weight: 700; color: var(--text); }
.rhyme-word b { color: var(--primary); text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 5px; }
.rhyme-banner { display: inline-block; margin: 4px auto 0; padding: 8px 18px; border-radius: 999px; background: #fef3c7; color: #78350f; font-weight: 700; font-size: 1.3rem; animation: pop 0.4s ease; }
.rhyme-banner[hidden] { display: none; }

/* --------------------------------------------------- My Turn, Your Turn */
.seats { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin-bottom: 6px; }
.seat { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 12px; border-radius: 20px; border: 3px solid transparent; opacity: 0.55; min-width: 96px; transition: opacity 0.2s, transform 0.2s; }
.seat-face { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-size: 2.2rem; background: var(--bg-1); }
.seat.on { opacity: 1; border-color: var(--primary); background: #fff; transform: scale(1.06); animation: turn-pulse 1.1s ease-in-out infinite; }
.seat.done { opacity: 1; }
.seat-mark { position: absolute; top: -8px; right: -4px; font-size: 1.4rem; }
.turn-prompt { font-size: 1.25rem; font-weight: 700; margin: 8px 0 2px; }
.turns-stage .pic.huge, .turns-stage .pic.huge img { max-height: min(240px, 26vh); }
@media (prefers-reduced-motion: reduce) { .buddy .b-all, .buddy .b-wing, .streak-flame, .rhyme-action-emoji, .rhyme-row-emoji, .seat.on { animation: none !important; } }

/* Two misses: the answer lights up and the game goes on */
.reveal { animation: reveal 0.9s ease-in-out 2; }
@keyframes reveal { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.35); } }
.move-on { margin: 12px auto 0; padding: 10px 16px; max-width: 420px; border-radius: 16px; background: #fef3c7; color: #78350f; font-weight: 700; text-align: center; font-size: 1.1rem; }
.fill.filled { color: var(--primary); }

/* About this app (Parent Zone → Settings) */
.version-line { margin: 0; font-weight: 700; }

/* ------------------------------------------------ milestones & certificates */
.goal-card { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #fff7d6, #ffffff); border: 3px solid #facc15; border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 12px 16px; margin-bottom: 14px; color: var(--text); text-decoration: none; }
.goal-emoji { font-size: 2.4rem; line-height: 1; flex: none; }
.goal-info { flex: 1; min-width: 0; display: grid; gap: 4px; }
.goal-info b { font-size: 1.05rem; }
.goal-info small { color: var(--muted); }
.goal-go { font-size: 1.6rem; flex: none; }
.goal-bar { height: 12px; border-radius: 99px; background: #f1ecd8; overflow: hidden; }
.goal-bar > span { display: block; height: 100%; min-width: 6px; border-radius: inherit; background: linear-gradient(90deg, #f59e0b, #facc15); transition: width 0.6s; }
.goal-list { display: grid; gap: 10px; }
.goal-list .goal-card { margin-bottom: 0; }
.goal-row { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; }
.goal-row .goal-emoji { font-size: 1.8rem; filter: grayscale(0.85); opacity: 0.65; }
.goal-row.earned .goal-emoji { filter: none; opacity: 1; }
.goal-row.earned { border: 2px solid #facc15; }
.goal-state { flex: none; font-weight: 700; color: var(--muted); font-size: 0.95rem; }
.goal-row.earned .goal-state { color: #b45309; }
.cert-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.cert-mini { position: relative; display: grid; justify-items: center; gap: 4px; text-align: center; padding: 14px 10px; border-radius: 18px; background: #fffaf0; border: 4px double #f5b301; box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; }
.cert-mini-emoji { font-size: 2.4rem; }
.cert-mini small { color: var(--muted); }
.cert-mini.new { animation: cert-glow 1.6s ease-in-out infinite; }
.cert-mini .badge { position: absolute; top: -8px; right: -6px; background: #ef4444; color: #fff; font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
@keyframes cert-glow { 50% { box-shadow: 0 0 0 6px rgba(250, 204, 21, 0.45); } }
.cert-banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 14px; border-radius: var(--radius); background: linear-gradient(135deg, #f59e0b, #facc15); color: #fff; text-decoration: none; box-shadow: var(--shadow); animation: cert-glow 1.6s ease-in-out infinite; }
.cert-banner b { display: block; font-size: 1.2rem; }
.cert-banner small { opacity: 0.95; }
.cert-banner-emoji { font-size: 2.6rem; animation: flame 1.6s ease-in-out infinite; }
.cert-pop { text-decoration: none; background: linear-gradient(135deg, #ca8a04, #facc15); }
.certificate { margin: 8px auto 16px; max-width: 900px; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); background: #fffaf0; }
.certificate svg { display: block; width: 100%; height: auto; }
.goal-group > summary { text-align: left; }
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body.printing-cert { background: #fff !important; }
  body.printing-cert * { visibility: hidden; }
  body.printing-cert .certificate, body.printing-cert .certificate * { visibility: visible; }
  body.printing-cert .certificate { position: fixed; inset: 0; margin: 0; max-width: none; box-shadow: none; border-radius: 0; }
}

/* ------------------------------------------------ story questions to say */
.talk-stage { display: grid; justify-items: center; gap: 12px; }
.talk-top { display: flex; align-items: center; gap: 12px; justify-content: center; }
.talk-top .prompt { text-align: left; }
.talk-choices { justify-content: center; gap: 10px; }
.chip.big-chip { font-size: 1.2rem; padding: 12px 20px; }
.chip.big-chip.correct { background: var(--ok); color: #fff; }
.age-row .chip { min-width: 52px; justify-content: center; font-weight: 700; }
