:root {
  color: #1c1915;
  background: #efe7d6;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

main {
  width: min(960px, calc(100% - 32px));
  margin: 28px auto 64px;
}

header {
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

button {
  border: 2px solid #1c1915;
  background: #1c1915;
  color: #efe7d6;
  font: 600 15px ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 10px 18px;
  min-height: 42px;
  cursor: pointer;
}

button:hover {
  background: #3a3126;
}

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

#limits {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

#limits label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select {
  border: 2px solid #1c1915;
  background: #f7f3ea;
  color: inherit;
  font: 16px ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 8px 10px;
  width: 100%;
  min-height: 42px;
}

canvas {
  width: 100%;
  height: auto;
  background: #f7f3ea;
  border: 2px solid #1c1915;
  display: block;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 2px solid #1c1915;
  border-top: 0;
  background: #f7f3ea;
}

.stats div {
  padding: 12px 14px;
  min-width: 0;
}

.stats div + div {
  border-left: 2px solid #1c1915;
}

.stats span,
.facts span {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stats strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.meter {
  display: flex;
  height: 10px;
  border: 2px solid #1c1915;
  border-top: 0;
  background: #f7f3ea;
}

.meter span {
  display: block;
  height: 100%;
  flex: 1 1 0;
  min-width: 0;
}

.meter [data-action="jump"] {
  background: #1c1915;
}

.meter [data-action="duck"] {
  background: #8c4a2f;
}

.meter [data-action="run"] {
  background: #2f6b45;
}

.meter-key {
  margin: 8px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 4px 0 10px;
  vertical-align: -1px;
}

.swatch.jump {
  background: #1c1915;
  margin-left: 0;
}

.swatch.duck {
  background: #8c4a2f;
}

.swatch.run {
  background: #2f6b45;
}

.live {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 2px solid #1c1915;
  background: #f7f3ea;
  margin-top: 12px;
}

.live div {
  padding: 10px 12px;
  min-width: 0;
}

.live div + div {
  border-left: 2px solid #1c1915;
}

.live span {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
}

#status,
#reason {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
}

#reason {
  min-height: 1.5em;
  margin-top: 0;
}

#analysis {
  margin-top: 32px;
}

#analysis h2 {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 600;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.facts div {
  padding: 12px 14px;
  border: 2px solid #1c1915;
  background: #f7f3ea;
  min-width: 0;
}

.facts strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.chart-card {
  border: 2px solid #1c1915;
  background: #f7f3ea;
  padding: 14px 14px 8px;
  min-width: 0;
}

.chart-card svg {
  width: 100%;
  height: auto;
  display: block;
}

.donut-layout {
  display: flex;
  align-items: center;
  gap: 18px;
}

.donut-layout svg {
  width: 148px;
  flex: none;
}

.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.donut-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.donut-legend i {
  width: 12px;
  height: 12px;
  flex: none;
}

.donut-total,
.legend-text,
.axis-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  fill: #1c1915;
}

.donut-total {
  font-size: 18px;
  font-weight: 700;
}

.donut-label,
.axis-text,
.legend-text {
  font-size: 11px;
}

.chart-empty,
.prob-list,
.bar-list {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.prob-list,
.bar-list {
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
  max-height: 240px;
  overflow: auto;
}

.prob-list li,
.bar-list li {
  display: grid;
  grid-template-columns: 118px 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.stack,
.bar-track {
  display: flex;
  height: 12px;
  background: #efe7d6;
  border: 1px solid #1c1915;
}

.stack span,
.bar-fill {
  display: block;
  height: 100%;
}

.bar-fill {
  background: #1c1915;
  width: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 2px solid #1c1915;
  background: #f7f3ea;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px;
  border-bottom: 1px solid #d9d0c0;
}

th {
  position: sticky;
  top: 0;
  background: #f7f3ea;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
}

td:last-child {
  min-width: 220px;
}

tr.jump td:nth-child(3) {
  color: #1c1915;
  font-weight: 700;
}

tr.duck td:nth-child(3) {
  color: #8c4a2f;
  font-weight: 700;
}

tr.run td:nth-child(3) {
  color: #2f6b45;
  font-weight: 700;
}

@media (max-width: 800px) {
  h1 {
    font-size: 32px;
  }

  #limits,
  .stats,
  .live {
    grid-template-columns: 1fr 1fr;
  }

  .live div:nth-child(n + 3) {
    border-top: 2px solid #1c1915;
  }

  .live div:nth-child(odd) {
    border-left: 0;
  }

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

  #limits button {
    grid-column: 1 / -1;
  }

  .stats div:nth-child(3),
  .stats div:nth-child(4) {
    border-top: 2px solid #1c1915;
  }

  .stats div:nth-child(odd) {
    border-left: 0;
  }

  .prob-list li,
  .bar-list li {
    grid-template-columns: 92px 1fr auto;
  }
}
