* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root { color-scheme: dark; }
body { margin: 0; background: #061b2c; color: #fff7e5; font: 1rem/1.5 system-ui, sans-serif; }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 3px solid #ffca57; outline-offset: 4px; }
.quest-wrap { width: min(76rem, calc(100% - 2rem)); margin-inline: auto; }
.sr-only, .quest-skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.quest-skip { position: absolute; z-index: 5; top: .5rem; left: .5rem; padding: .6rem; background: #061b2c; }
.quest-nav { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding-block: .42rem; font-size: .9rem; }
.quest-nav a { display: inline-flex; align-items: center; min-height: 44px; }
.quest-brand { gap: .45rem; font-weight: 800; text-decoration: none; }
.quest-brand img { padding: .2rem; background: #fff; border-radius: 50%; }
.quest-map { background: radial-gradient(ellipse at top, #1372a1, #061b2c 80%); }
.quest-board {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  width: min(100%, 82rem);
  margin: auto;
  box-shadow: 0 0 4rem #00131cb3;
}
.quest-map-art { display: block; width: 100%; height: auto; }
#quest-count {
  position: absolute;
  inset: 8.2% 4.55% auto auto;
  display: grid;
  width: 24.85%;
  height: 4%;
  place-items: center;
  margin: 0;
  border-radius: 1.7cqw;
  background: linear-gradient(#fff1af, #ffc75b);
  color: #14273a;
  box-shadow: inset 0 0 0 .15cqw #fff8ce;
  font-size: 2.05cqw;
  font-weight: 950;
  white-space: nowrap;
}
.quest-gates { margin: 0; padding: 0; list-style: none; }
.quest-gates li {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
}
.quest-gates li:nth-child(1) { --x: 29.7%; --y: 70.2%; --w: 25.4%; --h: 16.1%; }
.quest-gates li:nth-child(2) { --x: 51.4%; --y: 64.2%; --w: 21.1%; --h: 7.5%; }
.quest-gates li:nth-child(3) { --x: 73.2%; --y: 60.1%; --w: 18.6%; --h: 7.2%; }
.quest-gates li:nth-child(4) { --x: 83.2%; --y: 50.7%; --w: 16.1%; --h: 7.4%; }
.quest-gates li:nth-child(5) { --x: 66.3%; --y: 43%; --w: 16.8%; --h: 7.3%; }
.quest-gates li:nth-child(6) { --x: 46.7%; --y: 41.8%; --w: 16.5%; --h: 7.3%; }
.quest-gates li:nth-child(7) { --x: 30.3%; --y: 33.4%; --w: 15.8%; --h: 7.4%; }
.quest-gates li:nth-child(8) { --x: 43%; --y: 26.3%; --w: 16.5%; --h: 7.4%; }
.quest-gates li:nth-child(9) { --x: 64.3%; --y: 26.5%; --w: 19.4%; --h: 7.4%; }
.quest-gates button, .map-start, .map-trophy {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 1.5cqw;
  background: transparent;
}
.quest-gates button:enabled, .map-start, .map-trophy:enabled { cursor: pointer; }
.quest-gates button[data-gate-state="current"] {
  box-shadow: inset 0 0 0 .24cqw #fff6ae, 0 0 1.05cqw .15cqw #ffce35;
}
.quest-gates button:enabled:hover, .map-start:hover, .map-trophy:enabled:hover {
  background: #fff8aa35;
  box-shadow: inset 0 0 0 .28cqw #fff6ae, 0 0 1.2cqw #ffce35;
}
.gate-emblem {
  position: absolute;
  left: 7%;
  top: 28%;
  display: grid;
  place-items: center;
  width: 3.65cqw;
  aspect-ratio: 1;
  border: .17cqw solid #fff0ab;
  border-radius: 50%;
  background: #176238;
  color: white;
  box-shadow: 0 .22cqw .5cqw #10272c;
  font-size: 2.15cqw;
  line-height: 1;
}
[data-gate-state="current"] .gate-emblem { background: #032e56; }
.quest-gates li:first-child .gate-emblem { left: 42%; top: 62%; width: 17%; font-size: 2.95cqw; }
.gate-finished-label {
  position: absolute;
  inset: 24% 14% 40% 18%;
  display: grid;
  place-content: center;
  border-radius: 1cqw;
  background: linear-gradient(#fff1b5, #ffe68a);
  color: #112537;
  font-size: 2.05cqw;
  font-weight: 900;
  line-height: 1.08;
  box-shadow: 0 0 .65cqw #ffe68a;
}
.map-sparky {
  position: absolute;
  z-index: 2;
  left: var(--sx);
  top: var(--sy);
  width: 7.2%;
  height: auto;
  pointer-events: none;
  transform: translate(-50%, -94%);
  filter: drop-shadow(0 0 .52rem #fff3a8);
}
.quest-board[data-step="0"] { --sx: 51%; --sy: 77%; }
.quest-board[data-step="1"] { --sx: 58%; --sy: 67%; }
.quest-board[data-step="2"] { --sx: 77%; --sy: 63%; }
.quest-board[data-step="3"] { --sx: 88%; --sy: 54%; }
.quest-board[data-step="4"] { --sx: 70%; --sy: 47%; }
.quest-board[data-step="5"] { --sx: 52%; --sy: 45%; }
.quest-board[data-step="6"] { --sx: 35%; --sy: 37%; }
.quest-board[data-step="7"] { --sx: 48%; --sy: 30%; }
.quest-board[data-step="8"] { --sx: 69%; --sy: 30%; }
.quest-board[data-step="9"] { --sx: 86%; --sy: 86%; }
@media (prefers-reduced-motion: no-preference) {
  .map-sparky { transition: left .6s ease, top .6s ease; }
}
.map-start, .map-trophy { position: absolute; width: 25%; height: 13%; inset: 84% auto auto 2%; }
.map-trophy { inset: 80% 2.5% auto auto; height: 17%; width: 23.5%; }
.map-trophy span { position: absolute; top: 5%; right: 6%; padding: .3cqw .55cqw; background: #092538; border-radius: 1cqw; font-size: 2cqw; }
.map-trophy:enabled { box-shadow: 0 0 2cqw #ffe36b; }
.map-controls { display: flex; align-items: center; justify-content: space-between; gap: .65rem 1rem; flex-wrap: wrap; padding-block: .9rem; }
#quest-status { margin: 0; }
.quest-button, .quest-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .65rem;
  min-height: 46px; padding: .55rem .95rem; border: 1px solid #eab74c; border-radius: 2rem;
  background: #ffcf64; color: #092333; font-weight: 800; text-decoration: none; cursor: pointer;
}
.quest-button:hover { background: #ffe29f; }
.quest-secondary { background: transparent; color: #fff4d6; border-color: #6296a9; }
.quest-secondary:hover { background: #16465d; }
.quest-game {
  width: min(54rem, calc(100% - 1.5rem)); max-height: calc(100% - 1.5rem);
  padding: 0; border: 1px solid #d9a949; border-radius: 1.2rem;
  background: #0b2b41; color: #fff7e5; box-shadow: 0 1.2rem 4rem #0009;
}
.quest-game::backdrop { background: #06131ce0; }
.quest-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
#room-image { display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.quest-game[data-state="complete"] #room-image { max-height: 23rem; object-fit: contain; padding: 1rem; }
.quest-panel-copy { padding: clamp(1rem, 3.5vw, 2rem); padding-top: 3rem; }
.quest-kicker { margin: 0; color: #9bdeec; font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.quest-panel h2 { margin: .3rem 0; line-height: 1.08; font-size: clamp(1.65rem, 4vw, 3rem); letter-spacing: -.035em; }
.quest-panel-copy ol { padding-inline-start: 1.4rem; }
.quest-panel-copy li + li { margin-top: .25rem; }
.quest-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.quest-close { position: absolute; top: .45rem; right: .55rem; width: 44px; height: 44px; border: 1px solid #76a6bb; border-radius: 50%; background: #082333; color: white; font-size: 1.5rem; cursor: pointer; }
.room-status { margin: .5rem 1rem 1rem; }
.room-status:empty { display: none; }
@media (max-width: 620px) {
  .quest-panel { grid-template-columns: minmax(0, 1fr); }
  #room-image { aspect-ratio: 16 / 9; height: auto; }
  .quest-panel-copy { padding-top: 1rem; }
  .map-controls { justify-content: center; text-align: center; }
}

.quest-preview-note { margin-block: 0; padding-block: .45rem .65rem; font-size: .88rem; color: #b9d9ea; }
.quest-preview-note strong { margin-inline-end: .35rem; color: #ffdb76; }
[data-gate-state="preview"] .gate-emblem { background: #07527b; }
.quest-gates button[data-gate-state="preview"][aria-current="step"] {
  box-shadow: inset 0 0 0 .24cqw #fff6ae, 0 0 1.05cqw .15cqw #ffce35;
}
.power-pill { width: fit-content; padding: .3rem .7rem; border-radius: 2rem; border: 1px solid #c6a04f; background: #122a3d; color: #ffde83; font-size: .88em; font-weight: 800; }
.week-one-invite {
  margin-block-start: 1rem;
  padding: .9rem;
  border: 1px solid #c6a04f;
  border-radius: 1rem;
  background: #092538;
}
.week-one-invite p:not(.quest-kicker) { margin: .32rem 0 .7rem; color: #ffde83; font-size: clamp(1.05rem, 2.5vw, 1.3rem); }

@font-face {
  font-family: "Patrick Hand";
  src: url("assets/fonts/patrick-hand.woff2") format("woff2");
  font-display: swap;
}

.quest-page { color-scheme: light; background: #fff8e8; color: #19432e; }
.quest-page :focus-visible { outline-color: #237647; }
.quest-page .quest-skip { background: #fffdf4; }
.quest-page .quest-nav {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: .25rem .65rem;
}
.quest-page .quest-nav .quest-brand { margin-inline-end: auto; }
.quest-page .quest-nav > a:not(.quest-brand) {
  padding-inline: .68rem;
  border-radius: 999px;
  color: #19432e;
  text-decoration: none;
  font-weight: 750;
}
.quest-page .quest-nav > a:not(.quest-brand):hover { background: #e9efd8; }
.quest-page .quest-map { padding-block: .55rem 2rem; background: transparent; }

.quest-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(5rem, .4fr);
  align-items: center;
  gap: .5rem;
  padding: clamp(1rem, 4vw, 2.35rem);
  border: 1px solid #cbd9b5;
  border-radius: 1.35rem;
  background: #e7efd4 url("assets/brain-story/picture-book-meadow.webp") center bottom / cover;
}
.quest-hero h1, .power-track h2 { font-family: "Patrick Hand", system-ui, sans-serif; }
.quest-hero h1 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); line-height: 1; }
.quest-hero-copy > p { max-width: 41ch; margin: .55rem 0 .65rem; }
.quest-hero > img { display: block; width: min(100%, 11rem); height: auto; justify-self: center; }
.quest-hero-progress {
  max-width: 27rem;
  padding: .45rem .65rem;
  border-radius: .65rem;
  background: #fffdf2dc;
}
.quest-hero-progress p { margin: 0; font-size: .82rem; font-weight: 750; }
.quest-hero-progress progress { display: block; margin-top: .35rem; width: 100%; height: .65rem; accent-color: #267944; }
.quest-page .map-controls { justify-content: space-between; text-align: start; }
.quest-page .map-controls p { font-size: .92rem; }
.quest-page .quest-button { background: #225a3c; color: #fff; border-color: #225a3c; }
.quest-page .quest-button:hover { background: #17482d; }

.power-track h2 { margin: 0 0 .5rem; font-size: clamp(1.75rem, 3.6vw, 2.55rem); }
.power-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.power-levels button {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: .45rem;
  align-items: center;
  width: 100%;
  height: 100%;
  min-height: 3.7rem;
  padding: .55rem;
  border: 1px solid #cbd5b9;
  border-radius: .85rem;
  background: #fffdf4;
  color: #19432e;
  text-align: start;
  cursor: pointer;
}
.power-levels button:enabled:hover { background: #eff5e1; }
.power-levels button[data-power-state="next"] { border-color: #779c58; background: #eaf3db; }
.mission-number {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #e8eed8;
  color: #225a3c;
  font-weight: 850;
}
[data-power-state="earned"] .mission-number { background: #225a3c; color: white; }
.mission-reward { padding: .24rem .48rem; border-radius: 999px; background: #fff0bc; color: #6d4a0c; font-size: .78rem; font-weight: 850; white-space: nowrap; }
.quest-picture-map { margin-top: 1.05rem; }
.quest-picture-map summary { width: fit-content; cursor: pointer; padding: .6rem .75rem; border: 1px solid #cbd5b9; border-radius: .8rem; background: #fffdf4; font-weight: 750; }
.quest-picture-map .quest-board { margin: .7rem auto 0; max-width: 48rem; overflow: hidden; border-radius: 1rem; box-shadow: none; }

.quest-page .quest-game { background: #fffaf0; color: #19432e; border-color: #adc2a1; }
.quest-page .quest-game::backdrop { background: #173c2bd9; }
.quest-page .quest-kicker { color: #48684b; }
.quest-page .power-pill { background: #fff0bc; color: #6d4a0c; }
.quest-page .quest-close { background: #19432e; border-color: #19432e; }
.quest-page .quest-secondary { color: #19432e; border-color: #9ab28a; }
.quest-page .quest-secondary:hover { background: #e8efd9; }
.quest-page .week-one-invite { background: #edf3dc; }
.quest-page .week-one-invite p:not(.quest-kicker) { color: #19432e; }

@media (max-width: 900px) { .power-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 590px) {
  .quest-page .quest-nav { column-gap: .3rem; font-size: .81rem; }
  .quest-page .quest-nav > a:not(.quest-brand) { padding-inline: .4rem; }
  .quest-page .quest-wrap { width: calc(100% - 1.2rem); }
  .quest-hero-copy > p { font-size: .91rem; }
  .power-levels { grid-template-columns: minmax(0, 1fr); }
}

/* One continuous storybook scene, with a different route layout on small screens. */
.quest-page .quest-map {
  background: linear-gradient(#fff8e800 24%, #fff8e8 77%), url("assets/brain-story/picture-book-meadow.webp") center top / max(100%, 68rem) auto no-repeat;
}
.quest-page .quest-hero {
  padding: clamp(1.15rem, 4.5vw, 3.4rem) 0 clamp(1rem, 3vw, 2rem);
  grid-template-columns: minmax(0, 1.05fr) minmax(7rem, .8fr);
  gap: clamp(.4rem, 4vw, 2.5rem);
  border: 0;
  border-radius: 0;
  background: transparent;
}
.quest-page .quest-hero h1 { max-width: 15ch; font-size: clamp(2.25rem, 6.3vw, 5.9rem); }
.quest-page .quest-hero > img { width: min(100%, 23rem); filter: drop-shadow(0 12px 16px #29523122); }
.quest-page .quest-subtitle { color: #81501c; font-size: clamp(1.03rem, 2vw, 1.5rem); font-weight: 800; }
.quest-page .quest-hero-progress { padding: .35rem 0; background: transparent; }
.quest-page .quest-hero-progress progress { max-width: 18rem; }
.quest-page .map-controls { justify-content: flex-start; padding-block: .6rem .35rem; }
.quest-page #quest-status { font-size: .9rem; }

.quest-trail { position: relative; isolation: isolate; padding: 1.4rem .8rem .6rem; }
.trail-lines { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.trail-lines path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.trail-edge { stroke: #c2cf9d; stroke-width: 15; }
.trail-center { stroke: #f6edbf; stroke-width: 6; stroke-dasharray: 2 12; }
.quest-page .power-levels { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem clamp(.3rem, 2vw, 2rem); }
.quest-page .power-levels li:nth-child(4) { grid-column: 3; grid-row: 2; }
.quest-page .power-levels li:nth-child(5) { grid-column: 2; grid-row: 2; }
.quest-page .power-levels li:nth-child(6) { grid-column: 1; grid-row: 2; }
.quest-page .trail-stop {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: .2rem;
  align-content: end;
  width: 100%;
  height: 100%;
  min-height: 7.3rem;
  padding: .35rem .15rem;
  border: 0;
  border-radius: .45rem;
  background: transparent;
  color: #19432e;
  text-align: center;
}
.quest-page .trail-stop:enabled { cursor: pointer; }
.quest-page .trail-stop:enabled:hover { background: transparent; }
.quest-page .trail-stop:enabled:hover strong { text-decoration: underline; }
.quest-page .trail-stop .mission-number {
  grid-row: auto;
  width: 2.9rem;
  height: 2.9rem;
  border: .2rem solid #fff9e6;
  box-shadow: 0 .12rem .3rem #36462944;
}
.quest-page .trail-stop[data-state="locked"] .mission-number { background: #e1e7d0; color: #4d6150; }
.quest-page .trail-stop[data-state="complete"] .mission-number { background: #225a3c; color: #fff; }
.quest-page .trail-stop[data-state="current"] .mission-number,
.quest-page .trail-trophy:enabled .mission-number { background: #ffd66c; color: #563927; box-shadow: 0 0 0 .26rem #fff2ba, 0 0 1rem #e4a63a65; }
.trail-stop strong, .trail-place, #trophy-status {
  padding-inline: .27rem;
  border-radius: .35rem;
  background: #fff8e9e6;
}
.trail-place, #trophy-status { color: #4c6753; font-size: .85rem; }
.trail-reward { color: #81501c; font-weight: 750; white-space: nowrap; }
.trail-landmark { display: block; width: min(66%, 8.4rem); aspect-ratio: 2.1 / 1; object-fit: cover; margin-bottom: .15rem; border-radius: 50%; opacity: .9; mask-image: radial-gradient(ellipse, #000 55%, transparent 76%); }
[data-state="locked"] .trail-landmark { opacity: .58; }
.trail-finish { width: min(14rem, 100%); margin: .75rem .5rem 0 auto; }
.quest-page .trail-trophy { min-height: 5.2rem; }
.trail-sparky, .trail-scrolly { position: absolute; top: 0; left: 0; z-index: 2; width: 0; height: 0; pointer-events: none; }
.trail-sparky img, .trail-run-cycle { position: absolute; filter: drop-shadow(0 2px 3px #394f244e); }
.trail-sparky img {
  bottom: .55rem;
  right: .95rem;
  width: clamp(2.65rem, 6vw, 4.2rem);
  height: auto;
}
.trail-run-cycle {
  bottom: 0;
  left: 0;
  translate: -50%;
  aspect-ratio: 1;
  background: var(--runner-sheet) 0 0 / 200% 200% no-repeat;
}
.trail-sparky .trail-run-cycle {
  display: none;
  width: clamp(2.55rem, 7vw, 4.2rem);
  --runner-sheet: url("assets/storybook/chase-sparky-walk.webp");
}
.trail-scrolly .trail-run-cycle {
  width: clamp(2rem, 6vw, 3.55rem);
  --runner-sheet: url("assets/storybook/chase-scrolly-walk.webp");
}
.trail-sparky.is-running img { display: none; }
.trail-sparky.is-running .trail-run-cycle { display: block; }
.is-running .trail-run-cycle { animation: trail-steps .34s steps(1, end) infinite; }
.faces-left .trail-run-cycle { scale: -1 1; }
.quest-page .trail-skip {
  position: fixed;
  inset: auto max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) auto;
  z-index: 4;
  background: #fff8e8;
  box-shadow: 0 .25rem .85rem #19432e30;
}
.trail-coin { display: none; position: absolute; bottom: 2.6rem; right: .9rem; color: #533603; background: #ffdb77; border-radius: 99px; padding: .15rem .38rem; font-size: .8rem; font-weight: 900; }
.trail-sparky.has-coin .trail-coin { display: block; animation: trail-coin-rise .68s ease-out both; }
@keyframes trail-steps { 0% { background-position: 0 0; } 25% { background-position: 100% 0; } 50% { background-position: 0 100%; } 75% { background-position: 100% 100%; } }
@keyframes trail-coin-rise { from { opacity: 0; transform: translateY(.55rem); } 30% { opacity: 1; } to { opacity: 0; transform: translateY(-1.3rem); } }

@media (max-width: 680px) {
  .quest-page .quest-hero { grid-template-columns: minmax(0, 1fr) minmax(5rem, .43fr); }
  .quest-page .quest-hero > img { width: min(100%, 10rem); }
  .quest-trail { padding-inline: .25rem; }
  .quest-page .power-levels { grid-template-columns: minmax(0, 1fr); gap: .55rem; }
  .quest-page .power-levels li:nth-child(n) { grid-column: auto; grid-row: auto; }
  .quest-page .trail-stop {
    min-height: 4.25rem;
    grid-template-columns: 3.4rem minmax(0, 1fr) 3.6rem;
    justify-items: start;
    align-content: center;
    align-items: center;
    text-align: start;
    padding-inline: .15rem;
  }
  .quest-page .trail-stop .mission-number { grid-column: 1; grid-row: 1 / 3; }
  .quest-page .power-levels li:nth-child(even) .mission-number { transform: translateX(.32rem); }
  .trail-stop strong { grid-column: 2; grid-row: 1; }
  .trail-place, #trophy-status { grid-column: 2; grid-row: 2; }
  .trail-landmark { grid-column: 3; grid-row: 1 / 3; width: 100%; aspect-ratio: 1.25; margin: 0; }
  .trail-finish { width: 100%; margin: .55rem 0 0; }
  .trail-sparky img { right: auto; left: -1.26rem; bottom: 1.35rem; }
  .trail-coin { right: auto; left: 1rem; }
  .quest-page .quest-game { margin: auto auto 0; width: 100%; max-width: none; max-height: 88dvh; border-radius: 1.25rem 1.25rem 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .is-running .trail-run-cycle, .trail-sparky.has-coin .trail-coin { animation: none; }
}
