@font-face {
  font-family: "Andika";
  font-weight: 700;
  font-display: block;
  src: url(fonts/andika-bold.woff2) format("woff2");
  unicode-range: U+41-5A, U+61-7A;
}

:root {
  --ink: #3b2160;
  --muted: #7a6a96;
  --card: #ffffff;
  --go: #ff4fa3;
  --go-dark: #c2307a;
  --blue: #8e5cf7;
  --blue-dark: #6a3ad1;
  --teal: #19c3b4;
  --gold: #ffc61a;
  --right: #22c55e;
  --wrong: #ff3b30;
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif;
  --letters: "Andika", ui-rounded, system-ui, sans-serif;
  --gap: clamp(10px, 2vmin, 20px);
  --safe-t: max(16px, env(safe-area-inset-top));
  --safe-r: max(16px, env(safe-area-inset-right));
  --safe-b: max(16px, env(safe-area-inset-bottom));
  --safe-l: max(16px, env(safe-area-inset-left));
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(#ffc4e6, #d9c8ff 60%, #c3e6ff);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: 0.45; }
[hidden] { display: none !important; }

/* ---------- screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--gap);
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  overflow-y: auto;
}
.screen.on { display: flex; }

/* ---------- buttons ---------- */
.big-btn {
  font-size: clamp(26px, 5vmin, 46px);
  font-weight: 800;
  color: #fff;
  padding: 0.45em 1.3em;
  border-radius: 999px;
  background: var(--go);
  box-shadow: 0 0.18em 0 var(--go-dark);
  transition: transform 0.08s, box-shadow 0.08s;
}
.big-btn:active { transform: translateY(0.14em); box-shadow: 0 0.04em 0 var(--go-dark); }
.big-btn.blue, .big-btn.purple { background: var(--blue); box-shadow: 0 0.18em 0 var(--blue-dark); }
.big-btn.blue:active, .big-btn.purple:active { box-shadow: 0 0.04em 0 var(--blue-dark); }
.pill {
  font-size: clamp(16px, 2.6vmin, 22px);
  font-weight: 800;
  padding: 0.45em 0.9em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}
.pill.icon { padding: 0.45em 0.6em; }
.pill.gems { background: #e9fbff; }
.pill.danger { color: #c62828; }
.link { font-size: 18px; font-weight: 700; color: var(--muted); text-decoration: underline; padding: 12px; }
:focus-visible { outline: 4px solid var(--blue); outline-offset: 3px; }

/* ---------- the friend ---------- */
.buddy { position: relative; display: inline-grid; place-items: center; line-height: 1; }
.buddy .emo { display: inline-block; font-size: 1em; }
.buddy .emo.flip { transform: scaleX(-1); }
.buddy .emo.rainbow { animation: rainbow 3s linear infinite; }
.buddy .hat { position: absolute; font-size: 0.42em; transform: translate(-50%, -30%) rotate(var(--turn)); pointer-events: none; }
.buddy.big { font-size: clamp(110px, 26vmin, 240px); animation: bob 2.4s ease-in-out infinite; }
.buddy.small { font-size: clamp(44px, 8vmin, 72px); }

/* ---------- who's playing ---------- */
.title { display: flex; align-items: center; gap: 0.25em; margin-top: 2vmin; font-size: clamp(40px, 9vmin, 90px); }
.title h1 {
  font-size: 1em;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0.06em 0 var(--blue-dark), 0 0.1em 0.15em rgba(0, 0, 0, 0.2);
}
.ask { font-size: clamp(30px, 6.5vmin, 60px); font-weight: 800; text-align: center; }
.players { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); max-width: 1100px; margin-bottom: auto; }
.player-card {
  width: clamp(150px, 26vmin, 230px);
  aspect-ratio: 3 / 4;
  border-radius: 32px;
  background: linear-gradient(160deg, #fff, #ffe3f3);
  box-shadow: 0 10px 0 rgba(90, 40, 140, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 14px 10px 16px;
  border: 5px solid #fff;
  transition: transform 0.1s;
}
.player-card:active { transform: translateY(6px) scale(0.98); }
.player-card .buddy { font-size: clamp(70px, 14vmin, 130px); flex: 1; }
.player-name { font-size: clamp(26px, 5vmin, 42px); font-weight: 900; color: var(--ink); }
.player-gems { font-size: clamp(16px, 2.6vmin, 22px); font-weight: 800; background: #e9fbff; border-radius: 999px; padding: 0.2em 0.7em; }
.player-card.add { background: rgba(255, 255, 255, 0.55); border: 5px dashed #fff; justify-content: center; gap: 8px; }
.player-card.add .plus { font-size: clamp(60px, 12vmin, 110px); font-weight: 900; color: var(--go); line-height: 1; }
.player-card.add .player-name { color: var(--go); font-size: clamp(20px, 3.6vmin, 30px); }

/* ---------- new player ---------- */
.back { position: absolute; top: var(--safe-t); left: var(--safe-l); z-index: 1; }
.step { display: none; flex-direction: column; align-items: center; gap: calc(var(--gap) * 1.5); margin: auto; width: 100%; }
.step.on { display: flex; }
.name-input {
  font: inherit;
  font-size: clamp(36px, 8vmin, 72px);
  font-weight: 800;
  text-align: center;
  width: min(90%, 620px);
  padding: 0.25em 0.5em;
  border-radius: 28px;
  border: 5px solid #fff;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 0 rgba(90, 40, 140, 0.15);
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.name-input:focus { border-color: var(--go); }
.ages { --size: clamp(90px, 17vmin, 150px); display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); }
.ages button {
  width: var(--size);
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: clamp(40px, 9vmin, 80px);
  font-weight: 900;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 8px 0 var(--blue-dark);
}
.ages button:nth-child(2n) { background: var(--go); box-shadow: 0 8px 0 var(--go-dark); }
.buddies { display: flex; flex-wrap: wrap; justify-content: center; gap: calc(var(--gap) * 1.5); }
.buddy-card {
  width: clamp(160px, 28vmin, 260px);
  aspect-ratio: 4 / 5;
  border-radius: 36px;
  background: #fff;
  box-shadow: 0 10px 0 rgba(90, 40, 140, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 6px solid #fff;
  transition: transform 0.15s;
}
.buddy-card .buddy { font-size: clamp(90px, 17vmin, 160px); }
.buddy-name { font-size: clamp(24px, 4.5vmin, 40px); font-weight: 900; }
.buddy-card.picked { transform: scale(1.08); border-color: var(--gold); }

/* ---------- home ---------- */
.topbar { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 1100px; }
.topbar h2 { flex: 1; text-align: center; font-size: clamp(26px, 5vmin, 44px); font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-body { display: flex; gap: calc(var(--gap) * 1.5); align-items: center; justify-content: center; width: 100%; max-width: 1100px; flex: 1 0 auto; }
.podium { flex: 0 0 auto; display: grid; place-items: center; width: clamp(200px, 34vmin, 340px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(#fff 0%, #fff 45%, rgba(255, 255, 255, 0) 70%); }
.pickers { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pickers h3 { font-size: clamp(18px, 3vmin, 26px); font-weight: 900; color: var(--muted); margin-top: 6px; }
.tiles { display: flex; gap: 10px; overflow-x: auto; padding: 4px 4px 12px; scrollbar-width: none; }
.tiles::-webkit-scrollbar { display: none; }
.tile {
  flex: 0 0 auto;
  width: clamp(72px, 12vmin, 104px);
  aspect-ratio: 1;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 5px 0 rgba(90, 40, 140, 0.15);
  display: grid;
  place-items: center;
  position: relative;
  border: 4px solid #fff;
}
.tile.on { border-color: var(--go); }
.tile .buddy { font-size: clamp(40px, 7vmin, 60px); }
.tile .hat-art { font-size: clamp(36px, 6.5vmin, 54px); }
.tile.locked > :first-child { opacity: 0.35; filter: grayscale(1); }
.tile-cost { position: absolute; bottom: 4px; font-size: clamp(11px, 1.8vmin, 15px); font-weight: 800; }
.my-letters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--letters);
  font-weight: 700;
  font-size: clamp(18px, 3.2vmin, 28px);
  width: 1.7em;
  height: 1.7em;
  border-radius: 0.5em;
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: #c9bfdc;
  box-shadow: 0 3px 0 rgba(90, 40, 140, 0.12);
}
.chip.stage1 { background: #fff4c2; color: #9a7a00; }
.chip.stage2 { background: #ffd6ec; color: #c2307a; }
.chip.stage3 { background: #e5d7ff; color: #6a3ad1; }
.chip.stage4 { background: #c9f4ee; color: #0f8077; }
.chip.stage5 { background: linear-gradient(135deg, #fff2a8, #ffc61a); color: #7a4f00; }
.home-go { display: flex; gap: var(--gap); flex-wrap: wrap; justify-content: center; position: sticky; bottom: 12px; }
.go { animation: pulse 1.6s ease-in-out infinite; }

/* ---------- the adventure ---------- */
.scene { padding: 0; overflow: hidden; touch-action: none; }
.sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 60% at 30% 100%, var(--ground0) 0 60%, transparent 61%),
    radial-gradient(110% 55% at 85% 100%, var(--ground1) 0 62%, transparent 63%),
    linear-gradient(var(--sky0), var(--sky1) 55%, var(--ground0) 55.2%, var(--ground1));
}
.trail { position: absolute; inset: 0; width: 100%; height: 100%; }
.trail path { fill: none; stroke: var(--path); stroke-width: clamp(18px, 4vmin, 40px); stroke-linecap: round; stroke-dasharray: 2 1.6vmin; opacity: 0.9; }
.world { position: absolute; inset: 0; }
.world > * { position: absolute; transform: translate(-50%, -50%); }
.decor { animation: sway 4s ease-in-out infinite; line-height: 1; }
.cloud { font-size: clamp(50px, 10vmin, 110px); opacity: 0.9; animation: drift 30s linear infinite alternate; }
.stone {
  width: clamp(64px, 11vmin, 110px);
  aspect-ratio: 1.6;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff, #ece4f7 60%, #cfc2e6);
  box-shadow: 0 6px 0 rgba(70, 40, 110, 0.25);
  display: grid;
  place-items: center;
}
.stone.start { font-size: clamp(32px, 6vmin, 56px); }
.stone .gem { font-size: clamp(30px, 5.5vmin, 52px); translate: 0 -40%; animation: bob 1.8s ease-in-out infinite; }
.stone.done .gem { animation: collect 0.6s ease-in forwards; }
.stone.next { animation: glow 1s ease-in-out infinite; }
.goal { font-size: clamp(110px, 24vmin, 230px); line-height: 1; filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.12)); animation: bob 3s ease-in-out infinite; }
.walker { font-size: clamp(80px, 15vmin, 150px); transform: translate(-50%, -88%) !important; transition: left 0.65s cubic-bezier(0.4, 0, 0.6, 1), top 0.65s cubic-bezier(0.4, 0, 0.6, 1); z-index: 2; }
.walker.hopping .emo { animation: hop 0.65s ease-out; }
.walker .emo.flip { transform: scaleX(-1); }
.hud { position: absolute; top: var(--safe-t); left: var(--safe-l); right: var(--safe-r); display: flex; align-items: center; justify-content: space-between; gap: 12px; z-index: 3; }
.stops { display: flex; gap: 8px; padding: 8px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); }
.stops i { width: clamp(16px, 2.8vmin, 26px); aspect-ratio: 1; border-radius: 50%; background: #e2d9f1; }
.stops i.on { background: var(--go); box-shadow: 0 0 0 3px #ffd6ec; }
.hop { position: absolute; bottom: var(--safe-b); left: 50%; transform: translateX(-50%); z-index: 3; animation: hopPulse 1.2s ease-in-out infinite; }
.sprinkle { position: fixed; z-index: 30; font-size: clamp(22px, 4vmin, 38px); pointer-events: none; animation: sprinkle 1.2s ease-out forwards; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(60, 30, 100, 0.3);
  z-index: 10;
}
.overlay.open { display: flex; animation: fade 0.2s; }
.card {
  background: var(--card);
  border-radius: 36px;
  box-shadow: 0 14px 0 rgba(70, 30, 120, 0.18), 0 20px 50px rgba(70, 30, 120, 0.25);
  padding: clamp(16px, 3vmin, 32px);
  width: min(100%, 920px);
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2vmin, 18px);
  position: relative;
  animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

/* question */
.ask-head { display: flex; align-items: center; gap: 12px; width: 100%; }
.ask-line { flex: 1; font-size: clamp(22px, 4.2vmin, 40px); font-weight: 900; color: var(--blue); }
.prompt { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 4vmin, 40px); min-height: clamp(90px, 18vmin, 170px); }
.listen { font-size: clamp(56px, 12vmin, 110px); width: 1.6em; aspect-ratio: 1; border-radius: 50%; background: #f3ecff; box-shadow: 0 6px 0 #ddd0f5; animation: pulse 1.6s ease-in-out infinite; }
.big-pic { font-size: clamp(80px, 17vmin, 160px); line-height: 1; }
.letter-card { font-family: var(--letters); font-weight: 700; font-size: clamp(70px, 15vmin, 140px); line-height: 1.1; padding: 0 0.25em; border-radius: 0.25em; background: #fff4fa; box-shadow: 0 6px 0 #ffd6ec; color: var(--go-dark); }
.word { display: flex; gap: clamp(8px, 1.5vmin, 16px); }
.tile-letter {
  font-family: var(--letters);
  font-weight: 700;
  font-size: clamp(64px, 14vmin, 130px);
  width: 1.05em;
  line-height: 1.15;
  border-radius: 0.2em;
  background: #f3ecff;
  box-shadow: 0 6px 0 #ddd0f5;
  color: var(--ink);
  transition: transform 0.15s, background 0.15s;
}
.tile-letter.lit { background: var(--gold); transform: translateY(-0.12em) scale(1.08); }
.choices { --n: 3; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: clamp(10px, 2vmin, 20px); width: 100%; }
.choice {
  aspect-ratio: 1;
  max-height: 34vh;
  border-radius: 28px;
  background: #fff;
  border: 5px solid #eadff9;
  box-shadow: 0 8px 0 #ddd0f5;
  display: grid;
  place-items: center;
  transition: transform 0.08s;
  justify-self: center;
  width: 100%;
}
.choice:active { transform: translateY(5px); }
.choices.letters .glyph { font-family: var(--letters); font-weight: 700; font-size: clamp(70px, 15vmin, 150px); line-height: 1; color: var(--ink); }
.choices.pictures .pic { font-size: clamp(64px, 13vmin, 130px); line-height: 1; }
.choice.right { border-color: var(--right); background: #dcfce7; animation: pop 0.4s; }
.choice.wrong { border-color: var(--wrong); background: #ffe4e1; opacity: 0.55; animation: shake 0.4s; }
.choice.reveal { border-color: var(--right); background: #dcfce7; animation: glowCard 1s ease-in-out infinite; }
.key-hint { display: none; color: var(--muted); font-weight: 700; font-size: clamp(14px, 2vmin, 18px); }
@media (hover: hover) and (pointer: fine) { .key-hint { display: block; } }
.toast { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-size: clamp(24px, 4.5vmin, 40px); font-weight: 900; color: var(--blue); opacity: 0; pointer-events: none; }
.toast.show { animation: toast 1.8s ease-out; }
.float { position: fixed; font-weight: 900; font-size: clamp(28px, 5vmin, 44px); color: var(--teal); text-shadow: 0 2px 0 #fff, 0 0 8px #fff; pointer-events: none; animation: float 1.1s ease-out forwards; z-index: 30; transform: translateX(-50%); }

/* finish, kingdom, pause, gate */
.finish-place { font-size: clamp(80px, 16vmin, 150px); line-height: 1; animation: bob 2s ease-in-out infinite; }
.finish-card h2, .kingdom-card h2, .pause-card h2, .gate-card h2 { font-size: clamp(28px, 5.5vmin, 52px); font-weight: 900; text-align: center; }
.finish-treasure { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.treasure { font-size: clamp(70px, 14vmin, 130px); line-height: 1; animation: reveal 1s cubic-bezier(0.2, 1.4, 0.4, 1) 0.4s both; }
.treasure-name { font-size: clamp(20px, 3.6vmin, 32px); font-weight: 800; color: var(--blue); }
.finish-gems { font-size: clamp(20px, 3.6vmin, 30px); font-weight: 800; }
.row { display: flex; gap: var(--gap); flex-wrap: wrap; justify-content: center; position: sticky; bottom: 0; }
.kingdom-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(6px, 1.5vmin, 14px); width: 100%; padding: clamp(10px, 2vmin, 20px); border-radius: 28px; background: linear-gradient(#cdeaff, #ffe3f3 55%, #b8f0c0 56%, #8fd694); }
.treasure-slot { font-size: clamp(40px, 8vmin, 74px); aspect-ratio: 1; border-radius: 20px; background: rgba(255, 255, 255, 0.5); line-height: 1; }
.treasure-slot.empty { font-size: clamp(20px, 3.5vmin, 30px); opacity: 0.6; }
.pause-card { width: min(100%, 520px); }
.gate-card { width: min(100%, 460px); }
.gate-q { font-size: clamp(30px, 6vmin, 50px); font-weight: 900; }
.gate-show { font-size: clamp(30px, 6vmin, 50px); font-weight: 900; min-height: 1.3em; color: var(--blue); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.pad button { font-size: clamp(24px, 4.5vmin, 36px); font-weight: 900; padding: 0.4em 0; border-radius: 18px; background: #f3ecff; box-shadow: 0 4px 0 #ddd0f5; }
.pad .ok { background: var(--go); color: #fff; box-shadow: 0 4px 0 var(--go-dark); }

/* ---------- grown-ups ---------- */
.grown { background: #f6f2fc; }
.grown-list { display: flex; flex-direction: column; gap: var(--gap); width: 100%; max-width: 900px; }
.grown-card { background: #fff; border-radius: 24px; padding: 20px; width: 100%; max-width: 900px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 4px 0 rgba(90, 40, 140, 0.08); -webkit-user-select: text; user-select: text; }
.grown-card h3 { font-size: 26px; font-weight: 900; }
.grown-card h4 { font-size: 18px; font-weight: 900; margin-top: 6px; }
.stats { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 17px; }
.stats dt { color: var(--muted); font-weight: 700; }
.stats dd { font-weight: 800; }
.letter-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(28px, max-content) minmax(150px, 1fr)); gap: 6px; align-items: center; font-size: 15px; font-weight: 700; color: var(--muted); }
.legend .chip { width: 1.3em; height: 1.3em; font-size: 18px; }
.muted { color: var(--muted); font-size: 16px; line-height: 1.4; }
.edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.edit label { font-weight: 800; color: var(--muted); }
.grown-input { font: inherit; font-size: 18px; padding: 6px 10px; border-radius: 12px; border: 2px solid #e2d9f1; }
.check { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; }
.check input { width: 22px; height: 22px; }
.notes p { font-size: 16px; line-height: 1.5; color: var(--muted); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.confetti i { position: absolute; top: -24px; width: 12px; height: 18px; border-radius: 3px; animation: fall 2.6s linear forwards; }

/* ---------- motion ---------- */
.shake { animation: shake 0.4s; }
.pop { animation: pop 0.35s; }
@keyframes pop { 0% { transform: scale(0.85); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes fade { from { opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes hopPulse { 50% { transform: translateX(-50%) scale(1.06); } }
@keyframes bob { 50% { transform: translateY(-6%); } }
@keyframes collect { to { transform: translateY(-260%) scale(1.6); opacity: 0; } }
@keyframes glow { 50% { box-shadow: 0 0 0 8px rgba(255, 198, 26, 0.6), 0 6px 0 rgba(70, 40, 110, 0.25); } }
@keyframes glowCard { 50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.35), 0 8px 0 #ddd0f5; } }
@keyframes sway { 50% { transform: translate(-50%, -50%) rotate(4deg); } }
@keyframes drift { to { margin-left: 10vw; } }
@keyframes hop { 40% { translate: 0 -55%; } 70% { translate: 0 -10%; } 85% { translate: 0 3%; scale: 1.06 0.94; } }
@keyframes sprinkle { from { opacity: 1; } to { opacity: 0; transform: translate(var(--dx), -90px) scale(1.4); } }
@keyframes rainbow { to { filter: hue-rotate(360deg) saturate(1.3); } }
@keyframes float { to { transform: translate(-50%, -70px); opacity: 0; } }
@keyframes toast { 15%, 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes reveal { from { transform: scale(0) rotate(-30deg); } }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--spin, 360deg)); } }

/* ---------- small screens ---------- */
@media (max-width: 700px) {
  .home-body { flex-direction: column; }
  .pickers { align-self: stretch; }
  .kingdom-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-height: 560px) {
  .choice { max-height: 40vh; }
  .prompt { min-height: 70px; }
}

/* grown-ups mastery table */
table.concepts { width: 100%; border-collapse: collapse; font-size: 15px; }
table.concepts th, table.concepts td { padding: 5px 8px; text-align: right; border-bottom: 1px solid #ece4f6; }
table.concepts th:first-child, table.concepts td:first-child, table.concepts th:nth-child(2), table.concepts td:nth-child(2) { text-align: left; }
table.concepts tr.mastered td:nth-child(3) { color: #15803d; font-weight: 800; }
table.concepts tr.learning td:nth-child(3) { color: #b45309; font-weight: 800; }
table.concepts tr.later td { color: var(--muted); }
@media (max-width: 560px) { table.concepts th:nth-child(2), table.concepts td:nth-child(2) { display: none; } }

/* During the lesson after a miss the cards rest; the big letter (or picture) asks to be tapped. */
.choices.hold button { pointer-events: none; filter: saturate(0.4); opacity: 0.55; }
.choices.hold button.reveal { opacity: 1; filter: none; }
.touch-me { animation: touch-me 1s ease-in-out infinite; outline: 6px solid #ffd60a; outline-offset: 6px; border-radius: 0.25em; }
@keyframes touch-me { 50% { transform: scale(1.08); } }

/* Stone games: the same choices as balloons, cookies for her friend, or stars to catch. */
.choices.game-balloons .choice {
  border: 0;
  border-radius: 50% 50% 46% 46% / 56% 56% 44% 44%;
  aspect-ratio: 0.86;
  background: radial-gradient(circle at 32% 28%, #fff8 0 12%, transparent 13%), var(--balloon, #ff8fc8);
  box-shadow: inset -10px -14px 0 rgba(0, 0, 0, 0.08), 0 8px 0 rgba(70, 30, 120, 0.12);
  position: relative;
  animation: balloon 2.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.8s);
}
.choices.game-balloons .choice::after { content: ''; position: absolute; top: 99%; left: 50%; width: 3px; height: 14%; background: #b9a8d6; }
.choices.game-balloons .choice:nth-child(4n + 2) { --balloon: #9fd8ff; }
.choices.game-balloons .choice:nth-child(4n + 3) { --balloon: #ffe27a; }
.choices.game-balloons .choice:nth-child(4n + 4) { --balloon: #b6f0a8; }
.choices.game-balloons .choice.right { animation: balloon-pop 0.45s ease-out forwards; }
.choices.game-balloons .choice.wrong { animation: shake 0.4s; }
.choices.game-balloons .choice.reveal { animation: glowCard 1s ease-in-out infinite; }

.choices.game-feed .choice {
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f8dcae, #dca56a);
  box-shadow: inset -8px -10px 0 rgba(120, 70, 20, 0.15), 0 8px 0 rgba(120, 70, 20, 0.25);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.6, 1);
}
.choices.game-feed .choice.right { animation: none; opacity: 0; transition: transform 0.45s, opacity 0.2s 0.15s; }
#askBuddy.nom { animation: nom 0.5s ease-out; }

.choices.game-stars { background: linear-gradient(#2a1f6b, #4a3aa6); border-radius: 28px; padding: clamp(10px, 2vmin, 20px); }
.choices.game-stars .choice {
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #fffbe0 0 45%, #ffd84a 75%);
  box-shadow: 0 0 24px 4px rgba(255, 220, 80, 0.7);
  position: relative;
  animation: twinkle 3s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * -1.1s);
}
.choices.game-stars .choice::after { content: '✨'; position: absolute; top: -6%; right: 2%; font-size: clamp(22px, 4vmin, 40px); }
.choices.game-stars .choice.right { animation: caught 0.5s ease-in forwards; }
.choices.game-stars .choice.wrong { animation: shake 0.4s; }
.choices.game-stars .choice.reveal { animation: glowCard 1s ease-in-out infinite; }

@keyframes balloon { 50% { transform: translateY(-7%) rotate(2deg); } }
@keyframes balloon-pop { 40% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes twinkle { from { transform: translate(-4%, 3%) rotate(-5deg); } to { transform: translate(4%, -3%) rotate(5deg); } }
@keyframes caught { to { transform: translateY(-40%) scale(0.4); opacity: 0; } }
@keyframes nom { 30% { transform: scale(1.25); } 60% { transform: scale(0.95); } }
.choices.game-balloons { padding-bottom: clamp(14px, 3vmin, 30px); }
#askCard[data-game='feed'] #askBuddy { scale: 1.6; translate: 10% 10%; animation: hungry 1.4s ease-in-out infinite; }
@keyframes hungry { 50% { rotate: -6deg; } }
.buddy .held { font-size: 0.36em; }
.tile.fresh { animation: glow 1.2s ease-in-out 4; }
.treasure.gold, .treasure-slot.gold { filter: drop-shadow(0 0 0.12em #ffd60a) drop-shadow(0 0 0.05em #ffb300); }
.treasure-slot.gold { background: linear-gradient(135deg, #fff3b0, #ffd60a); }

/* The egg and the pet that hatched last. */
.podium { position: relative; }
.podium .egg, .podium .pet { position: absolute; bottom: 6%; font-size: clamp(40px, 8vmin, 70px); line-height: 1; }
.podium .egg { right: 2%; }
.podium .pet { left: 2%; }
.egg { display: inline-block; line-height: 1; position: relative; }
.egg.crack1 { animation: wobble 2.4s ease-in-out infinite; }
.egg.crack2 { animation: wobble 0.9s ease-in-out infinite; }
.egg.crack1::after, .egg.crack2::after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  top: 46%;
  height: 0.16em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 8'%3E%3Cpath d='M0 4 L6 1 L11 6 L17 2 L23 7 L29 2 L34 6 L40 3' fill='none' stroke='%235b3a1a' stroke-width='1.6'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.egg.crack1::after { right: 50%; }
.finish-treasure .egg { font-size: clamp(50px, 9vmin, 90px); }
.walker .pet { position: absolute; left: -24%; bottom: -4%; font-size: 0.42em; }
.walker.hopping .pet { animation: hop 0.65s ease-out 0.1s; }
.pet-slot { background: linear-gradient(135deg, #ffe3f3, #e9dcff); }
@keyframes wobble { 0%, 100% { rotate: 0deg; } 25% { rotate: -8deg; } 75% { rotate: 8deg; } }
@media (max-height: 560px) {
  .choices.game-stars .choice, .choices.game-balloons .choice { max-height: 32vh; }
}
.choices.game-balloons, .choices.game-stars { padding-inline: clamp(14px, 3vmin, 24px); }
