/* Director of Realms — parallax scenes and interactive pieces.
   Layers read --sy (scroll offset, px) from site.js and --mx/--my (pointer, -1→1) from their
   scene; --p and --pt describe the scene's progress through and off the viewport. */

/* ---------------------------------------------------------------------------------------------
   Hero shell */

.hero {
  position: relative;
  isolation: isolate;
  min-height: max(640px, 100svh);
  display: grid;
  align-items: center;
  padding: calc(var(--top-h) + 40px) 0 clamp(72px, 10vh, 120px);
  overflow: clip;
}

.hero--short {
  min-height: max(520px, 74svh);
}

.hero__inner {
  position: relative;
  z-index: 2;
  display: grid;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
}

.hero__inner--single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 900px;
}

.hero__inner--center {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  text-align: center;
}

.hero__inner--center .eyebrow {
  justify-content: center;
}

.hero__copy {
  max-width: 660px;
  transform: translate3d(0, calc(var(--hero-lift, 0) * 1px), 0);
}

.hero__copy .lede {
  margin-top: 24px;
}

.hero__inner--center .hero__copy .lede {
  margin-inline: auto;
}

.hero__copy .actions {
  margin-top: 36px;
}

.hero__inner--center .actions {
  justify-content: center;
}

.hero__copy .chip-list {
  margin-top: 32px;
}

.hero__inner--center .chip-list {
  justify-content: center;
}

.hero .eyebrow {
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8);
}

.hero h1 {
  text-shadow: 0 2px 30px rgba(8, 10, 14, 0.75);
}

.hero .lede {
  color: #c4c8d2;
  text-shadow: 0 1px 18px rgba(8, 10, 14, 0.9);
}

@media (max-width: 960px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 8px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: calc(1 - var(--pt, 0) * 4);
}

.scroll-cue::after {
  content: '';
  width: 1px;
  height: 38px;
  background: linear-gradient(var(--gold), transparent);
  animation: cue 2.2s var(--ease-out) infinite;
  transform-origin: top;
}

@keyframes cue {
  0% {
    transform: scaleY(0);
    opacity: 0;
  }
  40% {
    transform: scaleY(1);
    opacity: 1;
  }
  100% {
    transform: scaleY(1) translateY(12px);
    opacity: 0;
  }
}

/* ---------------------------------------------------------------------------------------------
   Scene base */

.scene {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.scene::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 20;
  background:
    linear-gradient(180deg, rgba(8, 10, 14, 0.7) 0%, rgba(8, 10, 14, 0) 22%),
    linear-gradient(0deg, var(--black) 0%, rgba(8, 10, 14, 0) 26%);
}

.scene__sky {
  position: absolute;
  inset: 0;
}

.layer {
  position: absolute;
  inset: 0;
  will-change: transform;
  transform: translate3d(calc(var(--mx, 0) * var(--d, 0) * -9px), calc(var(--sy, 0px) + var(--my, 0) * var(--d, 0) * -5px), 0);
}

.layer > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

@media (prefers-reduced-motion: reduce) {
  .layer {
    transform: none !important;
  }
}

/* ---------------------------------------------------------------------------------------------
   Home — dusk beyond the doorway */

.scene--home .scene__sky {
  background:
    radial-gradient(ellipse 55% 40% at 62% 72%, rgba(234, 201, 111, 0.2), transparent 70%),
    linear-gradient(180deg, #05070b 0%, #0a0e16 38%, #151722 62%, #2a2419 78%, #0d0f14 100%);
}

@media (max-width: 760px) {
  .scene--home .layer--planet,
  .scene--home .constellation {
    display: none;
  }
}

.scene--home .layer--sun {
  filter: saturate(calc(1 - var(--pt, 0) * 0.5));
}

.twinkle {
  animation: twinkle 4.8s ease-in-out infinite;
  animation-delay: var(--t, 0s);
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

.constellation line {
  stroke: #eac96f;
  stroke-opacity: 0.16;
  stroke-width: 1.2;
}

.constellation circle {
  fill: #fff0b0;
  opacity: 0.7;
}

.shooting-star {
  position: absolute;
  top: 12%;
  left: -10%;
  width: 180px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(255, 240, 176, 0.9));
  border-radius: 2px;
  opacity: 0;
  transform: rotate(-12deg);
  animation: shoot 14s linear infinite 3s;
}

@keyframes shoot {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(-12deg);
  }
  2% {
    opacity: 1;
  }
  9% {
    opacity: 0;
    transform: translate3d(70vw, -12vh, 0) rotate(-12deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(70vw, -12vh, 0) rotate(-12deg);
  }
}

.glow-window {
  animation: flicker 5s ease-in-out infinite;
  animation-delay: var(--t, 0s);
}

.glow-window--eldritch {
  fill: #e7a5ba;
  filter: drop-shadow(0 0 6px #e7a5ba);
}

@keyframes flicker {
  0%,
  100% {
    opacity: 0.95;
  }
  45% {
    opacity: 0.55;
  }
  60% {
    opacity: 0.85;
  }
}

.tentacle {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: sway 9s ease-in-out infinite;
}

.tentacle:nth-child(2) {
  animation-duration: 11s;
  animation-delay: -3s;
}

.tentacle:nth-child(3) {
  animation-duration: 7s;
  animation-delay: -5s;
}

@keyframes sway {
  0%,
  100% {
    transform: rotate(-2.5deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

.lantern-glow {
  fill: url(#none);
  fill: rgba(234, 201, 111, 0.18);
  filter: blur(8px);
  animation: flicker 3.6s ease-in-out infinite;
}

.layer--mist {
  mix-blend-mode: screen;
}

.mist {
  position: absolute;
  left: -20%;
  width: 140%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(200, 190, 170, 0.12), transparent);
  filter: blur(18px);
  animation: drift 38s linear infinite;
}

.mist--a {
  top: 62%;
}

.mist--b {
  top: 72%;
  animation-duration: 52s;
  animation-direction: reverse;
  opacity: 0.8;
}

.mist--c {
  top: 55%;
  height: 14%;
  animation-duration: 64s;
  opacity: 0.6;
}

@keyframes drift {
  from {
    transform: translateX(-8%);
  }
  to {
    transform: translateX(8%);
  }
}

.hero--home .hero__copy {
  opacity: calc(1 - var(--pt, 0) * 1.6);
}

/* The interactive d20 hanging in the dusk sky */

.hero-die {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 14px;
}

.die-stage {
  position: relative;
  width: min(100%, 440px);
  aspect-ratio: 1;
  cursor: pointer;
  border-radius: 50%;
}

.die-stage canvas {
  position: absolute;
  inset: 0;
}

.die-stage:focus-visible {
  outline-offset: -20px;
  border-radius: 50%;
}

.die-caption {
  min-height: 3.2em;
  max-width: 34ch;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(8, 10, 14, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  text-align: center;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.die-caption strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  color: var(--gold);
}

@media (max-width: 960px) {
  .die-stage {
    width: min(78vw, 320px);
  }
}

/* ---------------------------------------------------------------------------------------------
   Brand interlude — the full satin logo passing through the viewport */

.interlude {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 32px;
  padding-block: clamp(90px, 14vw, 180px);
  text-align: center;
  overflow: clip;
}

.interlude__mark {
  --dor-logo-width: clamp(220px, 30vw, 360px);
  filter: drop-shadow(0 30px 60px rgba(234, 201, 111, 0.12));
}

.interlude__halo {
  position: absolute;
  inset: 20% 25%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(234, 201, 111, 0.12), transparent);
}

.interlude p {
  max-width: 56ch;
  color: var(--muted);
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
}

/* ---------------------------------------------------------------------------------------------
   AI GM — the stage */

.scene--stage .scene__sky {
  background:
    radial-gradient(ellipse 50% 60% at 50% 45%, rgba(179, 177, 252, 0.16), transparent 70%),
    linear-gradient(180deg, #07060c 0%, #0d0b16 60%, #0a0910 100%);
}

.beams {
  position: absolute;
  inset: 0;
}

.beam {
  position: absolute;
  top: -10%;
  left: calc(var(--x) / 1600 * 100%);
  width: 34vw;
  max-width: 520px;
  height: 115%;
  transform: translateX(-50%) rotate(var(--tilt));
  transform-origin: 50% 0;
  background: linear-gradient(180deg, rgba(179, 177, 252, 0.34), rgba(179, 177, 252, 0.08) 60%, transparent 92%);
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  filter: blur(6px);
  mix-blend-mode: screen;
  opacity: calc(0.55 + var(--p, 0) * 0.2);
  animation: beam 9s ease-in-out infinite;
  animation-delay: calc(var(--i) * -3s);
}

@keyframes beam {
  0%,
  100% {
    transform: translateX(-50%) rotate(calc(var(--tilt) - 2deg));
  }
  50% {
    transform: translateX(-50%) rotate(calc(var(--tilt) + 2deg));
  }
}

.npc .rim path,
.npc .rim rect,
.npc .rim circle {
  fill: none;
  stroke: #b3b1fc;
  stroke-opacity: 0.35;
  stroke-width: 1.4;
}

.orb {
  fill: #b3b1fc;
  filter: drop-shadow(0 0 10px #b3b1fc);
  animation: flicker 4s ease-in-out infinite;
}

.curtain {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 10;
  width: 46vw;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.55) 0 14px, rgba(179, 177, 252, 0.06) 30px, rgba(0, 0, 0, 0.5) 46px, rgba(40, 30, 70, 0.4) 64px),
    linear-gradient(180deg, #1c1433, #0f0b1c);
  box-shadow: inset -30px 0 60px rgba(0, 0, 0, 0.6);
  will-change: transform;
}

.curtain--left {
  left: 0;
  border-bottom-right-radius: 38% 12%;
  transform: translateX(calc(-62% - var(--pt, 0) * 50%)) skewX(calc(var(--pt, 0) * 4deg));
  transform-origin: 0 0;
}

.curtain--right {
  right: 0;
  border-bottom-left-radius: 38% 12%;
  transform: translateX(calc(62% + var(--pt, 0) * 50%)) skewX(calc(var(--pt, 0) * -4deg));
  transform-origin: 100% 0;
  box-shadow: inset 30px 0 60px rgba(0, 0, 0, 0.6);
}

.valance {
  position: absolute;
  inset: 0 0 auto;
  z-index: 11;
  height: clamp(60px, 9vw, 120px);
  transform: translateY(calc(var(--pt, 0) * -40%));
}

.valance svg {
  width: 100%;
  height: 100%;
}

@media (max-width: 760px) {
  .curtain {
    width: 60vw;
  }

  .curtain--left {
    transform: translateX(calc(-84% - var(--pt, 0) * 30%));
  }

  .curtain--right {
    transform: translateX(calc(84% + var(--pt, 0) * 30%));
  }
}

/* Thought cards — what each NPC wants, floating over the stage */

.thoughts {
  position: relative;
  min-height: 540px;
}

.thought {
  position: absolute;
  width: min(252px, 78vw);
  padding: 16px 18px;
  border: 1px solid rgba(179, 177, 252, 0.35);
  border-radius: 14px;
  background: rgba(14, 12, 24, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.9);
  font-size: 0.9rem;
  transform: translate3d(calc(var(--mx, 0) * var(--d, 2) * 7px), calc(var(--my, 0) * var(--d, 2) * 5px), 0);
}

.thought b {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--text);
}

.thought dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 8px 0 0;
}

.thought dt {
  color: var(--gm);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-top: 3px;
}

.thought dd {
  margin: 0;
  color: var(--muted);
}

/* On narrow screens the floating cards stack in normal flow instead of overlapping. */
@media (max-width: 960px) {
  .thoughts,
  .page-cards,
  .page-cards--worlds {
    display: grid;
    gap: 14px;
    min-height: 0;
  }

  .thought,
  .page-card {
    position: relative;
    inset: auto !important;
    width: 100%;
    max-width: 460px;
  }

  .page-card {
    --r: 0deg !important;
  }
}

/* ---------------------------------------------------------------------------------------------
   Mapmaking — exploded map stack */

.scene--maps .scene__sky {
  background:
    radial-gradient(ellipse 50% 50% at 70% 50%, rgba(147, 203, 158, 0.12), transparent 70%),
    linear-gradient(180deg, #060908 0%, #0a0f0d 60%, #080a0e 100%);
}

.mapstack {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 0.86;
  perspective: 2600px;
  perspective-origin: 40% 30%;
}

.mapstack__rig {
  position: absolute;
  inset: 20% 22% 4% 2%;
  transform-style: preserve-3d;
  transform: rotateX(56deg) rotateZ(calc(-36deg + var(--mx, 0) * 6deg));
  --gap: calc(58px * (1 - var(--settle, 0)) + 2px);
}

.mapstack__legend {
  position: absolute;
  right: 0;
  top: 6%;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  opacity: calc(1 - var(--settle, 0) * 1.4);
}

.mapstack__legend li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
  padding: 6px 14px 6px 8px;
  border: 1px solid rgba(147, 203, 158, 0.35);
  border-radius: 999px;
  background: rgba(8, 10, 14, 0.85);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
}

.mapstack__legend i {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(147, 203, 158, 0.16);
  color: var(--maps);
  font-style: normal;
  font-size: 0.72rem;
}

.mapstack__plane {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: translateZ(calc(var(--i) * var(--gap)));
  transition: transform 0.2s linear;
}

.mapstack__svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.mapstack__plane--floor .mapstack__svg {
  filter: drop-shadow(0 40px 40px rgba(0, 0, 0, 0.7));
}

.mapstack__plane--floor .map-grid {
  stroke: rgba(147, 203, 158, 0.07);
}

.mapstack__plane--floor pattern path,
.dungeon pattern path {
  stroke: rgba(147, 203, 158, 0.1);
  stroke-width: 1;
}

.cell {
  fill: #18211d;
}

.cell--corridor {
  fill: #141b18;
}

.walls {
  fill: none;
  stroke: #93cb9e;
  stroke-width: 3;
  stroke-linecap: square;
}

.door {
  fill: #eac96f;
}

.prop {
  fill: rgba(200, 173, 118, 0.12);
  stroke: #c8ad76;
  stroke-width: 1.3;
}

.prop .prop-top {
  fill: rgba(200, 173, 118, 0.28);
}

.prop--rug {
  fill: rgba(231, 165, 186, 0.1);
  stroke: rgba(231, 165, 186, 0.5);
}

.prop-glow {
  fill: #fff0b0;
  stroke: none;
}

.light-core {
  fill: #fff0b0;
}

.token {
  fill: #eac96f;
  stroke: #080a0e;
  stroke-width: 3;
}

.fog {
  fill: rgba(4, 6, 8, 0.72);
}

.mapstack__plane--fog {
  opacity: calc(1 - var(--settle, 0) * 0.75);
}

@media (prefers-reduced-motion: reduce) {
  .mapstack__rig {
    --gap: 34px;
  }
}

.hero-stack {
  position: relative;
  width: 100%;
  max-width: 620px;
  justify-self: center;
}

@media (max-width: 960px) {
  .hero-stack {
    margin-top: clamp(40px, 16vw, 110px);
  }
}

.hero--maps .mapstack {
  --settle: clamp(0, calc(var(--pt, 0) * 2.6), 1);
}

.stats--six {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
}

.stats--six .stat__value {
  font-size: clamp(2rem, 1.5rem + 1.6vw, 2.8rem);
}

.dungeon--demo {
  aspect-ratio: 30 / 20;
}

.dungeon--static .cell,
.dungeon--static .walls,
.dungeon--static .door,
.dungeon--static .prop,
.dungeon--static .light,
.dungeon--static .light-core,
.dungeon--static .token {
  animation: none;
  opacity: 1;
  stroke-dashoffset: 0;
}

.seed-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.seed-form label {
  width: 100%;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
}

.seed-form input {
  width: 12ch;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: rgba(8, 10, 14, 0.8);
  color: var(--text);
  font: 600 1rem ui-monospace, 'Cascadia Code', Consolas, monospace;
}

.seed-form input:focus-visible {
  outline: 2px solid var(--maps);
  outline-offset: 2px;
}

.transit svg {
  width: 100%;
  height: auto;
}

.transit__map rect:first-child {
  fill: #101714;
  stroke: rgba(147, 203, 158, 0.45);
  stroke-width: 2;
}

.transit__room {
  fill: #1a241f;
  stroke: #93cb9e;
  stroke-width: 2;
}

.road {
  fill: none;
  stroke: #c8ad76;
  stroke-width: 14;
  stroke-linecap: round;
  opacity: 0.55;
}

.transit__pin circle {
  fill: #eac96f;
  stroke: #080a0e;
  stroke-width: 3;
}

.transit__pin text {
  fill: var(--text);
  font: 600 15px var(--font-body);
  paint-order: stroke;
  stroke: #101714;
  stroke-width: 5px;
}

.transit__link {
  stroke: #eac96f;
  stroke-width: 2;
  stroke-dasharray: 5 6;
  animation: gossip 1.4s linear infinite;
}

.storeys {
  position: relative;
  aspect-ratio: 1 / 0.82;
  perspective: 2600px;
  perspective-origin: 40% 40%;
}

.storeys__rig {
  position: absolute;
  inset: 26% 30% 6% 4%;
  transform-style: preserve-3d;
}

.storeys__floor {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(58deg) rotateZ(-32deg) translateZ(calc(var(--i) * 52px));
  border-radius: 12px;
  background: rgba(10, 16, 13, 0.92);
  border: 1px solid rgba(147, 203, 158, 0.35);
  box-shadow: 0 30px 40px -20px rgba(0, 0, 0, 0.8);
}

.storeys__floor svg {
  width: 100%;
  height: 100%;
}

.storeys__legend {
  top: 10%;
  opacity: 1;
}

.themes {
  margin-top: 40px;
}

.theme-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.theme {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(21, 24, 32, 0.7);
  font-size: 0.92rem;
  font-weight: 600;
}

.theme em {
  font-style: normal;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--maps);
}

.theme span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Swatches use each theme's own floor and wall colours (src/utils/map-theme-packs.ts). */
.theme--parchment span {
  background: linear-gradient(135deg, #f4e9cd 50%, #241f18 50%);
}

.theme--holo span {
  background: linear-gradient(135deg, #152230 50%, #9fd6ea 50%);
}

.theme--terminal span {
  background: linear-gradient(135deg, #0a1f12 50%, #4dff9f 50%);
}

.theme--noir span {
  background: linear-gradient(135deg, #141310 50%, #f2c230 50%);
}

/* ---------------------------------------------------------------------------------------------
   Campaigns — the tome */

.scene--tome .scene__sky {
  background:
    radial-gradient(ellipse 60% 50% at 50% 90%, rgba(138, 194, 233, 0.18), transparent 70%),
    linear-gradient(180deg, #05080c 0%, #09101a 70%, #0a0e14 100%);
}

.motes i {
  position: absolute;
  bottom: 18%;
  left: var(--x);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: #8ac2e9;
  box-shadow: 0 0 10px #8ac2e9;
  opacity: 0;
  animation: rise var(--dur) linear infinite;
  animation-delay: var(--delay);
}

@keyframes rise {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0);
  }
  15% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translate3d(calc(var(--size) * 6), -70vh, 0);
  }
}

.page-cards {
  position: relative;
  min-height: 460px;
}

.page-card {
  position: absolute;
  width: min(260px, 70vw);
  padding: 16px 18px 18px;
  border: 1px solid rgba(138, 194, 233, 0.3);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(20, 28, 40, 0.94), rgba(12, 17, 25, 0.94));
  box-shadow: 0 30px 60px -34px rgba(0, 0, 0, 0.95);
  font-size: 0.88rem;
  color: var(--muted);
  transform: translate3d(calc(var(--mx, 0) * var(--d, 2) * 8px), calc(var(--sy, 0px) + var(--my, 0) * var(--d, 2) * 6px), 0) rotate(var(--r, 0deg));
}

.page-card small {
  display: block;
  margin-bottom: 6px;
  color: var(--campaigns);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-card b {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.12rem;
  color: var(--text);
}

/* Story spine (Campaigns) */

.spine {
  display: grid;
  gap: 18px;
  padding: clamp(22px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  background: rgba(16, 20, 28, 0.85);
}

.spine__act {
  display: flex;
  align-items: center;
  gap: 14px;
}

.spine__act span {
  width: 64px;
  font-family: var(--font-display);
  color: var(--campaigns);
}

.spine__act i {
  position: relative;
  flex: 1;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(138, 194, 233, 0.35);
  background: rgba(138, 194, 233, 0.06);
}

.spine__act i.is-done {
  background: rgba(138, 194, 233, 0.45);
  border-color: transparent;
}

.spine__act i.is-broken {
  background: repeating-linear-gradient(45deg, rgba(231, 165, 186, 0.5) 0 6px, transparent 6px 12px);
  border-color: rgba(231, 165, 186, 0.6);
}

.spine__act i.is-new {
  border-style: dashed;
  border-color: var(--gold);
  background: rgba(234, 201, 111, 0.12);
}

.spine__act i.is-finale {
  flex: 1.4;
  border-color: var(--gold);
  background: rgba(234, 201, 111, 0.25);
}

/* Campaign graph (Campaigns) */

.graph-art {
  width: 100%;
  height: auto;
}

.graph-art__edges path {
  fill: none;
  stroke: rgba(138, 194, 233, 0.35);
  stroke-width: 2;
  stroke-dasharray: 3 7;
  animation: gossip 3s linear infinite;
}

.graph-art .n circle {
  fill: #121a24;
  stroke-width: 2.5;
}

.graph-art .n text {
  fill: var(--text);
  font: 600 14px var(--font-body);
  text-anchor: middle;
}

.graph-art .n--chapter circle {
  stroke: var(--gold);
}

.graph-art .n--npc circle {
  stroke: var(--gm);
}

.graph-art .n--place circle {
  stroke: var(--maps);
}

.graph-art .n--clue circle {
  stroke: var(--campaigns);
}

.graph-art .n--secret circle {
  stroke: var(--worlds);
  stroke-dasharray: 4 4;
}

/* Save slots (Campaigns) */

.slots {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.slots li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(21, 24, 32, 0.75);
  color: var(--muted);
}

.slots b {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 500;
}

.slots li.is-current {
  border-color: var(--campaigns);
  box-shadow: 0 0 0 1px rgba(138, 194, 233, 0.35), 0 20px 40px -30px rgba(138, 194, 233, 0.6);
}

.slots li.is-auto b {
  color: var(--campaigns);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------------------------------------
   Living worlds — the town */

.scene--town .scene__sky {
  background: linear-gradient(180deg, #04040a 0%, #0a0812 55%, #150d15 100%);
}

.scene__dusk {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #120a18 0%, #3a1d2a 52%, #7a3f3a 74%, #1a0f14 100%);
  opacity: calc(0.85 - var(--pt, 0) * 1.4);
}

.layer--night {
  opacity: calc(0.35 + var(--pt, 0) * 1.6);
}

.moon {
  position: absolute;
  top: 14%;
  left: 18%;
  width: clamp(54px, 7vw, 96px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6d8, #e8d7b0 60%, #b9a67c);
  box-shadow: 0 0 60px rgba(255, 240, 200, 0.35);
  transform: translate3d(calc(var(--pt, 0) * 40vw), calc(var(--pt, 0) * -6vh), 0);
}

.window {
  fill: #eac96f;
  animation: flicker 6s ease-in-out infinite;
  animation-delay: var(--t, 0s);
}

.window--rose {
  fill: #e7a5ba;
}

.thread {
  stroke: #e7a5ba;
  stroke-width: 1.6;
  stroke-opacity: 0.7;
  stroke-dasharray: 6 12;
  animation: gossip 3.6s linear infinite;
  animation-delay: var(--t, 0s);
  filter: drop-shadow(0 0 4px rgba(231, 165, 186, 0.6));
}

@keyframes gossip {
  to {
    stroke-dashoffset: -72;
  }
}

/* Living worlds components */

.page-cards--worlds {
  min-height: 360px;
}

.page-cards--worlds .page-card {
  border-color: rgba(231, 165, 186, 0.35);
}

.page-cards--worlds .page-card small {
  color: var(--worlds);
}

.ledger {
  display: grid;
  gap: 10px;
  padding: clamp(18px, 2.4vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  background: rgba(16, 13, 18, 0.85);
}

.ledger__row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(27, 31, 41, 0.6);
}

.ledger__row p {
  color: var(--text);
}

.ledger__tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--worlds);
}

.ledger__row.is-superseded p {
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-color: rgba(231, 165, 186, 0.6);
}

.ledger__row.is-superseded .ledger__tag {
  color: var(--faint);
}

.ledger__row.is-conflict {
  border: 1px dashed rgba(234, 201, 111, 0.55);
}

.ledger__row.is-conflict .ledger__tag {
  color: var(--gold);
}

.proposal__why {
  margin: 4px 0 18px;
  font-style: italic;
}

.axes {
  display: grid;
  gap: 8px;
}

.axis {
  display: grid;
  grid-template-columns: 92px 1fr 44px;
  gap: 12px;
  align-items: center;
  font-size: 0.86rem;
  color: var(--muted);
}

.axis__track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(59, 65, 78, 0.55);
}

.axis__zero {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: var(--divider);
}

.axis__bar {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: var(--antique);
  transition: left 0.8s var(--ease-out), width 0.8s var(--ease-out), background-color 0.4s;
}

.axis__bar.is-negative {
  background: var(--worlds);
}

.axis__value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.axis.is-changed .axis__name,
.axis.is-changed .axis__value {
  color: var(--worlds);
  font-weight: 700;
}

.axis.is-changed .axis__track {
  box-shadow: 0 0 0 1px rgba(231, 165, 186, 0.45);
}

[data-rule][aria-pressed='true'] {
  outline: 2px solid var(--worlds);
  outline-offset: 2px;
}

.narration--worlds {
  border-color: rgba(231, 165, 186, 0.3);
  background: linear-gradient(180deg, rgba(30, 18, 26, 0.9), rgba(14, 11, 16, 0.9));
}

.narration--worlds .narration__who {
  color: var(--worlds);
}

.narration--worlds .narration__who::before {
  background: var(--worlds);
  box-shadow: 0 0 10px var(--worlds);
}

.narration--worlds .narration__text {
  font-family: var(--font-body);
  font-size: 1.02rem;
}

.clock-wrap {
  display: grid;
  justify-items: center;
  gap: 16px;
}

.clock {
  width: min(100%, 320px);
  height: auto;
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.6));
}

.clock__rim {
  fill: #0e0b10;
  stroke: rgba(231, 165, 186, 0.45);
  stroke-width: 3;
}

.clock__seg {
  fill: rgba(231, 165, 186, 0.06);
  stroke: #0e0b10;
  stroke-width: 4;
  transition: fill 0.6s var(--ease-out);
}

.clock__seg.is-filled {
  fill: rgba(231, 165, 186, 0.7);
}

.is-full .clock__seg.is-filled {
  fill: #e7a5ba;
  animation: flicker 1.8s ease-in-out infinite;
}

.clock__hub {
  fill: var(--gold);
}

.clock__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  text-align: center;
  max-width: 24ch;
}

.log {
  margin-top: 22px;
}

/* ---------------------------------------------------------------------------------------------
   Your AI — the orrery */

.scene--orrery .scene__sky {
  background:
    radial-gradient(ellipse 50% 50% at 50% 52%, rgba(176, 188, 203, 0.1), transparent 70%),
    linear-gradient(180deg, #06070a 0%, #0b0d12 100%);
}

.orbit {
  fill: #b0bccb;
  transform-origin: 1170px 470px;
  animation: orbit 60s linear infinite;
}

.orbit--a {
  fill: #eac96f;
  animation-duration: 24s;
}

.orbit--b {
  animation-duration: 40s;
  animation-direction: reverse;
}

.orbit--c {
  animation-duration: 70s;
  fill: #c8ad76;
}

.orbit--d {
  animation-duration: 110s;
  animation-direction: reverse;
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

/* Engine wheel (Your AI) */

.wheel {
  position: relative;
  width: min(80%, 420px);
  aspect-ratio: 1;
  justify-self: center;
  container-type: inline-size;
}

.wheel__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(176, 188, 203, 0.3);
  transform: rotate(calc(var(--pt, 0) * 120deg));
}

.wheel__item {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  gap: 2px;
  min-width: 118px;
  padding: 10px 14px;
  border: 1px solid rgba(176, 188, 203, 0.35);
  border-radius: 12px;
  background: rgba(12, 14, 19, 0.92);
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(-44cqw) rotate(calc(-1 * var(--a) - var(--pt, 0) * 120deg));
  box-shadow: 0 20px 40px -26px rgba(0, 0, 0, 0.9);
}

.wheel__item b {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--text);
}

.wheel__core {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  justify-items: center;
  gap: 10px;
  transform: translate(-50%, -50%);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
}

.wheel__core svg {
  filter: drop-shadow(0 0 20px rgba(234, 201, 111, 0.45));
}

@media (max-width: 520px) {
  .wheel__item {
    min-width: 96px;
    padding: 8px 10px;
  }
}

.provider-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.provider-list li {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 10, 14, 0.6);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.sizing {
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
}

.sizing__row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr) minmax(0, 2fr);
  gap: 18px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(59, 65, 78, 0.55);
  color: var(--muted);
}

.sizing__row:last-child {
  border-bottom: 0;
}

.sizing__row span:nth-child(2) {
  color: var(--gold);
  font-weight: 600;
}

.sizing__row b {
  color: var(--text);
  font-weight: 600;
}

.sizing__row--head {
  background: rgba(21, 24, 32, 0.8);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sizing__row--head span:nth-child(2) {
  color: var(--muted);
}

@media (max-width: 760px) {
  .sizing__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .sizing__row--head {
    display: none;
  }
}

.meter {
  padding: clamp(24px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  background: linear-gradient(180deg, rgba(27, 31, 41, 0.92), rgba(12, 15, 20, 0.95));
}

.meter__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 600;
}

.meter__head b {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2.2rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.meter__track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(59, 65, 78, 0.5);
  overflow: hidden;
}

.meter__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--studio), var(--gold));
  transition: width 0.16s linear;
}

.meter__warn {
  position: absolute;
  left: 80%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(8, 10, 14, 0.9);
}

.meter__scale {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--faint);
}

.meter__status {
  min-height: 3em;
  margin: 18px 0 16px;
  color: var(--muted);
}

.meter.is-warn .meter__fill {
  background: linear-gradient(90deg, var(--gold), #f0a55a);
}

.meter.is-capped .meter__fill {
  background: linear-gradient(90deg, #f0a55a, var(--worlds));
}

.meter.is-capped .meter__head b {
  color: var(--worlds);
}

/* 404 */

.nf-die {
  position: relative;
  display: grid;
  place-items: center;
  width: 120px;
  margin: 0 auto 26px;
  opacity: 0.9;
  animation: spin 40s linear infinite;
}

.nf-die span {
  position: absolute;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold);
  animation: spin 40s linear infinite reverse;
}

/* ---------------------------------------------------------------------------------------------
   Pricing — floating dice */

.scene--dice .scene__sky {
  background:
    radial-gradient(ellipse 50% 50% at 50% 40%, rgba(234, 201, 111, 0.1), transparent 70%),
    linear-gradient(180deg, #06070a, #0b0d12);
}

.float-die {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  opacity: 0.55;
  animation: spin var(--spin) linear infinite;
}

.float-die svg {
  width: 100%;
  height: 100%;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------------------------------------
   Dice tray and roll tables */

.tray {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 22px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 38%, #1b202b 0%, #10141b 60%, #0b0e13 100%);
  border: 1px solid rgba(200, 173, 118, 0.4);
  box-shadow:
    inset 0 0 0 7px rgba(8, 10, 14, 0.95),
    inset 0 0 0 8px rgba(200, 173, 118, 0.18),
    inset 0 40px 90px rgba(0, 0, 0, 0.55),
    0 40px 90px -40px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.tray::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .42 0 0 0 0 .5 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.tray canvas {
  position: absolute;
  inset: 0;
}

.tray-column {
  position: sticky;
  top: calc(var(--top-h) + 24px);
}

@media (max-width: 900px) {
  .tray-column {
    position: static;
  }
}

.tray--compact {
  aspect-ratio: 16 / 7;
  margin: 4px 0 6px;
}

.tray__hud {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.tray__hud > * {
  pointer-events: auto;
}

.tray__total {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(8, 10, 14, 0.8);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}

.tray__total b {
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
  margin-left: 6px;
}

.dice-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dice-picker button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: rgba(21, 24, 32, 0.8);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.dice-picker button:hover {
  color: var(--text);
  border-color: rgba(200, 173, 118, 0.6);
}

.dice-picker button[aria-pressed='true'] {
  color: var(--black);
  background: var(--gold);
  border-color: var(--gold);
}

.dice-picker svg {
  width: 18px;
  height: 18px;
}

.dice-picker button[aria-pressed='true'] svg path {
  stroke: var(--black);
}

.roll-table {
  counter-reset: none;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
}

.roll-table::before {
  content: attr(data-heading);
  grid-column: 1 / -1;
  padding: 0 12px 12px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.roll-table li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(59, 65, 78, 0.5);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
  transition: background-color 0.4s, color 0.4s, box-shadow 0.4s;
}

.roll-table li > span:first-child {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--antique);
  text-align: right;
}

.roll-table li a {
  color: inherit;
  text-decoration: none;
}

.roll-table li a:hover {
  color: var(--text);
}

.roll-table li.is-hit {
  background: rgba(234, 201, 111, 0.1);
  box-shadow: inset 0 0 0 1px rgba(234, 201, 111, 0.55);
  color: var(--text);
}

.roll-table li.is-hit > span:first-child {
  color: var(--gold);
}

.roll-table--set li {
  grid-template-columns: 70px 1fr;
}

.roll-table--set li > span:first-child {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .roll-table {
    grid-template-columns: minmax(0, 1fr);
  }
}

.roll-result {
  min-height: 3.4em;
  margin-top: 18px;
  font-size: 1.05rem;
  color: var(--muted);
}

.roll-result strong {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--gold);
  font-size: 1.3rem;
}

.roll-result__breakdown {
  display: block;
  margin-top: 0.4em;
  font-size: 0.82em;
  color: var(--muted);
}

/* ---------------------------------------------------------------------------------------------
   Skill check (AI GM page) */

.check {
  display: grid;
  gap: 22px;
}

.check__options {
  display: grid;
  gap: 10px;
}

.check__option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(21, 24, 32, 0.7);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.check__option small {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.86rem;
}

.check__option .dc {
  grid-row: 1 / span 2;
  grid-column: 2;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(179, 177, 252, 0.4);
  color: var(--gm);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

.check__option:hover {
  border-color: rgba(179, 177, 252, 0.55);
}

.check__option[aria-pressed='true'] {
  border-color: var(--gm);
  background: rgba(179, 177, 252, 0.1);
}

.narration {
  position: relative;
  min-height: 190px;
  padding: 22px 24px;
  border-radius: 16px;
  border: 1px solid rgba(179, 177, 252, 0.3);
  background: linear-gradient(180deg, rgba(20, 17, 34, 0.92), rgba(12, 11, 20, 0.92));
}

.narration__who {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gm);
}

.narration__who::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gm);
  box-shadow: 0 0 10px var(--gm);
}

.narration__text {
  font-family: var(--font-display);
  font-size: 1.18rem;
  line-height: 1.55;
  color: var(--text);
}

.narration__meta {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.caret::after {
  content: '▍';
  margin-left: 2px;
  color: var(--gm);
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---------------------------------------------------------------------------------------------
   Seed-a-dungeon demo (Mapmaking page) */

.dungeon {
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(147, 203, 158, 0.35);
  background: #0b100e;
  overflow: hidden;
}

.dungeon svg {
  width: 100%;
  height: auto;
}

.dungeon .cell {
  opacity: 0;
  animation: pop 0.4s var(--ease-out) forwards;
  animation-delay: calc(var(--k) * 3ms);
}

.dungeon .walls {
  stroke-dasharray: 4000;
  stroke-dashoffset: 4000;
  animation: draw 1.6s var(--ease-out) forwards 0.5s;
}

.dungeon .door,
.dungeon .prop,
.dungeon .light,
.dungeon .light-core,
.dungeon .token {
  opacity: 0;
  animation: pop 0.5s var(--ease-out) forwards 1.5s;
}

@keyframes pop {
  to {
    opacity: 1;
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

.dungeon__bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.seed {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.95rem;
  color: var(--maps);
}

/* ---------------------------------------------------------------------------------------------
   World tick demo (Living worlds page) */

.web {
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(231, 165, 186, 0.3);
  background: radial-gradient(ellipse at 50% 40%, #1a1219, #0c0a0e 70%);
  overflow: hidden;
}

.web svg {
  width: 100%;
  height: auto;
  display: block;
}

.web .edge {
  stroke: rgba(231, 165, 186, 0.22);
  stroke-width: 1.5;
}

.web .edge.is-hot {
  stroke: #e7a5ba;
  stroke-width: 2.4;
  stroke-dasharray: 5 7;
  animation: gossip 1.6s linear infinite;
}

.web .node circle {
  fill: #151820;
  stroke: rgba(231, 165, 186, 0.5);
  stroke-width: 2;
  transition: fill 0.5s, stroke 0.5s;
}

.web .node.is-knows circle {
  fill: #3a2230;
  stroke: #e7a5ba;
}

.web .node.is-source circle {
  fill: #eac96f;
  stroke: #eac96f;
}

.web .node text {
  fill: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  text-anchor: middle;
}

.web .node .role {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
}

.log li {
  padding: 10px 14px;
  border-left: 2px solid var(--worlds);
  border-radius: 0 10px 10px 0;
  background: rgba(21, 24, 32, 0.7);
  color: var(--muted);
  font-size: 0.92rem;
  animation: pop 0.5s var(--ease-out);
}

.log li b {
  color: var(--text);
  font-weight: 600;
}

/* ---------------------------------------------------------------------------------------------
   Pipeline — the anatomy of a turn / a map */

.pipeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 56px;
  display: grid;
  gap: 18px;
}

.pipeline::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
}

.pipeline::after {
  content: '';
  position: absolute;
  left: 19px;
  top: 8px;
  width: 2px;
  height: calc((100% - 16px) * var(--fill, 0));
  background: linear-gradient(var(--gold), var(--area));
  box-shadow: 0 0 12px rgba(234, 201, 111, 0.5);
}

.pipeline li {
  position: relative;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(21, 24, 32, 0.65);
  transition: border-color 0.5s, background-color 0.5s;
}

.pipeline li::before {
  content: attr(data-step);
  position: absolute;
  z-index: 1;
  left: -56px;
  top: 16px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--black);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1rem;
  transition: border-color 0.5s, color 0.5s, box-shadow 0.5s;
}

.pipeline li.is-lit {
  border-color: color-mix(in srgb, var(--area) 45%, transparent);
  background: rgba(27, 31, 41, 0.9);
}

.pipeline li.is-lit::before {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 18px rgba(234, 201, 111, 0.4);
}

.pipeline h3 {
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.pipeline p {
  color: var(--muted);
  font-size: 0.97rem;
}

.pipeline .engine {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--area);
}

/* ---------------------------------------------------------------------------------------------
   Realm cards (home) */

.realms {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.realm {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 340px;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  background: linear-gradient(180deg, rgba(27, 31, 41, 0.9), rgba(12, 15, 20, 0.95));
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.5s var(--ease-out), border-color 0.3s;
}

.realm::before {
  content: '';
  position: absolute;
  inset: auto -30% -40% -30%;
  height: 70%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--area) 28%, transparent), transparent);
  opacity: 0.5;
  transition: opacity 0.4s, transform 0.6s var(--ease-out);
}

.realm:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--area) 60%, transparent);
}

.realm:hover::before {
  opacity: 1;
  transform: translateY(-10%);
}

.realm__die {
  width: 58px;
  height: 58px;
  margin-bottom: 28px;
  transition: transform 0.8s var(--ease-spring);
}

.realm__die path {
  stroke: var(--area);
}

.realm:hover .realm__die {
  transform: rotate(72deg) scale(1.08);
}

.realm h3 {
  margin-bottom: 10px;
}

.realm p {
  position: relative;
  color: var(--muted);
  font-size: 0.97rem;
}

.realm .arrow-link {
  position: relative;
  margin-top: auto;
  padding-top: 24px;
}

/* ---------------------------------------------------------------------------------------------
   Play modes (home + AI GM) */

.modes {
  display: grid;
  gap: clamp(28px, 4vw, 56px);
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  align-items: start;
}

@media (max-width: 900px) {
  .modes {
    grid-template-columns: minmax(0, 1fr);
  }
}

.modes--single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 820px;
}

.dial {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 1;
  margin-inline: auto;
}

.dial__face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #1d2230, #0b0e13 70%);
  border: 1px solid rgba(200, 173, 118, 0.35);
  box-shadow: inset 0 0 0 10px rgba(8, 10, 14, 0.9), 0 40px 80px -40px rgba(0, 0, 0, 0.9);
}

.dial__needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 40%;
  margin-left: -2px;
  border-radius: 4px;
  background: linear-gradient(var(--gold), rgba(234, 201, 111, 0.2));
  transform-origin: 50% 0;
  transform: rotate(calc(180deg + var(--angle, -60deg)));
  transition: transform 0.9s var(--ease-spring);
  box-shadow: 0 0 16px rgba(234, 201, 111, 0.45);
}

.dial__hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #0b0e13;
  border: 1px solid rgba(200, 173, 118, 0.5);
}

.dial__hub svg {
  width: 62%;
  height: 62%;
}

.dial__tick {
  position: absolute;
  left: calc(50% + sin(var(--a)) * 37%);
  top: calc(50% - cos(var(--a)) * 37%);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  transform: translate(-50%, -50%);
  white-space: nowrap;
  transition: color 0.4s;
}

.modes[data-mode-dial] .dial__needle {
  transform: rotate(calc(180deg + var(--angle, -60deg)));
}

/* Example console on the home page */

.console {
  display: grid;
  gap: 2px;
  margin: 0;
}

.console > div {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(59, 65, 78, 0.55);
}

.console > div:last-child {
  border-bottom: 0;
}

.console dt {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--antique);
  padding-top: 2px;
}

.console dd {
  margin: 0;
  color: var(--text);
  font-size: 0.97rem;
}

.hero-die--cta {
  margin: 0 auto 8px;
}

.die-stage--small {
  width: 180px;
}

.dial__tick.is-on {
  color: var(--gold);
}

.mode-panel {
  padding: clamp(24px, 3vw, 36px);
}

.mode-panel h3 {
  margin: 20px 0 12px;
}

.mode-panel p {
  color: var(--muted);
}

.mode-panel .ticks {
  margin-top: 20px;
}

/* ---------------------------------------------------------------------------------------------
   Pricing */

.tiers {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  align-items: stretch;
}

.tier {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 26px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  background: linear-gradient(180deg, rgba(27, 31, 41, 0.92), rgba(12, 15, 20, 0.95));
}

.tier--featured {
  border-color: rgba(234, 201, 111, 0.6);
  box-shadow: 0 40px 80px -50px rgba(234, 201, 111, 0.45);
}

.tier--featured::before {
  content: 'Most popular choice for regular campaigns';
  content: 'For regular campaigns';
  position: absolute;
  top: -12px;
  left: 22px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--black);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tier__index {
  color: var(--faint);
  font-family: var(--font-display);
}

.tier__name {
  margin-top: 4px;
  font-size: 1.35rem;
}

.tier__price {
  margin-top: 14px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.tier__amount {
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1;
  color: var(--gold);
}

.tier__per {
  color: var(--muted);
  font-size: 0.95rem;
}

.tier__blurb {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.93rem;
}

.tier__facts,
.tier__features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 0.93rem;
}

.tier__facts {
  padding-block: 14px;
  border-block: 1px solid var(--line);
}

.tier__facts b {
  font-weight: 600;
  color: var(--text);
}

.tier__features li {
  position: relative;
  padding-left: 22px;
  color: var(--muted);
}

.tier__features li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.6em;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--antique);
  transform: rotate(45deg);
}

.tier__features li.is-planned {
  color: var(--faint);
}

.planned-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.tier__cta {
  margin-top: auto;
}

.tier__price--tba {
  display: inline-block;
  margin-top: 14px;
  padding: 6px 12px;
  border: 1px dashed rgba(200, 173, 118, 0.55);
  border-radius: var(--r-control);
  color: var(--antique);
  font-size: 0.92rem;
  font-weight: 600;
}

.compare-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
}

.compare {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.compare th,
.compare td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(59, 65, 78, 0.6);
  text-align: center;
}

.compare thead th {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  color: var(--text);
  background: rgba(21, 24, 32, 0.8);
}

.compare tbody th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
}

.compare tr:last-child th,
.compare tr:last-child td {
  border-bottom: 0;
}

.tick {
  color: var(--gold);
  font-weight: 700;
}

.cross {
  color: var(--faint);
}

/* ---------------------------------------------------------------------------------------------
   Decorative dice */

.die-art {
  display: block;
  overflow: visible;
}

.divider-die {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-block: 0;
}

.divider-die::before,
.divider-die::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--divider));
}

.divider-die::after {
  background: linear-gradient(90deg, var(--divider), transparent);
}

.divider-die svg {
  width: 26px;
  height: 26px;
  opacity: 0.8;
}
