:root {
  color-scheme: light;
  --navy: #142939;
  --ink: #152c3d;
  --muted: #536774;
  --petrol: #08695e;
  --petrol-dark: #07564f;
  --border: #d6e2e5;
  --mint: #eaf5f2;
  --bg: #f5f8f9;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.125rem; line-height: 1.28; letter-spacing: -.024em; }
h3 { font-size: 1rem; line-height: 1.35; }
p { line-height: 1.54; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #148b7d; outline-offset: 3px; }
:focus { scroll-margin-block: 103px 94px; }
svg { width: 20px; height: 20px; display: block; flex: none; }
.skip { position: fixed; left: 12px; top: -80px; padding: 12px; background: white; z-index: 5; }
.skip:focus { top: 12px; }

.masthead { background: linear-gradient(145deg,#172e40,#102434); color: #f0faf9; }
.mast-inner {
  max-width: 750px; margin: auto; min-height: 76px; padding: max(12px, env(safe-area-inset-top)) 18px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { flex: none; border-radius: 11px; }
.brand strong { display: block; font-size: 1.02rem; font-weight: 740; letter-spacing: -.025em; }
.brand small { display: block; color: #b9ced7; font-size: .75rem; margin-top: 3px; }
.masthead .library-button {
  color: #f0faf9; background: #27434e; border-color: #3c5963; font-size: .81rem; padding: 7px 10px;
}
.masthead .library-button:hover { background: #355460; }
.masthead :focus-visible { outline-color: #a8e5d9; }

main { width: min(100%, 750px); margin: auto; padding: 20px 18px calc(16px + env(safe-area-inset-bottom)); }
.progress-section {
  position: sticky; top: 0; z-index: 3; background: var(--bg);
  margin: -9px 0 28px; padding: 9px 0 1px;
}
.progress-caption { color: var(--petrol-dark); font-weight: 720; font-size: .82rem; margin-bottom: 8px; }
#steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.step {
  min-width: 0; min-height: 44px; padding: 0 1px 5px; border: 0; background: none; color: var(--muted);
  text-align: left; font-weight: 560; font-size: .75rem; line-height: 1.2;
}
.step::before { content: ""; display: block; height: 5px; border-radius: 3px; background: #dce7e9; margin-bottom: 7px; }
.step.done::before { background: #8bbfb5; }
.step[aria-current="step"] { color: var(--petrol-dark); font-weight: 750; }
.step[aria-current="step"]::before { background: var(--petrol); }
.intro { margin-bottom: 17px; overflow-wrap: anywhere; }
.intro h1 { font-size: clamp(1.85rem, 7.2vw, 2.65rem); letter-spacing: -.052em; line-height: 1.08; font-weight: 740; margin-bottom: 8px; }
.intro p { color: var(--muted); max-width: 58ch; }
.card {
  background: #fff; border: 1px solid var(--border); border-radius: 15px; box-shadow: 0 3px 10px #10283807;
  padding: 17px; min-width: 0; overflow-wrap: anywhere;
}
.stack { display: grid; align-content: start; gap: 14px; min-width: 0; }
.card-top { display: flex; align-items: center; gap: 10px; }
.tile {
  width: 39px; height: 39px; flex: none; border-radius: 10px; background: var(--mint);
  color: var(--petrol); display: grid; place-items: center;
}
.callout {
  background: var(--mint); border: 1px solid #cee4df; border-radius: 11px; padding: 13px;
  display: flex; gap: 10px; align-items: flex-start; min-width: 0;
}
.callout svg { color: var(--petrol); width: 18px; height: 18px; margin-top: 2px; }
.callout p, .hint { color: var(--muted); font-size: .9rem; }
.callout strong { display: block; margin-bottom: 2px; font-size: .91rem; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-weight: 670; font-size: .9rem; }
input, textarea {
  width: 100%; min-width: 0; min-height: 48px; padding: 10px 12px; border: 1px solid #b5c7ce;
  border-radius: 9px; background: white; color: var(--ink); line-height: 1.4;
}
textarea { min-height: 88px; resize: vertical; }
#question { min-height: 105px; }
input::placeholder, textarea::placeholder { color: #6b7f87; }
[aria-invalid="true"] { border-color: #a62c30; box-shadow: 0 0 0 1px #a62c30; }
.row { display: flex; align-items: end; gap: 8px; }
.row .field:first-child { flex: 1; }
.weight { flex: 0 0 92px; }
.button {
  display: inline-flex; gap: 7px; align-items: center; justify-content: center; min-height: 47px;
  padding: 8px 13px; border: 1px solid transparent; border-radius: 9px; background: none;
  color: var(--ink); font-size: .9rem; font-weight: 680; line-height: 1.25; text-align: center;
}
.button svg { width: 17px; height: 17px; }
.primary { color: white; background: var(--petrol); }
.primary:hover { background: var(--petrol-dark); }
.secondary, .icon-button { color: var(--ink); background: white; border-color: #cfdbdf; }
.secondary:hover, .icon-button:hover { background: #edf7f4; border-color: #86b5ad; }
.icon-button { flex: 0 0 47px; width: 47px; padding: 7px; }
.icon-button:disabled { opacity: .45; }
.text-button { color: var(--petrol-dark); padding-inline: 4px; }
.text-button:hover { text-decoration: underline; }
.danger { color: #942d31; }
.danger:hover { background: #fff0ee; border-color: #d9a2a2; }
.actions {
  display: flex; gap: 9px; padding: 12px 0 calc(11px + env(safe-area-inset-bottom));
  position: sticky; bottom: 0; z-index: 2; margin-top: 3px; background: var(--bg);
}
.actions .primary { flex: 1; }
.options { display: grid; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.choice {
  border: 1px solid var(--border); border-radius: 10px; display: grid;
  grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px; cursor: pointer;
}
.choice:has(input:checked) { border-color: #4d9d91; background: #edf8f5; }
.choice input { width: 18px; height: 18px; min-height: 18px; margin: 2px 0 0; accent-color: var(--petrol); }
.choice strong { font-size: .95rem; }
.choice small { display: block; margin-top: 3px; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.section { border: 1px solid var(--border); border-radius: 11px; padding: 11px 13px 13px; margin: 0; min-width: 0; }
.section legend { padding: 0 5px; max-width: 100%; font-weight: 700; font-size: .95rem; }
.scoring { display: grid; gap: 9px; }
.scoring .field { grid-template-columns: minmax(0, 1fr) 80px; align-items: center; gap: 8px; }
.scoring input { text-align: center; }
.error { border: 1px solid #e1afad; background: #fff2f1; color: #8c292c; padding: 11px; border-radius: 9px; font-size: .9rem; }
.question-summary { color: var(--muted); font-size: .9rem; }
.chart { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.chart li { display: grid; gap: 4px; }
.bar-label { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; font-size: .9rem; }
.bar-label strong { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
meter { display: block; width: 100%; height: 15px; appearance: none; background: transparent; }
meter::-webkit-meter-bar { border: 0; border-radius: 6px; background: #e8eff0; }
meter::-webkit-meter-optimum-value { background: #16786d; border-radius: 6px; }
meter::-moz-meter-bar { background: #16786d; border-radius: 6px; }
meter.contra::-webkit-meter-optimum-value { background: #9b5146; }
meter.contra::-moz-meter-bar { background: #9b5146; }
.argument-list { margin: 0; padding-left: 19px; line-height: 1.5; font-size: .9rem; }
.status-line { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: center; justify-content: space-between; color: var(--muted); font-size: .79rem; }
.status-line > div { display: flex; align-items: center; gap: 6px; }
.status-line svg { width: 14px; height: 14px; color: var(--petrol); }
dialog {
  width: min(calc(100% - 28px), 550px); max-height: 85vh; max-height: 85dvh; overflow: auto;
  color: var(--ink); border: 1px solid var(--border); border-radius: 15px; padding: 16px; overflow-wrap: anywhere;
}
dialog::backdrop { background: #142939a6; }
.dialog-head, .saved-row { display: flex; gap: 9px; justify-content: space-between; align-items: center; }
.dialog-head { margin-bottom: 13px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.list { display: grid; gap: 8px; }
.saved-row .open-record { flex: 1; min-width: 0; justify-content: flex-start; text-align: left; }
.saved-row small { display: block; color: var(--muted); font-weight: 480; margin-top: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (min-width: 680px) {
  main { padding: 29px 24px 24px; }
  .mast-inner { padding-inline: 24px; }
  .card { padding: 23px; }
  .pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 377px) {
  .mast-inner { padding-inline: 12px; }
  .brand { gap: 6px; }
  .brand strong { font-size: .9rem; }
  .brand img { width: 36px; height: 36px; }
  .brand small { display: none; }
  .masthead .library-button { font-size: .73rem; padding-inline: 7px; }
  main { padding-inline: 12px; }
  .card { padding: 13px; }
  .step { font-size: .7rem; }
  .weight { flex-basis: 73px; }
}
