:root {
  color-scheme: dark;
  --bg: #01040f;
  --bg-soft: #050a1a;
  --panel: rgba(3, 8, 24, 0.82);
  --panel-strong: rgba(4, 9, 26, 0.95);
  --border: rgba(217, 230, 252, 0.16);
  --text: #d9e6fc;
  --muted: rgba(217, 230, 252, 0.78);
  --dim: rgba(217, 230, 252, 0.54);
  --gold: #f4c76b;
  --rose: #e67aa0;
  --violet: #a78bfa;
  --blue: #6ed7ff;
  --green: #9fe7c3;
  --danger: #ff6b7d;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-anchor: none;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 20%, rgba(59, 88, 178, 0.18), transparent 28rem),
    radial-gradient(circle at 78% 4%, rgba(217, 230, 252, 0.08), transparent 23rem),
    radial-gradient(circle at 52% 100%, rgba(96, 70, 180, 0.12), transparent 30rem),
    linear-gradient(180deg, #01040f 0%, #01040f 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.modal-open {
  overflow: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  content: '';
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.55) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(255, 255, 255, 0.26) 0 1px, transparent 1.2px);
  background-position:
    0 0,
    48px 78px;
  background-size:
    146px 146px,
    218px 218px;
  opacity: 0.26;
}

.ambient {
  position: fixed;
  z-index: -2;
  width: 36rem;
  height: 36rem;
  border-radius: 999px;
  filter: blur(34px);
  opacity: 0.28;
  pointer-events: none;
}

.ambient-a {
  top: -11rem;
  left: -8rem;
  background: #223b8f;
}

.ambient-b {
  right: -12rem;
  bottom: 2rem;
  background: #122552;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3.5rem);
  border-bottom: 1px solid var(--border);
  background: rgba(1, 4, 15, 0.84);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.brand-mark {
  width: 1.2rem;
  height: 1.2rem;
  border: 1px solid rgba(244, 199, 107, 0.84);
  border-radius: 999px;
  box-shadow:
    0 0 22px rgba(244, 199, 107, 0.62),
    inset 0 0 10px rgba(244, 199, 107, 0.28);
}

.nav-links {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
}

.nav-links a {
  padding: 0.58rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  transition: 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.06);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.app-shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4.5rem) 0 5rem;
}

.intro-mode .topbar,
.intro-mode .site-footer {
  display: none;
}

.intro-mode .app-shell {
  width: 100vw;
  padding: 0;
}

.intro-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: clamp(1.5rem, 5vw, 5rem);
  background: #01040f;
  color: #d9e6fc;
}

.intro-screen::before {
  position: absolute;
  inset: 0;
  content: '';
  background-image:
    radial-gradient(circle, rgba(217, 230, 252, 0.62) 0 1px, transparent 1.3px),
    radial-gradient(circle, rgba(217, 230, 252, 0.22) 0 1px, transparent 1.1px);
  background-position:
    22px 30px,
    86px 108px;
  background-size:
    180px 180px,
    260px 260px;
  opacity: 0.18;
}

.intro-copy {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  min-height: 11rem;
  display: grid;
  place-items: center;
  text-align: center;
  transition: opacity 0.32s ease, filter 0.32s ease, transform 0.42s ease;
}

.intro-copy.intro-vanish {
  opacity: 0;
  filter: blur(10px);
}

.intro-copy.intro-final {
  transform: translateY(-6vh);
}

.intro-final-lines {
  display: grid;
  gap: 0;
  place-items: center;
}

.intro-final .intro-line {
  font-size: clamp(1.8rem, 4.8vw, 4.8rem);
  line-height: 1.02;
}

.intro-final .intro-line::after {
  display: none;
}

.intro-hint {
  color: rgba(217, 230, 252, 0.48);
  font-family: 'IM Fell Double Pica SC', Georgia, serif;
  font-size: clamp(1.2rem, 3vw, 2.2rem);
  letter-spacing: 0.08em;
}

.intro-line {
  color: #d9e6fc;
  font-family: 'IM Fell Double Pica SC', Georgia, serif;
  font-size: clamp(2.1rem, 6vw, 5.7rem);
  letter-spacing: 0.045em;
  line-height: 1.1;
  text-transform: uppercase;
  text-shadow: 0 0 22px rgba(217, 230, 252, 0.22), 0 0 70px rgba(59, 88, 178, 0.34);
}

.intro-line::after {
  display: inline-block;
  width: 0.08em;
  height: 0.86em;
  margin-left: 0.14em;
  background: #d9e6fc;
  content: '';
  transform: translateY(0.12em);
  animation: caret 0.9s steps(2, jump-none) infinite;
}

.intro-reveal {
  overflow: hidden;
  white-space: normal;
}

.intro-reveal span {
  display: inline-block;
  max-width: 100%;
  clip-path: inset(0 100% 0 0);
  animation: revealText 1.75s ease forwards;
}

.intro-fade {
  margin-top: 0.18rem;
  opacity: 0;
  animation: fadeInUniverse 0.9s ease forwards;
}

.intro-final .intro-fade {
  font-size: clamp(1.4rem, 3.5vw, 3.45rem);
  letter-spacing: 0.035em;
}

.intro-journey {
  position: absolute;
  z-index: 2;
  bottom: clamp(3rem, 9vh, 6rem);
  min-width: min(28rem, calc(100vw - 3rem));
  padding: 1.05rem 2.2rem;
  border: 1px solid rgba(217, 230, 252, 0.56);
  border-radius: 2px;
  background: rgba(217, 230, 252, 0.06);
  color: #d9e6fc;
  font-family: 'IM Fell Double Pica SC', Georgia, serif;
  font-size: clamp(1.15rem, 2.6vw, 1.8rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  box-shadow: 0 0 34px rgba(217, 230, 252, 0.1);
  transition: transform 0.18s ease, background 0.18s ease;
}

.intro-journey:hover {
  background: rgba(217, 230, 252, 0.12);
  transform: translateY(-2px);
}

.site-footer {
  display: flex;
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 0 0 2rem;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  font-size: 0.88rem;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--gold);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  min-height: calc(100vh - 8rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 1.8rem;
  height: 1px;
  background: currentColor;
  content: '';
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
  letter-spacing: -0.045em;
}

h1 {
  max-width: 12ch;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(4.2rem, 10vw, 8.6rem);
  line-height: 0.86;
}

h2 {
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  line-height: 0.95;
  font-family: 'Cormorant Garamond', Georgia, serif;
}

h3 {
  font-size: 1.2rem;
}

p {
  color: var(--muted);
  line-height: 1.75;
}

.lead {
  max-width: 700px;
  color: #d9dded;
  font-size: clamp(1.05rem, 2.2vw, 1.22rem);
}

.hero-actions,
.inline-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  margin-top: 1.5rem;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.7rem;
  padding: 0.78rem 1.05rem;
  border-radius: 999px;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--gold), #fff0a6);
  color: #1a1407;
  font-weight: 800;
  box-shadow: 0 12px 34px rgba(244, 199, 107, 0.22);
}

.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 700;
}

.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 700;
}

.danger-button {
  border: 1px solid rgba(255, 107, 125, 0.28);
  background: rgba(255, 107, 125, 0.12);
  color: #ffd5db;
  font-weight: 800;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.small {
  min-height: 2.25rem;
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
}

.cosmos-card,
.panel,
.question-card,
.auth-card {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.cosmos-card {
  position: relative;
  min-height: clamp(540px, 58vw, 690px);
  overflow: hidden;
  isolation: isolate;
}

.cosmos-card::before,
.cosmos-card::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: '';
}

.cosmos-card::before {
  background:
    linear-gradient(180deg, rgba(1, 4, 15, 0.08), rgba(1, 4, 15, 0.5)),
    radial-gradient(circle at 54% 45%, transparent 0 42%, rgba(1, 4, 15, 0.34) 73%, rgba(1, 4, 15, 0.72) 100%);
  z-index: 1;
}

.cosmos-card::after {
  border-radius: inherit;
  box-shadow: inset 0 0 90px rgba(1, 4, 15, 0.9), inset 0 -120px 120px rgba(1, 4, 15, 0.76);
  z-index: 3;
}

.cosmos-hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.96;
  transform: scale(1.02);
  z-index: 0;
}

.metrics {
  position: absolute;
  right: 1.25rem;
  bottom: 1.25rem;
  left: 1.25rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  z-index: 4;
}

.metric {
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(5, 8, 18, 0.7);
  backdrop-filter: blur(12px);
}

.metric strong {
  display: block;
  color: var(--text);
  font-size: 1.2rem;
}

.metric span,
.fineprint,
.meta {
  color: var(--dim);
  font-size: 0.86rem;
}

.character-count {
  display: block;
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-stack {
  display: grid;
  min-width: 0;
  gap: 1.2rem;
}

.section-stack > *,
.panel,
.timeline-source-picker > *,
.timeline-draft-intro > *,
.timeline-source-controls,
.timeline-editor,
.event-row,
.branch-selector {
  min-width: 0;
  max-width: 100%;
}

.timeline-page {
  position: relative;
  left: 50%;
  width: min(1480px, calc(100vw - 2rem));
  max-width: 100%;
  transform: translateX(-50%);
}

.timeline-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
}

.timeline-page-header-copy {
  max-width: 1040px;
}

.timeline-page-header-copy .lead {
  max-width: 960px;
  margin-bottom: 0;
}

.timeline-create-toggle {
  align-self: end;
  margin-bottom: 0.35rem;
  white-space: nowrap;
}

.timeline-create-panel {
  display: grid;
  gap: 1rem;
  scroll-margin-top: 7.5rem;
  animation: fadeInUniverse 0.28s ease both;
}

.timeline-event-kind-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.timeline-event-kind-picker .event-type-button.active {
  border-color: rgba(244, 199, 107, 0.76);
  background: rgba(244, 199, 107, 0.13);
  color: var(--gold);
  box-shadow: 0 0 28px rgba(244, 199, 107, 0.08);
}

.timeline-event-fields {
  display: grid;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(217, 230, 252, 0.12);
  animation: fadeInUniverse 0.24s ease both;
}

.timeline-workspace {
  position: relative;
  min-height: clamp(600px, 72vh, 940px);
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 8%, rgba(63, 87, 171, 0.17), transparent 26rem),
    radial-gradient(circle at 82% 88%, rgba(167, 139, 250, 0.11), transparent 30rem),
    rgba(2, 7, 22, 0.9);
}

.timeline-workspace::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(217, 230, 252, 0.32) 0 1px, transparent 1.3px),
    radial-gradient(circle, rgba(244, 199, 107, 0.2) 0 1px, transparent 1.2px);
  background-position: 12px 24px, 96px 86px;
  background-size: 190px 190px, 280px 280px;
  content: '';
  opacity: 0.22;
}

.timeline-workspace > * {
  position: relative;
  z-index: 1;
}

.timeline-workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: end;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(217, 230, 252, 0.14);
}

.timeline-workspace-header h3,
.timeline-workspace-header p {
  margin-bottom: 0;
}

.timeline-workspace-header > p {
  max-width: 560px;
  color: var(--muted);
  text-align: right;
}

.timeline-canvas {
  display: block;
  min-height: 460px;
  padding-top: 1.25rem;
  overflow-anchor: none;
}

.timeline-page,
.timeline-workspace,
.personal-timeline-scroll,
.personal-main-track {
  overflow-anchor: none;
}

.timeline-empty-canvas {
  position: relative;
  display: grid;
  min-height: 440px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(217, 230, 252, 0.18);
  border-radius: 24px;
  color: var(--muted);
}

.timeline-empty-canvas::before {
  position: absolute;
  right: 7%;
  left: 7%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(217, 230, 252, 0.62), transparent);
  content: '';
}

.timeline-empty-canvas p {
  position: relative;
  z-index: 1;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: #05091a;
}

.personal-timeline-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.5rem 0 1.5rem;
  scrollbar-color: rgba(217, 230, 252, 0.34) transparent;
}

.personal-main-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--event-count), 240px);
  align-items: start;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 440px;
  padding: 0.5rem 1.5rem 2rem;
}

.personal-main-line {
  position: absolute;
  top: 274px;
  right: 2rem;
  left: 2rem;
  height: 2px;
  background:
    linear-gradient(90deg, #d9e6fc 0 calc(100% - 2.2rem), transparent calc(100% - 2.2rem)),
    repeating-linear-gradient(90deg, rgba(217, 230, 252, 0.76) 0 12px, transparent 12px 24px);
  box-shadow: 0 0 14px rgba(217, 230, 252, 0.24);
}

.personal-main-event {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 250px 48px auto;
  justify-items: center;
  min-width: 0;
}

.personal-event-card {
  align-self: end;
  width: min(100%, 230px);
  max-height: 228px;
  overflow-y: auto;
  padding: 1rem;
  border: 1px solid rgba(217, 230, 252, 0.16);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(217, 230, 252, 0.08), transparent 9rem),
    rgba(3, 8, 24, 0.92);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.24);
  scrollbar-width: thin;
}

.personal-event-card.major-event-card {
  border-color: rgba(244, 199, 107, 0.32);
  background:
    radial-gradient(circle at 50% 0%, rgba(244, 199, 107, 0.11), transparent 9rem),
    rgba(3, 8, 24, 0.94);
}

.personal-event-card h3 {
  margin: 0.7rem 0 0;
  color: #d9e6fc;
  font-size: 1.18rem;
}

.personal-event-card .history-description {
  margin-top: 0.7rem;
}

.personal-node-button {
  position: relative;
  align-self: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #d9e6fc;
  cursor: pointer;
}

.personal-node-button::before {
  position: absolute;
  inset: 8px;
  border: 2px solid #d9e6fc;
  border-radius: inherit;
  background: #01040f;
  box-shadow:
    0 0 12px rgba(217, 230, 252, 0.88),
    0 0 28px rgba(217, 230, 252, 0.32);
  content: '';
  transition: 0.22s ease;
}

.personal-node-button.major-node-button::before {
  background: #d9e6fc;
}

.personal-node-button:hover::before,
.personal-node-button:focus-visible::before,
.personal-node-button[aria-expanded='true']::before {
  inset: 5px;
  border-color: var(--gold);
  box-shadow:
    0 0 14px rgba(244, 199, 107, 0.9),
    0 0 34px rgba(244, 199, 107, 0.38);
}

.personal-node-drawer {
  position: relative;
  z-index: 5;
  justify-self: center;
  width: min(660px, calc(100vw - 6rem));
  margin-top: 0.35rem;
  padding-top: 2rem;
  animation: fadeInUniverse 0.24s ease both;
}

.personal-node-drawer::before {
  position: absolute;
  top: -0.45rem;
  left: 50%;
  width: 1px;
  height: 2.35rem;
  background: rgba(137, 156, 190, 0.72);
  box-shadow: 0 0 12px rgba(217, 230, 252, 0.38);
  content: '';
  transform: translateX(-50%);
}

.node-choice-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.8rem;
  border: 1px solid rgba(217, 230, 252, 0.15);
  border-radius: 18px;
  background: rgba(2, 7, 22, 0.95);
}

.attached-personal-branches {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.personal-branch {
  position: relative;
  width: 100%;
  padding-top: 1.5rem;
  color: rgba(217, 230, 252, var(--branch-brightness));
}

.personal-branch::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 1.6rem;
  background: rgba(121, 139, 171, calc(var(--branch-brightness) * 0.82));
  box-shadow: 0 0 12px rgba(217, 230, 252, calc(var(--branch-brightness) * 0.5));
  content: '';
}

.personal-branch-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.9rem;
  align-items: center;
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(217, 230, 252, calc(var(--branch-brightness) * 0.6));
  border-radius: 18px;
  background: rgba(4, 8, 23, 0.94);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.personal-branch-heading strong,
.personal-branch-heading small {
  display: block;
}

.personal-branch-heading strong {
  margin-top: 0.4rem;
  color: #d9e6fc;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem;
}

.personal-branch-heading small {
  margin-top: 0.25rem;
  color: var(--muted);
}

.branch-story-node {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(217, 230, 252, var(--branch-brightness));
  border-radius: 50%;
  background: rgba(217, 230, 252, var(--branch-brightness));
  box-shadow:
    0 0 12px rgba(217, 230, 252, var(--branch-brightness)),
    0 0 28px rgba(217, 230, 252, calc(var(--branch-brightness) * 0.38));
}

.personal-branch-content {
  padding: 0.9rem 0 0;
  animation: fadeInUniverse 0.22s ease both;
}

.secondary-timeline-scroll {
  overflow-x: auto;
  padding: 0.5rem 0 0.8rem;
}

.secondary-timeline-rail {
  position: relative;
  display: flex;
  gap: 1rem;
  min-width: max-content;
  width: max-content;
  padding: 3.5rem 0.4rem 0.5rem;
}

.secondary-timeline-rail::before {
  position: absolute;
  top: 2.65rem;
  right: 0.8rem;
  left: 0.8rem;
  height: 1px;
  background: rgba(121, 139, 171, calc(var(--branch-brightness) * 0.82));
  box-shadow: 0 0 10px rgba(217, 230, 252, calc(var(--branch-brightness) * 0.45));
  content: '';
}

.secondary-event-node {
  position: relative;
  width: 200px;
  min-height: 150px;
  padding: 0.85rem;
  border: 1px solid rgba(217, 230, 252, calc(var(--branch-brightness) * 0.48));
  border-radius: 16px;
  background: rgba(4, 8, 23, 0.9);
  color: #d9e6fc;
}

.secondary-event-node::before {
  position: absolute;
  top: -1.25rem;
  left: 50%;
  width: 0.62rem;
  height: 0.62rem;
  border: 2px solid rgba(217, 230, 252, var(--branch-brightness));
  border-radius: 50%;
  background: #01040f;
  box-shadow: 0 0 12px rgba(217, 230, 252, var(--branch-brightness));
  content: '';
  transform: translateX(-50%);
}

.secondary-event-node.major-secondary-node::before {
  background: rgba(217, 230, 252, var(--branch-brightness));
}

.secondary-event-node h4 {
  margin: 0.6rem 0 0;
  color: #d9e6fc;
  font-size: 1rem;
}

.secondary-event-delete {
  margin-top: 0.8rem;
}

.detached-branches {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px dashed rgba(217, 230, 252, 0.16);
  border-radius: 18px;
}

.detached-branches > summary {
  color: var(--muted);
  cursor: pointer;
}

.detached-branch-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.alternate-choice-panel {
  display: grid;
  gap: 1.25rem;
}

.alternate-choice-paths {
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid rgba(244, 199, 107, 0.24);
  border-radius: 18px;
  background: rgba(244, 199, 107, 0.055);
}

.alternate-choice-modal {
  width: min(920px, 100%);
}

.history-branch-scroll {
  min-height: 490px;
  margin-top: 1.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgba(217, 230, 252, 0.12);
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 10%, rgba(91, 76, 160, 0.12), transparent 24rem),
    rgba(3, 8, 24, 0.58);
  scrollbar-color: rgba(217, 230, 252, 0.34) transparent;
}

.history-era-directory {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.history-era-group {
  overflow: hidden;
  border: 1px solid rgba(217, 230, 252, 0.15);
  border-radius: 22px;
  background: rgba(3, 8, 24, 0.72);
  transition: border-color 180ms ease, background 180ms ease;
}

.history-era-group[open] {
  border-color: rgba(244, 199, 107, 0.38);
  background: rgba(5, 10, 28, 0.9);
}

.history-era-group > summary {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  list-style: none;
}

.history-era-group > summary::-webkit-details-marker {
  display: none;
}

.history-era-copy {
  display: grid;
  gap: 0.25rem;
}

.history-era-copy strong {
  color: #d9e6fc;
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.5vw, 1.8rem);
}

.history-era-copy small {
  color: var(--muted);
  font-size: 0.82rem;
}

.history-era-action {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-era-action::after {
  content: '+';
  font-size: 1.1rem;
}

.history-era-group[open] .history-era-action::after {
  content: '−';
}

.history-era-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid rgba(217, 230, 252, 0.1);
}

.history-branch-world {
  position: relative;
  min-width: 100%;
}

.history-main-line {
  position: absolute;
  top: 274px;
  left: 42px;
  height: 1px;
  background:
    linear-gradient(90deg, #d9e6fc 0 calc(100% - 2.2rem), transparent calc(100% - 2.2rem)),
    repeating-linear-gradient(90deg, rgba(217, 230, 252, 0.78) 0 12px, transparent 12px 24px);
}

.history-main-node {
  position: absolute;
  top: 20px;
  left: var(--history-node-left);
  width: 250px;
}

.history-node-marker {
  position: absolute;
  top: 266px;
  left: 50%;
  z-index: 2;
  width: 1rem;
  height: 1rem;
  border: 2px solid #d9e6fc;
  border-radius: 999px;
  background: #d9e6fc;
  box-shadow: 0 0 22px rgba(217, 230, 252, 0.6);
  transform: translateX(-50%);
}

.history-event-card {
  width: 250px;
  height: 228px;
  min-height: 228px;
  max-height: 228px;
  margin-top: 0;
  padding: 1rem;
  overflow: hidden;
}

.history-event-card .history-description-body,
.personal-event-card .history-description-body {
  max-height: 6.4rem;
  overflow-y: auto;
  padding-right: 0.35rem;
  scrollbar-color: rgba(217, 230, 252, 0.32) transparent;
}

.history-attached-branch {
  position: absolute;
  top: var(--history-branch-top);
  left: var(--history-branch-left);
  width: 860px;
  min-height: 430px;
  overflow: visible;
}

.history-attached-branch::before {
  position: absolute;
  bottom: 100%;
  left: 28px;
  width: 1px;
  height: var(--history-connector-height);
  background: linear-gradient(180deg, rgba(217, 230, 252, 0.82), rgba(244, 199, 107, 0.74));
  content: '';
}

.history-attached-branch::after {
  position: absolute;
  top: -0.45rem;
  left: 21px;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid var(--gold);
  border-radius: 999px;
  background: #01040f;
  box-shadow: 0 0 18px rgba(244, 199, 107, 0.48);
  content: '';
}

.history-branch-origin {
  display: inline-flex;
  margin: 0 0 0.8rem 2rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-branch-card {
  padding: clamp(1.2rem, 2.5vw, 2rem);
}

.history-owner-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(217, 230, 252, 0.12);
}

.history-creator {
  display: grid;
  gap: 1.25rem;
}

.history-creator-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.history-creator-modes .active {
  border-color: rgba(244, 199, 107, 0.72);
  background: rgba(244, 199, 107, 0.12);
  color: var(--gold);
}

.history-creator-form {
  display: grid;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(217, 230, 252, 0.12);
}

.history-review-card {
  border-color: rgba(244, 199, 107, 0.2);
}

.history-description {
  margin-top: 0.8rem;
  border-top: 1px solid rgba(217, 230, 252, 0.12);
}

.history-description summary {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.8rem;
  color: #d9e6fc;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.history-description summary::-webkit-details-marker {
  display: none;
}

.history-description summary::after {
  color: var(--gold);
  content: '+';
  font-size: 1.1rem;
}

.history-description[open] summary::after {
  content: '−';
}

.history-description-body {
  padding-top: 0.75rem;
  color: var(--muted);
}

.history-description-body p:last-child {
  margin-bottom: 0;
}

.timeline-node-description {
  margin-top: 0.7rem;
}

.history-story-body .story-body {
  margin-top: 0.8rem;
}

.history-no-branches {
  position: absolute;
  top: 390px;
  left: 42px;
  padding: 0.85rem 1rem;
  border: 1px dashed rgba(217, 230, 252, 0.18);
  border-radius: 999px;
  color: var(--muted);
}

.panel,
.question-card,
.auth-card {
  padding: clamp(1.2rem, 3vw, 2rem);
}

.auth-card {
  display: grid;
  align-content: start;
  gap: 0.9rem;
  padding-bottom: clamp(3.25rem, 5vw, 5rem);
}

.auth-card button[type='submit'] {
  justify-self: start;
  margin-top: 0.25rem;
}

.auth-card .fineprint {
  margin-top: 0.85rem;
}

.feature-card {
  min-height: 100%;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
}

.feature-card .icon {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 1rem;
  place-items: center;
  border-radius: 14px;
  background: rgba(244, 199, 107, 0.12);
  color: var(--gold);
}

.background-topic-grid {
  align-items: stretch;
}

.background-topic-card {
  display: flex;
  flex-direction: column;
  min-height: clamp(320px, 30vw, 430px);
  padding: clamp(1.4rem, 2.4vw, 2rem);
}

.background-topic-card h3 {
  margin-bottom: 1rem;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.background-topic-card p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.2vw, 1.08rem);
  line-height: 1.8;
}

.question-card {
  max-width: 820px;
  margin: 0 auto;
}

.quiz-branch-point-question {
  max-width: 940px;
}

.quiz-event-directory {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.3rem;
  padding: 1rem;
  border: 1px solid rgba(217, 230, 252, 0.18);
  border-radius: 20px;
  background: rgba(217, 230, 252, 0.035);
}

.quiz-event-directory legend {
  padding: 0 0.35rem;
  color: var(--gold);
  font-weight: 800;
}

.quiz-event-directory > p,
.quiz-event-empty,
.quiz-event-loading {
  margin: 0;
  color: var(--muted);
}

.quiz-event-options {
  display: grid;
  gap: 0.65rem;
  max-height: 21rem;
  overflow-y: auto;
  padding-right: 0.25rem;
  scrollbar-color: rgba(217, 230, 252, 0.34) transparent;
}

.quiz-event-option {
  display: grid;
  grid-template-columns: auto minmax(6rem, 0.3fr) minmax(0, 1fr);
  gap: 0.8rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(217, 230, 252, 0.14);
  border-radius: 16px;
  background: rgba(4, 8, 23, 0.76);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.quiz-event-option:hover,
.quiz-event-option.selected {
  border-color: rgba(244, 199, 107, 0.62);
  background: rgba(244, 199, 107, 0.08);
  box-shadow: 0 0 24px rgba(244, 199, 107, 0.08);
}

.quiz-event-option input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--gold);
}

.quiz-event-date {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.quiz-event-copy,
.quiz-event-copy strong,
.quiz-event-copy small {
  display: block;
  min-width: 0;
}

.quiz-event-copy small {
  margin-top: 0.25rem;
  overflow: hidden;
  color: var(--muted);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quiz-new-event-panel {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  border: 1px dashed rgba(244, 199, 107, 0.34);
  border-radius: 18px;
  background: rgba(1, 4, 15, 0.64);
  animation: fadeInUniverse 0.22s ease both;
}

.quiz-branch-notes {
  margin-top: 1.2rem;
}

.quiz-branch-notes .big-input {
  margin-top: 0;
}

.branch-decision-card,
.generation-card {
  text-align: center;
}

.branch-decision-card .form-actions {
  justify-content: center;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.choice-button {
  min-height: 7rem;
  border: 1px solid rgba(217, 230, 252, 0.22);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.2), transparent 58%),
    rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.choice-button:hover,
.choice-button:focus-visible {
  border-color: rgba(244, 199, 107, 0.62);
  background:
    radial-gradient(circle at 50% 0%, rgba(244, 199, 107, 0.2), transparent 58%),
    rgba(255, 255, 255, 0.075);
  transform: translateY(-2px);
}

.story-generating {
  display: inline-flex;
  gap: 0.7rem;
  align-items: center;
  justify-content: center;
  margin-top: 2rem;
  color: var(--gold);
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.generating-orbit {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid rgba(217, 230, 252, 0.24);
  border-radius: 50%;
  animation: generatingSpin 1.6s linear infinite;
}

.generating-orbit::before {
  position: absolute;
  inset: 0.55rem;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, #fff4c7, #9c6fff 48%, #101633 76%);
  box-shadow: 0 0 22px rgba(156, 111, 255, 0.5);
  content: '';
}

.generating-orbit i {
  position: absolute;
  top: -0.16rem;
  left: 50%;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: #fff4c7;
  box-shadow: 0 0 12px #fff4c7;
  transform: translateX(-50%);
}

.generating-dots {
  display: inline-block;
  width: 1.6rem;
  overflow: hidden;
  animation: generatingDots 1.2s steps(4, end) infinite;
}

.generation-card h2 {
  max-width: 18ch;
  margin-inline: auto;
  font-size: clamp(2rem, 4.5vw, 4rem);
  line-height: 1.02;
}

.progress-track {
  height: 0.45rem;
  margin-bottom: 1.4rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--violet));
  transition: width 0.24s ease;
}

.question-number {
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.big-input,
input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  outline: 0;
  background: rgba(4, 7, 18, 0.58);
  color: var(--text);
  transition: border-color 0.18s ease, background 0.18s ease;
}

input,
textarea,
select {
  padding: 0.86rem 0.95rem;
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

.big-input {
  min-height: 13rem;
  margin-top: 1rem;
  padding: 1.1rem;
  font-size: 1.1rem;
  line-height: 1.7;
}

input:focus,
textarea:focus,
select:focus,
.big-input:focus {
  border-color: rgba(244, 199, 107, 0.72);
  background: rgba(8, 12, 28, 0.88);
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.timeline-editor {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.timeline-draft-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 1.1fr);
  gap: 1.25rem;
  align-items: end;
  margin: 1.25rem 0 0.8rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(217, 230, 252, 0.14);
  border-radius: 18px;
  background: rgba(217, 230, 252, 0.035);
}

.timeline-draft-intro h3,
.timeline-draft-intro p {
  margin: 0;
}

.timeline-draft-intro > p {
  color: var(--muted);
  line-height: 1.65;
}

.event-type-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.2rem;
  align-items: center;
  margin-bottom: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(217, 230, 252, 0.12);
  border-radius: 16px;
  background: rgba(1, 4, 15, 0.54);
  color: var(--muted);
  font-size: 0.84rem;
}

.event-type-legend > span {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
}

.event-type-legend p {
  flex: 1 1 100%;
  margin: 0;
  color: var(--dim);
  line-height: 1.55;
}

.event-type-swatch {
  width: 1.15rem;
  height: 1.15rem;
  border: 1px solid rgba(217, 230, 252, 0.26);
  border-radius: 5px;
  background: rgba(217, 230, 252, 0.05);
}

.event-type-swatch.major {
  border-color: rgba(244, 199, 107, 0.7);
  background: rgba(244, 199, 107, 0.1);
}

.event-remove-button {
  min-width: 2.5rem;
  min-height: 2.5rem;
  border-color: rgba(255, 126, 142, 0.22);
  color: #ffb0bb;
  font-size: 1.2rem;
}

.timeline-draft-preview {
  margin-top: 1rem;
  padding: 1rem 1.1rem 1.25rem;
  border: 1px solid rgba(137, 156, 190, 0.22);
  border-radius: 18px;
  background: rgba(2, 7, 22, 0.72);
}

.timeline-draft-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}

.timeline-draft-heading h3,
.timeline-draft-heading p {
  margin: 0;
}

.timeline-draft-heading > span {
  max-width: 330px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: right;
}

.timeline-draft-scroll {
  overflow-x: auto;
  padding: 1.15rem 0 0.4rem;
}

.timeline-draft-rail {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--draft-event-count), minmax(150px, 1fr));
  gap: 1rem;
  min-width: max(100%, calc(var(--draft-event-count) * 165px));
  padding-top: 1.15rem;
}

.timeline-draft-rail::before {
  position: absolute;
  top: 0.33rem;
  right: 0.75rem;
  left: 0.75rem;
  height: 1px;
  background: #d9e6fc;
  box-shadow: 0 0 10px rgba(217, 230, 252, 0.22);
  content: '';
}

.timeline-draft-node {
  position: relative;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid rgba(217, 230, 252, 0.12);
  border-radius: 14px;
  background: rgba(217, 230, 252, 0.035);
}

.timeline-draft-node::before {
  position: absolute;
  top: -1.19rem;
  left: 50%;
  width: 0.55rem;
  height: 0.55rem;
  border: 1px solid #d9e6fc;
  border-radius: 50%;
  background: #01040f;
  content: '';
  transform: translateX(-50%);
}

.timeline-draft-node.selected {
  border-color: rgba(244, 199, 107, 0.42);
}

.timeline-draft-node.selected::before {
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: 0 0 13px rgba(244, 199, 107, 0.48);
}

.timeline-draft-node span,
.timeline-draft-node strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-draft-node span {
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.timeline-draft-node strong {
  margin-top: 0.35rem;
  color: #d9e6fc;
}

.timeline-draft-empty {
  margin: 1rem 0 0;
  color: var(--muted);
}

.branch-selector {
  display: grid;
  gap: 0.55rem;
  margin: 1.25rem 0 0;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid rgba(244, 199, 107, 0.28);
  border-radius: 18px;
  background: rgba(244, 199, 107, 0.055);
}

.timeline-source-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.75fr);
  gap: 1rem 1.5rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(217, 230, 252, 0.15);
  border-radius: 18px;
  background: rgba(217, 230, 252, 0.04);
}

.timeline-source-picker .eyebrow,
.timeline-source-picker p {
  margin-bottom: 0;
}

.timeline-source-picker p,
.timeline-draft-intro p {
  overflow-wrap: anywhere;
}

.timeline-source-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
}

.timeline-source-controls select {
  min-width: 0;
}

.branch-selector legend {
  padding: 0 0.35rem;
  color: var(--gold);
  font-weight: 800;
}

.branch-selector-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.timeline-node.branch-point-node {
  border-color: rgba(244, 199, 107, 0.62);
  background:
    radial-gradient(circle at 50% 0, rgba(244, 199, 107, 0.16), transparent 8rem),
    rgba(244, 199, 107, 0.07);
  box-shadow: 0 0 32px rgba(244, 199, 107, 0.12);
}

.branch-point-label {
  display: inline-flex;
  margin-left: 0.35rem;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timeline-note {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.event-row {
  display: grid;
  grid-template-columns: 0.6fr 1fr 1.6fr auto;
  gap: 0.55rem;
  align-items: start;
  padding: 0.8rem;
  border: 1px solid rgba(217, 230, 252, 0.12);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(217, 230, 252, 0.07), rgba(244, 199, 107, 0.035));
}

.event-row.major-event-row {
  border-color: rgba(244, 199, 107, 0.28);
  background: linear-gradient(135deg, rgba(244, 199, 107, 0.1), rgba(217, 230, 252, 0.05));
}

.event-row .date-input {
  border-color: rgba(255, 126, 142, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 126, 142, 0.12);
}

.event-row .title-input {
  font-size: 1.08rem;
  font-weight: 800;
}

.branch-preview {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
  opacity: var(--branch-strength, 0.35);
  transition: opacity 0.2s ease;
}

.branch-preview:hover {
  opacity: min(1, calc(var(--branch-strength, 0.35) + 0.12));
}

.alternate-rail::before {
  background: rgba(121, 139, 171, calc(var(--branch-strength, 0.35) * 0.9));
}

.event-symbol {
  display: inline-grid;
  width: 1rem;
  height: 1rem;
  margin-right: 0.45rem;
  place-items: center;
  border-radius: 999px;
  color: #d9e6fc;
  font-size: 0.8rem;
  line-height: 1;
}

.event-symbol.hollow {
  border: 1px solid #d9e6fc;
}

.event-symbol.filled {
  border: 1px solid #d9e6fc;
  background: #d9e6fc;
  color: #01040f;
}

.compact-actions {
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.split-timeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.timeline-rail {
  position: relative;
  display: flex;
  gap: clamp(1rem, 2vw, 1.6rem);
  min-height: 245px;
  width: max-content;
  min-width: 100%;
  padding: 4.7rem 1rem 2.4rem;
}

.timeline-rail-scroll {
  overflow-x: auto;
  scrollbar-color: rgba(217, 230, 252, 0.34) transparent;
}

.timeline-rail::before {
  position: absolute;
  top: 4rem;
  right: 1rem;
  left: 1rem;
  height: 1px;
  background:
    linear-gradient(90deg, #d9e6fc 0 calc(100% - 2.2rem), transparent calc(100% - 2.2rem)),
    repeating-linear-gradient(90deg, rgba(217, 230, 252, 0.78) 0 12px, transparent 12px 24px);
  content: '';
}

.timeline-node {
  position: relative;
  flex: 0 0 clamp(178px, 43%, 220px);
  padding: 1rem;
  border: 1px solid rgba(217, 230, 252, 0.14);
  border-radius: 18px;
  background: rgba(217, 230, 252, 0.045);
  color: #d9e6fc;
}

.timeline-node::before {
  position: absolute;
  top: -1.08rem;
  left: 50%;
  width: 0.72rem;
  height: 0.72rem;
  border: 2px solid #d9e6fc;
  border-radius: 999px;
  background: #01040f;
  box-shadow: 0 0 18px rgba(217, 230, 252, 0.54);
  content: '';
  transform: translateX(-50%);
}

.timeline-node.major-node::before {
  background: #d9e6fc;
}

.timeline-node:nth-child(odd) {
  transform: translateY(0.75rem);
}

.timeline-node:nth-child(even) {
  transform: translateY(4rem);
}

.timeline-node:nth-child(odd)::after,
.timeline-node:nth-child(even)::after {
  position: absolute;
  left: 50%;
  width: 1px;
  background: rgba(217, 230, 252, 0.58);
  content: '';
  transform: translateX(-50%);
}

.timeline-node:nth-child(odd)::after {
  top: 100%;
  height: 3.8rem;
}

.timeline-node:nth-child(even)::after {
  bottom: 100%;
  height: 3.5rem;
}

.story-result-hero {
  display: grid;
  gap: 1.25rem;
}

.story-result-frames {
  display: grid;
  grid-template-columns: minmax(190px, 0.85fr) minmax(180px, 0.72fr) minmax(320px, 1.43fr);
  gap: 1rem;
}

.story-result-frame {
  position: relative;
  min-height: 230px;
  padding: 1.35rem;
  overflow: hidden;
  border: 1px solid rgba(217, 230, 252, 0.16);
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 10%, rgba(244, 199, 107, 0.1), transparent 11rem),
    rgba(2, 7, 22, 0.76);
}

.story-result-frame-number {
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  color: rgba(217, 230, 252, 0.28);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.story-result-title-frame,
.story-result-branch-frame {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.story-result-title-frame .eyebrow {
  margin-bottom: 0.75rem;
}

.story-result-title-frame h2 {
  margin: 0;
  font-size: clamp(2.25rem, 4.8vw, 4.2rem);
  line-height: 0.94;
}

.story-result-title-frame > p:last-child,
.story-result-branch-frame > p:last-child {
  margin: 0.85rem 0 0;
  color: var(--muted);
}

.story-result-branch-frame {
  border-color: rgba(244, 199, 107, 0.32);
}

.story-result-branch-label {
  margin: 0;
  color: var(--gold);
  font-family: 'IM Fell Double Pica SC', Georgia, serif;
  font-size: clamp(1.45rem, 3vw, 2.4rem);
  letter-spacing: 0.08em;
  line-height: 1.08;
}

.story-result-quote-frame {
  display: grid;
  align-items: center;
}

.story-result-quote-frame blockquote {
  margin: 0;
  padding: 0.4rem 0 0.4rem 1.15rem;
  border-left: 1px solid rgba(244, 199, 107, 0.5);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.08rem, 1.8vw, 1.32rem);
  font-style: italic;
  line-height: 1.55;
}

.story-result-quote-frame blockquote p {
  margin: 0;
}

.story-result-quote-frame cite {
  display: block;
  margin-top: 0.9rem;
  color: var(--gold);
  font-size: 0.83rem;
  line-height: 1.45;
}

.timeline-date {
  border-color: rgba(217, 230, 252, 0.34);
  color: #d9e6fc;
}

.timeline-rail-card {
  overflow: hidden;
}

.timeline-rail-card:not(.timeline-expanded) .timeline-rail {
  max-height: 290px;
  overflow: hidden;
}

.timeline-rail-card:not(.timeline-expanded) .timeline-rail-scroll {
  max-height: 290px;
  overflow: hidden;
}

.timeline-rail-card:not(.timeline-expanded) .timeline-node:nth-child(n + 3) {
  display: none;
}

.timeline-expanded .timeline-rail {
  min-width: 100%;
}

.branch-map {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  gap: clamp(2rem, 6vw, 7rem);
  align-items: center;
  min-height: 310px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 46%, rgba(244, 199, 107, 0.16), transparent 11rem),
    linear-gradient(135deg, rgba(18, 22, 42, 0.9), rgba(7, 10, 24, 0.82));
}

.branch-map::before,
.branch-map::after {
  position: absolute;
  left: 45%;
  width: min(38vw, 470px);
  height: 1px;
  background: linear-gradient(90deg, rgba(244, 199, 107, 0.95), rgba(167, 139, 250, 0.15));
  content: '';
  transform-origin: left center;
}

.branch-map::before {
  top: 51%;
  transform: rotate(-16deg);
}

.branch-map::after {
  top: 54%;
  transform: rotate(16deg);
}

.branch-origin {
  position: relative;
  z-index: 2;
  width: min(420px, 100%);
  padding: 1.1rem;
  border: 1px solid rgba(244, 199, 107, 0.22);
  border-radius: 22px;
  background: rgba(6, 8, 20, 0.78);
  box-shadow: 0 0 44px rgba(244, 199, 107, 0.12);
}

.branch-origin p {
  max-width: 38ch;
}

.branch-year {
  margin-left: 0.35rem;
}

.branch-path {
  position: absolute;
  right: clamp(1rem, 4vw, 3.5rem);
  z-index: 2;
  padding: 0.78rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-weight: 800;
}

.branch-path-current {
  top: 23%;
}

.branch-path-alternate {
  bottom: 21%;
}

.story-body {
  color: var(--text);
  white-space: pre-wrap;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  line-height: 1.62;
}

.starfield-wrap {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 32px;
  background: #01020a;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.72), var(--shadow);
  isolation: isolate;
}

.starfield-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 80%, rgba(59, 130, 246, 0.12), transparent 28rem),
    radial-gradient(circle at 24% 20%, rgba(167, 139, 250, 0.16), transparent 20rem),
    #01020a;
  transform: scale(var(--starfield-zoom, 1));
  transform-origin: center;
  transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.star-layer {
  position: absolute;
  inset: 0;
}

.starfield-panels {
  position: absolute;
  inset: 4rem 1rem 1rem;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-content: start;
  gap: 0.8rem;
  pointer-events: none;
}

.star-control-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.7rem;
  margin-top: 1.25rem;
}

.star-toggle {
  min-width: 9rem;
}

.star-count-card {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 3;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(217, 230, 252, 0.15);
  border-radius: 999px;
  background: rgba(5, 7, 16, 0.62);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.star-zoom-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 5;
  display: grid;
  grid-template-columns: 2.35rem minmax(3.5rem, auto) 2.35rem;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(217, 230, 252, 0.18);
  border-radius: 999px;
  background: rgba(5, 7, 16, 0.72);
  backdrop-filter: blur(12px);
}

.star-zoom-controls button {
  min-height: 2.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
}

.star-zoom-controls button:hover,
.star-zoom-controls button:focus-visible {
  background: rgba(244, 199, 107, 0.12);
  color: var(--gold);
}

.star-zoom-controls output {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
}

.galaxy-cloud {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  filter: blur(1px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.cloud-a {
  --cloud-rotation: -18deg;
  inset: 14% 44% 45% 12%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(244, 199, 107, 0.22), rgba(124, 58, 237, 0.18) 38%, transparent 70%);
  transform: rotate(-18deg) scale(0.88);
}

.cloud-b {
  --cloud-rotation: 22deg;
  inset: 36% 10% 18% 48%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(217, 230, 252, 0.2), rgba(59, 130, 246, 0.18) 34%, transparent 72%);
  transform: rotate(22deg) scale(0.88);
}

.galaxy-density .galaxy-cloud {
  opacity: 1;
  transform: rotate(var(--cloud-rotation, -18deg)) scale(1);
}

.starfield-scene::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: '';
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.2px),
    radial-gradient(circle, rgba(255, 255, 255, 0.35) 0 1px, transparent 1px);
  background-size:
    92px 92px,
    160px 160px;
  opacity: 0.28;
}

.star {
  position: absolute;
  z-index: 1;
  width: max(32px, calc(var(--size) * 1px));
  height: max(32px, calc(var(--size) * 1px));
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  transform: translate(-50%, -50%);
  animation: pulse 5.6s ease-in-out infinite alternate;
  isolation: isolate;
}

.star::before,
.star::after {
  position: absolute;
  top: 50%;
  left: 50%;
  pointer-events: none;
  content: '';
  transform: translate(-50%, -50%);
}

.star::before {
  z-index: 2;
  width: calc(var(--size) * 1px);
  height: calc(var(--size) * 1px);
  border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, #ffffff 0 18%, #fffbe8 26%, var(--star-color, #d9e6fc) 58%, transparent 76%);
  box-shadow:
    0 0 calc(var(--size) * 1.15px) rgba(255, 255, 255, 0.92),
    0 0 calc(var(--size) * 2.6px) var(--star-glow, #d9e6fc),
    0 0 calc(var(--size) * 4.8px) color-mix(in srgb, var(--star-glow, #d9e6fc), transparent 52%);
}

.star::after {
  z-index: 1;
  width: calc(var(--size) * 7px);
  height: calc(var(--size) * 7px);
  border-radius: 50%;
  background: radial-gradient(circle,
    color-mix(in srgb, var(--star-glow, #d9e6fc), white 24%) 0,
    color-mix(in srgb, var(--star-glow, #d9e6fc), transparent 55%) 12%,
    color-mix(in srgb, var(--star-glow, #d9e6fc), transparent 78%) 34%,
    transparent 70%);
  opacity: 0.62;
  filter: blur(0.7px);
}

.star.private-star::before {
  outline: 1px dashed rgba(217, 230, 252, 0.34);
  outline-offset: 4px;
}

.star.highlight {
  z-index: 5;
  animation: pulse 0.42s ease-in-out infinite alternate;
}

.star.highlight::after {
  opacity: 1;
  filter: blur(1px) brightness(1.28);
}

.star.burst {
  animation: burst 0.78s ease forwards;
}

@keyframes pulse {
  from {
    opacity: 0.74;
    transform: translate(-50%, -50%) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
  }
}

@keyframes burst {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(var(--burst-scale, 26));
    filter: blur(2px);
  }
}

.star-panel {
  position: relative;
  z-index: 4;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  background: rgba(5, 7, 16, 0.78);
  backdrop-filter: blur(16px);
  pointer-events: auto;
}

.star-panel-add {
  grid-column: 1;
}

.star-panel:nth-child(3) {
  grid-column: 1;
}

.star-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.star-panel-heading h3 {
  margin: 0;
}

.star-panel-body,
.regret-index-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.star-panel-body .regret-form {
  padding-top: 1rem;
}

.starfield-panels > .regret-index-panel {
  position: relative;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  width: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 20px;
  background: rgba(5, 7, 16, 0.62);
  backdrop-filter: blur(14px);
  overflow: hidden;
  pointer-events: auto;
}

.starfield-panels > .star-panel-add {
  grid-column: 1 / -1;
}

.starfield-panels .hidden {
  display: none;
}

.regret-form,
.forum-form,
.forum-answer-form {
  display: grid;
  gap: 0.8rem;
}

.range-label {
  gap: 0.6rem;
}

.spectrum-note {
  margin: -0.25rem 0 0;
  color: var(--dim);
  font-size: 0.82rem;
}

.privacy-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.privacy-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.52rem 0.76rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
}

.regret-management {
  display: grid;
  gap: 0.55rem;
  padding-top: 0;
}

.regret-index-panel {
  position: relative;
  z-index: 4;
}

.regret-index-list {
  display: grid;
  gap: 0.45rem;
}

.regret-index-row {
  display: grid;
  grid-template-columns: minmax(4.4rem, auto) 1fr auto;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  padding: 0.5rem 0.58rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  text-align: left;
}

.regret-index-row:hover,
.regret-index-row:focus-visible {
  border-color: rgba(244, 199, 107, 0.42);
  background: rgba(244, 199, 107, 0.08);
}

.regret-index-row strong {
  color: var(--text);
}

.regret-index-row em {
  color: var(--dim);
  font-style: normal;
  font-size: 0.78rem;
}

.owned-row {
  grid-template-columns: 1fr auto auto;
}

.owned-row > button:first-child {
  display: grid;
  gap: 0.15rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.forum-panel {
  display: grid;
  gap: 1rem;
}

.forum-thread-list,
.forum-answers {
  display: grid;
  gap: 0.75rem;
}

.forum-thread {
  display: grid;
  gap: 0.85rem;
}

.story-list,
.history-list {
  display: grid;
  gap: 0.9rem;
}

.story-card,
.history-card {
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.055);
}

.grid.two.dashboard-primary-grid {
  grid-template-columns: minmax(280px, 0.76fr) minmax(420px, 1.24fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: start;
}

.dashboard-stories-panel,
.dashboard-timeline-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.dashboard-stories-panel > h3,
.dashboard-timeline-panel > h3 {
  margin-bottom: 0.25rem;
}

.saved-story-card {
  display: grid;
  gap: 0.95rem;
  padding: 1.25rem;
}

.saved-story-card > h3,
.saved-story-card > p,
.saved-story-card > details,
.saved-story-card > .compact-actions {
  margin: 0;
}

.saved-story-card > h3 {
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.18;
}

.saved-story-card > p {
  color: var(--muted);
  line-height: 1.6;
}

.story-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.15rem;
}

.saved-story-card > details {
  padding-top: 0.8rem;
  border-top: 1px solid rgba(217, 230, 252, 0.1);
}

.saved-story-card > details > summary {
  color: var(--gold);
  font-weight: 800;
  cursor: pointer;
}

.saved-story-card > details .story-body {
  margin-top: 1rem;
  font-size: 1.2rem;
}

.dashboard-timeline-directory,
.timeline-directory-groups,
.timeline-directory-events {
  display: grid;
  gap: 0.8rem;
}

.timeline-directory-search {
  margin-top: 0.8rem;
}

.timeline-directory-group {
  overflow: hidden;
  border: 1px solid rgba(217, 230, 252, 0.15);
  border-radius: 18px;
  background: rgba(4, 8, 23, 0.72);
}

.timeline-directory-group > summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  color: var(--text);
  cursor: pointer;
  list-style-position: inside;
}

.timeline-directory-summary-copy {
  display: grid;
  gap: 0.22rem;
  min-width: 0;
}

.timeline-directory-summary-copy strong {
  overflow-wrap: anywhere;
}

.timeline-directory-summary-copy small {
  color: var(--dim);
}

.alternate-directory-group {
  border-color: rgba(167, 139, 250, 0.22);
  background: linear-gradient(135deg, rgba(85, 68, 143, 0.09), rgba(4, 8, 23, 0.78));
}

.alternate-directory-group[open] {
  border-color: rgba(244, 199, 107, 0.34);
}

.timeline-directory-group > summary small {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.timeline-directory-events {
  padding: 0 1rem 1rem;
}

.timeline-directory-event {
  display: grid;
  grid-template-columns: minmax(7rem, 0.34fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
  padding: 0.8rem 0;
  border-top: 1px solid rgba(217, 230, 252, 0.1);
}

.timeline-directory-group[hidden],
.timeline-directory-event[hidden] {
  display: none;
}

.timeline-directory-event time {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.timeline-directory-event strong {
  color: var(--text);
}

.timeline-directory-empty-branch {
  margin: 0;
  padding: 0.8rem;
  border-top: 1px solid rgba(217, 230, 252, 0.1);
  color: var(--dim);
  font-size: 0.86rem;
}

.badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.58rem;
  border: 1px solid rgba(244, 199, 107, 0.24);
  border-radius: 999px;
  background: rgba(244, 199, 107, 0.09);
  color: #ffe4a5;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: clamp(1.5rem, 4vw, 3rem);
}

.empty-state {
  padding: 1.25rem;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(10, 13, 29, 0.92);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.5rem);
  transition: 0.2s ease;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.64);
  backdrop-filter: blur(10px);
  overscroll-behavior: contain;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(88vh, 900px);
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-backdrop.is-story-modal .modal {
  width: min(980px, 100%);
  max-height: calc(100dvh - 2rem);
  min-height: min(76dvh, 860px);
}

.modal-backdrop.is-story-modal .modal-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.modal-header,
.modal-footer {
  flex: 0 0 auto;
  padding: 1rem 1.25rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
  margin: 0;
}

.modal-content {
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem;
  overscroll-behavior: contain;
  scrollbar-color: rgba(217, 230, 252, 0.42) transparent;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-content .story-body {
  padding-bottom: 0.5rem;
}

.modal-content .modal-bottom-actions {
  margin-top: 1rem;
}

.story-editor-form {
  display: grid;
  gap: 1rem;
}

.story-editor-form textarea {
  min-height: 22rem;
  resize: vertical;
}

.story-reader-modal .modal-content {
  min-height: 0;
}

.story-reader-modal .story-body {
  max-width: 76ch;
  margin: 0 auto;
}

.decision-change-note {
  margin: -0.25rem 0;
  color: var(--gold);
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
}

.story-result-actions {
  justify-content: center;
  margin-top: 1.25rem;
}

.hidden {
  display: none !important;
}

@keyframes caret {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

@keyframes revealText {
  to { clip-path: inset(0 0 0 0); }
}

@keyframes fadeInUniverse {
  from { opacity: 0; transform: translateY(0.35rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes generatingSpin {
  to { transform: rotate(360deg); }
}

@keyframes generatingDots {
  from { width: 0; }
  to { width: 1.6rem; }
}

@media (max-width: 1180px) and (min-width: 921px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.45rem;
  }

  .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 1500px) {
  .timeline-source-picker,
  .timeline-draft-intro {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

@media (max-width: 920px) {
  .topbar {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .hero,
  .grid.two,
  .grid.three,
  .split-timeline,
  .auth-layout,
  .timeline-page-header {
    grid-template-columns: 1fr;
  }

  .grid.two.dashboard-primary-grid {
    grid-template-columns: 1fr;
  }

  .timeline-create-toggle {
    justify-self: start;
  }

  .timeline-workspace-header {
    align-items: start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .timeline-workspace-header > p {
    text-align: left;
  }

  .event-row {
    grid-template-columns: 1fr;
  }

  .timeline-source-picker,
  .timeline-source-controls {
    grid-template-columns: 1fr;
  }

  .timeline-draft-intro {
    grid-template-columns: 1fr;
  }

  .timeline-draft-heading {
    display: grid;
  }

  .timeline-draft-heading > span {
    text-align: left;
  }

  .personal-main-track {
    grid-template-columns: repeat(var(--event-count), 215px);
    gap: 0.8rem;
    padding-inline: 1rem;
  }

  .personal-node-drawer {
    width: min(580px, calc(100vw - 3rem));
  }

  .branch-map {
    grid-template-columns: 1fr;
    min-height: 430px;
    align-items: start;
  }

  .story-result-frames {
    grid-template-columns: 1fr;
  }

  .story-result-frame {
    min-height: 190px;
  }

  .branch-map::before,
  .branch-map::after {
    top: 56%;
    left: 28%;
    width: min(56vw, 360px);
  }

  .branch-path-current {
    top: 52%;
  }

  .branch-path-alternate {
    bottom: 8%;
  }

  .starfield-wrap {
    min-height: 820px;
  }

  .starfield-panels {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-columns: 1fr;
    padding-top: 4.5rem;
  }

  .star-panel-add,
  .starfield-panels > .regret-index-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .starfield-panels > .star-panel-add {
    grid-column: 1;
  }

  .starfield-panels > .regret-index-panel {
    max-height: none;
    margin: 0;
  }

  .regret-index-row {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .intro-copy.intro-final {
    transform: translateY(-8vh);
  }

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

  .quiz-event-option {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .quiz-event-date {
    grid-column: 2;
  }

  .quiz-event-copy {
    grid-column: 2;
  }

  .app-shell {
    width: min(100vw - 1rem, 1180px);
  }

  .timeline-page {
    width: calc(100vw - 0.5rem);
  }

  .timeline-workspace {
    padding-inline: 0.75rem;
  }

  .personal-main-track {
    grid-template-columns: repeat(var(--event-count), 190px);
    padding-inline: 0.5rem;
  }

  .personal-event-card {
    width: 180px;
  }

  .personal-node-drawer {
    width: min(340px, calc(100vw - 1.5rem));
  }

  .timeline-event-kind-picker,
  .node-choice-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-links a {
    padding: 0.45rem 0.55rem;
    font-size: 0.8rem;
  }

  .cosmos-card {
    min-height: 420px;
  }
}
