:root {
  --bg: #f3f0e8;
  --panel: rgba(255, 253, 248, 0.86);
  --panel-strong: #fffdf8;
  --text: #1c261f;
  --muted: #5c685f;
  --line: rgba(28, 38, 31, 0.12);
  --accent: #0f6c53;
  --accent-soft: #daf0e6;
  --gold: #cf9b3c;
  --shadow: 0 18px 60px rgba(24, 29, 22, 0.08);
  --danger: #b55237;
  --cash: #88b6a5;
  --invest: #0f6c53;
  --debt: #d27a5e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(207, 155, 60, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(15, 108, 83, 0.16), transparent 26%),
    linear-gradient(180deg, #f8f6f0 0%, var(--bg) 100%);
}

.app-shell {
  max-width: 1560px;
  margin: 0 auto;
  padding: 32px 24px 40px;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.nav-mark,
.nav-links a,
.inline-link {
  color: var(--text);
  text-decoration: none;
}

.nav-mark {
  font-weight: 700;
  letter-spacing: 0.04em;
}

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

.inline-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.nav-links a,
.inline-link {
  font-weight: 700;
}

.nav-links a,
.inline-link {
  border-bottom: 1px solid rgba(28, 38, 31, 0.18);
}

.inline-link {
  display: inline-block;
  margin-top: 8px;
}

.hero,
.layout {
  display: grid;
  gap: 24px;
}

.hero {
  grid-template-columns: 1.6fr 0.8fr;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
}

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

h1 {
  font-size: clamp(2.4rem, 4vw, 4.8rem);
  line-height: 0.95;
  margin-bottom: 16px;
}

.hero-copy,
.muted,
.advisor-tip,
.scenario-description,
.chart-caption p,
#reality-check-copy {
  color: var(--muted);
  line-height: 1.6;
}

.hero-card,
.panel,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  padding: 20px;
  border-radius: 26px;
}

.hero-stat-label {
  margin-bottom: 12px;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-tags span,
.turn-pill,
.scenario-type,
.market-sentiment {
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
}

.layout {
  grid-template-columns: minmax(300px, 0.92fr) minmax(500px, 1.45fr) minmax(300px, 0.88fr);
  align-items: start;
}

.panel {
  border-radius: 30px;
  padding: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.panel-header.compact {
  align-items: center;
}

.goal-form {
  display: grid;
  gap: 14px;
}

.goal-form label {
  display: grid;
  gap: 8px;
}

.goal-form span {
  font-size: 0.88rem;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 14px 16px;
  color: var(--text);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

button {
  cursor: pointer;
  border: none;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.primary-button,
.secondary-button,
.choice-button {
  border-radius: 18px;
  padding: 14px 16px;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #17493e);
  color: white;
  box-shadow: 0 12px 30px rgba(15, 108, 83, 0.24);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  color: var(--text);
}

.reality-check,
.progress-card,
.ticker-card,
.allocation-card,
.projection-card,
.timeline-card {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.6);
}

.scenario-card {
  border-radius: 26px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  padding: 22px;
}

.scenario-meta,
.choice-grid,
.decision-footer,
.stats-grid,
.allocation-list,
.legend {
  display: flex;
  gap: 12px;
}

.scenario-meta,
.decision-footer {
  justify-content: space-between;
  align-items: center;
}

.choice-grid {
  margin: 24px 0;
  flex-direction: column;
}

.choice-button {
  text-align: left;
  font-size: 1rem;
  font-weight: 800;
  background: linear-gradient(180deg, #ffffff 0%, #f7f4ec 100%);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(28, 38, 31, 0.06);
}

.choice-button.selected {
  border-color: rgba(15, 108, 83, 0.55);
  box-shadow: inset 0 0 0 1px rgba(15, 108, 83, 0.35);
  background: linear-gradient(180deg, #effaf5 0%, #e9f6f0 100%);
}

.choice-button:hover:not(:disabled),
.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  box-shadow: 0 14px 30px rgba(28, 38, 31, 0.1);
}

.advisor-tip {
  max-width: 55ch;
}

.stats-grid {
  flex-wrap: wrap;
}

.stat-card {
  flex: 1 1 46%;
  min-width: 130px;
  padding: 18px;
  border-radius: 22px;
}

.stat-card p {
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-card strong {
  font-size: 1.35rem;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(15, 108, 83, 0.12);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--accent));
}

.allocation-ring {
  display: flex;
  justify-content: center;
  padding: 12px 0 18px;
}

.ring {
  width: 158px;
  height: 158px;
  border-radius: 50%;
  background: conic-gradient(var(--cash) 0deg 120deg, var(--invest) 120deg 250deg, var(--debt) 250deg 360deg);
  position: relative;
}

.ring::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: #faf8f2;
  border: 1px solid rgba(28, 38, 31, 0.08);
}

.allocation-list {
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.92rem;
  flex-wrap: wrap;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
}

.cash-dot { background: var(--cash); }
.invest-dot { background: var(--invest); }
.debt-dot { background: var(--debt); }

.ticker-window {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fbfaf6;
}

.ticker-track {
  display: flex;
  gap: 24px;
  min-width: max-content;
  padding: 14px 20px;
  animation: ticker-slide 26s linear infinite;
}

.ticker-item {
  white-space: nowrap;
  color: var(--muted);
}

.ticker-item.positive { color: var(--accent); }
.ticker-item.negative { color: var(--danger); }

.event-feed {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.event-feed li {
  border-left: 2px solid rgba(15, 108, 83, 0.3);
  padding-left: 16px;
}

.event-feed small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

#projection-chart {
  width: 100%;
  height: auto;
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfaf4 0%, #f4efe4 100%);
  border: 1px solid var(--line);
}

.legend {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.legend-line {
  display: inline-block;
  width: 24px;
  height: 0;
  border-top: 3px solid;
  margin-right: 8px;
  vertical-align: middle;
}

.legend-line.mirror {
  border-color: var(--accent);
}

.legend-line.shadow {
  border-color: var(--gold);
  border-top-style: dashed;
}

.rules-list {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.rules-list li + li {
  margin-top: 6px;
}

@keyframes ticker-slide {
  from { transform: translateX(0); }
  to { transform: translateX(-35%); }
}

@media (max-width: 1180px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .decision-footer,
  .scenario-meta,
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 20px 14px 28px;
  }

  .top-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel,
  .hero-card {
    padding: 18px;
    border-radius: 22px;
  }

  .stat-card {
    flex-basis: 100%;
  }
}
