:root {
  color-scheme: light;
  --ink: #102a47;
  --ink-soft: #35526f;
  --ocean: #0f4f72;
  --teal: #1d9c98;
  --teal-bright: #43d4c7;
  --coral: #ff765d;
  --sun: #f5c64d;
  --violet: #7759cf;
  --cream: #fbf7ed;
  --paper: #fffdf8;
  --line: rgba(16, 42, 71, 0.12);
  --shadow: 0 22px 70px rgba(16, 42, 71, 0.13);
  --shadow-soft: 0 10px 30px rgba(16, 42, 71, 0.09);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --content: 1380px;
  --topbar-height: 76px;

  /* Dreambly Me brand constants. */
  --brand-navy: #0d245a;
  --brand-gold: #bfa181;
  --brand-blue: #264f8f;
  --brand-ice: #effafd;
  --brand-night: #121212;

  /* Shell semantic aliases. */
  --shell-ink: var(--ink);
  --shell-ink-soft: var(--ink-soft);
  --shell-surface: var(--paper);
  --shell-surface-warm: var(--cream);
  --shell-accent: var(--teal);
  --shell-accent-bright: var(--teal-bright);
  --shell-highlight: var(--sun);
  --shell-alert: var(--coral);
  --shell-dream: var(--violet);
  --shell-line: var(--line);
  --shell-on-accent: var(--paper);
  --shell-focus: var(--sun);
  --shell-tile-accent: var(--brand-blue);
  --shell-nav-surface: color-mix(in srgb, var(--shell-surface) 86%, transparent);
  --shell-nav-border: color-mix(in srgb, var(--shell-ink) 8%, transparent);
  --shell-nav-muted: color-mix(in srgb, var(--shell-ink) 55%, transparent);
  --shell-nav-active: color-mix(in srgb, var(--shell-highlight) 28%, transparent);
  --shell-nav-shadow: 0 -10px 30px color-mix(in srgb, var(--shell-ink) 8%, transparent);
  --shell-card-border: color-mix(in srgb, var(--shell-ink) 10%, transparent);
  --shell-card-shadow: 0 24px 72px color-mix(in srgb, var(--shell-ink) 16%, transparent);
  --shell-card-shadow-hover: 0 32px 88px color-mix(in srgb, var(--shell-ink) 22%, transparent);
  --shell-card-radius: 34px;
  --shell-card-radius-small: 22px;
  --shell-cover-shade: linear-gradient(0deg, color-mix(in srgb, var(--brand-night) 72%, transparent), transparent 68%);
  --shell-progress-track: color-mix(in srgb, var(--shell-ink) 13%, transparent);
  --shell-subtle-surface: color-mix(in srgb, var(--shell-surface) 82%, transparent);
  --shell-soft-accent: color-mix(in srgb, var(--shell-tile-accent) 12%, var(--shell-surface));
  --shell-locked-surface: color-mix(in srgb, var(--shell-surface-warm) 82%, var(--shell-surface));

  /* Pack-scoped runtime defaults for Island Adventures Book 6. */
  --pack-accent: #264f8f;
  --pack-reader-bg: #061728;

  font-family: "Trebuchet MS", "Avenir Next", Avenir, ui-rounded, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--cream);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 20%, rgba(67, 212, 199, 0.09), transparent 28rem),
    radial-gradient(circle at 90% 30%, rgba(245, 198, 77, 0.1), transparent 28rem),
    var(--cream);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  transform: translateY(-160%);
  opacity: 0;
  pointer-events: none;
  padding: 10px 16px;
  border-radius: 12px;
  color: white;
  background: var(--ink);
  transition: transform 160ms ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.app-shell {
  min-height: 100vh;
}

.content-width {
  width: min(calc(100% - 64px), var(--content));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--topbar-height);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 10px 28px;
  border-bottom: 1px solid rgba(16, 42, 71, 0.08);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.brand-button,
.grownups-button,
.nav-button,
.text-button,
.game-tab {
  border: 0;
  cursor: pointer;
  background: transparent;
}

.brand-button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  text-align: left;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 16px 16px 16px 5px;
  color: white;
  background: linear-gradient(135deg, var(--coral), #ff9d5d 58%, var(--sun));
  box-shadow: 0 8px 20px rgba(255, 118, 93, 0.28);
  transform: rotate(-5deg);
}

.brand-mark span {
  font-size: 21px;
  transform: rotate(5deg);
}

.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-copy strong {
  font-size: 15px;
  letter-spacing: 0.02em;
}

.brand-copy small {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary-nav {
  position: fixed;
  z-index: 110;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 10px 10px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--shell-nav-border);
  background: var(--shell-nav-surface);
  box-shadow: var(--shell-nav-shadow);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
}

.primary-nav-row {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-inline: auto;
}

.nav-button {
  min-width: 0;
  min-height: 66px;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 14px;
  color: var(--shell-nav-muted);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.04em;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.nav-button:hover {
  color: var(--shell-ink);
}

.nav-button:active {
  transform: scale(0.97);
}

.nav-button.is-active {
  color: var(--shell-ink);
  background: var(--shell-nav-active);
}

.nav-button span:first-child {
  font-size: 20px;
  line-height: 1;
}

.grownups-button {
  grid-column: 2;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(16, 42, 71, 0.12);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.grownups-button:hover {
  color: var(--ink);
  background: rgba(16, 42, 71, 0.04);
}

.screen {
  display: none;
  min-height: calc(100vh - var(--topbar-height));
  animation: screen-in 420ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.screen.is-active {
  display: block;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
}

.eyebrow-light {
  color: rgba(255, 255, 255, 0.78);
}

.button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  color: var(--ink);
  background: linear-gradient(135deg, #ffdb6f, var(--sun));
  box-shadow: 0 12px 28px rgba(245, 198, 77, 0.3);
}

.button-glass {
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: white;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
}

.button-glass:hover {
  background: rgba(255, 255, 255, 0.2);
}

.button-ink {
  color: white;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(16, 42, 71, 0.18);
}

.button-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
  font-size: 10px;
}

/* Stories shelf */

.stories-screen {
  background:
    radial-gradient(circle at 14% 8%, color-mix(in srgb, var(--shell-accent-bright) 13%, transparent), transparent 34rem),
    radial-gradient(circle at 88% 16%, color-mix(in srgb, var(--shell-highlight) 14%, transparent), transparent 31rem),
    var(--shell-surface-warm);
}

.stories-library {
  padding-block: clamp(62px, 8vw, 112px) 132px;
}

.stories-heading,
.dream-library-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 42px;
  margin-bottom: 38px;
}

.stories-heading h1,
.dream-library-heading h1 {
  max-width: 780px;
  margin: 14px 0 0;
  color: var(--shell-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(46px, 6vw, 82px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.stories-heading > p,
.dream-library-heading > p {
  max-width: 410px;
  margin: 0 0 8px;
  color: var(--shell-ink-soft);
  font-size: 16px;
  line-height: 1.65;
}

.stories-shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 28px;
}

.story-shelf-tile {
  --tile-accent: var(--shell-tile-accent);
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-card-radius);
  cursor: default;
  color: var(--shell-ink);
  background: var(--shell-surface);
  box-shadow: var(--shell-card-shadow);
  text-align: left;
  transform: translateZ(0);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.story-shelf-primary {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(320px, 1fr) auto;
  padding: 0;
  border: 0;
  cursor: pointer;
  color: inherit;
  background: transparent;
  text-align: left;
}

.story-shelf-tile::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  height: 6px;
  pointer-events: none;
  background: var(--tile-accent);
}

.story-shelf-tile:hover {
  border-color: var(--tile-accent);
  box-shadow: var(--shell-card-shadow-hover);
  transform: translateY(-7px);
}

.story-shelf-cover {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--shell-locked-surface);
}

.story-shelf-cover > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

.story-shelf-tile:hover .story-shelf-cover > img {
  transform: scale(1.045);
}

.story-shelf-cover-shade {
  position: absolute;
  inset: 0;
  background: var(--shell-cover-shade);
}

.story-shelf-badge {
  position: absolute;
  top: 22px;
  left: 22px;
  padding: 9px 13px;
  border-radius: 999px;
  color: var(--shell-on-accent);
  background: var(--tile-accent);
  box-shadow: var(--shell-card-shadow);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-shelf-badge-locked {
  color: var(--shell-ink);
  background: var(--shell-highlight);
}

.story-shelf-copy {
  display: grid;
  padding: 28px 30px 30px;
  background: var(--shell-surface);
}

.story-shelf-kicker {
  color: var(--tile-accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.story-shelf-title {
  margin-top: 9px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 3vw, 42px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.story-shelf-detail {
  margin-top: 8px;
  color: var(--shell-ink-soft);
  font-size: 13px;
}

.story-shelf-action {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 18px 30px 20px;
  border: 0;
  border-top: 1px solid var(--shell-card-border);
  cursor: pointer;
  color: inherit;
  background: var(--shell-surface);
  text-align: left;
}

.story-shelf-label {
  margin-left: auto;
  color: var(--shell-ink);
  font-size: 13px;
  font-weight: 900;
}

.story-shelf-arrow {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--shell-on-accent);
  background: var(--tile-accent);
}

.story-shelf-progress {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--shell-ink-soft);
  font-size: 10px;
  font-weight: 800;
}

.story-shelf-progress[hidden] {
  display: none;
}

.story-progress-ring,
.story-progress-ring svg {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

.story-progress-ring circle {
  fill: none;
  stroke-width: 5;
}

.story-progress-track {
  stroke: var(--shell-progress-track);
}

.story-progress-value {
  stroke: var(--tile-accent);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 360ms ease;
}

/* World landing + Explore friends */

.world-shell,
.explore-shell {
  padding-top: 54px;
  padding-bottom: 80px;
}

.world-back,
.explore-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 22px;
  padding: 10px 0;
  border: 0;
  cursor: pointer;
  color: var(--shell-ink);
  background: transparent;
  font-weight: 900;
}

.world-card,
.explore-story-card {
  overflow: hidden;
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-card-radius);
  background: var(--shell-surface);
  box-shadow: var(--shell-card-shadow);
}

.world-cover-band {
  position: relative;
  min-height: clamp(350px, 45vw, 560px);
  display: flex;
  align-items: end;
  overflow: hidden;
  background: var(--pack-reader-bg);
}

.world-cover-band > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.world-cover-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, color-mix(in srgb, var(--brand-night) 86%, transparent), color-mix(in srgb, var(--brand-night) 4%, transparent) 74%);
}

.world-cover-copy {
  position: relative;
  z-index: 1;
  max-width: 850px;
  padding: clamp(30px, 6vw, 72px);
  color: white;
}

.world-cover-copy h1,
.explore-heading h1,
.explore-story-copy h1 {
  margin: 12px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 6vw, 78px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.world-cover-copy p {
  max-width: 620px;
  margin: 18px 0 0;
  font-size: 17px;
  line-height: 1.55;
}

.world-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: clamp(22px, 4vw, 44px);
}

.world-action {
  min-height: 150px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 24px;
  border: 2px solid color-mix(in srgb, var(--pack-accent) 22%, transparent);
  border-radius: var(--shell-card-radius-small);
  cursor: pointer;
  color: var(--shell-ink);
  background: color-mix(in srgb, var(--pack-accent) 8%, var(--shell-surface));
  text-align: left;
}

.world-action-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: white;
  background: var(--pack-accent);
  font-size: 26px;
}

.world-action span:nth-child(2) {
  display: grid;
  gap: 5px;
}

.world-action small,
.world-action em {
  color: var(--shell-ink-soft);
  font-size: 12px;
  font-style: normal;
}

.world-action small {
  color: var(--pack-accent);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.world-action strong {
  font-size: clamp(23px, 3vw, 32px);
}

.world-action b {
  font-size: 28px;
}

.world-premium-bar,
.explore-premium-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 17px 24px;
  color: var(--shell-ink);
  background: color-mix(in srgb, var(--brand-gold) 22%, var(--shell-surface));
  font-size: 13px;
  font-weight: 800;
}

.explore-premium-bar {
  justify-content: flex-start;
  margin-bottom: 36px;
  border: 1px solid color-mix(in srgb, var(--brand-gold) 48%, transparent);
  border-radius: 999px;
}

.explore-premium-bar span:last-child {
  color: var(--shell-ink-soft);
  font-weight: 500;
}

.explore-heading {
  max-width: 900px;
  margin-bottom: 34px;
}

.explore-heading p {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--shell-ink-soft);
  line-height: 1.6;
}

.explore-character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 22px;
}

.explore-character-tile {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-card-radius-small);
  cursor: pointer;
  color: var(--shell-ink);
  background: var(--shell-surface);
  box-shadow: var(--shadow-soft);
  text-align: left;
}

.portrait-crop {
  position: relative;
  width: 100%;
  display: block;
  overflow: hidden;
  background: color-mix(in srgb, var(--pack-accent) 10%, var(--shell-surface-warm));
}

.portrait-crop > img {
  position: absolute;
  max-width: none;
  object-fit: fill;
}

.portrait-crop.is-direct {
  aspect-ratio: 4 / 5;
}

.portrait-crop.is-direct > img {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.explore-grid-portrait {
  min-height: 230px;
}

.explore-character-tile.is-locked .portrait-crop > img {
  filter: grayscale(1) saturate(0) brightness(0.46) contrast(1.1);
}

.explore-portrait-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, color-mix(in srgb, var(--brand-navy) 38%, transparent), transparent 70%);
}

.explore-character-copy {
  min-height: 142px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 20px;
}

.explore-character-copy strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 500;
  line-height: 1.05;
}

.explore-character-copy small {
  color: var(--shell-ink-soft);
  line-height: 1.45;
}

.explore-lock-chip {
  width: max-content;
  display: inline-flex;
  margin-top: 3px;
  padding: 7px 10px;
  border-radius: 999px;
  color: white;
  background: var(--brand-navy);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.explore-story-card {
  padding: clamp(22px, 5vw, 56px);
}

.explore-story-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.15fr);
  gap: clamp(30px, 6vw, 74px);
  align-items: center;
}

.explore-story-portrait {
  overflow: hidden;
  border-radius: var(--shell-card-radius-small);
  box-shadow: var(--shell-card-shadow);
}

.explore-story-copy h1 {
  color: var(--shell-ink);
}

.explore-story-paragraphs {
  display: grid;
  gap: 14px;
  margin-top: 26px;
  color: var(--shell-ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 2.1vw, 23px);
  line-height: 1.6;
}

.explore-story-paragraphs p {
  margin: 0;
}

.explore-locked-story {
  margin-top: 28px;
  padding: 24px;
  border-radius: var(--shell-card-radius-small);
  background: var(--shell-locked-surface);
}

.explore-locked-story p {
  margin: 15px 0 20px;
  color: var(--shell-ink-soft);
  line-height: 1.55;
}

@media (max-width: 820px) {
  .world-actions,
  .explore-story-layout {
    grid-template-columns: 1fr;
  }

  .explore-story-portrait {
    width: min(100%, 440px);
    margin-inline: auto;
  }
}

@media (max-width: 580px) {
  .world-shell,
  .explore-shell {
    padding-top: 34px;
  }

  .world-card,
  .explore-story-card {
    border-radius: var(--shell-card-radius-small);
  }

  .world-cover-band {
    min-height: 330px;
  }

  .world-actions {
    padding: 16px;
  }

  .world-action {
    min-height: 126px;
    gap: 13px;
    padding: 17px;
  }

  .world-action-icon {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .explore-premium-bar {
    align-items: flex-start;
    border-radius: var(--shell-card-radius-small);
  }
}

/* Catalog-driven Play switcher */

.play-pack-bar {
  display: grid;
  grid-template-columns: minmax(190px, 0.32fr) minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-card-radius-small);
  background: var(--shell-subtle-surface);
  box-shadow: var(--shell-card-shadow);
}

.play-pack-heading h2 {
  margin: 7px 0 0;
  color: var(--shell-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.play-pack-switcher {
  min-width: 0;
  display: flex;
  gap: 11px;
  overflow-x: auto;
  padding: 4px;
}

.play-pack-choice {
  min-width: 220px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 8px 16px 8px 8px;
  border: 1px solid var(--shell-card-border);
  border-radius: 18px;
  cursor: pointer;
  color: var(--shell-ink);
  background: var(--shell-surface);
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.play-pack-choice:hover,
.play-pack-choice.is-active {
  border-color: var(--shell-tile-accent);
  background: var(--shell-soft-accent);
  transform: translateY(-2px);
}

.play-pack-choice img {
  width: 54px;
  aspect-ratio: 1;
  border-radius: 13px;
  object-fit: cover;
}

.play-pack-choice-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.play-pack-choice-copy strong,
.play-pack-choice-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-pack-choice-copy strong {
  font-size: 12px;
}

.play-pack-choice-copy small {
  color: var(--shell-ink-soft);
  font-size: 10px;
}

.play-empty {
  place-items: center;
  padding: 70px 24px;
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-card-radius);
  background: var(--shell-surface);
  box-shadow: var(--shell-card-shadow);
  text-align: center;
}

.play-empty:not([hidden]) {
  display: grid;
}

.play-empty > span {
  color: var(--shell-highlight);
  font-size: 34px;
}

.play-empty h2 {
  margin: 12px 0 4px;
  color: var(--shell-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 40px;
  font-weight: 500;
}

.play-empty p {
  max-width: 510px;
  margin: 0 0 24px;
  color: var(--shell-ink-soft);
  line-height: 1.6;
}

/* Aggregate Dream library */

.dream-library-view {
  padding-block: clamp(58px, 8vw, 106px) 132px;
}

.dream-library-group + .dream-library-group {
  margin-top: 46px;
}

.dream-library-group > h2 {
  margin: 0 0 18px;
  color: var(--shell-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
}

.dream-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 20px;
}

.dream-library-card {
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: end;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-card-radius);
  cursor: pointer;
  color: var(--shell-on-accent);
  background: var(--brand-night);
  box-shadow: var(--shell-card-shadow);
  text-align: left;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.dream-library-card:hover {
  box-shadow: var(--shell-card-shadow-hover);
  transform: translateY(-5px);
}

.dream-library-card > img,
.dream-library-card-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.dream-library-card > img {
  object-fit: cover;
}

.dream-library-card-shade {
  background: var(--shell-cover-shade);
}

.dream-library-card-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 7px;
  padding: 28px;
}

.dream-library-card-copy span {
  color: color-mix(in srgb, var(--shell-on-accent) 68%, transparent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dream-library-card-copy strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 500;
}

.dream-library-card-arrow {
  position: absolute;
  right: 24px;
  bottom: 26px;
  z-index: 2;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--shell-ink);
  background: var(--shell-highlight);
}

.dream-library-empty {
  justify-items: center;
  gap: 18px;
  padding: 70px 24px;
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-card-radius);
  color: var(--shell-ink);
  background: var(--shell-surface);
  box-shadow: var(--shell-card-shadow);
  text-align: center;
}

.dream-library-empty:not([hidden]) {
  display: grid;
}

/* Home */

.home-hero {
  position: relative;
  min-height: min(770px, calc(100vh - var(--topbar-height)));
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  color: white;
  background: #0b385c;
}

.home-hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  animation: hero-drift 18s ease-in-out infinite alternate;
}

@keyframes hero-drift {
  from {
    transform: scale(1.015) translate3d(-0.3%, 0, 0);
  }
  to {
    transform: scale(1.06) translate3d(0.8%, -0.5%, 0);
  }
}

.home-hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 28, 52, 0.92) 0%, rgba(8, 38, 66, 0.68) 35%, rgba(5, 28, 52, 0.05) 70%),
    linear-gradient(0deg, rgba(5, 28, 52, 0.54), transparent 55%);
}

.home-hero-glow {
  position: absolute;
  top: 12%;
  right: 28%;
  width: 24vw;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 225, 122, 0.16);
  filter: blur(60px);
  animation: glow-breathe 7s ease-in-out infinite;
}

@keyframes glow-breathe {
  50% {
    opacity: 0.45;
    transform: scale(1.25);
  }
}

.home-hero-content {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 64px), var(--content));
  margin: 0 auto;
  padding: 90px 0 76px;
}

.home-hero h1 {
  max-width: 760px;
  margin: 20px 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(52px, 6.4vw, 96px);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.home-hero-content > p {
  max-width: 580px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal-bright);
  box-shadow: 0 0 0 5px rgba(67, 212, 199, 0.14);
}

.home-content {
  padding: 92px 0 100px;
}

.mode-section,
.crew-section {
  scroll-margin-top: calc(var(--topbar-height) + 20px);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 34px;
}

.section-heading h2 {
  max-width: 720px;
  margin: 12px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 4vw, 54px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.section-heading > p {
  max-width: 390px;
  margin: 0 0 5px;
  color: var(--ink-soft);
  line-height: 1.65;
}

.section-heading-compact {
  align-items: center;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.mode-card {
  position: relative;
  min-height: 430px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xl);
  cursor: pointer;
  color: white;
  text-align: left;
  box-shadow: var(--shadow-soft);
  isolation: isolate;
}

.mode-card img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 650ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

.mode-card-story img {
  object-position: 30% center;
}

.mode-card-play img {
  object-position: 75% center;
}

.mode-card-dream img {
  object-position: 40% center;
}

.mode-card:hover img {
  transform: scale(1.07);
}

.mode-card-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, rgba(6, 26, 48, 0.9), rgba(6, 26, 48, 0.08) 66%);
}

.mode-card-copy {
  display: grid;
  gap: 5px;
  padding: 30px;
}

.mode-number {
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.mode-card-copy strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 36px;
  font-weight: 500;
}

.mode-card-copy small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.mode-arrow {
  position: absolute;
  right: 24px;
  bottom: 26px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  transition: transform 180ms ease, background 180ms ease;
}

.mode-card:hover .mode-arrow {
  transform: rotate(8deg) scale(1.08);
  background: rgba(255, 255, 255, 0.22);
}

.crew-section {
  padding-top: 100px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  color: var(--teal);
  font-weight: 900;
}

.crew-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}

.crew-card {
  overflow: hidden;
  border: 1px solid rgba(16, 42, 71, 0.08);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: 0 8px 26px rgba(16, 42, 71, 0.06);
}

.crew-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #fffdf7;
}

.crew-card-copy {
  display: grid;
  gap: 4px;
  padding: 14px 15px 16px;
}

.crew-card-copy strong {
  font-size: 14px;
}

.crew-card-copy small {
  color: var(--ink-soft);
  font-size: 11px;
}

/* Shared screen headers */

.screen-intro {
  min-height: 178px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding-top: 46px;
  padding-bottom: 30px;
}

.screen-intro h1 {
  margin: 12px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 5vw, 66px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.045em;
}

.intro-copy {
  max-width: 450px;
  margin: 0 0 6px;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* Story */

.story-screen {
  padding-bottom: 70px;
}

.story-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-meta strong {
  color: var(--ink);
  font-size: 20px;
}

.meta-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
}

.story-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.story-main {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 12px;
}

.story-stage {
  --story-motion-opacity-multiplier: 1;
  --story-drift-settle-multiplier: 1;
  position: relative;
  width: 100%;
  min-height: 0;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border-radius: var(--radius-xl);
  color: white;
  background: #061728;
  box-shadow: var(--shadow);
  isolation: isolate;
}

.story-stage.is-square-art {
  aspect-ratio: 1 / 1;
}

.story-stage.is-square-art .story-layer-stack.is-legacy-stack {
  display: none;
}

.story-scene-group {
  position: absolute;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  transform-origin: center;
  animation: story-scene-drift var(--story-drift-duration, 14s) ease-in-out infinite alternate;
  transition: opacity 260ms ease;
}

.story-stage.has-spatial-art .story-scene-group {
  animation: none;
  transform: none;
}

.story-stage.is-static-art .story-scene-group {
  animation: none;
  transform: none;
}

.story-scene-group > img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.story-stage.has-spatial-art .story-scene-group > img {
  display: none;
}

.story-stage.is-changing .story-scene-group {
  opacity: 0.2;
}

.story-parallax {
  position: absolute;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 420ms ease;
}

.story-spatial-plane,
.story-spatial-local-frame,
.story-spatial-image {
  display: block;
}

.story-spatial-plane {
  position: absolute;
  will-change: transform;
}

.story-spatial-local-frame {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.story-spatial-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  pointer-events: none;
}

.story-parallax.is-ready {
  opacity: 1;
}

.story-parallax.is-spatial-stack {
  isolation: isolate;
}

.story-depth-layer {
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0;
}

.story-parallax.is-ready .story-depth-layer {
  animation: story-layer-reveal 720ms cubic-bezier(0.2, 0.78, 0.24, 1) both;
}

.story-parallax.is-ready .story-depth-layer-mid {
  animation-delay: 90ms;
}

.story-parallax.is-ready .story-depth-layer-near {
  animation-delay: 170ms;
}

@keyframes story-layer-reveal {
  to {
    opacity: 1;
  }
}

.story-depth-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes story-scene-drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(
        calc(var(--story-drift-x, 0.2%) * var(--story-drift-settle-multiplier, 1)),
        calc(var(--story-drift-y, -0.1%) * var(--story-drift-settle-multiplier, 1)),
        0
      )
      scale(calc(1 + var(--story-drift-scale-delta, 0.01) * var(--story-drift-settle-multiplier, 1)));
  }
}

.story-art-plane {
  position: absolute;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.story-moment {
  position: absolute;
  display: block;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-50%, -50%, 0);
  transform-origin: center;
  will-change: opacity;
}

.story-moment--storm-darken {
  background: radial-gradient(
    circle at 0% 0%,
    rgba(2, 9, 28, 1) 0%,
    rgba(3, 11, 32, 0.82) 28%,
    rgba(4, 13, 37, 0.45) 55%,
    rgba(4, 13, 37, 0.12) 78%,
    transparent 100%
  );
}

.story-moment--lantern-drift,
.story-moment--deck-lantern-drift,
.story-moment--eggshell-warm,
.story-moment--temple-warm {
  background: radial-gradient(ellipse at center, rgba(255, 194, 96, 0.92), rgba(255, 174, 73, 0.5) 48%, transparent 100%);
}

.story-moment--lightning {
  background: radial-gradient(ellipse at center, rgba(230, 244, 255, 0.95), rgba(178, 216, 255, 0.48) 48%, transparent 100%);
}

.story-moment--cloud-swell {
  background: radial-gradient(ellipse at center, rgba(52, 27, 100, 0.96), rgba(63, 34, 116, 0.54) 50%, transparent 100%);
}

.story-moment--jelly-glow {
  background: radial-gradient(ellipse at center, rgba(106, 236, 255, 0.86), rgba(102, 183, 255, 0.4) 52%, transparent 100%);
}

.story-moment--vortex-swell {
  background: radial-gradient(ellipse at center, rgba(238, 225, 255, 0.9), rgba(154, 115, 255, 0.48) 50%, transparent 100%);
}

.story-motion-layer {
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: calc(0.52 * var(--story-motion-opacity-multiplier, 1));
  background: radial-gradient(circle at 78% 24%, rgba(255, 232, 157, 0.3), transparent 21%);
  mix-blend-mode: screen;
  animation: story-light-pool 6.2s ease-in-out infinite alternate;
}

.story-motion-layer::before,
.story-motion-layer::after {
  content: "";
  position: absolute;
  inset: -14%;
  pointer-events: none;
  opacity: 0;
}

.story-stage[data-motion-mood="storm"] .story-motion-layer,
.story-stage[data-motion-mood="storm-glow"] .story-motion-layer {
  opacity: calc(0.62 * var(--story-motion-opacity-multiplier, 1));
  background: radial-gradient(circle at 24% 18%, rgba(183, 220, 255, 0.26), transparent 25%);
  animation: story-storm-breathe 4.8s ease-in-out infinite alternate;
}

/* Rain only where the illustrator painted rain (scene 2). Owner-confirmed from
   the art: streaks tilt ~30deg with tops to the LEFT of vertical, so the rain
   travels left-to-right as it falls. Pages 4 and 6 are painted dry (wind and
   vortex scenes) and get no rain overlay. */
.story-stage[data-scene="scene-02"] .story-motion-layer::before {
  opacity: 0.12;
  background: repeating-linear-gradient(
    60deg,
    transparent 0 20px,
    rgba(210, 236, 255, 0.72) 20px 21px,
    transparent 21px 42px
  );
  background-size: 42px 126px;
  -webkit-mask-image: repeating-linear-gradient(150deg, #000 0 52px, transparent 52px 126px);
  mask-image: repeating-linear-gradient(150deg, #000 0 52px, transparent 52px 126px);
  filter: blur(0.2px);
  animation: story-rain 0.95s linear infinite;
}

.story-stage[data-motion-mood="storm"] .story-motion-layer::after {
  background: radial-gradient(circle at 22% 18%, rgba(229, 244, 255, 0.9), transparent 24%);
}

.story-stage[data-motion-mood="glow"] .story-motion-layer,
.story-stage[data-motion-mood="cave"] .story-motion-layer,
.story-stage[data-motion-mood="dream"] .story-motion-layer,
.story-stage[data-motion-mood="celebration"] .story-motion-layer {
  background:
    radial-gradient(circle at 76% 34%, rgba(255, 232, 122, 0.34), transparent 22%),
    radial-gradient(circle at 28% 72%, rgba(98, 222, 255, 0.22), transparent 24%);
  animation: story-glow-wash 7s ease-in-out infinite alternate;
}

.story-stage[data-motion-mood="glow"] .story-motion-layer::before,
.story-stage[data-motion-mood="cave"] .story-motion-layer::before,
.story-stage[data-motion-mood="dream"] .story-motion-layer::before,
.story-stage[data-motion-mood="celebration"] .story-motion-layer::before {
  opacity: 0.5;
  background:
    radial-gradient(circle at 14% 32%, rgba(255, 239, 141, 0.8) 0 2px, transparent 4px),
    radial-gradient(circle at 48% 64%, rgba(132, 238, 255, 0.74) 0 2px, transparent 5px),
    radial-gradient(circle at 78% 26%, rgba(255, 209, 114, 0.74) 0 3px, transparent 6px),
    radial-gradient(circle at 88% 76%, rgba(199, 148, 255, 0.68) 0 2px, transparent 5px);
  filter: blur(0.4px);
  animation: story-motes 9s ease-in-out infinite alternate;
}

.story-stage[data-motion-mood="storm-glow"] .story-motion-layer::after {
  opacity: 0.48;
  background:
    radial-gradient(circle at 62% 68%, rgba(108, 228, 255, 0.62), transparent 18%),
    radial-gradient(circle at 78% 38%, rgba(255, 225, 112, 0.48), transparent 16%);
  animation: story-glow-pulse 4.2s ease-in-out infinite alternate;
}

.story-stage[data-motion-mood="breeze"] .story-motion-layer::before,
.story-stage[data-motion-mood="calm"] .story-motion-layer::before,
.story-stage[data-motion-mood="deck"] .story-motion-layer::before {
  opacity: 0.24;
  background: radial-gradient(circle at 68% 24%, rgba(255, 246, 191, 0.42), transparent 24%);
  animation: story-light-pool 8.5s ease-in-out infinite alternate;
}

@keyframes story-light-pool {
  from {
    transform: translate3d(-1%, 1%, 0) scale(0.98);
  }
  to {
    transform: translate3d(1%, -1%, 0) scale(1.04);
    opacity: calc(0.72 * var(--story-motion-opacity-multiplier, 1));
  }
}

@keyframes story-storm-breathe {
  to {
    opacity: calc(0.82 * var(--story-motion-opacity-multiplier, 1));
    transform: translate3d(2%, -1%, 0);
  }
}

@keyframes story-rain {
  from {
    transform: translate3d(-5%, -14%, 0);
  }
  to {
    transform: translate3d(5%, 14%, 0);
  }
}

@keyframes story-glow-wash {
  to {
    opacity: calc(0.76 * var(--story-motion-opacity-multiplier, 1));
    transform: translate3d(-1.2%, 1%, 0) scale(1.04);
  }
}

@keyframes story-motes {
  from {
    transform: translate3d(-2%, 3%, 0) scale(0.98);
  }
  to {
    transform: translate3d(3%, -4%, 0) scale(1.04);
  }
}

@keyframes story-glow-pulse {
  to {
    opacity: 0.78;
    transform: scale(1.08);
  }
}

.story-vignette {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, rgba(3, 15, 28, 0.42), transparent 26%);
}

.story-caption-bar {
  position: absolute;
  z-index: 3;
  right: 6%;
  bottom: 4%;
  left: 6%;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.story-caption-text {
  max-width: 940px;
  margin: 0;
  margin-inline: auto;
  color: white;
  font-size: clamp(17px, 2vw, 25px);
  font-weight: 800;
  line-height: 1.24;
  letter-spacing: 0.005em;
  text-align: center;
  text-wrap: balance;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  text-shadow:
    -1px -1px 0 rgba(3, 14, 25, 0.96),
    1px -1px 0 rgba(3, 14, 25, 0.96),
    -1px 1px 0 rgba(3, 14, 25, 0.96),
    1px 1px 0 rgba(3, 14, 25, 0.96),
    0 3px 8px rgba(0, 0, 0, 0.88),
    0 7px 22px rgba(0, 0, 0, 0.58);
}

.story-caption-text.is-entering {
  animation: story-caption-enter 280ms cubic-bezier(0.18, 0.78, 0.24, 1) both;
}

@keyframes story-caption-enter {
  from {
    opacity: 0;
    transform: translate3d(0, 5px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.story-caption-text:empty,
.story-caption-bar.captions-off {
  opacity: 0;
}

.story-pages-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 30px);
  background: rgba(6, 26, 48, 0.82);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  backdrop-filter: blur(18px) saturate(1.12);
  animation: story-pages-scrim-in 180ms ease-out both;
}

.story-pages-overlay[hidden] {
  display: none;
}

.story-pages-panel {
  width: min(100%, 880px);
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: story-pages-panel-in 220ms cubic-bezier(0.18, 0.78, 0.24, 1) both;
}

.story-pages-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 12px;
}

.story-pages-header h3 {
  margin: 0;
  color: white;
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 900;
}

.story-pages-close {
  width: 44px;
  min-width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  transition: transform 160ms ease, background 160ms ease;
}

.story-pages-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.story-pages-close:active {
  transform: scale(0.96);
}

.story-pages-close svg {
  width: 22px;
  height: 22px;
}

.story-pages-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-block: 10px;
  padding-inline: max(14px, calc(50% - clamp(75px, 19%, 115px)));
  scroll-padding-inline: max(14px, calc(50% - clamp(75px, 19%, 115px)));
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.story-pages-grid::-webkit-scrollbar {
  display: none;
}

.story-page-tile {
  position: relative;
  z-index: 0;
  flex-grow: 0;
  flex-shrink: 0;
  flex-basis: clamp(150px, 38%, 230px);
  min-height: 44px;
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 6px 6px 8px;
  border: 3px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.08);
  font-size: clamp(9px, 1.4vw, 12px);
  font-weight: 850;
  scroll-snap-align: center;
  text-align: center;
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.story-page-tile:hover {
  color: white;
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
}

.story-page-tile.is-active {
  z-index: 1;
  border-color: var(--sun);
  color: white;
  background: rgba(255, 205, 84, 0.2);
  box-shadow: 0 0 0 2px rgba(255, 205, 84, 0.22);
  transform: scale(1.025);
}

.story-page-tile img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  border-radius: 10px;
}

.story-page-tile span {
  display: block;
}

@keyframes story-pages-scrim-in {
  from {
    opacity: 0;
  }
}

@keyframes story-pages-panel-in {
  from {
    opacity: 0;
    transform: scale(0.98) translateY(5px);
  }
}

.story-player-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 12px 9px;
  border: 1px solid rgba(16, 42, 71, 0.08);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.82);
  box-shadow: 0 8px 24px rgba(11, 42, 68, 0.05);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
}

.story-player-primary {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.story-step-button,
.story-play-control,
.story-tool-button {
  min-height: 46px;
  cursor: pointer;
  transition: transform 160ms ease, color 160ms ease, background 160ms ease;
}

.story-step-button:hover,
.story-step-button:focus-visible,
.story-tool-button:hover,
.story-tool-button:focus-visible {
  color: var(--ink);
  background: rgba(16, 42, 71, 0.06);
}

.story-step-button:active,
.story-tool-button:active {
  transform: scale(0.96);
}

.story-step-button:disabled {
  cursor: default;
  opacity: 0.42;
  transform: none;
  background: transparent;
}

.story-step-button {
  width: 46px;
  min-width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 12px;
  color: rgba(16, 42, 71, 0.62);
  background: transparent;
}

.story-step-button svg {
  width: 20px;
  height: 20px;
}

.story-play-control {
  width: 56px;
  min-width: 56px;
  min-height: 56px;
  display: grid;
  place-items: center;
  flex: 0 0 56px;
  align-items: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: var(--ink);
  background: var(--sun);
}

.story-play-control:hover,
.story-play-control:focus-visible {
  color: var(--ink);
  background: #ffd96f;
  transform: scale(1.03);
}

.story-play-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
}

.story-play-svg {
  width: 26px;
  height: 26px;
  grid-area: 1 / 1;
}

.story-play-svg-pause,
.story-play-control.is-playing .story-play-svg-play {
  display: none;
}

.story-play-control.is-playing .story-play-svg-pause {
  display: block;
}

.story-play-copy {
  display: none;
}

#story-audio-detail {
  display: none;
  color: rgba(255, 255, 255, 0.58);
  font-size: 8px;
}

.story-player-tools {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.story-tool-button {
  min-width: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  border: none;
  border-radius: 12px;
  color: rgba(16, 42, 71, 0.62);
  background: transparent;
  font-size: 10px;
  font-weight: 750;
}

.story-tool-button strong {
  font-size: 10px;
  font-weight: 900;
}

.story-tool-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.story-icon-tool-button {
  width: 46px;
  min-width: 46px;
  padding: 0;
}

.story-mute-icon {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
}

.story-mute-svg {
  width: 21px;
  height: 21px;
  grid-area: 1 / 1;
}

.story-mute-svg-muted,
.story-mute-button[aria-pressed="true"] .story-mute-svg-audible {
  display: none;
}

.story-mute-button[aria-pressed="true"] {
  color: var(--ink);
  background: rgba(255, 205, 84, 0.28);
}

.story-mute-button[aria-pressed="true"] .story-mute-svg-muted {
  display: block;
}

.story-pages-button {
  border-radius: 999px;
}

.story-tool-button.caption-toggle.is-active {
  color: var(--ink);
  background: rgba(255, 205, 84, 0.28);
}

.story-fullscreen-button {
  min-width: 104px;
}

.story-caption-progress {
  position: absolute;
  top: 5px;
  right: 12px;
  left: 12px;
  height: 3px;
  border-radius: 999px;
  background: rgba(5, 33, 56, 0.08);
}

.story-caption-scrub {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  transform: translateY(-50%);
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.story-caption-scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(16, 42, 71, 0.35);
  border-radius: 50%;
  background: var(--sun);
}

.story-caption-scrub::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(16, 42, 71, 0.35);
  border-radius: 50%;
  background: var(--sun);
}

.story-caption-progress span {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--sun);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 90ms linear;
}

.story-main:fullscreen,
.story-main:-webkit-full-screen,
.story-main.is-fullscreen-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
  background: #041321;
}

.story-main.is-fullscreen-fallback {
  position: fixed;
  inset: 0;
  z-index: 500;
  width: 100vw;
  height: 100dvh;
}

body.story-fullscreen-open {
  overflow: hidden;
}

body.story-fullscreen-open .primary-nav {
  display: none;
}

.story-main:fullscreen .story-stage,
.story-main:-webkit-full-screen .story-stage,
.story-main.is-fullscreen-fallback .story-stage {
  min-height: 0;
  flex: 1 1 auto;
  aspect-ratio: auto;
  border-radius: 16px;
  box-shadow: none;
}

.story-main:fullscreen .story-player-nav,
.story-main:-webkit-full-screen .story-player-nav,
.story-main.is-fullscreen-fallback .story-player-nav {
  width: 100%;
  flex: 0 0 auto;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(245, 247, 243, 0.96);
}

.story-main:fullscreen .story-caption-text,
.story-main:-webkit-full-screen .story-caption-text,
.story-main.is-fullscreen-fallback .story-caption-text {
  font-size: clamp(20px, 3vw, 34px);
}


/* Games */

.play-screen {
  padding-bottom: 80px;
}

.game-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.game-shell[hidden] {
  display: none;
}

.game-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.game-tabs::-webkit-scrollbar {
  display: none;
}

.game-tab {
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 17px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
}

.game-tab:hover {
  color: var(--ink);
  background: rgba(16, 42, 71, 0.04);
}

.game-tab.is-active {
  color: white;
  background: var(--ink);
}

.game-panel {
  min-height: 590px;
  display: none;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 36px;
  align-items: center;
  padding: 36px;
}

.game-panel.is-active {
  display: grid;
}

.game-panel-copy h2 {
  margin: 12px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.game-panel-copy > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.game-stats {
  display: flex;
  gap: 24px;
  margin: 26px 0;
}

.game-stats > span {
  min-width: 68px;
  display: grid;
  gap: 4px;
}

.game-stats small {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.game-stats strong {
  font-size: 24px;
  line-height: 1;
}

.game-stats b {
  color: var(--teal);
  font-weight: inherit;
}

.memory-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(84px, 1fr));
  gap: 12px;
  perspective: 1200px;
}

.memory-card {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 20px;
  cursor: pointer;
  background: transparent;
  perspective: 800px;
}

.memory-card-inner {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transform-style: preserve-3d;
  transition: transform 440ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.memory-card.is-flipped .memory-card-inner,
.memory-card.is-matched .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card.is-matched {
  cursor: default;
  pointer-events: none;
}

.memory-card.is-matched .memory-card-inner {
  animation: memory-match-pop 520ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.memory-card.is-matched::after {
  content: "✓";
  position: absolute;
  z-index: 4;
  top: 7px;
  right: 7px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  background: var(--teal);
  box-shadow: 0 5px 14px rgba(16, 42, 71, 0.24);
  font-size: 13px;
  font-weight: 900;
}

.memory-card.is-matched .memory-card-front {
  border-color: var(--teal-bright);
  box-shadow:
    0 0 0 3px rgba(67, 212, 199, 0.26),
    0 0 24px rgba(67, 212, 199, 0.56),
    0 8px 24px rgba(16, 42, 71, 0.1);
}

@keyframes memory-match-pop {
  0% {
    transform: rotateY(180deg) scale(1);
  }
  52% {
    transform: rotateY(180deg) scale(1.08);
  }
  100% {
    transform: rotateY(180deg) scale(1);
  }
}

.memory-card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: inherit;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 8px 24px rgba(16, 42, 71, 0.1);
}

.memory-card-back {
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.15), transparent 30%),
    linear-gradient(145deg, var(--ocean), #162a68 58%, var(--violet));
}

.memory-card-back::before,
.memory-card-back::after {
  content: "";
  position: absolute;
  width: 42%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 45% 55% 58% 42%;
  transform: rotate(35deg);
}

.memory-card-back::after {
  width: 68%;
  transform: rotate(-22deg);
}

.memory-card-back span {
  z-index: 1;
  font-size: 24px;
}

.memory-card-front {
  transform: rotateY(180deg);
  border: 2px solid white;
  background: #fffdf7;
}

.memory-card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-card-front span {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  overflow: hidden;
  padding: 6px 8px;
  border-radius: 99px;
  color: white;
  background: rgba(16, 42, 71, 0.74);
  backdrop-filter: blur(8px);
  font-size: 9px;
  font-weight: 900;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.puzzle-scene-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  padding: 4px 0;
}

.puzzle-scene-button {
  width: 46px;
  aspect-ratio: 1;
  flex: 0 0 46px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  background: var(--paper);
}

.puzzle-scene-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.puzzle-scene-button.is-active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(29, 156, 152, 0.15);
}

.puzzle-selected-label {
  display: block;
  margin-top: 8px;
  color: var(--teal);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.4;
}

.puzzle-wrap {
  position: relative;
  width: min(100%, 640px);
  justify-self: center;
}

.puzzle-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  aspect-ratio: 1;
  overflow: hidden;
  border: 6px solid white;
  border-radius: 24px;
  background: rgba(16, 42, 71, 0.08);
  box-shadow: var(--shadow-soft);
}

.puzzle-tile {
  position: relative;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  cursor: pointer;
  background-repeat: no-repeat;
  transition: transform 100ms ease, filter 160ms ease;
}

.puzzle-tile:hover {
  z-index: 1;
  filter: brightness(1.08);
}

.puzzle-tile.is-empty {
  cursor: default;
  background: repeating-linear-gradient(45deg, rgba(16, 42, 71, 0.03), rgba(16, 42, 71, 0.03) 8px, rgba(16, 42, 71, 0.06) 8px, rgba(16, 42, 71, 0.06) 16px) !important;
}

.puzzle-complete,
.glow-complete {
  position: absolute;
  inset: 18px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 22px;
  color: white;
  background: rgba(8, 34, 57, 0.76);
  backdrop-filter: blur(16px);
  animation: reward-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.puzzle-complete[hidden],
.glow-complete[hidden] {
  display: none;
}

.puzzle-complete > span,
.glow-complete > span {
  color: var(--sun);
  font-size: 34px;
}

.puzzle-complete strong,
.glow-complete strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 500;
}

.puzzle-complete small {
  color: rgba(255, 255, 255, 0.68);
}

@keyframes reward-in {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}

.glow-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 2 / 1;
  border-radius: 26px;
  background: #142a61;
  box-shadow: var(--shadow-soft);
}

.glow-stage > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.glow-stage-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(20, 24, 75, 0.12);
}

.glow-target {
  position: absolute;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 50%;
  cursor: pointer;
  background: rgba(255, 224, 109, 0.95);
  box-shadow: 0 0 10px 4px rgba(255, 216, 83, 0.62), 0 0 30px 14px rgba(208, 117, 255, 0.28);
  animation: target-float 3.2s ease-in-out infinite alternate;
}

.glow-target::after {
  content: "✦";
  color: white;
  font-size: 11px;
}

.glow-target:hover {
  transform: scale(1.18);
}

.glow-target.is-found {
  pointer-events: none;
  animation: target-found 380ms ease forwards;
}

@keyframes target-float {
  to {
    transform: translateY(-6px) scale(1.06);
  }
}

@keyframes target-found {
  to {
    opacity: 0;
    transform: scale(2.4);
  }
}

.maze-experience {
  width: min(100%, 690px);
  display: grid;
  justify-items: center;
  gap: 12px;
  justify-self: center;
}

.maze-board {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 7;
  overflow: hidden;
  border: 6px solid white;
  border-radius: 26px;
  background: #102a47;
  box-shadow: var(--shadow-soft);
  isolation: isolate;
}

.maze-board:focus-visible {
  outline: 4px solid rgba(67, 212, 199, 0.58);
  outline-offset: 4px;
}

.maze-backdrop {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.72) brightness(0.58);
  transform: scale(1.04);
}

.maze-board::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 90% 88%, rgba(255, 218, 90, 0.28), transparent 26%),
    linear-gradient(145deg, rgba(8, 42, 61, 0.34), rgba(28, 18, 74, 0.56));
}

.maze-grid {
  position: absolute;
  inset: 13px;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--maze-columns), minmax(0, 1fr));
  grid-template-rows: repeat(var(--maze-rows), minmax(0, 1fr));
}

.maze-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: visible;
  border: 0 solid transparent;
  border-radius: 0;
  cursor: default;
  background: rgba(4, 23, 41, 0.09);
  transition: background 180ms ease;
}

.maze-cell.maze-wall-north {
  border-top: 3px solid rgba(240, 255, 250, 0.92);
}

.maze-cell.maze-wall-east {
  border-right: 3px solid rgba(240, 255, 250, 0.92);
}

.maze-cell.maze-wall-south {
  border-bottom: 3px solid rgba(240, 255, 250, 0.92);
}

.maze-cell.maze-wall-west {
  border-left: 3px solid rgba(240, 255, 250, 0.92);
}

.maze-cell.is-visited {
  background: rgba(67, 212, 199, 0.13);
}

.maze-cell.is-start::after {
  content: "Start";
  position: absolute;
  top: 3px;
  left: 5px;
  color: rgba(255, 255, 255, 0.56);
  font-size: clamp(5px, 0.7vw, 8px);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.maze-player {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: min(74%, 46px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--sun);
  box-shadow:
    0 0 0 3px rgba(255, 211, 79, 0.2),
    0 8px 18px rgba(4, 22, 39, 0.38);
  transform: translate(-50%, -50%);
  animation: maze-player-arrive 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.maze-player img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes maze-player-arrive {
  from {
    opacity: 0.45;
    transform: translate(-50%, -50%) scale(0.72);
  }
}

.maze-goal {
  position: absolute;
  z-index: 2;
  inset: 4px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  border-radius: 50%;
  color: white;
  background: radial-gradient(circle, rgba(255, 224, 95, 0.92), rgba(212, 129, 255, 0.5) 46%, transparent 72%);
  filter: drop-shadow(0 0 9px rgba(255, 224, 95, 0.82));
  animation: maze-goal-glow 1.8s ease-in-out infinite alternate;
}

.maze-goal > span {
  color: white;
  font-size: clamp(14px, 2vw, 25px);
  line-height: 0.8;
}

.maze-goal small {
  font-size: clamp(5px, 0.65vw, 8px);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@keyframes maze-goal-glow {
  to {
    filter: drop-shadow(0 0 15px rgba(255, 224, 95, 1));
    transform: scale(1.06);
  }
}

.maze-board.is-bumped {
  animation: maze-bump 240ms ease;
}

@keyframes maze-bump {
  35% {
    transform: translateX(-3px);
  }
  70% {
    transform: translateX(3px);
  }
}

.maze-complete {
  position: absolute;
  inset: 18px;
  z-index: 5;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 20px;
  color: white;
  background: rgba(7, 34, 56, 0.78);
  backdrop-filter: blur(14px);
  text-align: center;
  animation: reward-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.maze-complete[hidden] {
  display: none;
}

.maze-complete img {
  width: 76px;
  aspect-ratio: 1;
  border: 3px solid white;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 28px rgba(255, 220, 95, 0.55);
}

.maze-complete strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 500;
}

.maze-complete small {
  color: rgba(255, 255, 255, 0.72);
}

.maze-dpad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  place-items: center;
  gap: 3px;
}

.maze-direction {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink);
  background: white;
  box-shadow: 0 5px 14px rgba(16, 42, 71, 0.08);
  font-size: 16px;
  font-weight: 900;
  transition: transform 120ms ease, background 120ms ease;
}

.maze-direction:hover {
  color: white;
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.maze-direction:active {
  transform: translateY(1px);
}

.maze-direction-north {
  grid-area: 1 / 2;
}

.maze-direction-west {
  grid-area: 2 / 1;
}

.maze-dpad-center {
  grid-area: 2 / 2;
  color: var(--teal);
  font-size: 14px;
}

.maze-direction-east {
  grid-area: 2 / 3;
}

.maze-direction-south {
  grid-area: 3 / 2;
}

.maze-status {
  min-height: 18px;
  margin: -3px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

/* Dream mode */

.dream-screen {
  color: var(--shell-ink);
  background: var(--shell-surface-warm);
}

.dream-stage {
  position: relative;
  min-height: calc(100vh - var(--topbar-height));
  display: flex;
  align-items: center;
  overflow: hidden;
  color: var(--shell-on-accent);
  background: var(--brand-night);
  isolation: isolate;
}

.dream-stage[hidden],
.dream-library-view[hidden] {
  display: none;
}

.dream-art {
  position: absolute;
  inset: 0;
  z-index: -6;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  animation: dream-drift 26s ease-in-out infinite alternate;
}

.dream-depth-art {
  position: absolute;
  inset: -3%;
  z-index: -5;
  overflow: hidden;
  pointer-events: none;
}

.dream-depth {
  position: absolute;
  inset: 0;
  display: block;
  will-change: transform;
}

.dream-depth img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dream-depth-far {
  animation: dream-depth-far 32s ease-in-out infinite alternate;
}

.dream-depth-mid {
  animation: dream-depth-mid 22s ease-in-out infinite alternate;
}

.dream-depth-near {
  animation: dream-depth-near 15s ease-in-out infinite alternate;
}

@keyframes dream-depth-far {
  to {
    transform: translate3d(0.6%, -0.2%, 0) scale(1.025);
  }
}

@keyframes dream-depth-mid {
  from {
    transform: translate3d(0.2%, -0.25%, 0) scale(1.02);
  }
  to {
    transform: translate3d(-0.55%, 0.35%, 0) scale(1.035);
  }
}

@keyframes dream-depth-near {
  from {
    transform: translate3d(-0.45%, 0.25%, 0) scale(1.025);
  }
  to {
    transform: translate3d(0.7%, -0.45%, 0) scale(1.045);
  }
}

@keyframes dream-drift {
  from {
    transform: scale(1.05) translateX(-1%);
  }
  to {
    transform: scale(1.13) translateX(1%);
  }
}

.dream-shade {
  position: absolute;
  inset: 0;
  z-index: -4;
  background:
    linear-gradient(90deg, rgba(14, 15, 66, 0.95), rgba(14, 15, 66, 0.62) 44%, rgba(14, 15, 66, 0.1) 78%),
    linear-gradient(0deg, rgba(14, 15, 66, 0.42), transparent 55%);
}

.dream-aurora {
  position: absolute;
  z-index: -3;
  width: 48vw;
  aspect-ratio: 1;
  border-radius: 48% 52% 55% 45%;
  filter: blur(90px);
  opacity: 0.22;
  animation: aurora 12s ease-in-out infinite alternate;
}

.dream-aurora-one {
  top: -22%;
  right: 5%;
  background: #ff7ae1;
}

.dream-aurora-two {
  right: 20%;
  bottom: -32%;
  background: #30e8c7;
  animation-delay: -5s;
}

@keyframes aurora {
  to {
    opacity: 0.4;
    transform: translate(8%, 5%) scale(1.18) rotate(15deg);
  }
}

.dream-particles {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.dream-particle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 10px rgba(139, 224, 255, 0.9);
  animation: particle-rise var(--duration) linear infinite;
  animation-delay: var(--delay);
}

@keyframes particle-rise {
  from {
    opacity: 0;
    transform: translateY(15vh) scale(0.4);
  }
  18% {
    opacity: 0.7;
  }
  82% {
    opacity: 0.45;
  }
  to {
    opacity: 0;
    transform: translateY(-95vh) translateX(24px) scale(1.3);
  }
}

.dream-content {
  width: min(calc(100% - 64px), var(--content));
  margin: 0 auto;
  padding: 70px 0;
}

.dream-content h1 {
  max-width: 690px;
  margin: 18px 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 6vw, 84px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.055em;
}

.dream-lead {
  max-width: 600px;
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  line-height: 1.6;
}

.breathing-orb-wrap {
  width: 170px;
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-top: 32px;
}

.breathing-orb {
  position: relative;
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  margin-bottom: 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 50px rgba(100, 213, 255, 0.2);
  animation: breathe 8s ease-in-out infinite;
}

.breathing-orb::before,
.breathing-orb::after {
  content: "";
  position: absolute;
  inset: -14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  animation: breathe-ring 8s ease-in-out infinite;
}

.breathing-orb::after {
  inset: -28px;
  animation-delay: -0.5s;
}

.breathing-orb-inner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, white, #8ee9ff 36%, #8a6dff 75%, transparent 76%);
  filter: drop-shadow(0 0 16px rgba(128, 220, 255, 0.8));
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.82);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes breathe-ring {
  0%,
  100% {
    opacity: 0.18;
    transform: scale(0.88);
  }
  50% {
    opacity: 0.58;
    transform: scale(1.1);
  }
}

.breathing-orb-wrap strong {
  font-size: 13px;
}

.breathing-orb-wrap small {
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
}

.dream-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 34px;
}

.dream-play-button {
  min-width: 280px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 18px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  cursor: pointer;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
}

.dream-play-button > span:first-child {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--ink);
  background: var(--sun);
  font-size: 11px;
}

.dream-play-button > span:last-child {
  display: grid;
  gap: 2px;
  text-align: left;
}

.dream-play-button strong {
  font-size: 12px;
}

.dream-play-button small {
  color: rgba(255, 255, 255, 0.52);
  font-size: 9px;
}

.dream-play-button.is-playing > span:first-child {
  background: var(--teal-bright);
}

.timer-picker {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(7, 23, 63, 0.28);
  backdrop-filter: blur(12px);
}

.timer-picker > span {
  padding: 0 8px 0 11px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.timer-picker button {
  padding: 8px 11px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.65);
  background: transparent;
  font-size: 10px;
  font-weight: 900;
}

.timer-picker button.is-active {
  color: var(--ink);
  background: white;
}

.timer-status {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.dream-character {
  position: absolute;
  right: 7vw;
  bottom: -4vw;
  width: min(28vw, 420px);
  opacity: 0.2;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 32px rgba(134, 120, 255, 0.5));
  transform: rotate(5deg);
  animation: jelly-float 7s ease-in-out infinite alternate;
}

.dream-character img {
  border-radius: 45%;
}

@keyframes jelly-float {
  to {
    opacity: 0.32;
    transform: translateY(-20px) rotate(1deg);
  }
}

/* Dialog and toast */

.toast {
  position: fixed;
  z-index: 300;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100% - 48px));
  padding: 13px 17px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  pointer-events: none;
  color: white;
  background: rgba(16, 42, 71, 0.92);
  box-shadow: 0 12px 38px rgba(16, 42, 71, 0.24);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 12px;
  font-weight: 800;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.grownups-dialog {
  width: min(580px, calc(100% - 32px));
  padding: 36px;
  border: 1px solid rgba(16, 42, 71, 0.12);
  border-radius: 28px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 100px rgba(5, 22, 40, 0.35);
}

.grownups-dialog::backdrop {
  background: rgba(5, 22, 40, 0.66);
  backdrop-filter: blur(8px);
}

.grownups-dialog h2 {
  margin: 13px 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.grownups-dialog > p {
  color: var(--ink-soft);
  line-height: 1.65;
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-soft);
  background: rgba(16, 42, 71, 0.06);
  font-size: 24px;
}

.dialog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 24px 0;
}

.dialog-grid > div {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(29, 156, 152, 0.08);
}

.dialog-grid strong {
  color: var(--teal);
  font-size: 26px;
}

.dialog-grid small {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.35;
}

.dialog-note {
  padding: 14px 16px;
  border-left: 3px solid var(--sun);
  background: rgba(245, 198, 77, 0.12);
  font-size: 12px;
}

/* Responsive */

.dream-content,
.home-content,
.stories-library,
.dream-library-view,
.story-screen,
.play-screen {
  padding-bottom: calc(87px + 18px + env(safe-area-inset-bottom));
}

@media (max-width: 1100px) {
  .mode-card {
    min-height: 370px;
  }

  .crew-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .game-panel {
    grid-template-columns: 240px minmax(0, 1fr);
    padding: 28px;
  }

  .memory-board {
    grid-template-columns: repeat(3, 1fr);
  }

}

@media (max-width: 820px) {
  :root {
    --topbar-height: 68px;
  }

  .content-width,
  .home-hero-content,
  .dream-content {
    width: min(calc(100% - 32px), var(--content));
  }

  .topbar {
    min-height: var(--topbar-height);
    padding: 8px 16px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .grownups-button span:last-child,
  .brand-copy small {
    display: none;
  }

  .grownups-button {
    width: 40px;
    height: 40px;
    justify-content: center;
    padding: 0;
  }

  .home-hero {
    min-height: 700px;
  }

  .home-hero-art {
    object-position: 62% center;
  }

  .home-hero-shade {
    background:
      linear-gradient(90deg, rgba(5, 28, 52, 0.88), rgba(5, 28, 52, 0.3)),
      linear-gradient(0deg, rgba(5, 28, 52, 0.72), transparent 74%);
  }

  .home-hero-content {
    padding-bottom: 62px;
  }

  .home-hero h1 {
    font-size: clamp(48px, 12vw, 72px);
  }

  .home-content {
    padding-top: 68px;
  }

  .section-heading,
  .stories-heading,
  .dream-library-heading,
  .screen-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .section-heading > p,
  .stories-heading > p,
  .dream-library-heading > p,
  .intro-copy {
    max-width: 620px;
  }

  .mode-grid {
    grid-template-columns: 1fr;
  }

  .mode-card {
    min-height: 300px;
  }

  .story-stage {
    min-height: 0;
  }

  .story-player-nav {
    gap: 7px;
  }

  .story-player-tools {
    gap: 5px;
  }

  .story-tool-button {
    min-width: 56px;
    padding-inline: 8px;
  }

  .story-fullscreen-button {
    min-width: 92px;
  }

  .game-panel.is-active {
    grid-template-columns: 1fr;
  }

  .game-panel-copy {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 22px;
  }

  .game-panel-copy .eyebrow,
  .game-panel-copy h2,
  .game-panel-copy > p,
  .game-panel-copy .puzzle-scene-picker {
    grid-column: 1 / -1;
  }

  .game-stats {
    align-self: center;
    margin: 20px 0 0;
  }

  .game-panel-copy > .button {
    align-self: end;
    margin-top: 20px;
  }

  .memory-board {
    grid-template-columns: repeat(4, 1fr);
  }

  .play-pack-bar {
    grid-template-columns: 1fr;
  }

  .dream-stage {
    align-items: flex-start;
  }

  .dream-content {
    padding-top: 64px;
  }

  .dream-shade {
    background:
      linear-gradient(90deg, rgba(14, 15, 66, 0.9), rgba(14, 15, 66, 0.36)),
      linear-gradient(0deg, rgba(14, 15, 66, 0.72), transparent 72%);
  }

  .dream-character {
    right: -4vw;
    width: 42vw;
  }
}

@media (max-width: 580px) {
  .brand-copy strong {
    font-size: 13px;
  }

  .home-hero {
    min-height: 670px;
  }

  .home-hero h1 {
    font-size: 50px;
  }

  .home-hero-content > p {
    font-size: 16px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-status span:nth-last-child(-n + 2) {
    display: none;
  }

  .section-heading h2,
  .stories-heading h1,
  .dream-library-heading h1,
  .screen-intro h1 {
    font-size: 38px;
  }

  .stories-library,
  .dream-library-view {
    padding-top: 46px;
  }

  .story-shelf-tile {
    border-radius: var(--shell-card-radius-small);
  }

  .story-shelf-primary {
    grid-template-rows: minmax(245px, 1fr) auto;
  }

  .story-shelf-copy {
    padding: 23px 22px 24px;
  }

  .story-shelf-progress-copy {
    display: none;
  }

  .play-pack-bar {
    padding: 16px;
  }

  .play-pack-choice {
    min-width: 190px;
  }

  .dream-library-card {
    min-height: 250px;
    border-radius: var(--shell-card-radius-small);
  }

  .mode-card {
    min-height: 260px;
  }

  .crew-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .story-stage {
    min-height: 0;
    border-radius: 18px;
  }

  .story-caption-bar {
    right: 3%;
    bottom: 5%;
    left: 3%;
  }

  .story-caption-text {
    font-size: 15px;
    line-height: 1.2;
    text-wrap: pretty;
  }

  .story-player-nav {
    gap: 4px;
    padding: 10px 6px 6px;
    border-radius: 15px;
  }

  .story-player-primary {
    gap: 8px;
  }

  .story-step-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    font-size: 14px;
  }

  .story-step-button span:not([aria-hidden]) {
    display: none;
  }

  .story-play-control {
    width: 48px;
    min-width: 48px;
    min-height: 48px;
    flex-basis: 48px;
  }

  .story-play-icon {
    width: 23px;
    height: 23px;
  }

  .story-play-svg {
    width: 23px;
    height: 23px;
  }

  .story-player-tools {
    display: flex;
    gap: 4px;
  }

  .story-tool-button,
  .story-fullscreen-button {
    width: 36px;
    min-width: 36px;
    min-height: 44px;
    gap: 0;
    padding: 0;
    font-size: 10px;
  }

  .story-tool-button.story-pages-button {
    width: 64px;
    min-width: 64px;
    gap: 4px;
    padding-inline: 6px;
  }

  #story-speed > span,
  #story-caption-toggle > strong,
  #story-fullscreen-label {
    display: none;
  }

  .story-caption-progress {
    top: 4px;
    right: 6px;
    left: 6px;
  }

  .game-shell {
    border-radius: 24px;
  }

  .game-panel {
    padding: 22px 16px 26px;
  }

  .game-panel-copy {
    display: block;
  }

  .game-panel-copy h2 {
    font-size: 36px;
  }

  .game-panel-copy > .button {
    margin-top: 0;
  }

  .memory-board {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .memory-card {
    border-radius: 14px;
  }

  .memory-card-front span {
    display: none;
  }

  .glow-stage {
    aspect-ratio: 1.45 / 1;
  }

  .maze-grid {
    inset: 8px;
  }

  .maze-cell.maze-wall-north {
    border-top-width: 2px;
  }

  .maze-cell.maze-wall-east {
    border-right-width: 2px;
  }

  .maze-cell.maze-wall-south {
    border-bottom-width: 2px;
  }

  .maze-cell.maze-wall-west {
    border-left-width: 2px;
  }

  .dream-content h1 {
    font-size: 48px;
  }

  .dream-lead {
    font-size: 14px;
  }

  .dream-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .dream-play-button {
    min-width: 0;
    width: 100%;
  }

  .timer-picker {
    justify-content: center;
  }

  .dream-character {
    display: none;
  }

  .grownups-dialog {
    padding: 30px 22px 24px;
  }

  .grownups-dialog h2 {
    font-size: 32px;
  }

  .dialog-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  .story-player-nav {
    gap: 0;
    padding-inline: 0;
  }

  .story-player-primary {
    gap: 6px;
  }

  .story-step-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .story-tool-button,
  .story-fullscreen-button {
    width: 30px;
    min-width: 30px;
  }

  .story-player-tools {
    gap: 0;
  }

  .story-tool-button.story-pages-button {
    width: 56px;
    min-width: 56px;
    gap: 1px;
    padding-inline: 3px;
  }

  .story-pages-button strong {
    font-size: 9px;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .story-scene-group,
  .story-motion-layer,
  .story-motion-layer::before,
  .story-motion-layer::after {
    animation: none !important;
    transform: none !important;
  }

  .story-parallax.is-ready .story-depth-layer {
    animation: none !important;
    opacity: 1;
    filter: none;
  }
}

.grownups-status {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--shell-ink-soft);
}

.grownups-status summary {
  cursor: pointer;
  font-weight: 600;
}

.grownups-status-body {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: var(--shell-surface-warm);
  border-radius: var(--radius-md);
  border: 1px solid var(--shell-line);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  line-height: 1.5;
}
