:root {
  --bg: #07080c;
  --bg-elev: #10131a;
  --bg-card: #151922;
  --ink: #e8e6e1;
  --muted: #8b909c;
  --line: rgba(232, 230, 225, 0.08);
  --accent: #c9a66b;
  --calm: #5b8a7a;
  --amber: #d4a017;
  --doom: #c23b2e;
  --doom-glow: rgba(194, 59, 46, 0.45);
  --radius: 14px;
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  position: relative;
}

#mood-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.6s var(--ease);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 2;
}

.site-header {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.75rem 1.25rem 1.5rem;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.brand-mark {
  font-family: var(--font);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #f2ebe0, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.lede {
  font-family: var(--font);
  font-size: clamp(1.15rem, 2.8vw, 1.45rem);
  line-height: 1.45;
  color: #d5d1c8;
  max-width: 38rem;
  margin: 0;
}

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.panel {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.35rem 1.25rem 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

.panel-head h2 {
  font-family: var(--font);
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.hint {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Dial */
.dial-wrap {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

.dial-readout {
  font-family: var(--font);
  font-size: clamp(3rem, 12vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(201, 166, 107, 0.25);
  transition: color 0.35s var(--ease), text-shadow 0.35s var(--ease);
}

.dial-readout .unit {
  font-size: 0.45em;
  margin-left: 0.1em;
  opacity: 0.8;
}

.dial-readout[data-tier="low"] {
  color: var(--calm);
  text-shadow: 0 0 40px rgba(91, 138, 122, 0.3);
}

.dial-readout[data-tier="mid"] {
  color: var(--amber);
  text-shadow: 0 0 40px rgba(212, 160, 23, 0.35);
}

.dial-readout[data-tier="high"] {
  color: var(--doom);
  text-shadow: 0 0 48px var(--doom-glow);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 420px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--calm), var(--amber), var(--doom));
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f5f0e6;
  border: 2px solid #1a1c22;
  box-shadow: 0 0 0 4px rgba(201, 166, 107, 0.35);
  transition: transform 0.15s var(--ease);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f5f0e6;
  border: 2px solid #1a1c22;
  box-shadow: 0 0 0 4px rgba(201, 166, 107, 0.35);
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.12);
}

.dial-scale {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 420px;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.dial-near {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: #c4bfb4;
  text-align: center;
  min-height: 1.4em;
}

/* Scrubber */
.scrubber-row {
  margin-bottom: 1rem;
}

#scenario-scrubber {
  max-width: none;
  margin-bottom: 0.45rem;
}

.scrubber-labels {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.scrubber-labels span {
  flex: 1;
  text-align: center;
  opacity: 0.55;
  transition: opacity 0.25s, color 0.25s;
}

.scrubber-labels span.active {
  opacity: 1;
  color: var(--accent);
}

/* Scenario list */
.scenario-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .scenario-list {
    grid-template-columns: repeat(5, 1fr);
  }
}

.scenario-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.75rem;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s,
    background 0.2s;
}

.scenario-card:hover {
  transform: translateY(-2px);
  border-color: rgba(201, 166, 107, 0.35);
}

.scenario-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.scenario-card[aria-selected="true"] {
  border-color: rgba(201, 166, 107, 0.65);
  box-shadow: 0 0 0 1px rgba(201, 166, 107, 0.25), 0 12px 28px rgba(0, 0, 0, 0.35);
  background: linear-gradient(160deg, rgba(201, 166, 107, 0.12), var(--bg-card));
}

.scenario-card.near-dial {
  box-shadow: inset 0 0 0 1px rgba(91, 138, 122, 0.55);
}

.scenario-card.near-dial[aria-selected="true"] {
  box-shadow: 0 0 0 1px rgba(201, 166, 107, 0.25), inset 0 0 0 1px rgba(91, 138, 122, 0.4),
    0 12px 28px rgba(0, 0, 0, 0.35);
}

.scenario-card .idx {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.scenario-card .name {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.35rem;
}

.scenario-card .band-chip {
  font-size: 0.72rem;
  color: var(--accent);
}

/* Detail */
.scenario-detail {
  display: grid;
  gap: 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0c0e14;
}

@media (min-width: 700px) {
  .scenario-detail {
    grid-template-columns: 140px 1fr;
  }
}

.detail-mood {
  min-height: 120px;
  background: radial-gradient(circle at 50% 70%, var(--calm), transparent 65%),
    linear-gradient(180deg, #12161f, #0a0c10);
  transition: background 0.5s var(--ease), box-shadow 0.5s;
  position: relative;
}

.detail-mood::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(255, 255, 255, 0.06), transparent 55%);
  pointer-events: none;
}

.detail-mood[data-mood="calm"] {
  background: radial-gradient(circle at 50% 80%, rgba(91, 138, 122, 0.55), transparent 60%),
    linear-gradient(180deg, #101820, #080a0c);
}

.detail-mood[data-mood="amber"] {
  background: radial-gradient(circle at 50% 75%, rgba(212, 160, 23, 0.55), transparent 58%),
    linear-gradient(180deg, #1a1408, #0a0806);
  box-shadow: inset 0 -20px 40px rgba(212, 160, 23, 0.12);
}

.detail-mood[data-mood="doom"] {
  background:
    radial-gradient(circle at 50% 110%, rgba(194, 59, 46, 0.7), transparent 55%),
    radial-gradient(ellipse at 50% 40%, rgba(40, 10, 8, 0.9), transparent 70%),
    linear-gradient(180deg, #1a0808, #050304);
  box-shadow: inset 0 0 60px var(--doom-glow);
}

.detail-mood[data-mood="doom"]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 64px;
  height: 64px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #3a4548, #1a2224 45%, #0a0c0e 70%),
    #1a2224;
  box-shadow:
    0 0 24px rgba(194, 59, 46, 0.65),
    0 8px 0 -2px rgba(80, 20, 15, 0.8);
  /* crack lines via repeating linear shadows */
  outline: 1px solid rgba(194, 59, 46, 0.25);
}

.detail-mood[data-mood="doom"]::after {
  background:
    linear-gradient(115deg, transparent 48%, rgba(194, 59, 46, 0.55) 49%, transparent 51%),
    linear-gradient(65deg, transparent 46%, rgba(255, 120, 80, 0.35) 50%, transparent 54%),
    radial-gradient(ellipse at 50% 100%, rgba(194, 59, 46, 0.35), transparent 55%);
}

.detail-body {
  padding: 1rem 1.1rem 1.2rem;
}

.detail-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.detail-body h3 {
  font-family: var(--font);
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.detail-pathway {
  margin: 0 0 1rem;
  color: #c8c4bb;
  font-size: 0.95rem;
}

.band-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.band-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
}

.band-fill {
  height: 100%;
  width: 20%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--calm), var(--accent));
  transition: width 0.4s var(--ease), background 0.4s, margin-left 0.4s var(--ease);
}

.band-range {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Refs */
.refs {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.85rem;
}

.refs li {
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--line);
  font-size: 0.92rem;
  color: #c9c5bc;
}

.refs strong {
  display: block;
  color: var(--ink);
  font-family: var(--font);
  margin-bottom: 0.25rem;
}

.refs em {
  font-style: normal;
  color: var(--accent);
  font-weight: 600;
}

/* Pathways */
.pathway-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .pathway-grid {
    grid-template-columns: 1fr 1fr;
  }
  .pathway-grid .span-2 {
    grid-column: 1 / -1;
  }
}

.pathway-grid article {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-card);
}

.pathway-grid h3 {
  font-family: var(--font);
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
}

.pathway-grid p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.disclaimer {
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px dashed rgba(201, 166, 107, 0.35);
  background: rgba(201, 166, 107, 0.06);
  font-size: 0.88rem;
  color: #b8b3a8;
}

.disclaimer strong {
  color: var(--accent);
}

.site-footer {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
  text-align: center;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.site-footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.mood-calm {
  --page-glow: rgba(91, 138, 122, 0.08);
}
body.mood-amber {
  --page-glow: rgba(212, 160, 23, 0.1);
}
body.mood-doom {
  --page-glow: rgba(194, 59, 46, 0.14);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, var(--page-glow, transparent), transparent 55%);
  transition: background 0.6s var(--ease);
}
