:root {
  --paper: #e9eeea;
  --surface: #f7f9f7;
  --ink: #18222e;
  --muted: #56636e;
  --rule: #c8d1cb;
  --teal: #0e6b63;
  --teal-soft: #cfe3df;
  --amber: #9a6414;
  --amber-soft: #f1e2c4;
  --red: #9b3434;
  --red-soft: #f1d6d3;
  --track: #d7dfda;
  --focus: #0e6b63;
  --ui: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --read: "Source Serif 4", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11191e;
    --surface: #182329;
    --ink: #e3e9e5;
    --muted: #97a59f;
    --rule: #2b3a40;
    --teal: #57b8aa;
    --teal-soft: #1d3936;
    --amber: #ddab4f;
    --amber-soft: #3a2f1b;
    --red: #e08a80;
    --red-soft: #3d2422;
    --track: #24323a;
    --focus: #57b8aa;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--teal); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; }
.skip:focus { left: 16px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.masthead { padding: 40px 0 28px; }
.masthead h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-weight: 750;
  margin: 0 0 14px;
  max-width: 16ch;
  font-variation-settings: "opsz" 96;
}
.lede { font-family: var(--read); font-size: 1.1rem; line-height: 1.6; color: var(--muted); max-width: 62ch; margin: 0; }
.lede strong { color: var(--ink); font-weight: 600; }

.layout { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 28px; align-items: start; padding-bottom: 40px; }
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 20px; }
.intake { position: sticky; top: 16px; }
@media (max-width: 880px) { .intake { position: static; } }
.panel-title { font-size: 1.15rem; margin: 0 0 14px; font-weight: 650; }

.field { display: block; border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.field-label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; padding: 0; }
textarea, input[type="url"] {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 12px;
}
textarea { resize: vertical; min-height: 180px; line-height: 1.45; }
input.link + input.link { margin-top: 8px; }
.hint { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 6px; }
.links .hint { margin-top: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px;
  padding: 10px 16px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  min-height: 44px;
}
.btn-quiet:hover { border-color: var(--muted); }
.btn-primary { width: 100%; background: var(--teal); color: var(--surface); border-color: var(--teal); font-size: 1.02rem; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary[disabled] { opacity: 0.6; cursor: progress; }
.cv-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cv-status { font-size: 0.88rem; color: var(--muted); }
.cv-status button { font: inherit; background: none; border: 0; color: var(--teal); text-decoration: underline; cursor: pointer; padding: 0 0 0 6px; }
.form-error { color: var(--red); font-size: 0.9rem; min-height: 0; margin: 10px 0 0; }
.form-error:empty { display: none; }
.privacy { font-size: 0.8rem; color: var(--muted); margin: 12px 0 0; }

/* Empty state */
.results:focus { outline: none; }
.empty h2 { font-size: 1.15rem; margin: 4px 0 16px; font-weight: 650; }
.legend { display: grid; gap: 16px; margin-bottom: 20px; }
.legend-row { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; }
.legend-row .bar { margin-top: 8px; }
.legend-row p, .empty-note { font-family: var(--read); margin: 0; max-width: 64ch; line-height: 1.6; }
.empty-note { color: var(--muted); margin-top: 12px; }
@media (max-width: 520px) { .legend-row { grid-template-columns: 1fr; gap: 6px; } }

/* Bars: the one loud element */
.bar { display: block; background: var(--track); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; }
.bar-pick { height: 12px; }
.bar-pick i { background: var(--teal); }
.bar-fit { height: 4px; }
.bar-fit i { background: var(--muted); }

/* Progress */
.status { margin-bottom: 16px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.9rem; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; }
.steps li.active { color: var(--ink); font-weight: 600; }
.steps li.active::before { background: var(--teal); border-color: var(--teal); animation: pulse 1.1s ease-in-out infinite; }
.steps li.done::before { background: currentColor; }
.steps li.failed { color: var(--red); }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .steps li.active::before { animation: none; } }

/* Ranking rows */
.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: rank; }
.row { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; }
.row-head { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: 4px 14px; padding: 16px 18px; align-items: start; }
.rank { font-size: 1.5rem; font-weight: 750; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.row-title { margin: 0; font-size: 1.08rem; font-weight: 650; line-height: 1.25; }
.row-mentors { margin: 3px 0 0; font-size: 0.9rem; color: var(--muted); }
.row-mentors a { color: inherit; }
.score { text-align: right; font-variant-numeric: tabular-nums; }
.score b { display: block; font-size: 1.7rem; line-height: 1; font-weight: 750; }
.score span { font-size: 0.78rem; color: var(--muted); }
.meters { grid-column: 2 / 4; display: grid; gap: 6px; margin-top: 10px; }
.meter { display: grid; grid-template-columns: 1fr 5.5rem; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--muted); }
.meter span { text-align: right; font-variant-numeric: tabular-nums; }
.why { grid-column: 2 / 4; font-family: var(--read); margin: 10px 0 0; line-height: 1.55; }
.chips { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 0.8rem; padding: 3px 9px; border-radius: 999px; background: var(--red-soft); color: var(--red); }
@media (max-width: 520px) {
  .row-head { grid-template-columns: 1.8rem 1fr; }
  .score { grid-column: 2; text-align: left; display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
  .score b { display: inline; font-size: 1.3rem; }
  .meters, .why, .chips { grid-column: 1 / 3; }
}

.toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border: 0; border-top: 1px solid var(--rule); background: none; font: inherit; font-weight: 600; color: var(--teal); cursor: pointer; text-align: left; border-radius: 0 0 14px 14px; min-height: 44px; }
.toggle[disabled] { color: var(--muted); cursor: default; font-weight: 500; }
.toggle .caret { transition: transform 0.15s ease; }
.toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .toggle .caret { transition: none; } }

.deep { padding: 4px 18px 20px; display: grid; gap: 18px; }
.deep[hidden] { display: none; }
.headline { font-family: var(--read); font-size: 1.08rem; font-weight: 600; margin: 0; line-height: 1.5; max-width: 68ch; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
.deep h4 { margin: 0 0 6px; font-size: 0.95rem; font-weight: 650; }
.deep ul { margin: 0; padding-left: 1.1rem; font-family: var(--read); line-height: 1.55; }
.deep li + li { margin-top: 6px; }
.deep li small { display: block; color: var(--muted); font-family: var(--ui); font-size: 0.8rem; }
.gap-list { list-style: none; padding: 0 !important; }
.gap { border-left: 3px solid var(--amber); padding: 2px 0 2px 12px; }
.gap.blocker { border-color: var(--red); }
.gap.minor { border-color: var(--rule); }
.gap p { margin: 0; }
.gap .fix { color: var(--muted); margin-top: 2px; }
.sev { font-family: var(--ui); font-size: 0.75rem; font-weight: 600; color: var(--amber); margin-left: 4px; }
.gap.blocker .sev { color: var(--red); }
.gap.minor .sev { color: var(--muted); }
.demo { background: var(--teal-soft); border-radius: 10px; padding: 14px 16px; }
.demo h4 { display: flex; justify-content: space-between; gap: 12px; }
.demo h4 span { font-weight: 500; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.demo p { margin: 0; font-family: var(--read); line-height: 1.55; }
.demo p + p { margin-top: 6px; color: var(--muted); }
.watch { font-family: var(--read); margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--amber-soft); }
.deep-error { color: var(--red); font-size: 0.9rem; margin: 0; padding: 4px 18px 16px; }

/* Combined plan */
.plan { background: var(--ink); color: var(--paper); border-radius: 16px; padding: 22px; margin-bottom: 16px; }
.plan h2 { margin: 0 0 4px; font-size: 1.3rem; font-weight: 750; letter-spacing: -0.01em; }
.plan .plan-what { font-family: var(--read); font-size: 1.05rem; line-height: 1.6; margin: 8px 0 0; max-width: 68ch; }
.plan .plan-why { font-family: var(--read); opacity: 0.8; margin: 8px 0 0; max-width: 68ch; }
.plan .covers { margin: 12px 0 0; font-size: 0.9rem; opacity: 0.85; }
.plan ol { margin: 16px 0 0; padding-left: 0; list-style: none; display: grid; gap: 8px; }
.plan ol li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 10px; font-family: var(--read); line-height: 1.5; }
.plan ol li b { font-family: var(--ui); font-weight: 650; }
.plan .apply { margin: 16px 0 0; font-size: 0.92rem; }
.plan .note { margin: 10px 0 0; font-size: 0.88rem; opacity: 0.8; font-family: var(--read); }
.plan-pending { color: var(--muted); font-size: 0.9rem; margin: 0 0 16px; }
@media (max-width: 520px) { .plan ol li { grid-template-columns: 1fr; gap: 0; } }

.rest { margin-top: 18px; }
.rest summary { cursor: pointer; font-weight: 600; color: var(--teal); padding: 10px 0; }
.ranking-compact .row-head { padding: 12px 16px; }
.ranking-compact .row-title { font-size: 1rem; }
.ranking-compact .score b { font-size: 1.25rem; }

.errorbox { background: var(--red-soft); color: var(--red); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }

.foot { color: var(--muted); font-size: 0.85rem; padding-bottom: 40px; }
.foot p { max-width: 80ch; margin: 0; }
