:root {
  color-scheme: dark;
  --night: #211544;
  --night-deep: #160e32;
  --ink: #241746;
  --cream: #fff8e8;
  --gold: #ffdc3c;
  --lavender: #c4a9ff;
  --panel: #34235c;
  --muted: #d4c6ed;
  font-family: "Nunito", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  background: var(--night);
  color: var(--cream);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100svh; background: radial-gradient(ellipse at 85% 0%, #352264, transparent 58%), var(--night); }
button, input { font: inherit; }
button { cursor: pointer; border: 0; color: inherit; font-weight: 800; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #fff8b3; outline-offset: 4px; }
button:disabled { cursor: default; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.08; letter-spacing: -.035em; }
h1 { font-size: clamp(2rem, 5vw, 4.75rem); }
h2 { font-size: clamp(1.55rem, 3.5vw, 2.6rem); }
p { line-height: 1.45; }
.shell { width: min(100% - 2.75rem, 1360px); margin-inline: auto; }
.topbar { padding-block: 1.05rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.brand { padding: 0; background: none; font-size: clamp(1.8rem, 4vw, 2.9rem); letter-spacing: -.05em; }
.brand span { color: var(--gold); display: inline-block; transform: rotate(13deg); }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; }
.quiet, .primary, .secondary { min-height: 2.75rem; padding: .65rem 1rem; border-radius: 2rem; line-height: 1.12; }
.quiet { background: #eae1ff; color: var(--ink); }
.quiet[aria-pressed="true"] { background: #bcecbf; }
.primary { background: var(--gold); color: var(--ink); }
.secondary { background: var(--lavender); color: var(--ink); }
.plain { background: transparent; padding: .25rem 0; }
#game-screen { min-height: min(62vh, 620px); outline: none; }
.hero { display: grid; grid-template-columns: 1fr minmax(110px, 22%); align-items: end; gap: 1rem; margin: .1rem 0 1rem; }
.hero h1 { margin-bottom: .75rem; }
.hero img { width: 100%; max-height: 190px; object-fit: contain; mix-blend-mode: lighten; justify-self: end; }
.switcher, .actions, .level-actions, .scene-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.switcher button { flex: 1; font-size: clamp(1rem, 2.3vw, 1.85rem); }
.switcher [aria-pressed="true"] { background: var(--gold); box-shadow: inset 0 0 0 2px #fff4b0; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.55rem, 1.1vw, 1rem); }
.game-tile {
  position: relative; display: grid; grid-template-columns: 43% 1fr; min-height: clamp(94px, 11vw, 160px);
  align-items: center; overflow: hidden; text-align: start; border-radius: clamp(.9rem, 2vw, 1.55rem); padding: 0;
  background: var(--tile); color: var(--ink); transition: transform .16s ease; box-shadow: inset 0 -5px 0 #23164725;
}
.game-tile img { width: 100%; height: 100%; object-fit: cover; align-self: stretch; }
.game-tile span { padding: .55rem .65rem; font-size: clamp(1rem, 2.3vw, 2.35rem); line-height: 1.04; letter-spacing: -.045em; overflow-wrap: break-word; }
.game-tile small { display: block; margin-top: .45rem; font-size: .48em; letter-spacing: .01em; }
.game-tile:hover:not(:disabled), .answer:hover:not(:disabled), .level:hover:not(:disabled) { transform: translateY(-3px); }
.game-tile:disabled { opacity: .57; }
.adventure { display: grid; gap: .8rem; margin: 0 0 1rem; }
.adventure .actions { justify-content: space-between; }
.adventure p, .footer, .muted { color: var(--muted); }
.footer { padding-block: 1rem; display: flex; gap: 1rem; justify-content: space-between; align-items: center; font-size: .86rem; }
.footer button { text-decoration: underline; }
.breadcrumb { margin-bottom: .7rem; color: var(--muted); }
.level-intro { display: grid; gap: .75rem; margin-bottom: 1.3rem; }
.level-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-top: 1rem; }
.level { background: #e8dcff; color: var(--ink); padding: 1rem; text-align: left; border-radius: 1.25rem; display: grid; gap: .4rem; min-height: 5rem; transition: transform .15s; }
.level:disabled { background: var(--panel); color: var(--muted); }
.level span { font-size: 1.12rem; }
.eyebrow { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: .9rem; }
.eyebrow .actions { gap: .4rem; }
.pill { display: inline-flex; align-items: center; background: var(--gold); color: var(--ink); font-weight: 850; padding: .35rem .75rem; border-radius: 1.5rem; white-space: nowrap; }
.question { text-align: center; font-size: clamp(1.75rem, 4.2vw, 3.9rem); margin: .65rem auto .8rem; max-width: 26ch; }
.scene { display: grid; place-items: center; min-height: 5rem; margin: .75rem auto; padding: .65rem; background: var(--panel); border-radius: 1.2rem; text-align: center; }
.scene-text { white-space: pre-line; font-weight: 850; font-size: clamp(1.7rem, 5.6vw, 5.4rem); line-height: 1.23; }
.scene-garden { width: 100%; height: clamp(125px, 22vw, 330px); object-fit: cover; border-radius: 1.2rem; display: block; margin: .7rem auto; }
.scene-controls { justify-content: center; margin: .8rem auto; }
.answer-grid { display: grid; grid-template-columns: repeat(var(--choices, 3), minmax(0, 1fr)); gap: clamp(.55rem, 1.25vw, 1.1rem); }
.answer {
  min-width: 0; border-radius: 1.3rem; background: var(--answer); color: var(--ink); padding: clamp(.55rem, 1.25vw, 1.1rem);
  display: grid; justify-items: center; align-content: center; gap: .4rem; min-height: clamp(5rem, 12vw, 10.5rem);
  font-size: clamp(1.05rem, 3vw, 2.85rem); letter-spacing: -.04em; line-height: 1; text-align: center;
  overflow-wrap: anywhere; box-shadow: inset 0 -5px 0 #24174627; transition: transform .15s;
}
.answer img { width: 100%; height: clamp(72px, 15vw, 215px); object-fit: cover; object-position: center 38%; border-radius: .8rem; }
.answer-icon { font-size: clamp(1.65rem, 5vw, 4.7rem); line-height: 1; }
.answer.is-correct { outline: 4px solid #fff6ab; outline-offset: 3px; }
.answer.is-tried { opacity: .57; }
.feedback { display: grid; justify-items: center; text-align: center; gap: .5rem; margin-top: .85rem; min-height: 2.1rem; font-weight: 700; }
.feedback p { max-width: 66ch; }
.meter { display: flex; gap: .35rem; align-items: center; }
.meter span { width: .8rem; height: .8rem; border-radius: 50%; background: #66548c; }
.meter .done { background: var(--gold); }
.complete { display: grid; justify-items: center; text-align: center; gap: 1rem; padding: clamp(1rem, 4vw, 3rem); }
.complete img { width: min(14rem, 55%); border-radius: 2rem; }
.complete .actions { justify-content: center; }
canvas { width: 100%; height: auto; background: #fff9ed; border-radius: 1rem; display: block; touch-action: none; }
.drawing { display: grid; gap: .7rem; max-width: 820px; margin: auto; }
.drawing button[aria-pressed="true"] { outline: 3px solid var(--gold); outline-offset: 2px; }
.swatch { display: grid; place-content: center; color: #241746; min-width: 2.85rem; min-height: 2.85rem; border-radius: .8rem; background: var(--swatch); }
dialog { border: 0; border-radius: 1.35rem; background: var(--panel); color: var(--cream); padding: 1.25rem; width: min(92vw, 550px); box-shadow: 0 15px 60px #100a29b3; }
dialog::backdrop { background: #130b2cb8; }
dialog p, dialog details { margin-top: .8rem; }
.dialog-head { display: flex; align-items: center; gap: .6rem; justify-content: space-between; }
.dialog-head button { border-radius: 50%; background: #ebdfff; color: var(--ink); width: 2.65rem; height: 2.65rem; font-size: 1.4rem; flex-shrink: 0; }
#pair-data { display: grid; gap: .75rem; justify-items: center; text-align: center; margin-top: .8rem; }
#pair-data svg { display: block; width: min(50vw, 220px); height: auto; border-radius: .4rem; }
.join-code { font-size: 2rem; font-weight: 900; letter-spacing: .15em; font-variant-numeric: tabular-nums; }
#remote { width: min(100% - 1.8rem, 560px); margin: auto; min-height: 100svh; display: grid; align-content: center; padding-block: 1rem; }
.remote-choices { display: grid; gap: .7rem; }
.remote-choices .answer { grid-template-columns: 36% 1fr; align-items: center; justify-items: center; min-height: clamp(4.2rem, 16dvh, 9rem); font-size: clamp(1.25rem, 6.4vw, 2.35rem); }
.remote-choices .answer img { height: clamp(48px, 11dvh, 105px); object-fit: cover; }
.remote-form, .remote-status { display: grid; justify-items: center; text-align: center; gap: 1rem; }
.remote-form input { font-size: 1.5rem; background: #fff9ed; color: var(--ink); border: 0; border-radius: .75rem; width: 100%; max-width: 12rem; text-align: center; padding: .6rem; letter-spacing: .17em; }
@media (max-width: 650px) {
  .shell { width: calc(100% - 1.4rem); }
  .topbar { align-items: start; }
  .top-actions { font-size: .81rem; }
  .top-actions .quiet { padding: .55rem .6rem; }
  .hero { grid-template-columns: 1fr 22%; align-items: center; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-tile { min-height: 80px; }
  .answer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .answer-grid > :last-child:nth-child(3) { grid-column: 1 / -1; }
  .answer img { height: min(20vw, 115px); }
  .remote-choices .answer img { height: clamp(48px, 11dvh, 105px); }
}
@media (max-height: 730px) and (min-width: 760px) {
  .topbar { padding-block: .6rem; }
  .hero img { max-height: 115px; }
  .hero h1 { font-size: clamp(2rem, 4vw, 3.7rem); }
  .game-tile { min-height: clamp(76px, 12.5vh, 130px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.garden-growth { text-align: center; margin-block: .5rem; font-size: clamp(1.4rem, 3.4vw, 2.5rem); }
#beat { display: inline-grid; place-items: center; width: 2.8rem; min-height: 2.8rem; border-radius: 50%; background: var(--panel); color: var(--gold); font-size: 1.6rem; }
.drawing button:disabled { opacity: .5; }
.remote-choices .answer:disabled { opacity: .58; }

.activity { display: grid; gap: .85rem; margin: auto; text-align: center; max-width: 1120px; }
.activity-prompt { font-size: clamp(1.48rem, 3.1vw, 3.1rem); max-width: 33ch; margin-inline: auto; }
.activity-body { display: grid; align-items: center; justify-items: center; gap: .65rem; }
.activity-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: .65rem; }
.activity-controls .answer {
  min-width: min(5.3rem, 22vw); min-height: clamp(3.4rem, 7vw, 5.9rem); padding: .4rem .8rem;
  font-size: clamp(.82rem, 1.55vw, 1.4rem); letter-spacing: -.02em; gap: .18rem;
}
.activity-controls .answer-icon { font-size: clamp(1.28rem, 3.2vw, 2.7rem); }
.activity-controls .answer:disabled { opacity: .42; }
.activity-feedback { color: var(--cream); min-height: 1.5em; font-weight: 750; }
.activity-clue { color: var(--cream); font-size: clamp(.96rem, 2vw, 1.45rem); font-weight: 700; }
.space-grid {
  display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); width: min(100%, 520px);
  gap: clamp(.2rem, .7vw, .5rem); padding: .6rem; border-radius: 1.25rem;
  background: radial-gradient(ellipse at 75% 25%, #46307d, #171035 75%); border: 1px solid #b195f758;
}
.space-cell {
  min-height: 2.3rem; height: clamp(2.3rem, 6vw, 4.85rem); display: grid; place-content: center;
  border-radius: .7rem; background: #a88ad43d; font-size: clamp(1.3rem, 4.4vw, 3.2rem);
}
.space-cell.lit { background: #8d74cb; box-shadow: inset 0 0 0 2px #e8d8ff; }
.space-cell.ship { background: #6d55a8; animation: piece-in .19s ease-out; }
@keyframes piece-in { from { scale: .87; } to { scale: 1; } }
.token-row { display: flex; justify-content: center; flex-wrap: wrap; gap: clamp(.23rem, 1vw, .65rem); width: fit-content; max-width: 100%; }
.token {
  width: clamp(1.8rem, 5.3vw, 4.6rem); height: clamp(1.8rem, 5.3vw, 4.6rem); display: grid; place-content: center;
  color: var(--muted); background: #ffffff16; border: 1px dashed #b29ad5; border-radius: .67rem;
  font-size: clamp(1.05rem, 3.2vw, 2.45rem); font-weight: 900;
}
.token.filled { background: #e8daff; border: 1px solid #e8daff; color: var(--ink); }
.token.beat { background: var(--gold); color: var(--ink); }
.model .token.filled { background: #b8defc; border-color: #b8defc; }
.garden-log .token.filled { background: #bdeab9; border-color: #bdeab9; }
.memory-grid { width: min(100%, 500px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.memory-grid:has(> :last-child:nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 335px; }
.memory-card {
  min-height: clamp(3.9rem, 10vw, 7rem); border-radius: 1rem; font-size: clamp(1.7rem, 5vw, 3rem); color: var(--ink);
  background: linear-gradient(145deg, #b1a5ff, #9475d9); box-shadow: inset 0 -5px 0 #36226d41; transform-origin: center;
}
.memory-card.face { background: #f5e9ff; animation: flip-in .2s ease-out; }
.memory-card.found { background: #a2edb6; }
@keyframes flip-in { from { transform: scaleX(.7); } to { transform: scaleX(1); } }
.chosen { outline: 3px solid var(--gold); outline-offset: 3px; }
.garden-play { position: relative; width: min(100%, 690px); }
.garden-play img { display: block; width: 100%; height: clamp(8rem, 19vw, 14rem); object-fit: cover; border-radius: 1rem; }
.garden-stage { position: absolute; top: 30%; left: 48%; transform: translate(-50%, -50%); font-size: clamp(1.9rem, 6vw, 5rem); animation: plant-up .35s ease-out; }
@keyframes plant-up { from { opacity: .4; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }
.two-pots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(100%, 430px); gap: .75rem; }
.pot-choice { display: grid; gap: .25rem; min-height: 7rem; place-content: center; border-radius: 1rem; background: #cd804f; color: #2e1d1c; }
.pot-choice span { font-size: clamp(2rem, 7vw, 4.3rem); }
.word-picture {
  display: grid; gap: .15rem; justify-items: center; min-width: 9.5rem; padding: .25rem 1rem .6rem; border-radius: 1rem;
  background: #443267; font-size: clamp(1.4rem, 3vw, 2.5rem);
}
.word-picture span { font-size: clamp(2.8rem, 9vw, 5.9rem); line-height: 1.18; }
.word-picture b { letter-spacing: .13em; }
.album { display: grid; justify-items: center; gap: .7rem; width: min(100%, 810px); }
.album figure {
  margin: 0; width: min(100%, 330px); cursor: grab; display: grid; gap: .15rem; background: #e9dcff;
  padding: .38rem .38rem .5rem; border-radius: 1rem; color: var(--ink); font-weight: 900;
}
.album figure img { width: 100%; height: clamp(7rem, 16vw, 12rem); border-radius: .75rem; object-fit: cover; object-position: center 38%; }
.album-bins { display: flex; justify-content: center; flex-wrap: wrap; gap: .7rem; }
.album-bin { display: grid; align-content: center; justify-items: center; padding: .5rem; min-height: 3.7rem; min-width: 5.3rem; border-radius: .75rem; background: #564287; }
.album-bin span { font-size: clamp(1.25rem, 2.6vw, 2.1rem); }
.album-bin b { font-size: clamp(.75rem, 1.4vw, 1.1rem); }
.album-strip { display: flex; justify-content: center; flex-wrap: wrap; gap: .35rem; }
.album-strip img { width: 2.4rem; height: 2.1rem; object-fit: cover; border-radius: .35rem; }
.season-wheel { display: grid; gap: .35rem; justify-items: center; position: relative; }
.wheel-face {
  position: relative; width: clamp(7.5rem, 19vw, 13rem); aspect-ratio: 1; border-radius: 50%;
  transform: rotate(var(--turn)); animation: wheel-turn .27s ease-out; border: 5px solid #e9dfff;
  background: conic-gradient(from -45deg, #9adea5 25%, #ffd966 25% 50%, #f7a571 50% 75%, #a4dfff 75%);
}
@keyframes wheel-turn { from { transform: rotate(var(--before, var(--turn))); } to { transform: rotate(var(--turn)); } }
.wheel-face span {
  position: absolute; left: 50%; top: 50%; width: 1.75em; height: 1.75em; display: grid; place-content: center;
  transform: translate(-50%, -50%) rotate(var(--segment)) translateY(-103%) rotate(calc(-1 * (var(--segment) + var(--turn))));
  font-size: clamp(1.2rem, 3.2vw, 2.2rem);
}
.wheel-pointer { position: absolute; top: -.8rem; z-index: 1; color: #fff2af; text-shadow: 0 1px 4px #1a1134; }
.wheel-current { font-weight: 850; font-size: clamp(1rem, 2vw, 1.4rem); }
.target-number { color: var(--gold); font-size: clamp(2.5rem, 7vw, 5.2rem); font-weight: 950; line-height: 1; }
.star-box, .basket-grid > div { padding: .65rem; border-radius: .9rem; background: #3d2b65; }
.ten-frame { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ten-frame:has(> :last-child:nth-child(6)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.basket-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.basket-grid > div { display: grid; gap: .4rem; justify-items: center; }
.rhythm-stage { display: grid; justify-items: center; gap: .4rem; }
.rhythm-instrument { font-size: clamp(3.4rem, 10vw, 7rem); }
.drawing #drawing-model { font-size: clamp(1.15rem, 3vw, 2rem); }
@media (max-width: 520px) {
  .activity-controls { gap: .45rem; }
  .activity-controls .answer { min-width: 4.2rem; min-height: 3.1rem; padding-inline: .45rem; }
  .basket-grid { width: 100%; }
  .basket-grid .token { width: 1.55rem; height: 1.55rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
