:root {
  color-scheme: light;
  font-family: "Inter", system-ui, sans-serif;
  color: #172b32;
  background: #f4f7f7;
  --muted: #4b6268;
  --border: #cddbdc;
  --brand: #0a5b54;
  --brand-dark: #08453f;
  --field: #eaf4f1;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
[hidden] { display: none !important; }
.wrap { width: min(100% - 2rem, 65rem); margin-inline: auto; }
.top { background: #12353a; color: #fff; }
.top-inner { min-height: 4.3rem; display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.wordmark { display: flex; gap: .65rem; align-items: center; font-size: 1.05rem; font-weight: 700; }
.mark { display: grid; place-items: center; background: #bcece1; color: #12353a; border-radius: .55rem; width: 2rem; height: 2rem; }
.mode { border: 1px solid #75a49d; border-radius: 2rem; padding: .25rem .65rem; color: #e4f5f0; font-size: .875rem; text-align: center; }
main { padding-block: 2.5rem 4rem; }
.intro { margin-bottom: 1.6rem; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.15; letter-spacing: -.045em; }
h2, legend { font-size: 1.3rem; line-height: 1.3; font-weight: 750; }
h3 { font-size: 1.08rem; }
.intro p { margin-top: .65rem; color: var(--muted); }
#source-form, #result { padding: clamp(1rem, 3vw, 1.65rem); background: #fff; border: 1px solid var(--border); border-radius: .85rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
.hint { margin-top: .35rem; font-size: .92rem; color: var(--muted); }
.sources, .metrics, .details-grid { display: grid; gap: .75rem; }
.sources { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-block: 1rem; }
.source { display: flex; align-items: start; gap: .7rem; padding: .85rem; cursor: pointer; border-radius: .55rem; border: 1px solid var(--border); }
.source:has(input:checked) { background: var(--field); border-color: #639891; }
.source input { width: 1.1rem; height: 1.1rem; margin: .2rem 0 0; flex: 0 0 auto; accent-color: var(--brand); }
.source strong, .source small { display: block; overflow-wrap: anywhere; }
.source small { color: var(--muted); font-size: .875rem; }
button { font: inherit; cursor: pointer; min-height: 2.65rem; padding: .5rem .85rem; border: 1px solid transparent; border-radius: .45rem; font-weight: 650; color: #fff; background: var(--brand); }
button:hover:not(:disabled) { background: var(--brand-dark); }
button:disabled { cursor: default; opacity: .65; }
:focus-visible { outline: 3px solid #328197; outline-offset: 3px; }
#progress:empty { display: none; }
#progress, #problem { margin-top: .7rem; }
#problem { color: #861f16; }
#result { margin-top: 1.15rem; }
.metrics { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); margin-block: 1rem 1.4rem; }
.metric { padding: .65rem .8rem; background: #f2f7f6; border-radius: .45rem; color: var(--muted); }
.metric strong { display: block; color: #172b32; font-size: 1.55rem; line-height: 1.2; }
.result-tools, .dialog-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.switch { display: flex; border: 1px solid var(--border); padding: .15rem; border-radius: .55rem; }
.switch button, .secondary { color: var(--brand); background: #fff; }
.switch button { font-size: .875rem; min-height: 2.2rem; padding-block: .3rem; }
.secondary { border-color: var(--border); }
.switch button[aria-pressed="true"], .switch button:hover:not(:disabled), .secondary:hover:not(:disabled) { background: var(--field); }
.items { list-style: none; margin: .65rem 0 0; padding: 0; }
.items li { border-top: 1px solid var(--border); padding-block: .75rem; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: .65rem; }
.list-row p { color: var(--muted); font-size: .9rem; }
dialog { width: min(100% - 2rem, 50rem); max-height: calc(100% - 2rem); color: #172b32; background: #fff; margin: auto; padding: 1rem; border: 1px solid var(--border); border-radius: .75rem; }
dialog::backdrop { background: #10252caa; }
.details-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); margin-top: .8rem; }
.record { padding: .8rem; overflow-wrap: anywhere; background: #f3f7f7; border-radius: .45rem; }
.record dl { margin: .5rem 0 0; }
.record dt { font-size: .875rem; font-weight: 700; }
.record dd { margin: 0 0 .45rem; }
@media (max-width: 36rem) {
  .top-inner { min-height: 3.8rem; }
  .mode, .wordmark { font-size: .86rem; }
  .mark { display: none; }
  main { padding-top: 1.45rem; }
  .sources { grid-template-columns: minmax(0, 1fr); }
  .list-row { align-items: flex-start; }
}
