:root {
  --bg: #0b1020;
  --panel: rgba(17, 24, 39, 0.78);
  --panel-strong: rgba(15, 23, 42, 0.95);
  --text: #e5edf7;
  --muted: #a9b8cc;
  --line: rgba(148, 163, 184, 0.2);
  --accent: #7dd3fc;
  --accent-strong: #38bdf8;
  --accent-soft: rgba(125, 211, 252, 0.14);
  --gold: #facc15;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --radius: 22px;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.12), transparent 30%),
    linear-gradient(180deg, #020617 0%, #0b1020 45%, #111827 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at center, black, transparent 85%);
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.topbar a {
  color: var(--muted);
  text-decoration: none;
}

.topbar a:hover,
.topbar a[aria-current="page"] {
  color: var(--text);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text) !important;
}

main {
  display: grid;
  gap: 22px;
}

.card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(15, 23, 42, 0.72));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero {
  padding: 48px 32px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.3rem, 5vw, 4.4rem);
  line-height: 1.05;
  margin-bottom: 16px;
  max-width: 11ch;
}

h2 {
  font-size: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: 12px;
}

p, li {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.lede {
  font-size: 1.15rem;
  max-width: 64ch;
}

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

.hero-actions,
.entry-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.button,
.entry-card,
.mode-tab {
  appearance: none;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
}

.button.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #03111d;
  border-color: transparent;
}

.button.secondary {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}

.button:hover,
.entry-card:hover,
.mode-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 211, 252, 0.45);
}

.entry-selector {
  display: grid;
  gap: 20px;
}

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

.entry-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  border-radius: 18px;
  padding: 18px;
  background: rgba(125, 211, 252, 0.05);
}

.entry-title {
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
}

.entry-copy {
  color: var(--muted);
  line-height: 1.5;
}

.text-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.page-intro {
  padding-top: 34px;
  padding-bottom: 34px;
}

.dialogue {
  display: grid;
  gap: 16px;
}

.turn {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.turn h2 {
  font-size: 0.92rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.turn.seeker {
  background: rgba(255,255,255,0.02);
}

.turn.cartographer {
  background: rgba(125, 211, 252, 0.06);
}

.closing-question {
  color: var(--text);
  font-weight: 700;
}

.chooser {
  display: grid;
  gap: 16px;
}

.state-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.state-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.state-filter-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}

.state-filter-btn:hover {
  border-color: rgba(125, 211, 252, 0.45);
  color: var(--text);
}

.state-filter-btn.active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: rgba(125, 211, 252, 0.4);
}

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.mode-tab {
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
}

.mode-tab.active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: rgba(125, 211, 252, 0.4);
}

.mode-panels {
  display: grid;
  gap: 16px;
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

.map-stack {
  display: grid;
  gap: 14px;
}

.territory {
  position: relative;
  overflow: hidden;
}

.territory::after {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -12px;
  width: 2px;
  height: 22px;
  background: rgba(125, 211, 252, 0.35);
}

.territory:last-child::after {
  display: none;
}

.territory.real {
  border-color: rgba(250, 204, 21, 0.28);
}

.territory.emphasis {
  border-color: rgba(125, 211, 252, 0.4);
}

.territory.warning {
  border-color: rgba(251, 146, 60, 0.35);
}

.territory.becoming {
  border-color: rgba(74, 222, 128, 0.35);
}

.territory.conduct {
  border-color: rgba(244, 114, 182, 0.3);
}

.crosscurrents ul,
ul {
  padding-left: 20px;
}

.origin-note {
  margin-top: 6px;
  text-align: center;
}

.origin-note .lineage {
  margin: 0;
  color: var(--text);
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}

@media (max-width: 820px) {
  .topbar,
  .grid.two,
  .entry-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    border-radius: 24px;
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    padding: 32px 22px;
  }

  .card {
    padding: 22px;
  }
}
.next-link {
  margin-top: 14px;
  color: var(--muted);
}

.next-link a,
.mode-pathway a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.next-link a:hover,
.mode-pathway a:hover {
  text-decoration: underline;
}

.next-step,
.mode-pathway {
  margin-top: 18px;
}

.pathway-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
}

.template-jump-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.template-jump-grid a {
  text-decoration: none;
  color: var(--text);
  background: rgba(125, 211, 252, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.4;
  transition: transform 150ms ease, opacity 180ms ease, border-color 150ms ease;
}

.template-jump-grid a:hover {
  border-color: rgba(125, 211, 252, 0.45);
  transform: translateY(-1px);
}

.template-jump-grid a.is-dimmed {
  opacity: 0.38;
}

.template-jump-grid a.is-hidden {
  display: none;
}

.template-stack {
  display: grid;
  gap: 16px;
}

.template-card h2 {
  margin-bottom: 8px;
}

.template-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: fit-content;
}

.template-badge.acute {
  background: rgba(248, 113, 113, 0.13);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.template-badge.processing {
  background: rgba(250, 204, 21, 0.12);
  border-color: rgba(250, 204, 21, 0.35);
  color: #fde68a;
}

.template-badge.recovery {
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.35);
  color: #bbf7d0;
}

.template-toggle {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  padding: 8px 14px;
  font-weight: 600;
  margin-bottom: 12px;
  cursor: pointer;
}

.template-toggle:hover {
  border-color: rgba(125, 211, 252, 0.45);
}

.template-card ul {
  margin-top: 6px;
  margin-bottom: 12px;
}

.template-card {
  transition: opacity 180ms ease, transform 200ms ease;
}

.template-card.is-collapsed > *:not(.eyebrow):not(h2):not(.template-toggle) {
  display: none;
}

.template-card.is-hidden {
  display: none;
}

.panic-banner {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  border-color: rgba(250, 204, 21, 0.38);
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.11), rgba(15, 23, 42, 0.85));
}

.panic-banner strong {
  color: #fef3c7;
}

.template-card.is-collapsed .template-toggle {
  margin-bottom: 0;
}

#feedback-form {
  display: grid;
  gap: 14px;
}

#feedback-form label,
#feedback-form fieldset {
  display: grid;
  gap: 8px;
  color: var(--text);
}

#feedback-form input,
#feedback-form select,
#feedback-form textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

#feedback-form textarea {
  resize: vertical;
  min-height: 110px;
}

#feedback-form fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

#feedback-form legend {
  color: var(--accent);
  padding: 0 6px;
}

#feedback-form fieldset label {
  grid-auto-flow: column;
  justify-content: start;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

@media (max-width: 820px) {
  .template-jump-grid {
    grid-template-columns: 1fr;
  }

  #feedback-form fieldset label {
    grid-auto-flow: row;
    justify-content: stretch;
    gap: 4px;
  }
}