:root {
  color-scheme: light;
  --ink: #15211c;
  --muted: #5d6b64;
  --paper: #f5f1e8;
  --panel: #fffdf7;
  --line: #c8d0c9;
  --green: #0d6b4d;
  --green-dark: #074633;
  --amber: #8a5b00;
  --red: #8d2e2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, #dcebe2 0, transparent 38rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

main {
  width: min(1050px, calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0;
}

header {
  max-width: 760px;
}

.eyebrow,
.output-label,
label,
.instrument span {
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 7vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.lede {
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.6;
}

.boundary,
.red-flags {
  margin: 28px 0;
  border-left: 5px solid var(--amber);
  background: #fff4d7;
  padding: 16px 20px;
  line-height: 1.55;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
  gap: 24px;
}

form,
.output,
.instrument {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 18px 55px rgb(21 33 28 / 7%);
  padding: 24px;
}

label {
  display: block;
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  padding: 14px;
  resize: vertical;
}

textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgb(13 107 77 / 14%);
  outline: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

button {
  border: 1px solid var(--green);
  border-radius: 999px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 11px 17px;
}

button:hover:not(:disabled) {
  background: var(--green-dark);
}

button.secondary {
  background: transparent;
  color: var(--green);
}

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

.output-label {
  margin-top: 0;
}

.results {
  list-style: none;
  margin: 18px 0;
  padding: 0;
}

.results li {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid #e0e4df;
  padding: 12px 0;
}

.results li.empty {
  display: block;
  color: var(--muted);
}

.rank {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: #e1eee7;
  color: var(--green-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.score {
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.score::after {
  content: "%";
}

.score-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.red-flags {
  border-color: var(--red);
  background: #feecec;
  color: var(--red);
}

.instrument {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 18px;
  align-items: center;
  margin-top: 24px;
}

.instrument span,
.instrument strong {
  display: block;
}

.instrument strong {
  margin-top: 6px;
  font-size: 0.86rem;
  line-height: 1.45;
}

#status[data-kind="error"] {
  color: var(--red);
}

#status[data-kind="success"] {
  color: var(--green);
}

@media (max-width: 760px) {
  main {
    padding: 36px 0;
  }

  .workbench,
  .instrument {
    grid-template-columns: 1fr;
  }
}
