:root {
  color-scheme: light;
  --ink: #121923;
  --muted: #5c6876;
  --steel-0: #f8fafb;
  --steel-1: #e7ebee;
  --steel-2: #c5ccd2;
  --blue: #163f70;
  --blue-light: #dbe9f6;
  --signal: #b8442f;
  --paper: #fffefb;
  --shadow: 0 22px 70px rgb(27 39 52 / 14%);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgb(255 255 255 / 90%), transparent 24rem),
    linear-gradient(145deg, var(--steel-0), var(--steel-1));
  font-family: "Avenir Next", Avenir, system-ui, -apple-system, sans-serif;
}

a { color: var(--blue); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgb(22 63 112 / 35%);
  outline-offset: 3px;
}

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

.masthead, .brand, .intro, .workspace, .field-pair, .evidence {
  display: flex;
}

.masthead {
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 30px;
}

.brand {
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font: 700 0.68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
}

.mode, .status, dt, .preset span {
  color: var(--muted);
  font: 650 0.78rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.intro {
  align-items: end;
  justify-content: space-between;
  gap: 38px;
  padding: 42px 0 34px;
  border-top: 1px solid var(--steel-2);
}

h1, h2, p { margin-top: 0; }
h1 {
  max-width: 720px;
  margin-bottom: 16px;
  font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif;
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

.intro p, .notes p, .output p {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.65;
}

.evidence {
  flex: 0 0 auto;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--steel-2);
  border-radius: 10px;
  background: var(--steel-2);
}

.evidence div {
  min-width: 116px;
  padding: 14px;
  background: var(--paper);
}

dt { margin-bottom: 5px; }
dd { margin: 0; font-weight: 750; }

.presets {
  margin: 0 0 24px;
  padding: 20px;
  border: 1px solid var(--steel-2);
  border-radius: 12px;
  background: rgb(255 254 251 / 70%);
}

.preset-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.preset-heading h2, .preset-heading p { margin: 0; }
.preset-heading h2 { font-size: 1rem; }
.preset-heading p { color: var(--muted); font-size: 0.86rem; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--steel-2);
  border-radius: 8px;
  background: var(--steel-2);
}

.preset {
  display: flex;
  min-height: 92px;
  margin: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-radius: 0;
  padding: 14px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
}

.preset:hover:not(:disabled), .preset.active {
  background: var(--blue-light);
  color: var(--blue);
}

.preset span { text-wrap: balance; }
.preset:disabled { opacity: 0.5; }

.workspace {
  min-height: 470px;
  overflow: hidden;
  border: 1px solid #aeb7bf;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.controls, .output { flex: 1 1 50%; padding: 32px; }
.controls {
  display: grid;
  align-content: center;
  gap: 11px;
}

label { color: #2e3945; font-size: 0.83rem; font-weight: 720; }
input, select, button {
  width: 100%;
  min-height: 48px;
  border-radius: 7px;
  font: inherit;
}
input, select {
  border: 1px solid #b6c0c9;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

.field-pair { gap: 12px; }
.field-pair > div { flex: 1; }
.field-pair label { display: block; margin-bottom: 11px; }

button {
  margin-top: 8px;
  border: 0;
  background: var(--blue);
  color: white;
  font-weight: 760;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #0c315c; }
button:disabled { cursor: wait; opacity: 0.58; }

.status { min-height: 1.4em; margin: 0; }
.status.error { color: var(--signal); }

.output {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--ink);
  color: white;
}

.output > span {
  color: #b8c5d1;
  font: 700 0.78rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.output strong {
  margin: 12px 0 22px;
  font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif;
  font-size: clamp(3.2rem, 8vw, 6rem);
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.output p { color: #b8c5d1; }

.odometer {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 7px;
  margin-bottom: 25px;
}
.odometer i {
  height: 5px;
  border-radius: 99px;
  background: #53606d;
}
.odometer i:nth-child(-n + 6) { background: #8ab4d9; }
.odometer i:nth-child(7) { background: var(--signal); }

.notes {
  max-width: 780px;
  padding-top: 50px;
}
.notes h2 { font-size: 1.4rem; }
.notes p { margin-bottom: 12px; }

@media (max-width: 840px) {
  .intro, .workspace { flex-direction: column; align-items: stretch; }
  .evidence { align-self: stretch; }
  .evidence div { flex: 1; min-width: 0; }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 20px, 1120px); padding-top: 16px; }
  .masthead { align-items: flex-start; }
  .mode { max-width: 90px; text-align: right; }
  .intro { padding-top: 28px; }
  .evidence, .field-pair { flex-direction: column; }
  .controls, .output { padding: 24px 20px; }
  .preset-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .preset-grid { grid-template-columns: 1fr; }
  .preset { min-height: 74px; }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 140ms ease; }
}
