:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --panel: rgba(255, 252, 247, 0.92);
  --ink: #1d2a2a;
  --muted: #5d6d6b;
  --line: #d9cec0;
  --accent: #1f7a6b;
  --accent-strong: #155348;
  --warn: #b85f2f;
  --bad: #a03d39;
  --shadow: 0 18px 50px rgba(52, 43, 33, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(31, 122, 107, 0.12), transparent 28rem),
    linear-gradient(180deg, #efe3d1 0%, var(--bg) 46%, #fdfbf6 100%);
}

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

.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero {
  padding: 1.4rem 0 1.8rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-strong);
  font-size: 0.78rem;
}

h1,
h2,
strong {
  font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif;
}

h1 {
  margin: 0;
  font-size: clamp(2.7rem, 6vw, 4.8rem);
  line-height: 0.95;
}

.lede {
  max-width: 48rem;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--muted);
}

.hero-actions,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

button {
  border: 1px solid var(--line);
  background: #fffaf2;
  color: var(--ink);
  padding: 0.72rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

button.primary {
  background: var(--accent);
  color: white;
  border-color: transparent;
}

.starter-control {
  display: grid;
  gap: 0.25rem;
  min-width: min(15rem, 100%);
}

.starter-control span {
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.starter-control select {
  width: 100%;
  min-height: 2.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf2;
  color: var(--ink);
  padding: 0.6rem 0.85rem;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(217, 206, 192, 0.85);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 1rem 1rem 1.15rem;
  backdrop-filter: blur(10px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 0.8rem;
}

.panel-head h2,
.panel-head p {
  margin: 0;
}

.panel-head p {
  max-width: 28rem;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
  text-align: right;
}

.input-panel textarea,
#markdown-output {
  width: 100%;
  min-height: 16rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  background: #fffdf9;
  line-height: 1.45;
}

#markdown-output {
  min-height: 14rem;
}

.summary-grid,
.results-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

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

.next-focus-panel {
  margin-top: 1rem;
}

.next-focus-card {
  display: grid;
  gap: 0.65rem;
}

.next-focus-card h2,
.next-focus-card p {
  margin: 0;
}

.next-focus-card h2 {
  font-size: 1.65rem;
}

.focus-label {
  display: inline-block;
  margin-bottom: 0.25rem;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.stat-card {
  display: grid;
  gap: 0.4rem;
}

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

.stat-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
}

.list-stack {
  display: grid;
  gap: 0.7rem;
}

.empty-state {
  color: var(--muted);
}

.route-item,
.bottleneck-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.9rem 1rem;
  background: rgba(255, 251, 244, 0.78);
}

.route-item h3,
.bottleneck-item h3 {
  margin: 0 0 0.35rem;
  font-size: 1.08rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.35rem 0 0;
}

.chip {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  background: #efe6d7;
}

.chip.low {
  background: rgba(160, 61, 57, 0.14);
  color: var(--bad);
}

.chip.mid {
  background: rgba(184, 95, 47, 0.15);
  color: var(--warn);
}

.chip.high {
  background: rgba(31, 122, 107, 0.14);
  color: var(--accent-strong);
}

.graph-shell {
  overflow: auto;
  border: 1px dashed var(--line);
  border-radius: 18px;
  min-height: 14rem;
  padding: 0.5rem;
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.7), rgba(249, 242, 231, 0.85));
}

.graph-shell svg {
  display: block;
  width: 100%;
  min-width: 680px;
  height: auto;
}

.copy-status {
  color: var(--muted);
  min-height: 1.2em;
}

@media (max-width: 900px) {
  .summary-grid,
  .results-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-head p {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 1rem, 100%);
    padding-top: 1rem;
  }

  .summary-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    border-radius: 20px;
    padding: 0.9rem;
  }

  h1 {
    font-size: 2.45rem;
  }

  .hero-actions > button,
  .starter-control {
    width: 100%;
  }

  .graph-shell svg {
    min-width: 520px;
  }
}
