/* kAIddo — playful, chunky, touch-first. iPhone + iPad. */
:root {
  --sky1: #7dd3fc;
  --sky2: #c4b5fd;
  --ink: #1e293b;
  --muted: #64748b;
  --card: #ffffff;
  --green: #22c55e;
  --green-d: #15803d;
  --blue: #3b82f6;
  --blue-d: #1d4ed8;
  --orange: #f97316;
  --orange-d: #c2410c;
  --red: #ef4444;
  --red-d: #b91c1c;
  --gold: #facc15;
  --ok: #16a34a;
  --bad: #f97316;
  --radius: 24px;
  --font: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Varela Round', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, var(--sky1), var(--sky2)) fixed;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}
button { font-family: inherit; color: inherit; touch-action: manipulation; cursor: pointer; }
input, select { font-family: inherit; -webkit-user-select: text; user-select: text; }
h1 { font-size: clamp(26px, 6vw, 44px); margin: 0.2em 0; text-align: center; }
h2 { font-size: clamp(20px, 4.5vw, 28px); margin: 0.3em 0 0.5em; }
.hidden { display: none !important; }
.lead { font-size: clamp(18px, 4.5vw, 26px); text-align: center; margin: 0.4em 0; }
.muted { color: var(--muted); font-size: 15px; }
.row { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; }
.row.left { justify-content: flex-start; }

#app { position: fixed; inset: 0; }
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 12px) calc(var(--safe-b) + 8px) calc(var(--safe-l) + 12px);
}
.screen.center { align-items: center; justify-content: center; text-align: center; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 24px; }

/* ---------- buttons ---------- */
.btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 26px;
  font-size: clamp(18px, 4.5vw, 24px);
  font-weight: 800;
  color: #fff;
  box-shadow: 0 6px 0 var(--shadow, rgba(0,0,0,.25));
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--shadow, rgba(0,0,0,.25)); }
.btn-green { background: var(--green); --shadow: var(--green-d); }
.btn-blue { background: var(--blue); --shadow: var(--blue-d); }
.btn-orange { background: var(--orange); --shadow: var(--orange-d); }
.btn-red { background: var(--red); --shadow: var(--red-d); }
.btn-xl { font-size: clamp(24px, 6vw, 34px); padding: 18px 40px; }
.btn.small { font-size: 16px; padding: 10px 16px; box-shadow: 0 4px 0 var(--shadow); }
.btn:disabled { opacity: .5; }

.round-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  font-size: 30px;
  box-shadow: 0 5px 0 #cbd5e1;
}
.round-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #cbd5e1; }
.help-btns { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 8px 0 rgba(15, 23, 42, .12);
}

/* ---------- topbar & nav ---------- */
.topbar { display: flex; gap: 8px; align-items: center; padding: 4px 0 8px; z-index: 5; }
.pill {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.92);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 900;
  font-size: 20px;
  box-shadow: 0 4px 0 rgba(15,23,42,.12);
}
.parent-btn { margin-left: auto; border: 0; background: rgba(255,255,255,.5); border-radius: 50%; width: 40px; height: 40px; font-size: 20px; opacity: .7; }
.bottom-nav {
  display: flex; justify-content: space-around;
  background: #fff;
  border-radius: 28px;
  padding: 6px;
  box-shadow: 0 -2px 0 rgba(15,23,42,.06), 0 6px 0 rgba(15,23,42,.12);
}
.nav-item { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; padding: 6px; border-radius: 22px; }
.nav-item.active { background: #e0f2fe; }
.nav-icon { font-size: 32px; line-height: 1; }
.nav-label { font-size: 14px; font-weight: 800; color: var(--muted); }

/* ---------- Kai ---------- */
.kai { position: relative; width: var(--kai-size); display: flex; flex-direction: column; align-items: center; }
.kai-body { position: relative; width: var(--kai-size); height: var(--kai-size); }
.kai-figure, .kai-svg { width: 100%; height: 100%; display: block; }
.kai[data-stage="1"] .kai-body { transform: scale(.82); transform-origin: bottom center; }
.kai[data-stage="2"] .kai-body { transform: scale(.9); transform-origin: bottom center; }
.kai-hat { position: absolute; top: -6%; left: 50%; transform: translateX(-50%); font-size: calc(var(--kai-size) * .32); line-height: 1; }
.kai[data-stage="3"] .kai-hat, .kai[data-stage="4"] .kai-hat { top: -12%; }
.kai-extra { position: absolute; right: -4%; bottom: 12%; font-size: calc(var(--kai-size) * .26); line-height: 1; }
.kai-bubble {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 10px 14px;
  font-weight: 800;
  font-size: clamp(16px, 4vw, 22px);
  margin-bottom: 10px;
  max-width: min(78vw, 460px);
  width: max-content;
  text-align: center;
  box-shadow: 0 5px 0 rgba(15,23,42,.12);
  animation: pop-in .25s ease-out;
}
.kai-bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%);
  border: 10px solid transparent; border-top-color: #fff; border-bottom: 0;
}
.kai-happy .kai-body { animation: bounce .6s ease; }
.kai-sad .kai-body { animation: shake .5s ease; }
.kai-wow .kai-body { animation: bounce .4s ease 2; }
.kai-listen .kai-body { animation: lean 1.2s ease-in-out infinite; }
.kai-corner { position: absolute; left: calc(var(--safe-l) + 6px); bottom: calc(var(--safe-b) + 4px); z-index: 4; pointer-events: none; }
.kai-corner .kai-bubble { position: absolute; bottom: 100%; left: 8px; width: max-content; max-width: min(70vw, 420px); text-align: left; }
.kai-corner .kai-bubble::after { left: 40px; }

/* ---------- home map ---------- */
.home .map-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 120px; }
.hero { display: flex; align-items: flex-end; justify-content: center; gap: 16px; padding: 8px 0 18px; }
.hero .kai { cursor: pointer; }
.hero-extras { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.chest-btn { font-size: 54px; border: 0; background: none; }
.review-btn { border: 0; border-radius: 999px; background: var(--orange); color: #fff; font-weight: 900; font-size: 18px; padding: 10px 16px; box-shadow: 0 5px 0 var(--orange-d); }
.path { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.unit-banner {
  display: flex; align-items: center; gap: 10px;
  width: min(92%, 560px);
  background: var(--unit);
  color: #fff;
  border-radius: 22px;
  padding: 10px 16px;
  margin-top: 18px;
  font-weight: 900;
  box-shadow: 0 6px 0 rgba(0,0,0,.18);
  text-shadow: 0 2px 0 rgba(0,0,0,.18);
}
.unit-banner.locked { filter: grayscale(.8) brightness(1.05); opacity: .75; }
.unit-icon { font-size: 34px; }
.unit-title { font-size: clamp(20px, 5vw, 26px); flex: 1; }
.unit-stars { font-size: 16px; background: rgba(0,0,0,.15); border-radius: 999px; padding: 4px 10px; }
.node {
  position: relative;
  width: 82px; height: 76px;
  border: 0;
  border-radius: 50%;
  transform: translateX(var(--x));
  background: var(--unit);
  box-shadow: 0 8px 0 rgba(0,0,0,.25), inset 0 -6px 0 rgba(0,0,0,.12);
  display: flex; align-items: center; justify-content: center;
}
.node:active { transform: translateX(var(--x)) translateY(6px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.node-icon { font-size: 36px; }
.node.locked { background: #cbd5e1; }
.node.locked .node-icon { font-size: 26px; opacity: .7; }
.node.done { background: var(--unit); }
.node.current { width: 100px; height: 92px; animation: pulse-ring 1.6s infinite; }
.node.current::after {
  content: '¡Aquí!';
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  background: #fff; color: var(--ink); font-weight: 900; font-size: 15px;
  padding: 3px 10px; border-radius: 999px; box-shadow: 0 3px 0 rgba(0,0,0,.12);
}
.node-stars { position: absolute; bottom: -18px; font-size: 15px; letter-spacing: -3px; white-space: nowrap; }
.node.nope { animation: shake .4s; }
.path-end { text-align: center; font-size: 64px; padding: 30px 0; }
.play-fab {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-b) + 96px);
  border: 0; border-radius: 999px;
  background: var(--green); color: #fff;
  font-size: clamp(26px, 7vw, 34px); font-weight: 900;
  padding: 14px 42px;
  white-space: nowrap;
  box-shadow: 0 7px 0 var(--green-d), 0 12px 24px rgba(0,0,0,.2);
  z-index: 6;
}
.play-fab:active { transform: translateX(-50%) translateY(5px); }

/* ---------- level ---------- */
.level { background: linear-gradient(170deg, color-mix(in srgb, var(--unit) 35%, #e0f2fe), #f0f9ff); }
.level-top { display: flex; align-items: center; gap: 12px; padding: 4px 0 8px; }
.close-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #fff; font-size: 24px; font-weight: 900; box-shadow: 0 4px 0 #cbd5e1; color: var(--muted); }
.progress { flex: 1; height: 22px; background: rgba(255,255,255,.8); border-radius: 999px; overflow: hidden; box-shadow: inset 0 3px 0 rgba(0,0,0,.08); }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--orange)); border-radius: 999px; transition: width .5s cubic-bezier(.3,1.4,.6,1); }
.combo { font-weight: 900; font-size: 22px; color: var(--orange-d); background: #fff; padding: 4px 12px; border-radius: 999px; box-shadow: 0 4px 0 rgba(0,0,0,.1); }
.combo.bump { animation: bounce .4s; }
.stage {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(12px, 3vh, 28px);
  padding-bottom: 90px;
  min-height: 0;
}
.intro { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 560px; }
.intro-icon { font-size: clamp(80px, 22vw, 140px); line-height: 1; animation: bounce 1.6s infinite; }
.unit-chip { background: var(--unit); color: #fff; font-weight: 900; font-size: 22px; padding: 6px 18px; border-radius: 999px; }
.tip { background: #fff; border-radius: 20px; padding: 12px 16px; font-size: clamp(17px, 4vw, 22px); font-weight: 700; box-shadow: 0 5px 0 rgba(0,0,0,.08); }

.word-card { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: min(86vw, 520px); position: relative; }
.phrase-card { max-width: min(94vw, 900px); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.big-emoji { font-size: clamp(72px, 20vw, 140px); line-height: 1.1; }
.big-emoji.small { font-size: clamp(56px, 14vw, 96px); }
.badge { position: absolute; top: 10px; right: 12px; background: var(--orange); color: #fff; font-weight: 900; border-radius: 999px; padding: 4px 10px; font-size: 15px; }
.word-view { font-weight: 900; text-align: center; letter-spacing: .01em; line-height: 1.15; }
.wv-word { font-size: clamp(54px, 15vw, 120px); }
.wv-syllable { font-size: clamp(44px, 12vw, 80px); }
.wv-phrase { font-size: clamp(30px, 7.5vw, 58px); }
.wv-dot { color: #cbd5e1; margin: 0 .06em; }
.wv-part { border-radius: 14px; padding: 0 .06em; transition: background .25s, color .25s; }
.wv-part.ok { color: var(--ok); background: #dcfce7; }
.wv-part.bad { color: var(--bad); background: #ffedd5; animation: shake .45s; }
.word-view.all-ok .wv-part { color: var(--ok); }
.heard { color: var(--muted); font-weight: 700; font-size: 17px; min-height: 1.3em; text-align: center; }
.controls { display: flex; align-items: center; justify-content: center; gap: 22px; }
.help-slot { min-width: 64px; }

.mic-btn {
  position: relative;
  width: clamp(110px, 30vw, 150px); height: clamp(110px, 30vw, 150px);
  border-radius: 50%;
  border: 0;
  background: radial-gradient(circle at 35% 30%, #fb7185, #e11d48);
  box-shadow: 0 9px 0 #9f1239, 0 14px 26px rgba(225, 29, 72, .35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff;
}
.mic-btn:active:not(:disabled) { transform: translateY(7px); box-shadow: 0 2px 0 #9f1239; }
.mic-icon { font-size: clamp(46px, 13vw, 64px); line-height: 1; }
.mic-label { font-weight: 900; font-size: 17px; }
.mic-btn[data-state="idle"] { animation: breathe 1.8s ease-in-out infinite; }
.mic-btn[data-state="listening"] { background: radial-gradient(circle at 35% 30%, #4ade80, #16a34a); box-shadow: 0 9px 0 #166534; }
.mic-btn[data-state="listening"] .mic-rings { position: absolute; inset: -10px; border-radius: 50%; border: 6px solid #4ade80; animation: ring 1s ease-out infinite; }
.mic-btn[data-state="thinking"], .mic-btn[data-state="off"] { opacity: .55; filter: grayscale(.4); }
.mic-btn:disabled { cursor: default; }

.manual-judge { background: #fff; border-radius: 20px; padding: 12px 18px; text-align: center; font-weight: 800; box-shadow: 0 6px 0 rgba(0,0,0,.1); }

/* balloons */
.balloon-field { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(12px, 4vw, 34px); padding: 20px 0; }
.balloon {
  position: relative;
  width: clamp(100px, 24vw, 150px); height: clamp(120px, 29vw, 180px);
  border-radius: 50% 50% 48% 52% / 58% 58% 42% 42%;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.65), transparent 30%), var(--c);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0,0,0,.2);
  animation: float 2.6s ease-in-out infinite;
  animation-delay: var(--d);
  opacity: .55;
  transform-origin: center bottom;
}
.balloon::after { content: ''; position: absolute; bottom: -38px; left: 50%; width: 2px; height: 40px; background: rgba(15,23,42,.35); }
.balloon .wv-syllable { font-size: clamp(38px, 10vw, 64px); }
.balloon .wv-part.ok, .balloon .wv-part.bad { background: rgba(255,255,255,.9); }
.balloon.target { opacity: 1; box-shadow: 0 0 0 6px #fff, 0 0 30px 10px rgba(250, 204, 21, .9); }
.balloon.popped { animation: pop-out .35s forwards; }
.balloon.fly-away { animation: fly-away 1s forwards; }

/* rocket */
.rocket-scene { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 5vw, 48px); width: 100%; max-width: 900px; }
.rocket-pad { display: flex; align-items: flex-end; gap: 10px; }
.rocket { font-size: clamp(80px, 20vw, 140px); transform: rotate(-45deg); transition: transform 1.4s cubic-bezier(.5,0,.8,.2); }
.rocket.launch { transform: translateY(-120vh) rotate(-45deg); }
.fuel-tank { width: 30px; height: clamp(160px, 38vh, 300px); background: #fff; border-radius: 999px; overflow: hidden; display: flex; align-items: flex-end; box-shadow: inset 0 3px 0 rgba(0,0,0,.1); }
.fuel-level { width: 100%; height: 0; background: linear-gradient(0deg, #f97316, #facc15); transition: height .6s cubic-bezier(.3,1.4,.6,1); }
.rocket-list { display: flex; flex-direction: column; gap: 10px; max-height: 48vh; overflow-y: auto; padding: 6px; }
.rocket-word { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.7); border-radius: 18px; padding: 8px 16px; font-weight: 900; font-size: clamp(22px, 5vw, 32px); opacity: .7; transition: all .25s; }
.rocket-word.current { background: #fff; opacity: 1; transform: scale(1.06); box-shadow: 0 6px 0 rgba(0,0,0,.12); }
.rocket-list { flex: 1; min-width: 0; max-width: 460px; }
.rocket-word .wv-word { font-size: clamp(24px, 6.5vw, 44px); }
.rocket-word.current .wv-word { font-size: clamp(30px, 8vw, 56px); }
.rocket-word.done { opacity: 1; background: #dcfce7; }
.rocket-word.done::after { content: '✅'; }
.rocket-word.tried { opacity: 1; background: #ffedd5; }
.rw-emoji { font-size: 1.2em; }

/* listen & tap */
.speaker-btn { width: clamp(120px, 30vw, 170px); height: clamp(120px, 30vw, 170px); border-radius: 50%; border: 0; background: var(--blue); font-size: clamp(56px, 14vw, 80px); box-shadow: 0 9px 0 var(--blue-d); }
.speaker-btn:active { transform: translateY(7px); box-shadow: 0 2px 0 var(--blue-d); }
.choices { display: grid; gap: 16px; width: min(94vw, 760px); grid-template-columns: repeat(3, 1fr); }
.choices.n4 { grid-template-columns: repeat(2, 1fr); }
.choice { border: 0; background: #fff; border-radius: 22px; padding: 22px 8px; font-size: clamp(28px, 7vw, 48px); font-weight: 900; box-shadow: 0 7px 0 #cbd5e1; }
.choice:active { transform: translateY(5px); box-shadow: 0 2px 0 #cbd5e1; }
.choice.right { background: #dcfce7; color: var(--ok); box-shadow: 0 7px 0 #86efac; animation: bounce .5s; }
.choice.wrong { background: #ffedd5; color: var(--bad); animation: shake .45s; opacity: .55; }

/* results */
.results .row { flex-wrap: nowrap; }
.results { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.res-stars { display: flex; gap: 8px; font-size: clamp(56px, 15vw, 90px); }
.res-star { filter: grayscale(1) opacity(.3); transform: scale(.7); transition: all .3s; }
.res-star.on.pop { filter: none; transform: scale(1.1); animation: bounce .5s; }
.res-coins { font-size: clamp(30px, 8vw, 44px); font-weight: 900; background: #fff; border-radius: 999px; padding: 6px 24px; box-shadow: 0 5px 0 rgba(0,0,0,.1); }
.res-stickers { font-weight: 900; font-size: 20px; }
.sticker-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; font-size: 40px; }
.sticker { animation: pop-in .4s; }

/* overlays */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 32px; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 520px; width: 100%; }
.chest-big { font-size: 140px; border: 0; background: none; line-height: 1; }

/* shop */
.shop-hero { display: flex; justify-content: center; padding: 10px 0 4px; }
.shop-section { background: rgba(255,255,255,.75); border-radius: var(--radius); padding: 12px 14px; margin: 12px auto; max-width: 820px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.shop-item { border: 0; background: #fff; border-radius: 20px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 5px 0 #cbd5e1; }
.shop-item:active { transform: translateY(4px); box-shadow: 0 1px 0 #cbd5e1; }
.shop-item.wearing { box-shadow: 0 0 0 4px var(--green), 0 5px 0 var(--green-d); }
.shop-item.poor { opacity: .55; }
.shop-emoji { font-size: 46px; line-height: 1.1; }
.swatch { width: 50px; height: 50px; border-radius: 50%; border: 4px solid rgba(0,0,0,.1); }
.shop-price { font-weight: 900; font-size: 17px; }

/* album */
.album-head { display: flex; align-items: center; justify-content: center; gap: 14px; }
.album-count { background: #fff; font-weight: 900; font-size: 22px; border-radius: 999px; padding: 4px 14px; box-shadow: 0 4px 0 rgba(0,0,0,.1); }
.album-page { background: #fff; border-radius: var(--radius); padding: 12px 14px; margin: 14px auto; max-width: 900px; border-top: 10px solid var(--unit); }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.sticker-slot { border: 3px dashed #cbd5e1; background: #f8fafc; border-radius: 18px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; }
.sticker-slot.got { border: 3px solid var(--unit); background: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.08); }
.sticker-emoji { font-size: 40px; line-height: 1.15; }
.sticker-slot:not(.got) .sticker-emoji { filter: grayscale(1); opacity: .4; }
.sticker-word { font-weight: 900; font-size: 15px; }

/* parent */
.parent { background: #f1f5f9; }
.parent-top { display: flex; align-items: center; gap: 12px; }
.parent-top h1 { font-size: 24px; }
.parent-body { display: flex; flex-direction: column; gap: 14px; max-width: 760px; width: 100%; margin: 0 auto; }
.parent .card { box-shadow: 0 3px 0 rgba(15,23,42,.08); }
.parent h3 { margin: 14px 0 6px; font-size: 17px; }
.gate { max-width: 420px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.gate-input { font-size: 32px; width: 160px; text-align: center; border-radius: 16px; border: 3px solid #cbd5e1; padding: 8px; }
.gate-err { color: var(--red); min-height: 1em; margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 800; margin: 10px 0; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
.select, .text { font-size: 17px; padding: 10px; border-radius: 12px; border: 2px solid #cbd5e1; background: #fff; }
.switch { width: 24px; height: 24px; accent-color: var(--green); }
.test-out { background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 10px; font-size: 14px; white-space: pre-wrap; min-height: 1em; }
.test-out:empty { display: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.stats > div { background: #f8fafc; border-radius: 12px; padding: 8px 10px; }
.stats b { font-size: 22px; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 70px 1fr 48px; align-items: center; gap: 8px; font-weight: 800; }
.bar { height: 16px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; }
.bar-fill.low { background: var(--red); }
.bar-fill.mid { background: var(--gold); }
.bar-fill.high { background: var(--green); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #ffedd5; color: var(--orange-d); font-weight: 800; border-radius: 999px; padding: 4px 10px; }

/* welcome / rest */
.welcome .stage { gap: 14px; overflow-y: auto; padding-bottom: 20px; }
.welcome .stage .card { min-width: 0; width: min(86vw, 520px); }
.logo { font-size: clamp(56px, 16vw, 100px); color: #fff; text-shadow: 0 6px 0 rgba(30, 41, 59, .25); letter-spacing: -.02em; }
.logo span { color: var(--gold); }
.egg { font-size: clamp(120px, 34vw, 200px); border: 0; background: none; line-height: 1; }
.egg.crack { animation: pop-out .7s forwards; }

/* floating text & confetti */
.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }
.float-text { position: fixed; transform: translateX(-50%); font-weight: 900; font-size: 28px; color: #ca8a04; text-shadow: 0 2px 0 #fff, 0 0 8px #fff; pointer-events: none; z-index: 70; animation: float-up 1.2s ease-out forwards; }

/* motion */
.pop-in { animation: pop-in .35s cubic-bezier(.3,1.5,.6,1); }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
.shake { animation: wiggle 1.4s ease-in-out infinite; }
@keyframes pop-in { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pop-out { to { transform: scale(1.5); opacity: 0; } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-14px); } 70% { transform: translateY(-4px); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }
@keyframes wiggle { 0%,60%,100% { transform: rotate(0); } 70% { transform: rotate(-10deg); } 80% { transform: rotate(10deg); } 90% { transform: rotate(-6deg); } }
@keyframes lean { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.play-fab.pulse { animation: fab-pulse 1.4s ease-in-out infinite; }
@keyframes fab-pulse { 0%,100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.06); } }
@keyframes pulse-ring { 0% { box-shadow: 0 8px 0 rgba(0,0,0,.25), 0 0 0 0 rgba(255,255,255,.9); } 100% { box-shadow: 0 8px 0 rgba(0,0,0,.25), 0 0 0 22px rgba(255,255,255,0); } }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes ring { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-14px) rotate(2deg); } }
@keyframes fly-away { to { transform: translateY(-90vh) rotate(12deg); opacity: 0; } }
@keyframes float-up { from { transform: translate(-50%, 0); opacity: 1; } to { transform: translate(-50%, -80px); opacity: 0; } }

/* iPad / landscape: more breathing room */
@media (min-width: 768px) {
  .node { width: 96px; height: 88px; }
  .node.current { width: 116px; height: 106px; }
  .node-icon { font-size: 42px; }
  .play-fab { bottom: calc(var(--safe-b) + 110px); }
}
@media (max-height: 560px) and (orientation: landscape) {
  .stage { flex-direction: row; flex-wrap: wrap; padding-bottom: 10px; }
  .kai-corner { display: none; }
  .big-emoji { font-size: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
