:root {
  color-scheme: light;
  --sun: #ffd84d;
  --sun-deep: #ffb400;
  --cream: #fff8ea;
  --paper: #ffffff;
  --ink: #3a2a1f;
  --ink-soft: #7a6555;
  --line: #f1e3cc;
  --sky: #dff1ff;
  --good: #2bb673;
  --try: #ff8a3d;
  --accent: #ff8a5c;
  --radius: 22px;
  --shadow: 0 10px 24px rgba(120, 80, 20, .12), 0 2px 4px rgba(120, 80, 20, .08);
  --font: ui-rounded, "Nunito", "Arial Rounded MT Bold", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -200px, #fff1b8 0%, transparent 70%),
    linear-gradient(180deg, var(--cream), #fff3dc);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 4px solid #3a86ff; outline-offset: 3px; border-radius: 12px; }

.app { max-width: 1100px; margin: 0 auto; padding: 0 16px calc(28px + env(safe-area-inset-bottom)); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
  background: linear-gradient(var(--cream) 70%, rgba(255, 248, 234, 0));
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 12px; box-shadow: var(--shadow); }
.brand span { display: grid; line-height: 1.05; }
.brand small { font-size: 12px; font-weight: 700; color: var(--ink-soft); letter-spacing: .02em; }
.brand strong { font-size: 19px; font-weight: 900; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.star-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px;
  background: var(--paper); border-radius: 999px; box-shadow: var(--shadow); font-weight: 900;
}
.icon-button {
  width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--paper);
  box-shadow: var(--shadow); font-size: 20px; display: grid; place-items: center;
}
.icon-button[aria-pressed="true"] { background: var(--sun); }
.icon-button .voice-on { display: none; }
.icon-button[aria-pressed="true"] .voice-on { display: inline; }
.icon-button[aria-pressed="true"] .voice-off { display: none; }
.grown-ups { font-weight: 900; color: var(--ink-soft); }

/* ---------- home ---------- */
.hero {
  position: relative; border-radius: 28px; overflow: hidden; box-shadow: var(--shadow);
  background: var(--sky); aspect-ratio: 3 / 2; max-height: 520px; width: 100%;
}
.hero-art { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.hero-copy {
  position: absolute; inset: auto 0 0 0; padding: 60px 20px 18px;
  background: linear-gradient(180deg, rgba(40, 25, 10, 0) 0%, rgba(40, 25, 10, .55) 100%);
  color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.eyebrow { margin: 0 0 4px; font-weight: 800; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; color: var(--sun); }
.hero h1 { margin: 0; font-size: clamp(24px, 5vw, 42px); line-height: 1.05; font-weight: 900; max-width: 18ch; }
.hero-sub { margin: 6px 0 0; font-size: clamp(15px, 2.4vw, 19px); font-weight: 700; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 26px 4px 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 24px; font-weight: 900; }
.section-head p { margin: 0; color: var(--ink-soft); font-weight: 700; }

.adventure-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.adventure {
  width: 100%; height: 100%; text-align: left; border: 0; padding: 0; border-radius: var(--radius);
  background: var(--paper); box-shadow: var(--shadow); overflow: hidden;
  display: grid; grid-template-columns: 42% 1fr; align-items: stretch;
  border-bottom: 6px solid var(--accent);
  transition: transform .15s ease, box-shadow .15s ease;
}
.adventure:hover { transform: translateY(-2px); }
.adventure:active { transform: scale(.98); }
.adventure-art { position: relative; min-height: 112px; }
.adventure-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ep-badge {
  position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 900; box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
.adventure-info { display: grid; align-content: center; gap: 4px; padding: 12px 14px; }
.adventure-info strong { font-size: 18px; line-height: 1.1; font-weight: 900; }
.skill { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.stars { display: flex; gap: 2px; font-size: 18px; margin-top: 2px; }
.star { color: #ead9bd; }
.star.lit { color: var(--sun-deep); text-shadow: 0 1px 0 #c98600; }
.footer-note { text-align: center; color: var(--ink-soft); font-weight: 700; font-size: 14px; margin: 26px 8px 0; }

/* ---------- play ---------- */
.play { display: grid; gap: 14px; }
.play-head { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 12px; }
.back-button {
  width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--paper);
  box-shadow: var(--shadow); font-size: 34px; line-height: 1; font-weight: 900; padding-bottom: 4px;
}
.play-titles small { display: block; color: var(--ink-soft); font-weight: 800; font-size: 13px; }
.play-titles h1 { margin: 0; font-size: clamp(20px, 4vw, 28px); font-weight: 900; line-height: 1.1; }
.dots { grid-column: 1 / -1; list-style: none; margin: 4px 0 0; padding: 0; display: flex; gap: 6px; }
.dots li { flex: 1; height: 10px; border-radius: 99px; background: #f0e0c4; transition: background .3s; }
.dots li.now { background: color-mix(in srgb, var(--accent) 45%, #f0e0c4); }
.dots li.done { background: var(--accent); }
.dots li.star { background: linear-gradient(90deg, var(--sun-deep), var(--accent)); }

.stage {
  position: relative; border-radius: 26px; overflow: hidden; box-shadow: var(--shadow);
  height: clamp(230px, 56vw, 400px); background: var(--sky);
}
.stage-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.9); }
.stage-shade { position: absolute; inset: 0; background: radial-gradient(closest-side, rgba(255, 252, 245, .92), rgba(255, 252, 245, .72) 60%, rgba(255, 252, 245, .35)); }
.show {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 16px; flex-wrap: wrap;
}
.sprite { width: 100%; height: auto; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(80, 50, 20, .25)); user-select: none; }
.hero-sprite { width: auto; max-width: 70%; height: 82%; max-height: 260px; }
.show-bag .bag-sprite { width: auto; height: 70%; max-height: 220px; }
.show-bag .offer { height: 55%; max-height: 180px; animation: offer 1.6s ease-in-out infinite alternate; }
.letter-card {
  display: grid; place-items: center; width: min(46%, 200px); aspect-ratio: 1; border-radius: 28px;
  background: #fff; box-shadow: var(--shadow); font-size: clamp(90px, 18vw, 150px); font-weight: 900;
  color: var(--accent); border: 6px solid color-mix(in srgb, var(--accent) 30%, #fff);
}
.mat {
  display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 6px 10px;
  width: min(94%, 560px); min-height: 70%; padding: 14px; border-radius: 22px;
  background: rgba(255, 255, 255, .7); border: 4px dashed color-mix(in srgb, var(--accent) 50%, #fff);
}
.mat.empty::after { content: "Nomi's mat"; color: var(--ink-soft); font-weight: 800; font-size: 20px; opacity: .7; }
.count-sprite { width: clamp(52px, 13vw, 90px); animation: drop .45s cubic-bezier(.3, 1.6, .5, 1) both; }
.mat.many .count-sprite { width: clamp(42px, 10vw, 72px); }
.big-shape { width: min(46%, 220px); }
.big-shape svg { width: 100%; height: auto; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .2)); }
.magnifier { font-size: clamp(90px, 20vw, 150px); filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .2)); animation: search 2.4s ease-in-out infinite; }
.jar { width: clamp(70px, 17vw, 130px); }
.plus { font-size: clamp(36px, 7vw, 56px); font-weight: 900; color: var(--ink-soft); }
.mystery {
  display: grid; place-items: center; width: clamp(70px, 17vw, 120px); aspect-ratio: 1; border-radius: 50%;
  background: conic-gradient(#ff6b6b, #ffd93d, #6bcb77, #4d96ff, #c77dff, #ff6b6b); color: #fff;
  font-size: clamp(40px, 8vw, 64px); font-weight: 900; text-shadow: 0 2px 4px rgba(0, 0, 0, .3);
}
.name-row { display: flex; align-items: flex-end; justify-content: center; gap: 6px; max-width: 100%; }
.name-char { height: clamp(90px, 22vw, 200px); width: auto; filter: drop-shadow(0 8px 10px rgba(80, 50, 20, .25)); }
.tile {
  display: grid; place-items: center; width: clamp(44px, 12vw, 92px); aspect-ratio: 1; border-radius: 16px; flex: none;
  background: #fff; box-shadow: var(--shadow); font-size: clamp(30px, 8vw, 62px); font-weight: 900; color: var(--ink);
}
.tile.gap { background: color-mix(in srgb, var(--accent) 18%, #fff); color: var(--accent); border: 4px dashed var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.routine { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(6px, 1.5vw, 12px); width: min(100%, 580px); }
.routine li {
  position: relative; flex: 1 1 0; min-width: 0; max-width: 104px; aspect-ratio: 1; border-radius: 16px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .85); box-shadow: var(--shadow); padding: 8px;
}
.routine li.later { background: rgba(255, 255, 255, .45); box-shadow: none; border: 3px dashed #e2cfae; }
.routine li.next { border: 4px dashed var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.routine .q { font-size: clamp(28px, 6vw, 48px); font-weight: 900; color: var(--accent); }
.routine .tick {
  position: absolute; right: -6px; top: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--good);
  color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 16px; box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
}
.show-char { height: 92%; width: auto; max-height: 330px; filter: drop-shadow(0 8px 10px rgba(80, 50, 20, .25)); }

/* question card */
.question-card { background: var(--paper); border-radius: 26px; box-shadow: var(--shadow); padding: 14px 14px 18px; display: grid; gap: 14px; }
.guide { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 10px; }
.guide img { width: 64px; height: auto; max-height: 112px; object-fit: contain; object-position: bottom; }
.bubble {
  position: relative; margin: 0; padding: 12px 16px; border-radius: 20px; background: var(--cream);
  font-size: clamp(19px, 3.6vw, 26px); font-weight: 900; line-height: 1.2; align-self: center;
}
.bubble::before {
  content: ""; position: absolute; left: -9px; bottom: 16px; border: 10px solid transparent;
  border-right-color: var(--cream); border-left: 0;
}
.say-button { width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--sun); font-size: 22px; align-self: center; box-shadow: var(--shadow); }

.options { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.options.two { grid-template-columns: repeat(2, 1fr); }
.options.wide { grid-template-columns: 1fr; }
@media (min-width: 640px) { .options.wide { grid-template-columns: repeat(2, 1fr); } }
.option {
  position: relative; min-height: 96px; border: 0; border-radius: 22px; padding: 10px 8px 12px;
  background: #fff; box-shadow: 0 0 0 3px var(--line), 0 6px 0 var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: transform .12s ease, box-shadow .12s ease, opacity .2s;
}
.option:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 3px var(--line), 0 2px 0 var(--line); }
.option .sprite { width: auto; height: clamp(64px, 16vw, 110px); max-width: 90%; }
.option .char { height: clamp(90px, 20vw, 140px); width: auto; }
.option .shape { width: clamp(64px, 16vw, 110px); }
.option .shape svg { width: 100%; height: auto; }
.option .label { display: block; font-size: clamp(16px, 3.4vw, 22px); font-weight: 900; line-height: 1.15; text-align: center; }
.option .label::first-letter { text-transform: uppercase; }
.options.wide .option { flex-direction: row; justify-content: flex-start; padding: 14px 18px; min-height: 76px; gap: 14px; }
.options.wide .option .label { text-align: left; }
.options.wide .option .sprite { height: 54px; }
.option.big .label { font-size: clamp(44px, 10vw, 72px); line-height: 1; }
.option .icon { font-size: 44px; line-height: 1; }
.option.basket { background: color-mix(in srgb, var(--accent) 8%, #fff); }
.blob { width: clamp(64px, 15vw, 100px); aspect-ratio: 1; border-radius: 46% 54% 52% 48% / 55% 45% 55% 45%; box-shadow: inset -6px -8px 0 rgba(0, 0, 0, .12), inset 6px 6px 0 rgba(255, 255, 255, .35); }
.blob.orange { background: #ff8c1a; }
.blob.green { background: #34b233; }
.blob.purple { background: #8e44ad; }
.option.right { box-shadow: 0 0 0 5px var(--good), 0 6px 0 #1d8a55; background: #ecfff4; animation: bounce .5s ease; }
.option.tried { opacity: .45; }
.option.faded { opacity: .4; }
.option.wiggle { animation: wiggle .4s ease; }

.feedback { margin: 0; min-height: 1.4em; text-align: center; font-size: clamp(17px, 3.2vw, 21px); font-weight: 800; }
.feedback.intro { color: var(--ink-soft); }
.feedback.retry { color: var(--try); }
.feedback.yay { color: #1d8a55; }
.next-button, .big-button {
  justify-self: center; border: 0; border-radius: 999px; padding: 14px 34px; min-height: 56px;
  background: var(--accent); color: #fff; font-size: 22px; font-weight: 900;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 70%, #000); animation: bounce .5s ease;
}
.next-button:active, .big-button:active { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 70%, #000); }

/* ---------- done ---------- */
.done { display: grid; place-items: center; padding-top: 12px; }
.done-card {
  width: min(100%, 560px); text-align: center; background: var(--paper); border-radius: 30px; box-shadow: var(--shadow);
  padding: 20px 18px 24px; display: grid; gap: 8px;
}
.done-cast { display: flex; justify-content: center; align-items: flex-end; height: clamp(170px, 40vw, 240px); }
.done-cast img { height: 100%; width: auto; filter: drop-shadow(0 8px 10px rgba(80, 50, 20, .2)); }
.done-cast .cast-ben { height: 86%; margin-right: -14px; animation: bob 2.2s ease-in-out infinite; }
.done-cast .cast-mia { position: relative; z-index: 1; animation: jump 1.1s ease-in-out infinite; }
.done-cast .cast-nomi { height: 58%; margin-left: -18px; animation: bob 1.8s ease-in-out infinite reverse; }
.done-card h1 { margin: 6px 0 0; font-size: clamp(28px, 6vw, 40px); font-weight: 900; }
.done-stars .stars { justify-content: center; font-size: 42px; gap: 6px; }
#done-text { margin: 0; font-size: 19px; font-weight: 700; color: var(--ink-soft); }
.done-actions { display: grid; gap: 10px; margin-top: 10px; justify-items: center; }
.done .big-button { --accent: #ff8a5c; width: min(100%, 340px); }
.big-button.secondary { --accent: #3fa7d6; font-size: 18px; }
.text-button { border: 0; background: none; font-weight: 800; font-size: 17px; color: var(--ink-soft); text-decoration: underline; padding: 10px; }
.text-button.danger { color: #c0392b; }

/* ---------- grown-ups ---------- */
.grownups { border: 0; border-radius: 26px; padding: 0; width: min(92vw, 520px); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); color: var(--ink); }
.grownups::backdrop { background: rgba(60, 40, 20, .45); }
.grownups form { padding: 22px; display: grid; gap: 10px; font-size: 16px; line-height: 1.45; }
.grownups h2 { margin: 0; font-size: 24px; font-weight: 900; }
.grownups p { margin: 0; }
.skills { margin: 0; padding-left: 20px; columns: 1; font-size: 15px; }
.grownups-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.grownups .big-button { --accent: #ffb400; padding: 10px 26px; min-height: 48px; font-size: 18px; animation: none; color: var(--ink); }

/* ---------- motion ---------- */
.pop { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1) both; }
.spark { position: fixed; z-index: 50; pointer-events: none; font-size: 22px; transform: translate(-50%, -50%); animation: spark .85s ease-out forwards; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall 2.8s ease-in forwards; }

@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes drop { from { transform: translateY(-40px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bounce { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.06); } 70% { transform: scale(.98); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes offer { from { transform: translateX(-6px) rotate(-4deg); } to { transform: translateX(6px) rotate(4deg); } }
@keyframes search { 0%, 100% { transform: translate(0, 0) rotate(-8deg); } 50% { transform: translate(14px, -8px) rotate(8deg); } }
@keyframes spark { to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.4); opacity: 0; } }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--spin)); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-18px); } }

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

/* ---------- small phones ---------- */
@media (max-width: 420px) {
  .adventure { grid-template-columns: 38% 1fr; }
  .adventure-info strong { font-size: 16px; }
  .options { gap: 8px; }
  .option { min-height: 84px; border-radius: 18px; }
  .guide img { width: 52px; }
}

/* On phones, keep the hero text off the characters' faces. */
@media (max-width: 600px) {
  .hero { aspect-ratio: auto; max-height: none; background: var(--paper); }
  .hero-art { height: auto; aspect-ratio: 3 / 2; }
  .hero-copy { position: static; padding: 14px 18px 18px; background: none; color: var(--ink); text-shadow: none; }
  .eyebrow { color: #e08a00; }
}
