:root {
  color-scheme: dark;
  --bg: #02040d;
  --safe-bg: #141322;
  --ink: #f4fbff;
  --ink-shadow: rgba(0, 0, 0, 0.54);
  --amber: #f8d66d;
  --teal: #35f6ff;
  --red: #ff4f9a;
  --blue: #7aa7ff;
  --violet: #9c7bff;
  --radius: 8px;
  --space-image: url("assets/space-smooth.jpg");
  --space-color-wash:
    linear-gradient(
      118deg,
      rgba(53, 246, 255, 0.18) 4%,
      rgba(122, 167, 255, 0.1) 29%,
      rgba(255, 79, 154, 0.16) 57%,
      rgba(248, 214, 109, 0.1) 79%,
      rgba(20, 19, 34, 0) 100%
    ),
    linear-gradient(
      236deg,
      rgba(20, 19, 34, 0) 0%,
      rgba(79, 255, 185, 0.11) 25%,
      rgba(20, 19, 34, 0) 51%,
      rgba(156, 123, 255, 0.17) 76%,
      rgba(20, 19, 34, 0) 100%
    );
  --space-edge-fade:
    linear-gradient(
      180deg,
      var(--safe-bg) 0%,
      rgba(20, 19, 34, 0.72) 7%,
      rgba(20, 19, 34, 0) 18%,
      rgba(20, 19, 34, 0) 82%,
      rgba(20, 19, 34, 0.72) 93%,
      var(--safe-bg) 100%
    );
  --space-background: var(--safe-bg) var(--space-edge-fade), var(--space-color-wash), var(--space-image) center top / cover no-repeat;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  height: 100%;
  min-height: 100vh;
  min-height: 100svh;
  background-color: var(--safe-bg);
  background-image: var(--space-edge-fade), var(--space-color-wash), var(--space-image);
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100svh;
  background-color: var(--safe-bg);
  background-image: var(--space-edge-fade), var(--space-color-wash), var(--space-image);
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--ink);
  font-family: "Space Mono", "Courier New", monospace;
  isolation: isolate;
  letter-spacing: 0;
  overscroll-behavior: none;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset:
    calc(env(safe-area-inset-top, 0px) * -1)
    calc(env(safe-area-inset-right, 0px) * -1)
    calc(env(safe-area-inset-bottom, 0px) * -1)
    calc(env(safe-area-inset-left, 0px) * -1);
  z-index: 1;
  pointer-events: none;
}

body::before {
  background: transparent;
  opacity: 1;
}

body::after {
  box-shadow:
    inset 0 -8rem 8rem rgba(0, 0, 0, 0.48),
    inset 5rem 0 7rem rgba(0, 0, 0, 0.18),
    inset -5rem 0 7rem rgba(0, 0, 0, 0.18),
    inset 0 0 3rem rgba(53, 246, 255, 0.1);
}

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

.viewport-background {
  position: fixed;
  inset:
    calc(env(safe-area-inset-top, 0px) * -1)
    calc(env(safe-area-inset-right, 0px) * -1)
    calc(env(safe-area-inset-bottom, 0px) * -1)
    calc(env(safe-area-inset-left, 0px) * -1);
  min-width: 100vw;
  min-height: 100vh;
  min-height: 100svh;
  background-color: var(--safe-bg);
  background-image: var(--space-edge-fade), var(--space-color-wash), var(--space-image);
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  pointer-events: none;
  z-index: 0;
}

.moving-background {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: auto;
}

.star-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.star-dot {
  position: absolute;
  left: var(--star-x);
  top: var(--star-y);
  width: var(--star-size);
  height: var(--star-size);
  border-radius: 50%;
  background: hsl(var(--star-hue) 100% 88%);
  box-shadow:
    0 0 calc(var(--star-size) * 3) hsl(var(--star-hue) 100% 70% / 0.62),
    0 0 calc(var(--star-size) * 8) hsl(var(--star-hue) 100% 64% / 0.24);
  opacity: var(--star-opacity);
  transform: translate3d(-50%, -50%, 0);
  animation: star-twinkle var(--star-speed) ease-in-out infinite;
  animation-delay: var(--star-delay);
}

.head-field {
  position: absolute;
  inset: 0;
  isolation: isolate;
  z-index: 1;
  pointer-events: none;
}

.spencer-head {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--size);
  height: auto;
  opacity: var(--opacity);
  filter:
    saturate(var(--saturation))
    contrast(1.12)
    drop-shadow(0 1.35rem 2rem rgba(0, 0, 0, 0.6))
    drop-shadow(0 0 1.45rem var(--glow))
    drop-shadow(0 0 0.8rem rgba(53, 246, 255, 0.2));
  transform:
    translate3d(var(--x), var(--y), 0)
    rotate(var(--rotation))
    scale(var(--scale));
  transform-origin: center;
  scale: 1;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
  cursor: pointer;
  pointer-events: auto;
  touch-action: auto;
  z-index: var(--depth);
}

.spencer-head.is-primary {
  opacity: var(--opacity);
}

.spencer-head.is-meowing {
  animation: head-meow-bounce 360ms cubic-bezier(0.19, 1, 0.22, 1);
}

.landing-shell {
  position: relative;
  z-index: 3;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding:
    max(clamp(1.25rem, 5vw, 3.5rem), calc(env(safe-area-inset-top, 0px) + 0.75rem))
    max(clamp(1.25rem, 5vw, 3.5rem), env(safe-area-inset-right, 0px))
    max(clamp(1.25rem, 5vw, 3.5rem), calc(env(safe-area-inset-bottom, 0px) + 5.8rem))
    max(clamp(1.25rem, 5vw, 3.5rem), env(safe-area-inset-left, 0px));
  pointer-events: none;
  text-align: center;
}

.headline {
  display: grid;
  justify-items: center;
  gap: clamp(0.65rem, 1.8vw, 1.35rem);
  width: min(92vw, 76rem);
  margin: 0;
  color: var(--ink);
  font-family: "Archivo Black", Impact, Haettenschweiler, sans-serif;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow:
    0 0.045em 0.14em var(--ink-shadow),
    0.012em 0.012em 0 rgba(255, 79, 154, 0.44),
    -0.012em -0.008em 0 rgba(53, 246, 255, 0.42);
}

.headline-main,
.headline-soon {
  display: block;
}

.headline-main {
  display: grid;
  justify-items: center;
  gap: 0.05em;
  width: 100%;
  font-size: clamp(2.75rem, 8.4vw, 8.8rem);
  line-height: 0.84;
}

.headline-main span {
  display: block;
}

.headline-light {
  font-family: "Space Mono", "Courier New", monospace;
  font-size: clamp(1.2rem, 3.2vw, 2.8rem);
  font-weight: 400;
  letter-spacing: 0.18em;
  line-height: 1.05;
}

.headline-bold {
  font-family: "Archivo Black", Impact, Haettenschweiler, sans-serif;
  font-weight: 900;
  max-width: 100%;
  white-space: nowrap;
}

.headline-soon {
  color: var(--teal);
  font-family: "Space Mono", "Courier New", monospace;
  font-size: clamp(0.72rem, 1.25vw, 1.05rem);
  font-weight: 400;
  letter-spacing: 0.18em;
  line-height: 1.2;
  text-shadow: 0 0.18rem 0.85rem rgba(0, 0, 0, 0.48);
}

.page-shell {
  position: relative;
  z-index: 3;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding:
    max(clamp(1.25rem, 5vw, 3.5rem), calc(env(safe-area-inset-top, 0px) + 0.75rem))
    max(clamp(1.25rem, 5vw, 3.5rem), env(safe-area-inset-right, 0px))
    max(clamp(1.25rem, 5vw, 3.5rem), calc(env(safe-area-inset-bottom, 0px) + 5.8rem))
    max(clamp(1.25rem, 5vw, 3.5rem), env(safe-area-inset-left, 0px));
  text-align: center;
}

.page-heading {
  display: grid;
  justify-items: center;
  gap: clamp(0.75rem, 2vw, 1.2rem);
  width: min(86vw, 42rem);
  margin: 0;
  color: var(--ink);
  text-transform: uppercase;
  text-shadow:
    0 0.045em 0.14em var(--ink-shadow),
    0.01em 0.01em 0 rgba(255, 79, 154, 0.32),
    -0.01em -0.008em 0 rgba(53, 246, 255, 0.34);
}

.page-kicker,
.page-soon {
  font-family: "Space Mono", "Courier New", monospace;
  font-weight: 400;
  letter-spacing: 0.18em;
}

.page-kicker {
  color: rgba(244, 251, 255, 0.74);
  font-size: clamp(0.78rem, 1.7vw, 1rem);
}

.page-title {
  font-family: "Archivo Black", Impact, Haettenschweiler, sans-serif;
  font-size: clamp(3.3rem, 10vw, 8rem);
  line-height: 0.86;
  letter-spacing: 0;
}

.page-soon {
  color: rgba(244, 251, 255, 0.72);
  font-size: clamp(0.72rem, 1.45vw, 1rem);
}

.listen-shell {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  min-height: 100svh;
  padding:
    max(clamp(1rem, 3.6vw, 3rem), calc(env(safe-area-inset-top, 0px) + 0.85rem))
    max(clamp(1rem, 4vw, 3rem), env(safe-area-inset-right, 0px))
    max(clamp(7.5rem, 12vw, 8.5rem), calc(env(safe-area-inset-bottom, 0px) + 6.7rem))
    max(clamp(1rem, 4vw, 3rem), env(safe-area-inset-left, 0px));
}

.listen-panel {
  width: min(100%, 72rem);
  margin: 0 auto;
  border: 1px solid rgba(244, 251, 255, 0.14);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(244, 251, 255, 0.105), rgba(244, 251, 255, 0.035)),
    rgba(20, 19, 34, 0.54);
  box-shadow:
    0 2rem 6rem rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(244, 251, 255, 0.13);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  overflow: hidden;
}

.listen-intro {
  display: grid;
  grid-template-columns: clamp(7.8rem, 21vw, 14.8rem) minmax(0, 1fr);
  gap: clamp(0.2rem, 0.9vw, 0.7rem);
  align-items: center;
  padding: clamp(0.7rem, 2vw, 1.25rem) clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid rgba(244, 251, 255, 0.12);
  text-align: left;
}

.listen-mascot {
  width: 124%;
  max-width: none;
  align-self: center;
  justify-self: start;
  margin-left: clamp(-1.1rem, -1.7vw, -0.55rem);
  filter:
    drop-shadow(0 1rem 1.25rem rgba(0, 0, 0, 0.48))
    drop-shadow(0 0 1rem rgba(53, 246, 255, 0.16));
}

.listen-intro-copy {
  display: grid;
  gap: 0.6rem;
  min-width: 0;
}

.listen-kicker,
.story-status,
.story-author,
.progress-label,
.speed-control,
.story-rail h2 {
  font-family: "Space Mono", "Courier New", monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.listen-kicker,
.story-status,
.story-author {
  margin: 0;
  color: rgba(53, 246, 255, 0.84);
  font-size: clamp(0.7rem, 1.4vw, 0.86rem);
  font-weight: 700;
}

.listen-intro h1 {
  max-width: 10ch;
  margin: 0;
  font-family: "Archivo Black", Impact, Haettenschweiler, sans-serif;
  font-size: clamp(3.5rem, 10vw, 7.4rem);
  line-height: 0.82;
  text-transform: uppercase;
  text-shadow:
    0 0.045em 0.13em rgba(0, 0, 0, 0.48),
    0.012em 0.012em 0 rgba(255, 79, 154, 0.36),
    -0.012em -0.008em 0 rgba(53, 246, 255, 0.36);
}

.listen-copy {
  max-width: 40rem;
  margin: 0;
  color: rgba(244, 251, 255, 0.72);
  font-size: clamp(0.9rem, 1.8vw, 1.08rem);
  line-height: 1.6;
}

.listen-grid {
  display: grid;
  grid-template-columns: minmax(15rem, 0.78fr) minmax(0, 1.4fr);
  min-height: 34rem;
}

.story-rail {
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: clamp(1rem, 2.4vw, 1.55rem);
  border-right: 1px solid rgba(244, 251, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(53, 246, 255, 0.09), transparent 40%),
    rgba(0, 0, 0, 0.12);
}

.story-rail h2 {
  margin: 0;
  color: rgba(244, 251, 255, 0.74);
  font-size: 0.78rem;
}

.story-list {
  display: grid;
  gap: 0.65rem;
}

.story-option {
  display: grid;
  grid-template-columns: 3.15rem minmax(0, 1fr);
  gap: 0.8rem;
  width: 100%;
  min-height: 4.5rem;
  padding: 0.7rem;
  border: 1px solid rgba(244, 251, 255, 0.12);
  border-radius: var(--radius);
  color: rgba(244, 251, 255, 0.76);
  background: rgba(244, 251, 255, 0.055);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.story-option:hover,
.story-option:focus-visible {
  border-color: rgba(53, 246, 255, 0.42);
  background: rgba(53, 246, 255, 0.1);
  outline: none;
}

.story-option:active {
  transform: scale(0.985);
}

.story-option.is-active {
  border-color: rgba(53, 246, 255, 0.64);
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(53, 246, 255, 0.14), rgba(255, 79, 154, 0.1)),
    rgba(244, 251, 255, 0.08);
  box-shadow: 0 0 1.5rem rgba(53, 246, 255, 0.1);
}

.story-thumb {
  display: grid;
  width: 3.15rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  color: rgba(244, 251, 255, 0.86);
  background:
    radial-gradient(circle at 38% 30%, rgba(248, 214, 109, 0.28), transparent 42%),
    linear-gradient(135deg, rgba(53, 246, 255, 0.22), rgba(255, 79, 154, 0.16)),
    rgba(244, 251, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(244, 251, 255, 0.18),
    0 0.5rem 1rem rgba(0, 0, 0, 0.28),
    0 0 1rem rgba(53, 246, 255, 0.1);
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  overflow: hidden;
}

.story-thumb.has-icon {
  border-radius: 18px;
}

.story-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-option-title {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.22;
}

.story-option-description {
  display: -webkit-box;
  margin-top: 0.22rem;
  overflow: hidden;
  color: rgba(244, 251, 255, 0.55);
  font-size: 0.72rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.player-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.15rem, 3vw, 2rem);
  align-items: start;
  padding: clamp(1.25rem, 4vw, 3rem);
  overflow: hidden;
}

.story-detail {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.75rem;
  max-width: 46rem;
  min-width: 0;
}

.story-detail h2 {
  margin: 0;
  color: var(--ink);
  font-family: "Archivo Black", Impact, Haettenschweiler, sans-serif;
  font-size: clamp(1.9rem, 5vw, 4.5rem);
  line-height: 0.9;
  text-transform: uppercase;
  text-shadow: 0 0.16rem 0.65rem rgba(0, 0, 0, 0.46);
}

.story-detail p:last-child {
  max-width: 34rem;
  margin: 0;
  color: rgba(244, 251, 255, 0.68);
  font-size: clamp(0.9rem, 1.7vw, 1.05rem);
  line-height: 1.6;
}

.player-controls {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  display: grid;
  gap: 1rem;
  padding-top: 0.5rem;
}

.transport-row {
  display: grid;
  grid-template-columns: minmax(4.75rem, 0.8fr) minmax(7rem, 1.1fr) minmax(4.75rem, 0.8fr);
  gap: 0.7rem;
  align-items: center;
}

.control-button,
.play-button {
  min-height: 2.8rem;
  border: 1px solid rgba(244, 251, 255, 0.18);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(244, 251, 255, 0.1);
  cursor: pointer;
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.control-button {
  padding: 0 1rem;
}

.play-button {
  padding: 0 1.25rem;
  color: #071013;
  background: linear-gradient(135deg, rgba(53, 246, 255, 0.96), rgba(248, 214, 109, 0.92));
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 0 1.65rem rgba(53, 246, 255, 0.2);
}

.skip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-color: rgba(53, 246, 255, 0.26);
  background:
    linear-gradient(135deg, rgba(53, 246, 255, 0.12), rgba(156, 123, 255, 0.08)),
    rgba(244, 251, 255, 0.1);
}

.skip-icon {
  display: block;
  width: 0;
  height: 0;
  filter: drop-shadow(0 0 0.55rem rgba(53, 246, 255, 0.72));
}

.skip-icon-left {
  border-top: 0.48rem solid transparent;
  border-right: 0.74rem solid var(--teal);
  border-bottom: 0.48rem solid transparent;
}

.skip-icon-right {
  border-top: 0.48rem solid transparent;
  border-bottom: 0.48rem solid transparent;
  border-left: 0.74rem solid var(--teal);
}

.player-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.restart-button {
  min-width: 8.75rem;
}

.control-button:hover,
.control-button:focus-visible,
.play-button:hover,
.play-button:focus-visible {
  border-color: rgba(53, 246, 255, 0.46);
  transform: translateY(-1px);
  outline: none;
}

.control-button:active,
.play-button:active {
  transform: scale(0.97);
}

.progress-label,
.speed-control {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: rgba(244, 251, 255, 0.7);
  font-size: 0.76rem;
  line-height: 1.4;
}

.progress-slider {
  width: 100%;
  accent-color: var(--teal);
  cursor: pointer;
}

.speed-control {
  align-items: center;
  justify-content: flex-start;
  margin-left: auto;
}

.speed-control select {
  min-height: 2.45rem;
  border: 1px solid rgba(244, 251, 255, 0.16);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(20, 19, 34, 0.82);
  padding: 0 0.85rem;
  font: inherit;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(1rem, calc(env(safe-area-inset-bottom, 0px) + 0.85rem));
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.18rem;
  width: min(86vw, 29rem);
  padding: 0.35rem;
  border: 1px solid rgba(244, 251, 255, 0.15);
  border-radius: 999px;
  background: rgba(20, 19, 34, 0.48);
  box-shadow:
    0 1.2rem 3rem rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(244, 251, 255, 0.12);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  transform: translateX(-50%);
}

.nav-link {
  display: grid;
  min-width: 0;
  min-height: 2.5rem;
  place-items: center;
  border-radius: 999px;
  color: rgba(244, 251, 255, 0.72);
  font-family: "Space Mono", "Courier New", monospace;
  font-size: clamp(0.64rem, 2.6vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    background 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--ink);
  background: rgba(244, 251, 255, 0.1);
  outline: none;
}

.nav-link:active {
  transform: scale(0.96);
}

.nav-link.is-active {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(53, 246, 255, 0.2), rgba(156, 123, 255, 0.18)),
    rgba(244, 251, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(244, 251, 255, 0.2),
    0 0 1.2rem rgba(53, 246, 255, 0.12);
}

.toy-page {
  --toy-bg: var(--safe-bg);
  --toy-panel: rgba(20, 19, 34, 0.54);
  --toy-paper: var(--ink);
  --toy-ink: #071013;
  --toy-line: rgba(244, 251, 255, 0.14);
  --toy-muted: rgba(244, 251, 255, 0.68);
  --toy-orange: var(--teal);
  --toy-blue: var(--teal);
  --toy-green: var(--amber);
  background-color: var(--toy-bg);
  background-image: var(--space-edge-fade), var(--space-color-wash), var(--space-image);
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  color: var(--toy-paper);
}

.toy-page::before {
  background: transparent;
}

.toy-page::after {
  box-shadow:
    inset 0 -8rem 8rem rgba(0, 0, 0, 0.48),
    inset 5rem 0 7rem rgba(0, 0, 0, 0.18),
    inset -5rem 0 7rem rgba(0, 0, 0, 0.18),
    inset 0 0 3rem rgba(53, 246, 255, 0.1);
}

.toy-page .viewport-background {
  background-color: var(--safe-bg);
  background-image: var(--space-edge-fade), var(--space-color-wash), var(--space-image);
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
}

.toy-shell {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  min-height: 100svh;
  padding:
    max(1rem, calc(env(safe-area-inset-top, 0px) + 1rem))
    max(1rem, env(safe-area-inset-right, 0px))
    max(7.5rem, calc(env(safe-area-inset-bottom, 0px) + 6.5rem))
    max(1rem, env(safe-area-inset-left, 0px));
}

.toy-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(19rem, 1.18fr);
  gap: clamp(1rem, 4vw, 3rem);
  align-items: center;
  width: min(100%, 74rem);
  min-height: calc(100vh - 9rem);
  min-height: calc(100svh - 9rem);
  margin: 0 auto;
}

.toy-copy {
  display: grid;
  gap: clamp(0.8rem, 2vw, 1.2rem);
}

.toy-kicker {
  margin: 0;
  color: rgba(53, 246, 255, 0.84);
  font-family: "Space Mono", "Courier New", monospace;
  font-size: clamp(0.68rem, 1.5vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.toy-copy h1 {
  max-width: 8ch;
  margin: 0;
  color: var(--toy-paper);
  font-family: "Archivo Black", Impact, Haettenschweiler, sans-serif;
  font-size: clamp(3rem, 8vw, 7.4rem);
  line-height: 0.82;
  text-transform: uppercase;
  text-shadow:
    0 0.045em 0.14em var(--ink-shadow),
    0.012em 0.012em 0 rgba(255, 79, 154, 0.44),
    -0.012em -0.008em 0 rgba(53, 246, 255, 0.42);
}

.toy-copy p:last-child {
  max-width: 29rem;
  margin: 0;
  color: var(--toy-muted);
  font-size: clamp(0.92rem, 1.7vw, 1.08rem);
  line-height: 1.62;
}

.toy-workbench {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
}

.toy-stage {
  position: relative;
  aspect-ratio: 1;
  width: min(100%, 42rem);
  justify-self: center;
  border: 1px solid var(--toy-line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(244, 251, 255, 0.105), rgba(244, 251, 255, 0.035)),
    rgba(20, 19, 34, 0.58);
  box-shadow:
    0 2rem 6rem rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(244, 251, 255, 0.13);
  overflow: hidden;
  touch-action: none;
}

.toy-stage::before {
  content: "";
  position: absolute;
  inset: 0.7rem;
  border: 1px solid rgba(244, 251, 255, 0.12);
  border-radius: 5px;
  pointer-events: none;
  z-index: 3;
}

.toy-face,
.hair-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.toy-face {
  object-fit: cover;
  filter:
    saturate(1.05)
    contrast(1.08)
    brightness(0.94)
    drop-shadow(0 1rem 1.25rem rgba(0, 0, 0, 0.42));
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.hair-canvas {
  z-index: 2;
  cursor: none;
  outline: none;
  touch-action: none;
}

.hair-canvas:focus-visible {
  box-shadow: inset 0 0 0 3px var(--toy-blue);
}

.toy-brush {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  display: grid;
  width: 2.25rem;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid rgba(53, 246, 255, 0.88);
  border-radius: 50%;
  background: rgba(53, 246, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(20, 19, 34, 0.9),
    0 0 1rem rgba(53, 246, 255, 0.34);
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-50%, -50%, 0) scale(0.9);
  transition: opacity 140ms ease, transform 140ms ease;
}

.toy-brush.is-visible {
  opacity: 1;
  transform: translate3d(-50%, -50%, 0) scale(1);
}

.toy-brush.is-erasing {
  border-color: rgba(255, 79, 154, 0.88);
  background: rgba(255, 79, 154, 0.08);
  box-shadow:
    0 0 0 1px rgba(20, 19, 34, 0.9),
    0 0 1rem rgba(255, 79, 154, 0.34);
}

.toy-brush.is-smudging {
  border-color: rgba(248, 214, 109, 0.9);
  background: rgba(248, 214, 109, 0.08);
  box-shadow:
    0 0 0 1px rgba(20, 19, 34, 0.9),
    0 0 1rem rgba(248, 214, 109, 0.3);
}

.toy-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: center;
}

.tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

.preset-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  width: min(100%, 34rem);
}

.preset-button {
  min-width: 0;
  border-color: rgba(53, 246, 255, 0.28);
  background:
    linear-gradient(135deg, rgba(53, 246, 255, 0.08), rgba(255, 79, 154, 0.07)),
    rgba(244, 251, 255, 0.075);
}

.brush-size-control {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.8rem;
  border: 1px solid rgba(244, 251, 255, 0.16);
  border-radius: var(--radius);
  color: rgba(244, 251, 255, 0.7);
  background: rgba(244, 251, 255, 0.065);
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brush-size-control input {
  width: min(26vw, 8.5rem);
  accent-color: var(--teal);
}

.toy-button {
  min-height: 2.75rem;
  min-width: 5.4rem;
  border: 1px solid rgba(244, 251, 255, 0.18);
  border-radius: 8px;
  color: var(--toy-paper);
  background: rgba(244, 251, 255, 0.1);
  cursor: pointer;
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.toy-button:hover,
.toy-button:focus-visible {
  border-color: rgba(53, 246, 255, 0.46);
  background:
    linear-gradient(135deg, rgba(53, 246, 255, 0.12), rgba(156, 123, 255, 0.08)),
    rgba(244, 251, 255, 0.1);
  outline: none;
}

.toy-button:active {
  transform: scale(0.96);
}

.toy-button.is-active {
  color: var(--toy-ink);
  background: linear-gradient(135deg, rgba(53, 246, 255, 0.96), rgba(248, 214, 109, 0.92));
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 0 1.65rem rgba(53, 246, 255, 0.2);
}

.toy-status {
  min-height: 1.4rem;
  margin: 0;
  color: var(--toy-muted);
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
}

.toy-page .bottom-nav {
  border-color: rgba(244, 251, 255, 0.15);
  background: rgba(20, 19, 34, 0.48);
}

@keyframes star-twinkle {
  0%,
  100% {
    opacity: calc(var(--star-opacity) * 0.45);
    transform: translate3d(-50%, -50%, 0) scale(0.78);
  }

  45% {
    opacity: var(--star-opacity);
    transform: translate3d(-50%, -50%, 0) scale(1.18);
  }
}

@keyframes head-meow-bounce {
  0%,
  100% {
    scale: 1;
  }

  36% {
    scale: 1.13;
  }

  64% {
    scale: 0.97;
  }
}

@media (max-width: 560px) {
  .toy-shell {
    padding-top: max(0.85rem, calc(env(safe-area-inset-top, 0px) + 0.75rem));
    padding-bottom: max(7.25rem, calc(env(safe-area-inset-bottom, 0px) + 6.2rem));
  }

  .toy-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
    align-content: start;
    min-height: auto;
  }

  .toy-copy {
    gap: 0.55rem;
    text-align: center;
  }

  .toy-kicker {
    font-size: 0.62rem;
  }

  .toy-copy h1 {
    max-width: 11ch;
    margin: 0 auto;
    font-size: clamp(2.45rem, 13vw, 4rem);
  }

  .toy-copy p:last-child {
    max-width: 23rem;
    margin: 0 auto;
    font-size: 0.84rem;
    line-height: 1.48;
  }

  .toy-stage {
    width: min(100%, 28rem);
    border-radius: 8px;
  }

  .toy-brush {
    width: 2rem;
  }

  .toy-controls {
    gap: 0.5rem;
  }

  .tool-group {
    width: 100%;
  }

  .preset-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .brush-size-control {
    width: 100%;
    justify-content: center;
  }

  .brush-size-control input {
    width: min(52vw, 12rem);
  }

  .toy-button {
    flex: 1 1 5.2rem;
    min-width: 0;
    min-height: 2.7rem;
    padding: 0 0.6rem;
    font-size: 0.68rem;
  }

  .toy-status {
    font-size: 0.64rem;
  }

  .headline {
    width: min(86vw, 22rem);
    gap: 0.62rem;
  }

  .headline-main {
    font-size: clamp(2.1rem, 10.5vw, 3.85rem);
    width: 100%;
  }

  .headline-light {
    font-size: clamp(0.98rem, 5vw, 1.6rem);
    letter-spacing: 0.12em;
  }

  .headline-bold {
    font-size: clamp(2rem, 10.2vw, 3.65rem);
  }

  .headline-soon {
    font-size: clamp(0.68rem, 3.1vw, 0.86rem);
    letter-spacing: 0.14em;
  }

  .bottom-nav {
    width: min(94vw, 24rem);
    padding: 0.3rem;
  }

  .nav-link {
    min-height: 2.35rem;
    font-size: clamp(0.58rem, 2.6vw, 0.74rem);
    letter-spacing: 0.035em;
  }

  .listen-shell {
    padding-bottom: max(7rem, calc(env(safe-area-inset-bottom, 0px) + 6.25rem));
  }

  .listen-panel {
    border-radius: var(--radius);
  }

  .listen-intro {
    grid-template-columns: minmax(6rem, 7.45rem) minmax(0, 1fr);
    gap: 0.3rem;
    padding: 0.65rem 0.65rem;
  }

  .listen-mascot {
    width: 132%;
    margin-left: -0.95rem;
  }

  .listen-intro h1 {
    max-width: 100%;
    font-size: clamp(2.45rem, 11.2vw, 3.7rem);
  }

  .listen-kicker {
    font-size: clamp(0.58rem, 2.6vw, 0.72rem);
    letter-spacing: 0.09em;
  }

  .listen-copy {
    max-width: 100%;
    font-size: clamp(0.82rem, 3.5vw, 0.96rem);
    line-height: 1.48;
  }

  .listen-grid,
  .player-stage {
    grid-template-columns: 1fr;
  }

  .story-rail {
    border-right: 0;
    border-bottom: 1px solid rgba(244, 251, 255, 0.1);
  }

  .story-list {
    display: flex;
    margin: 0 -0.15rem;
    padding-bottom: 0.25rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .story-option {
    flex: 0 0 min(78vw, 20rem);
    scroll-snap-align: start;
  }

  .player-stage {
    gap: 1.15rem;
    text-align: center;
  }

  .story-detail {
    justify-items: center;
  }

  .story-detail h2 {
    font-size: clamp(1.75rem, 9vw, 3rem);
  }

  .progress-label,
  .speed-control {
    justify-content: center;
  }

  .transport-row {
    grid-template-columns: minmax(4.5rem, 1fr) minmax(6.5rem, 1.15fr) minmax(4.5rem, 1fr);
  }

  .player-options {
    justify-content: center;
  }

  .speed-control {
    margin-left: 0;
  }

  .restart-button {
    min-width: min(100%, 8.75rem);
  }

  .control-button,
  .play-button {
    min-height: 2.65rem;
    font-size: 0.72rem;
  }

  .progress-label {
    flex-direction: column;
    gap: 0.2rem;
  }
}

@media (max-height: 520px) {
  .headline {
    gap: 0.38rem;
  }

  .headline-main {
    font-size: clamp(2.3rem, 7.2vw, 5.4rem);
    line-height: 0.82;
  }

  .headline-light {
    font-size: clamp(0.82rem, 2.3vw, 1.4rem);
  }

  .headline-bold {
    font-size: clamp(2.2rem, 7vw, 5.2rem);
  }

  .headline-soon {
    font-size: clamp(0.66rem, 1.5vw, 0.86rem);
  }
}

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

  .spencer-head {
    opacity: var(--opacity);
  }
}
