:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --ink: #1d2524;
  --muted: #66706c;
  --line: #d9ded6;
  --panel: #ffffff;
  --good: #247a55;
  --bad: #b1413f;
  --warn: #b7791f;
  --accent: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0 28px;
}

.heroTools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.languageTabs {
  display: inline-grid;
  grid-template-columns: repeat(2, 54px);
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef1ea;
}

.languageBtn {
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.languageBtn.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(29, 37, 36, 0.12);
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 840px;
  margin: 8px 0 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin: 4px 0 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.decision {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.decision,
.chartPanel,
.scenarioPanel,
.sources {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.decision > div {
  padding: 22px;
}

#action {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.9rem, 4vw, 3.2rem);
  line-height: 1;
}

#actionDetail {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.scoreBox {
  border-left: 1px solid var(--line);
  text-align: right;
}

#score {
  display: block;
  margin-top: 10px;
  font-size: 3rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.signal {
  min-height: 230px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.signal h3 {
  min-height: 46px;
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.value {
  font-size: 1.65rem;
  font-weight: 850;
}

.pill {
  width: fit-content;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf1f8;
  color: #244c87;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.pill.good {
  background: #e4f3eb;
  color: var(--good);
}

.pill.bad {
  background: #f8e8e5;
  color: var(--bad);
}

.pill.warn {
  background: #fbf0d8;
  color: var(--warn);
}

.signal p {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
}

.source {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}

.chartPanel,
.scenarioPanel,
.sources {
  padding: 20px;
}

.scenarioPanel {
  margin-top: 16px;
  margin-bottom: 16px;
}

.sectionHeader {
  margin-bottom: 14px;
}

.scenarioGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.scenario {
  min-height: 230px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  border-left-width: 6px;
}

.scenario.activeScenario {
  border-color: #1d2524;
  box-shadow: inset 0 0 0 1px #1d2524;
}

.scenario.good {
  border-left-color: var(--good);
  background: #f4fbf7;
}

.scenario.calm {
  border-left-color: var(--accent);
  background: #f6f9ff;
}

.scenario.warn {
  border-left-color: var(--warn);
  background: #fffaf0;
}

.scenario.bad {
  border-left-color: var(--bad);
  background: #fff6f4;
}

.scenario.good .scenarioScore,
.scenario.good strong {
  color: var(--good);
}

.scenario.calm .scenarioScore,
.scenario.calm strong {
  color: var(--accent);
}

.scenario.warn .scenarioScore,
.scenario.warn strong {
  color: var(--warn);
}

.scenario.bad .scenarioScore,
.scenario.bad strong {
  color: var(--bad);
}

.scenarioTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.level,
.scenarioScore {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.scenario h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.scenario strong {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
}

.scenario p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.42;
}

.chartHeader {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 12px;
}

#updated {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

.chartTools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.rangeTabs {
  display: inline-grid;
  grid-template-columns: repeat(2, 54px);
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef1ea;
}

.rangeBtn {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.rangeBtn.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(29, 37, 36, 0.12);
}

.rangeBtn:disabled {
  cursor: progress;
}

.chartWrap {
  position: relative;
}

canvas {
  width: 100%;
  height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  cursor: crosshair;
  display: block;
}

.tooltip {
  position: absolute;
  z-index: 2;
  width: min(460px, calc(100% - 20px));
  padding: 12px;
  border: 1px solid #c9d1c7;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 14px 34px rgba(29, 37, 36, 0.14);
  pointer-events: none;
}

.scenarioTooltip {
  border-left-width: 6px;
}

.scenarioTooltip.good {
  border-left-color: var(--good);
}

.scenarioTooltip.calm {
  border-left-color: var(--accent);
}

.scenarioTooltip.warn {
  border-left-color: var(--warn);
}

.scenarioTooltip.bad {
  border-left-color: var(--bad);
}

.scenarioTooltip.good h3 {
  color: var(--good);
}

.scenarioTooltip.calm h3 {
  color: var(--accent);
}

.scenarioTooltip.warn h3 {
  color: var(--warn);
}

.scenarioTooltip.bad h3 {
  color: var(--bad);
}

.tooltip h3 {
  margin: 0 0 4px;
  font-size: 0.96rem;
}

.tooltip .advice {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.35;
}

.tooltipRows {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.tooltipRow {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.tooltipRow span {
  white-space: nowrap;
}

.tooltipRow strong {
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

.tooltipRow.good strong {
  color: var(--good);
}

.tooltipRow.bad strong {
  color: var(--bad);
}

.tooltipRow.warn strong {
  color: var(--warn);
}

.sources {
  margin-top: 16px;
}

.sources p {
  max-width: 900px;
  color: var(--muted);
  line-height: 1.5;
}

.fineprint {
  font-size: 0.88rem;
}

@media (max-width: 960px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .scoreBox {
    border-left: 0;
    border-top: 1px solid var(--line);
    text-align: left;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .hero,
  .chartHeader {
    align-items: start;
    flex-direction: column;
  }

  .heroTools {
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
  }

  .languageTabs {
    flex: 1;
    grid-template-columns: repeat(2, 1fr);
  }

  .chartTools {
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
  }

  .rangeTabs {
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .heroTools > button {
    width: 100%;
  }
}
