:root {
  --bg: #FFF6EC;
  --ink: #3B2A20;
  --muted: #86705F;
  --card: #FFFFFF;
  --line: #EEDDCB;
  --accent: #F28C38;
  --accent-d: #D46B17;
  --good: #57B877;
  --mid: #F2B441;
  --low: #E8695B;
  --sheet: #FFFAF3;
  --shadow: 0 6px 18px rgba(80, 45, 20, .14);
  --r: 20px;
  /* System fonts only — nothing is downloaded. On iPhone/iPad this is SF Pro Rounded. */
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #2E241D; color: var(--ink); }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible { outline: 3px solid #5B8DEF; outline-offset: 2px; }
[hidden] { display: none !important; }

#app {
  position: relative; max-width: 430px; margin: 0 auto; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden; background: var(--bg);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- Top bar & meters ---------- */
.topbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; background: var(--bg); z-index: 5; }
.meters { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.meter { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.meter .mi { font-size: 20px; line-height: 1; }
.meter .lbl { font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .2px; }
.meter .bar { width: 100%; height: 9px; border-radius: 9px; background: #EFE1D2; overflow: hidden; }
.meter .bar i { display: block; height: 100%; border-radius: 9px; background: var(--good); transition: width .6s ease, background-color .6s; }
.meter.mid .bar i { background: var(--mid); }
.meter.low .bar i { background: var(--low); }
.meter.low .mi { animation: wobble 1.2s ease-in-out infinite; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--card); box-shadow: var(--shadow); font-size: 18px; color: var(--ink); flex: none; }

/* ---------- Stage ---------- */
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
#room { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.dim { position: absolute; inset: 0; background: #0E1330; opacity: 0; pointer-events: none; transition: opacity 1.2s ease; z-index: 2; }
.stage.sleeping .dim { opacity: .55; }
#foxWrap {
  position: absolute; left: 50%; bottom: 2%; height: 80%; width: auto; max-width: 96%; aspect-ratio: 236 / 345;
  transform: translateX(-50%); z-index: 3; touch-action: none; cursor: pointer;
}
/* Tall cat: hand gestures */
#fox .arm { transform-box: fill-box; transition: transform .35s cubic-bezier(.3, 1.3, .5, 1); }
#fox #armL { transform-origin: 85% 3%; }
#fox #armR { transform-origin: 15% 3%; }
#fox .m-excited #armL { transform: rotate(35deg); }
#fox .m-excited #armR { transform: rotate(-35deg); }
#fox .m-sad .arm, #fox .m-asleep .arm { transform: rotate(0); }
#fox .rub #armL { transform: rotate(-38deg); }
#fox .rub #armR { transform: rotate(38deg); }
#fox .wave #armR { animation: wave .45s ease-in-out 4; }
#fox .flail #armL { animation: flailL .22s ease-in-out 4; }
#fox .flail #armR { animation: flailR .22s ease-in-out 4; }
#fox .chin #armR { transform: rotate(-150deg) translate(4px, 0); }
@keyframes wave { 0%, 100% { transform: rotate(-160deg); } 50% { transform: rotate(-125deg); } }
@keyframes flailL { 0%, 100% { transform: rotate(110deg); } 50% { transform: rotate(150deg); } }
@keyframes flailR { 0%, 100% { transform: rotate(-110deg); } 50% { transform: rotate(-150deg); } }
#foxMover { width: 100%; height: 100%; }
#fox { width: 100%; height: 100%; overflow: visible; display: block; }
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
#zzz { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

.speech {
  position: absolute; left: 50%; top: 2%; transform: translate(-50%, 8px) scale(.9); z-index: 6;
  background: #fff; padding: 10px 16px; border-radius: 18px; font-weight: 900; font-size: 19px;
  box-shadow: var(--shadow); opacity: 0; transition: opacity .2s, transform .25s; pointer-events: none; white-space: nowrap; max-width: 90%;
}
.speech::after { content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -8px; border: 8px solid transparent; border-bottom: 0; border-top-color: #fff; }
.speech.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast {
  position: absolute; left: 50%; bottom: 12px; transform: translate(-50%, 20px); z-index: 7; opacity: 0;
  background: rgba(59, 42, 32, .92); color: #fff; padding: 9px 14px; border-radius: 14px; font-weight: 800; font-size: 14px;
  transition: opacity .25s, transform .25s; pointer-events: none; text-align: center; max-width: 88%;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Fox parts & moods ---------- */
#fox .ear { transform-box: fill-box; transform-origin: 50% 92%; transition: transform .45s cubic-bezier(.3, 1.4, .5, 1); }
#fox #tail { transform-box: fill-box; transform-origin: 8% 92%; transition: transform .5s; }
#fox #head { transform-box: fill-box; transform-origin: 50% 85%; transition: transform .5s; }
#fox #headBob { transform-box: fill-box; transform-origin: 50% 100%; }
#fox #bodyGroup { transform-box: fill-box; transform-origin: 50% 100%; }
#fox .m-sad #earL, #fox .m-sleepy #earL, #fox .m-asleep #earL { transform: rotate(-30deg); }
#fox .m-sad #earR, #fox .m-sleepy #earR, #fox .m-asleep #earR { transform: rotate(30deg); }
#fox .m-dirty #earL { transform: rotate(-12deg); }
#fox .m-hungry #earR { transform: rotate(14deg); }
#fox .m-excited .ear, #fox .listening .ear { transform: scale(1.12); }
#fox .m-sad #tail, #fox .m-asleep #tail { transform: rotate(28deg); }
#fox .m-happy #tail, #fox .m-hungry #tail, #fox .m-dirty #tail { animation: wag 2.2s ease-in-out infinite; }
#fox .m-excited #tail { animation: wag .5s ease-in-out infinite; }
#fox .m-sleepy #tail { animation: wag 4s ease-in-out infinite; }
#fox #bodyGroup, #fox #headBob { animation: breathe 3.4s ease-in-out infinite; }
#fox .m-asleep #bodyGroup, #fox .m-asleep #headBob { animation-duration: 5s; }
#fox .tilt #head { transform: rotate(-8deg); }
#fox .tilt2 #head { transform: rotate(7deg); }
#fox .twitchL #earL { animation: twitch .35s ease-in-out 2; }
#fox .twitchR #earR { animation: twitch .35s ease-in-out 2; }
#fox .listening #head { transform: rotate(-6deg); }

@keyframes wag { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(13deg); } }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, .988); } }
@keyframes twitch { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-14deg); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }

/* Reactions on the mover */
#foxMover.r-giggle { animation: giggle .8s ease-in-out; }
#foxMover.r-jump { animation: jump .75s cubic-bezier(.3, .7, .4, 1); }
#foxMover.r-spin { animation: spin .8s ease-in-out; }
#foxMover.r-sneeze { animation: sneeze 1.2s ease-in-out; }
#foxMover.r-tickle { animation: tickle .22s linear infinite; }
#foxMover.r-shake { animation: shakeno .6s ease-in-out; }
#foxMover.r-chomp { animation: chomp .3s ease-in-out 3; }
#foxMover.r-hop { animation: hop .5s ease-out; }
@keyframes giggle { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-7deg); } 35% { transform: rotate(7deg); } 55% { transform: rotate(-5deg); } 75% { transform: rotate(4deg); } }
@keyframes jump { 0% { transform: translateY(0) scale(1, 1); } 15% { transform: translateY(0) scale(1.08, .9); } 45% { transform: translateY(-32%) scale(.95, 1.06); } 75% { transform: translateY(0) scale(1.06, .93); } 100% { transform: translateY(0) scale(1, 1); } }
@keyframes spin { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(.92); } 100% { transform: rotate(360deg) scale(1); } }
@keyframes sneeze { 0% { transform: none; } 45% { transform: rotate(-6deg) scale(1.04, .97) translateY(-2%); } 55% { transform: rotate(5deg) scale(.95, 1.05) translateY(2%); } 70% { transform: rotate(-2deg); } 100% { transform: none; } }
@keyframes tickle { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-2%) rotate(-2deg); } 75% { transform: translateX(2%) rotate(2deg); } }
@keyframes shakeno { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-4%); } 40%, 80% { transform: translateX(4%); } }
@keyframes chomp { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, .96); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8%); } }

/* Particles */
.pt { position: absolute; font-size: 26px; line-height: 1; transform: translate(-50%, -50%); will-change: transform, opacity; }
.zz { position: absolute; font-weight: 900; color: #CFE0FF; font-size: 28px; text-shadow: 0 2px 6px rgba(0, 0, 0, .3); animation: zfloat 3s ease-out forwards; }
@keyframes zfloat { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(40px, -120px) scale(1.3); } }

/* ---------- Bath bar ---------- */
.bathbar {
  position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 8; background: rgba(255, 255, 255, .95);
  border-radius: 22px; padding: 10px; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
}
.bath-steps { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: center; font-size: 13px; font-weight: 800; color: var(--muted); }
.bath-steps span { padding: 3px 9px; border-radius: 10px; background: #F4ECE3; }
.bath-steps span.done { background: #DDF3E4; color: #2F7A49; }
.bath-tools { display: flex; gap: 8px; }
.tool { flex: 1; min-height: 58px; border-radius: 16px; background: #F7EFE6; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; gap: 2px; }
.tool .ic { font-size: 24px; }
.tool.sel { background: #FFE2C7; box-shadow: inset 0 0 0 3px var(--accent); }
.pill-btn { min-height: 48px; padding: 0 18px; border-radius: 16px; background: var(--accent); color: #fff; font-weight: 900; font-size: 16px; box-shadow: 0 3px 0 var(--accent-d); }
.pill-btn.ghost { background: #F1E6DA; color: var(--ink); box-shadow: 0 3px 0 #DCCAB7; }
.pill-btn.danger { background: var(--low); box-shadow: 0 3px 0 #B9473B; }
.pill-btn:active { transform: translateY(2px); box-shadow: none; }

/* ---------- Mic row ---------- */
.microw { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 14px 4px; background: var(--bg); z-index: 5; }
.side-btn { justify-self: center; min-width: 76px; min-height: 56px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; gap: 1px; padding: 4px 8px; }
.side-btn .ic { font-size: 20px; }
.mic {
  position: relative; width: 92px; height: 92px; border-radius: 50%; color: #fff;
  background: radial-gradient(circle at 35% 30%, #FFAE63, #EE7A22 70%); box-shadow: 0 6px 0 #C45F12, 0 10px 22px rgba(196, 95, 18, .35);
  display: grid; place-items: center; transition: transform .15s;
}
.mic:active { transform: translateY(3px); box-shadow: 0 3px 0 #C45F12; }
.mic-ic { width: 42px; height: 42px; }
.mic-ring { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); transform: rotate(-90deg); pointer-events: none; }
.mic-ring circle { fill: none; stroke-width: 5; }
.ring-bg { stroke: transparent; }
.ring-fg { stroke: #E8695B; stroke-linecap: round; stroke-dasharray: 289; stroke-dashoffset: 289; }
.mic .stop-ic { display: none; width: 30px; height: 30px; border-radius: 7px; background: #fff; }
.mic.recording { background: radial-gradient(circle at 35% 30%, #FF8C7E, #E04E3E 70%); box-shadow: 0 6px 0 #A9342A, 0 0 0 calc(var(--lvl, 0) * 18px) rgba(232, 105, 91, .25); }
.mic.recording .mic-ic { display: none; }
.mic.recording .stop-ic { display: block; }
.mic.recording .ring-bg { stroke: rgba(232, 105, 91, .2); }
.mic.busy { filter: saturate(.6); }
.mic.disabled { filter: grayscale(.7); opacity: .7; }
.mic-caption { grid-column: 1 / -1; text-align: center; font-weight: 800; font-size: 13px; color: var(--muted); margin-top: 10px; min-height: 18px; }
.save-chip { position: absolute; left: 50%; top: -46px; transform: translateX(-50%); z-index: 9; background: #fff; border-radius: 18px; padding: 10px 16px; font-weight: 900; box-shadow: var(--shadow); min-height: 44px; animation: popin .3s ease; }
@keyframes popin { from { transform: translateX(-50%) scale(.6); opacity: 0; } }

/* ---------- Action bar ---------- */
.actions { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 8px 10px 12px; background: var(--bg); z-index: 5; }
.act { min-height: 64px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 800; font-size: 12px; position: relative; }
.act .ic { font-size: 25px; line-height: 1.1; }
.act.on { background: #FFE2C7; box-shadow: inset 0 0 0 3px var(--accent); }
.act.nudge::after { content: ""; position: absolute; top: 6px; right: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--low); box-shadow: 0 0 0 3px #fff; animation: pulse 1.4s ease-in-out infinite; }
.act.nudge .ic { animation: wobble 1.6s ease-in-out infinite; }
.act:active { transform: scale(.96); }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }

/* ---------- Sheet ---------- */
.sheet-backdrop { position: absolute; inset: 0; background: rgba(40, 25, 15, .35); z-index: 20; animation: fade .2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 82%; display: flex; flex-direction: column;
  background: var(--sheet); border-radius: 26px 26px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .18); animation: slideup .28s cubic-bezier(.2, .9, .3, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-grab { width: 44px; height: 5px; border-radius: 4px; background: #E0CFBE; margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 4px 20px; }
.sheet-head h2 { margin: 0; font-size: 22px; font-weight: 900; }
.sheet-head .close { box-shadow: none; background: #F1E6DA; }
.sheet-body { overflow-y: auto; padding: 8px 16px 20px; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
@keyframes slideup { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.grid { display: grid; gap: 10px; }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.grid.g4 { grid-template-columns: repeat(4, 1fr); }
.tile { background: #fff; border-radius: 18px; min-height: 96px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 2px 8px rgba(80, 45, 20, .08); font-weight: 800; font-size: 13px; text-align: center; position: relative; }
.tile .big { font-size: 40px; line-height: 1.1; }
.tile svg { width: 64px; height: 64px; }
.tile.sel { box-shadow: inset 0 0 0 3px var(--accent), 0 2px 8px rgba(80, 45, 20, .08); background: #FFF1E3; }
.tile.sel::after { content: "✓"; position: absolute; top: 5px; right: 8px; color: var(--accent-d); font-weight: 900; }
.tags { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 8px; background: #F4ECE3; color: var(--muted); }
.tag.plus { background: #E1F4E7; color: #2F7A49; }
.tag.minus { background: #FBE4E1; color: #A33E32; }
.tabs { display: flex; background: #F1E6DA; border-radius: 16px; padding: 4px; margin-bottom: 12px; }
.tabs button { flex: 1; min-height: 42px; border-radius: 12px; font-weight: 900; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.section-label { font-weight: 900; font-size: 14px; color: var(--muted); margin: 14px 2px 8px; text-transform: uppercase; letter-spacing: .6px; }
.swatch { width: 100%; aspect-ratio: 1; border-radius: 16px; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .1); }
.swatch-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; }
.swatch-btn.sel .swatch { box-shadow: 0 0 0 3px var(--accent); }
.seg { display: flex; background: #F1E6DA; border-radius: 14px; padding: 4px; gap: 2px; }
.seg button { flex: 1; min-height: 40px; border-radius: 10px; font-weight: 800; font-size: 14px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border-radius: 16px; padding: 12px 14px; min-height: 56px; margin-bottom: 8px; font-weight: 800; }
.row small { display: block; font-weight: 600; color: var(--muted); font-size: 12px; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 16px; background: #DCCDBE; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.note { background: #EEF6FF; color: #2D4A6B; border-radius: 16px; padding: 12px 14px; font-size: 14px; line-height: 1.45; font-weight: 600; margin-bottom: 10px; }
.note b { font-weight: 900; }
.note.warm { background: #FFF1DF; color: #6B4524; }
.empty { text-align: center; color: var(--muted); padding: 26px 12px; font-weight: 700; line-height: 1.5; }
.empty .big { font-size: 46px; display: block; margin-bottom: 6px; }
.saying { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 16px; padding: 8px 8px 8px 14px; margin-bottom: 8px; }
.saying .meta { flex: 1; min-width: 0; font-weight: 800; }
.saying .meta small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.round { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; background: #F1E6DA; flex: none; }
.round.play { background: var(--accent); color: #fff; }
.count { font-size: 13px; color: var(--muted); font-weight: 800; text-align: right; margin-bottom: 8px; }

/* ---------- Overlay: games, onboarding ---------- */
.overlay { position: absolute; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; animation: fade .2s; }
.game-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); }
.game-head h2 { margin: 0; flex: 1; font-size: 20px; font-weight: 900; }
.score { font-weight: 900; background: #fff; border-radius: 14px; padding: 8px 12px; box-shadow: var(--shadow); min-width: 64px; text-align: center; }
.game-area { position: relative; flex: 1; overflow: hidden; touch-action: none; }
.game-area.sky { background: linear-gradient(#BFE3FF, #EAF6FF); }
.balloon { position: absolute; bottom: 0; width: 70px; height: 104px; cursor: pointer; touch-action: none; }
.balloon svg { width: 100%; height: 100%; pointer-events: none; }
.mem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px; max-width: 380px; margin: 0 auto; }
.card { aspect-ratio: 3 / 3.4; perspective: 600px; }
.card-in { position: relative; width: 100%; height: 100%; transition: transform .35s; transform-style: preserve-3d; }
.card.up .card-in, .card.done .card-in { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: grid; place-items: center; box-shadow: var(--shadow); }
.card-back { background: repeating-linear-gradient(45deg, #F7A35B, #F7A35B 10px, #F29A4C 10px, #F29A4C 20px); color: #fff; font-size: 30px; font-weight: 900; }
.card-front { background: #fff; transform: rotateY(180deg); }
.card-front svg { width: 80%; height: 80%; }
.card.done .card-front { background: #E1F4E7; }
.game-tip { text-align: center; font-weight: 800; color: var(--muted); padding: 8px 16px 14px; }
.result { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 246, 236, .92); z-index: 5; animation: fade .3s; }
.result-card { background: #fff; border-radius: 26px; padding: 26px 22px; width: min(86%, 330px); text-align: center; box-shadow: var(--shadow); }
.result-card h3 { margin: 6px 0; font-size: 26px; font-weight: 900; }
.result-card p { color: var(--muted); font-weight: 700; margin: 6px 0 16px; }
.result-card .big { font-size: 56px; }
.result-card .pill-btn { width: 100%; margin-top: 8px; }
canvas.catch { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.onb { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column; justify-content: flex-end; background: linear-gradient(rgba(255, 246, 236, 0) 30%, rgba(255, 246, 236, .7) 55%); animation: fade .3s; }
.onb-card { background: #fff; margin: 12px; border-radius: 28px; padding: 22px 20px 18px; box-shadow: 0 10px 30px rgba(80, 45, 20, .22); margin-bottom: calc(12px + env(safe-area-inset-bottom)); }
.onb-card h2 { margin: 0 0 8px; font-size: 26px; font-weight: 900; }
.onb-card p { margin: 0 0 12px; color: #5E4A3C; font-size: 16px; line-height: 1.5; font-weight: 600; }
.onb-dots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 14px; }
.onb-dots i { width: 8px; height: 8px; border-radius: 4px; background: #E6D6C5; transition: width .2s; }
.onb-dots i.on { width: 22px; background: var(--accent); }
.onb-btns { display: flex; gap: 10px; }
.onb-btns .pill-btn { flex: 1; }
.howto { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 14px; }
.howto div { background: #FFF4E8; border-radius: 14px; padding: 8px 4px; text-align: center; font-size: 12px; font-weight: 800; }
.howto div span { display: block; font-size: 26px; }
.mic-status { font-weight: 800; font-size: 14px; margin: -4px 0 12px; min-height: 20px; }
.mic-status.ok { color: #2F7A49; }
.mic-status.no { color: #A33E32; }

.dialog-wrap { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(40, 25, 15, .45); animation: fade .15s; padding: 16px; }
.dialog { background: #fff; border-radius: 24px; padding: 22px 20px 18px; width: min(100%, 340px); box-shadow: 0 20px 40px rgba(0, 0, 0, .25); }
.dialog h3 { margin: 0 0 8px; font-size: 21px; font-weight: 900; }
.dialog p { margin: 0 0 14px; color: #5E4A3C; line-height: 1.5; font-weight: 600; font-size: 15px; }
.dialog .btns { display: flex; gap: 10px; }
.dialog .btns .pill-btn { flex: 1; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; margin: 0 0 14px; font-size: 14px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* ---------- Reduced motion ---------- */
.rm #fox *, .rm #foxMover { animation: none !important; }
.rm #foxMover.r-giggle, .rm #foxMover.r-jump, .rm #foxMover.r-spin, .rm #foxMover.r-sneeze, .rm #foxMover.r-tickle, .rm #foxMover.r-shake, .rm #foxMover.r-hop { animation: rmpulse .5s ease !important; }
.rm .act.nudge .ic, .rm .meter.low .mi { animation: none; }
.rm .sheet, .rm .overlay, .rm .onb { animation: none; }
.rm .zz { animation-duration: 4.5s; }
@keyframes rmpulse { 50% { opacity: .75; } }

@media (max-height: 640px) {
  .mic { width: 78px; height: 78px; }
  .act { min-height: 56px; }
  .act .ic { font-size: 22px; }
  .meter .lbl { display: none; }
  .mic-caption { margin-top: 6px; }
}
@media (max-width: 350px) {
  .act { font-size: 10.5px; }
  .side-btn { min-width: 64px; }
}
.stage.bathing .toast { bottom: 150px; }
#foxWrap { transition: filter 1.2s ease; }
.stage.sleeping #foxWrap { filter: brightness(.78) saturate(.85); }

/* ---------- Extras: hands-free, shows, party, piano, trophies, games ---------- */
.mic-caption { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.auto-pill { min-height: 34px; padding: 4px 12px; border-radius: 17px; background: #F1E6DA; font-weight: 900; font-size: 12px; color: var(--muted); }
.auto-pill[aria-pressed="true"] { background: #DDF3E4; color: #2F7A49; }
.mic.live::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 3px solid rgba(87, 184, 119, .75); animation: livepulse 1.8s ease-out infinite; pointer-events: none; }
@keyframes livepulse { 0% { transform: scale(.94); opacity: 1; } 100% { transform: scale(1.28); opacity: 0; } }

#foxMover.r-dance { animation: dance .6s ease-in-out infinite; }
#foxMover.r-stretch { animation: stretch 2s ease-in-out; }
@keyframes dance { 0%, 100% { transform: rotate(-6deg) translateY(0); } 25% { transform: rotate(0) translateY(-4%); } 50% { transform: rotate(6deg) translateY(0); } 75% { transform: rotate(0) translateY(-4%); } }
@keyframes stretch { 0%, 100% { transform: scale(1, 1); } 40%, 60% { transform: scale(.95, 1.07); } }
#fox .dancearms #armL { animation: danceL .6s ease-in-out infinite; }
#fox .dancearms #armR { animation: danceR .6s ease-in-out infinite; }
@keyframes danceL { 0%, 100% { transform: rotate(20deg); } 50% { transform: rotate(135deg); } }
@keyframes danceR { 0%, 100% { transform: rotate(-135deg); } 50% { transform: rotate(-20deg); } }
#fox .reach #armL { transform: rotate(160deg); }
#fox .reach #armR { transform: rotate(-160deg); }
#fox .peek #armL { transform: rotate(-150deg); }
#fox .peek #armR { transform: rotate(150deg); }

.disco { position: absolute; inset: -60%; z-index: 2; pointer-events: none; mix-blend-mode: screen; opacity: .8;
  background: conic-gradient(from 0deg, rgba(255, 80, 140, .35), rgba(80, 160, 255, .35), rgba(255, 220, 80, .35), rgba(120, 255, 170, .35), rgba(200, 120, 255, .35), rgba(255, 80, 140, .35));
  animation: discospin 3s linear infinite; }
@keyframes discospin { to { transform: rotate(360deg); } }
.party-stop { position: absolute; right: 12px; top: 12px; z-index: 8; min-height: 44px; }

.gift { position: absolute; left: 5%; bottom: 10%; z-index: 5; width: 68px; height: 68px; font-size: 46px; line-height: 1; border-radius: 20px; animation: giftbob 1.3s ease-in-out infinite; filter: drop-shadow(0 4px 6px rgba(0,0,0,.25)); }
@keyframes giftbob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: #fff; border-radius: 16px; padding: 10px 6px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.stat span { font-size: 22px; }
.stat b { font-size: 22px; color: var(--ink); font-weight: 900; }
.tile.badge { min-height: 118px; }
.tile.badge.locked { opacity: .5; filter: grayscale(1); }

.piano { display: flex; gap: 6px; height: 170px; }
.key { flex: 1; border-radius: 12px 12px 16px 16px; color: #fff; font-weight: 900; font-size: 18px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12px; box-shadow: inset 0 -8px 0 rgba(0,0,0,.18); touch-action: none; transition: transform .08s; }
.key.down { transform: translateY(4px) scale(.97); box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); filter: brightness(1.15); }

.simon { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 22px; max-width: 360px; margin: 0 auto; }
.pad { aspect-ratio: 1; border-radius: 28px; font-size: 44px; opacity: .55; transition: opacity .1s, transform .1s; box-shadow: var(--shadow); touch-action: none; }
.pad.lit { opacity: 1; transform: scale(1.05); }

.rm #foxMover.r-dance, .rm #foxMover.r-stretch { animation: rmpulse .6s ease !important; }
.rm .disco { animation: none; }
.rm .gift { animation: none; }
.rm .mic.live::before { animation: none; opacity: .8; }
@media (max-height: 640px) { .auto-pill { min-height: 30px; } }

/* ---------- iPad (and any wide screen): use the full width, bigger controls ---------- */
@media (min-width: 600px) {
  #app { max-width: 900px; }
  .topbar { padding: 16px 22px 10px; gap: 12px; }
  .meters { gap: 16px; }
  .meter .mi { font-size: 26px; }
  .meter .lbl { font-size: 13px; }
  .meter .bar { height: 12px; }
  .icon-btn { width: 54px; height: 54px; font-size: 22px; border-radius: 16px; }
  #foxWrap { height: 82%; }
  .speech { font-size: 24px; padding: 12px 20px; }
  .toast { font-size: 16px; }
  .microw { padding: 14px 40px 6px; }
  .mic { width: 118px; height: 118px; }
  .mic-ic { width: 52px; height: 52px; }
  .side-btn { min-width: 110px; min-height: 68px; font-size: 14px; }
  .side-btn .ic { font-size: 26px; }
  .auto-pill { font-size: 14px; min-height: 40px; padding: 4px 16px; }
  .mic-caption { font-size: 15px; }
  .actions { gap: 12px; padding: 10px 22px 18px; }
  .act { min-height: 84px; font-size: 15px; border-radius: 22px; }
  .act .ic { font-size: 32px; }
  .sheet { max-width: 680px; margin: 0 auto; }
  .bathbar { max-width: 620px; margin: 0 auto; }
  .grid.g3 { grid-template-columns: repeat(4, 1fr); }
  .tile { min-height: 116px; font-size: 14px; }
  .onb-card { max-width: 620px; margin-left: auto; margin-right: auto; }
  .mem-grid { max-width: 520px; grid-template-columns: repeat(4, 1fr); }
  .simon { max-width: 460px; }
  .piano { height: 220px; }
}
