:root {
  color-scheme: light;
  --gq-color-ink: #111410;
  --gq-color-paper: #f3f0e8;
  --gq-color-paper-subtle: #e7e4dc;
  --gq-color-surface: #fff;
  --gq-color-acid: #c8f56a;
  --gq-color-text: #111410;
  --gq-color-text-muted: #55594f;
  --gq-color-separator: #b8bbb2;
  --gq-color-control-border: #60645c;
  --gq-color-success-text: #245c16;
  --gq-color-success-surface: #e8f8c7;
  --gq-color-danger-text: #8f2119;
  --gq-color-danger-surface: #ffe6e1;
  --gq-color-warning-text: #713f00;
  --gq-color-warning-surface: #fff0d5;
  --gq-font-ui: "Geist", "Segoe UI", system-ui, sans-serif;
  --gq-font-data: "Geist Mono", "Cascadia Mono", ui-monospace, monospace;
  --gq-radius-control: .375rem;
  --gq-radius-panel: .625rem;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--gq-color-paper); color: var(--gq-color-text); font: 1rem/1.6 var(--gq-font-ui); }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: .2em; }
button, .topbar a, summary { min-height: 44px; }
button { padding: .5rem 1rem; border: 1px solid var(--gq-color-control-border); border-radius: var(--gq-radius-control); background: var(--gq-color-surface); cursor: pointer; line-height: 1.5; }
button:hover:enabled { background: var(--gq-color-paper-subtle); }
button:active:enabled { transform: translateY(1px); background: var(--gq-color-paper-subtle); }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--gq-color-ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--gq-color-acid); }
[hidden] { display: none !important; }
.visually-hidden, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; left: 1rem; top: 1rem; padding: .5rem; z-index: 3; background: white; }
.topbar { min-height: 3.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 2rem; border-bottom: 1px solid var(--gq-color-separator); }
.topbar a { display: inline-flex; align-items: center; }
.brand { font-weight: 700; text-decoration: none; gap: .5rem; }
.brand span { color: var(--gq-color-text-muted); font-size: .875rem; font-weight: 400; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
nav button { background: transparent; }
main { max-width: 72rem; margin: 0 auto; padding: 2rem 2rem 3rem; }
h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 1rem; letter-spacing: -.025em; }
h2 { font-size: 1.25rem; line-height: 1.4; margin: 0; }
h3 { font-size: .875rem; font-weight: 600; margin: 0; color: var(--gq-color-text-muted); }
p { margin: .75rem 0; }
.intro { max-width: 72ch; }
.data-note, .help, footer { color: var(--gq-color-text-muted); font-size: .875rem; }
form { margin: 1.5rem 0 2rem; background: var(--gq-color-surface); border: 1px solid var(--gq-color-separator); border-radius: var(--gq-radius-panel); padding: 1.5rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.target-bar { display: flex; justify-content: space-between; align-items: start; gap: 1.5rem; }
.target-field { max-width: 24rem; }
label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .5rem; }
.input-line { display: flex; align-items: center; gap: .5rem; }
input { min-width: 0; width: 100%; min-height: 44px; padding: .5rem .75rem; border: 1px solid var(--gq-color-control-border); border-radius: var(--gq-radius-control); background: var(--gq-color-surface); }
input[inputmode="decimal"], output { font-family: var(--gq-font-data); font-variant-numeric: tabular-nums; }
input[aria-invalid="true"] { border: 2px solid var(--gq-color-danger-text); }
.decimal { min-width: 44px; padding: .5rem; font-weight: 700; }
.unit { white-space: nowrap; color: var(--gq-color-text-muted); }
.weight-total { margin: 0; text-align: right; }
.weight-total span, .weight-total output { display: block; }
.weight-total output { font-size: 1.25rem; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-top: 2rem; }
#row-count { font-size: .875rem; color: var(--gq-color-text-muted); }
.notice { font-size: .875rem; max-width: 90ch; padding-bottom: 1rem; }
.grade-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: .5rem 1rem; padding: 1rem 0; border-top: 1px solid var(--gq-color-separator); }
.grade-row h3 { grid-column: 1 / -1; }
.field { min-width: 0; }
.row-actions { display: flex; flex-direction: column; justify-content: flex-start; padding-top: 1.75rem; }
.score-status { grid-column: 1 / -1; margin: 0 0 .5rem; font-size: .75rem; color: var(--gq-color-text-muted); }
.field-error { color: var(--gq-color-danger-text); font-size: .875rem; margin: .5rem 0 0; overflow-wrap: anywhere; }
.add-line { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: .5rem 0 1rem; }
.action-bar { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--gq-color-separator); }
.secondary-actions, .result-actions, .dialog-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.primary { background: var(--gq-color-acid); font-weight: 700; padding-inline: 2rem; }
.primary:hover:enabled { background: #b8e65a; }
.error-summary { background: var(--gq-color-danger-surface); border-left: 4px solid var(--gq-color-danger-text); padding: 1rem; margin-bottom: 1rem; color: var(--gq-color-danger-text); overflow-wrap: anywhere; }
.result-area { border-top: 2px solid var(--gq-color-ink); padding-top: 1.5rem; }
.result-status { padding: .75rem 1rem; background: var(--gq-color-success-surface); color: var(--gq-color-success-text); border-radius: var(--gq-radius-control); font-weight: 600; }
.result-status[data-tone="warning"] { background: var(--gq-color-warning-surface); color: var(--gq-color-warning-text); }
.result-status[data-tone="danger"] { background: var(--gq-color-danger-surface); color: var(--gq-color-danger-text); }
dl { margin: 1.5rem 0; }
.measure { display: flex; justify-content: space-between; align-items: baseline; gap: 1.5rem; padding: .75rem 0; border-bottom: 1px solid var(--gq-color-separator); }
dt { max-width: 65%; }
dd { margin: 0; font: 1.25rem/1.5 var(--gq-font-data); white-space: nowrap; }
summary { cursor: pointer; padding: .75rem .25rem; font-weight: 600; }
textarea { width: 100%; padding: .75rem; background: var(--gq-color-surface); border: 1px solid var(--gq-color-control-border); border-radius: var(--gq-radius-control); resize: vertical; font-size: .875rem; }
.result-actions { margin-top: 1.5rem; }
.faq { border-top: 1px solid var(--gq-color-separator); margin-top: 3rem; padding-top: 1.5rem; max-width: 75ch; }
.faq h2 { margin-bottom: 1rem; }
.faq details { border-bottom: 1px solid var(--gq-color-separator); }
.faq p { margin: 0 0 1rem; }
footer { max-width: 72rem; margin: 0 auto; padding: 1.5rem 2rem max(2rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--gq-color-separator); }
dialog { max-width: min(32rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); border: 1px solid var(--gq-color-control-border); border-radius: var(--gq-radius-panel); padding: 1.5rem; overflow: auto; }
dialog::backdrop { background: rgb(17 20 16 / 40%); }
.dialog-actions { margin-top: 1.5rem; justify-content: end; }
input, button, textarea, summary { scroll-margin-block: 2rem; }
@media (min-width: 48rem) and (max-width: 74.999rem) { main, .topbar, footer { padding-inline: 1.5rem; } }
@media (max-width: 47.999rem) {
  .topbar { padding: .5rem 1rem; align-items: start; flex-direction: column; gap: .25rem; }
  .brand span { display: none; }
  nav { width: 100%; justify-content: space-between; gap: .5rem; font-size: .875rem; }
  main { padding: 1.5rem 1rem 2rem; }
  form { padding: 1rem; }
  h1 { font-size: 1.75rem; }
  .target-bar { flex-direction: column; gap: 1rem; }
  .target-field { width: 100%; }
  .weight-total { text-align: left; }
  .grade-row { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .row-actions { padding: 0; flex-direction: row; align-items: center; justify-content: space-between; gap: .5rem; }
  .score-status { margin: 0; }
  .action-bar { flex-direction: column; }
  .action-bar .primary { width: 100%; }
  .secondary-actions { display: grid; grid-template-columns: 1fr; }
  .measure { flex-direction: column; align-items: start; gap: .25rem; }
  dt { max-width: 100%; }
  footer { padding-inline: 1rem; }
  .result-actions { display: grid; grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { button:active:enabled { transform: none; } }
