/* Form 1040-AI — TaxCalcBench leaderboard
   Colors sampled from the 2025 Form 1040 fillable PDF. */

:root {
  color-scheme: light;

  --desk: #d8dcdf;
  --paper: #ffffff;
  --mint: #ddfffb;
  --mint-deep: #c4f3ed;
  --field: #f1f4ff;
  --field-deep: #e2e8ff;
  --shade: #c0c0c0;
  --ink: #0a0a0a;
  --ink-soft: #3c4146;
  --ink-blue: #1b2a78;
  --bar: #c5d0fb;
  --stamp: #c8202f;

  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Courier Prime", "Courier New", Courier, monospace;
  --sig: "Mrs Saint Delafield", "Snell Roundhand", cursive;

  --gutter: 148px;
  --rule: 1px solid var(--ink);
  --rule-2: 2px solid var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink-blue); }
b, strong { font-weight: 750; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--field); padding: 0 3px; }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--ink-blue); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* ───────── Desk & sheets ───────── */

.desk {
  padding: 40px 24px 64px;
  display: grid;
  gap: 32px;
  justify-items: center;
}

.sheet {
  width: 100%;
  max-width: 1260px;
  background: var(--paper);
  padding: 34px 40px 26px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 14px 40px -8px rgba(0, 0, 0, 0.22);
  position: relative;
  /* Keeps the stamp's scale-in animation from widening the page on phones. */
  overflow: hidden;
  overflow: clip;
}

/* ───────── Checkboxes (form-style squares with a typed X) ───────── */

input[type="checkbox"], input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 17px;
  height: 17px;
  margin: 0;
  border: 1px solid #6b6f73;
  border-radius: 0;
  background: #fff;
  display: inline-grid;
  place-content: center;
  vertical-align: -3px;
  cursor: pointer;
}
input[type="checkbox"]::after, input[type="radio"]::after,
.box.is-x::after {
  content: "X";
  font: 700 15px/1 var(--mono);
  transform: scale(0);
  transition: transform 90ms ease-out;
}
input:checked::after, .box.is-x::after { transform: scale(1); }
input:disabled { cursor: not-allowed; background: #f3f3f3; border-color: #a5a8ab; }

.box {
  display: inline-grid;
  place-content: center;
  width: 17px;
  height: 17px;
  border: 1px solid #6b6f73;
  background: #fff;
  vertical-align: -3px;
}

/* ───────── Header ───────── */

.fh {
  display: grid;
  grid-template-columns: auto 1fr auto auto 268px;
  align-items: stretch;
  background: var(--mint);
  border-bottom: var(--rule-2);
  min-height: 70px;
}

.fh > * { padding: 4px 10px; }

.fh-num {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 4px;
  border-right: var(--rule);
}
.fh-form {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.fh-big {
  font-weight: 900;
  font-stretch: semi-condensed;
  font-size: 54px;
  line-height: 0.9;
  letter-spacing: -0.035em;
}
.fh-suffix { font-size: 0.62em; letter-spacing: -0.02em; margin-left: 1px; }

.fh-title { display: flex; flex-direction: column; justify-content: center; gap: 2px; border-right: var(--rule); }
.fh-dept { font-size: 12.5px; }
.fh-title h1 {
  margin: 0;
  font-size: 29px;
  font-weight: 800;
  font-stretch: semi-condensed;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.fh-year {
  display: flex;
  align-items: center;
  font-size: 54px;
  font-weight: 800;
  font-stretch: semi-condensed;
  line-height: 1;
  letter-spacing: -0.02em;
  border-right: var(--rule);
  padding: 0 12px;
}
.fh-year-outline {
  color: transparent;
  -webkit-text-stroke: 1.3px var(--ink);
  font-weight: 500;
}

.fh-omb {
  display: flex;
  align-items: flex-end;
  font-size: 12.5px;
  white-space: nowrap;
  padding-bottom: 8px;
  border-right: var(--rule);
}
.fh-omb a { margin-left: 4px; }

.fh-irs {
  position: relative;
  display: flex;
  align-items: flex-start;
  font-size: 11.5px;
  padding-top: 6px;
  color: var(--ink-soft);
}
.fh-irs > span { max-width: 104px; }

.stamp {
  position: absolute;
  right: 8px;
  top: 5px;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 4px 12px 3px;
  border: 3px double var(--stamp);
  outline: 1.5px solid var(--stamp);
  outline-offset: 2px;
  color: var(--stamp);
  font-stretch: condensed;
  text-transform: uppercase;
  transform: rotate(-8deg);
  filter: url(#ink);
  opacity: 0.9;
  mix-blend-mode: multiply;
  pointer-events: none;
  animation: stamp-in 420ms cubic-bezier(.2, 1.6, .4, 1) 300ms both;
}
.stamp-top, .stamp-bot { font-weight: 900; font-size: 13px; letter-spacing: 0.2em; line-height: 1.1; }
.stamp-date { font-weight: 900; font-size: 22px; letter-spacing: 0.06em; line-height: 1; }

@keyframes stamp-in {
  from { transform: rotate(-8deg) scale(1.9); opacity: 0; }
  to   { transform: rotate(-8deg) scale(1); opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .stamp { animation: none; }
  html { scroll-behavior: auto; }
}

/* ───────── Strips under the header ───────── */

.strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: var(--rule);
  font-size: 14px;
  min-height: 30px;
  padding: 4px 0;
}
.strip-year p b { font-family: var(--mono); background: var(--field); padding: 1px 8px; }
.strip-right { white-space: nowrap; font-weight: 500; }

.strip-editions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px 28px;
  background: var(--mint);
  padding: 6px 4px;
}
.strip-editions label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.strip-editions .ed-note { color: var(--ink-soft); }

/* ───────── Identification block ───────── */

.ident {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 250px;
  grid-template-areas:
    "name name last last ssn"
    "pub  pub  paper paper contact"
    "addr addr addr apt  camp"
    "city city state zip camp";
  background: var(--mint);
  border-bottom: var(--rule-2);
}

.f {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: var(--rule);
  border-bottom: var(--rule);
  background: var(--mint);
}
.f-label {
  font-size: 12.5px;
  padding: 3px 6px 2px;
  line-height: 1.2;
}
.f-value, .f-input {
  display: block;
  margin-top: auto;
  min-height: 32px;
  padding: 6px 8px 4px;
  background: var(--field);
  border: 0;
  border-radius: 0;
  font: 400 15px/1.35 var(--mono);
  color: var(--ink);
  overflow-wrap: anywhere;
  width: 100%;
}
a.f-value { text-decoration: none; }
a.f-value:hover { text-decoration: underline; }
.f-input { appearance: none; -webkit-appearance: none; }
.f-input::placeholder { color: #7d8597; }
.f-input:focus { outline: 2px solid var(--ink-blue); outline-offset: -2px; background: #fff; }
select.f-input {
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.ssn { letter-spacing: 0.04em; }

.f-name    { grid-area: name; }
.f-last    { grid-area: last; }
.f-ssn     { grid-area: ssn; border-right: 0; }
.f-pub     { grid-area: pub; }
.f-paper   { grid-area: paper; }
.f-contact { grid-area: contact; border-right: 0; }
.f-addr    { grid-area: addr; }
.f-apt     { grid-area: apt; }
.f-city    { grid-area: city; border-bottom: 0; }
.f-state   { grid-area: state; border-bottom: 0; }
.f-zip     { grid-area: zip; border-bottom: 0; }

.campaign {
  grid-area: camp;
  padding: 5px 8px 6px;
  font-size: 12.5px;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.campaign-title { font-weight: 800; font-size: 15px; font-stretch: semi-condensed; }
.campaign-boxes { display: flex; justify-content: center; gap: 22px; margin-top: auto; font-weight: 700; font-size: 14px; }
.campaign-boxes label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

/* ───────── Sections ───────── */

.sec {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  border-bottom: var(--rule-2);
}
.sec-label {
  padding: 8px 12px 10px 0;
  background: var(--paper);
  font-size: 13px;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sec-label h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  font-stretch: semi-condensed;
  line-height: 1;
  letter-spacing: -0.01em;
}
.sec-body {
  background: var(--mint);
  padding: 8px 0 10px 12px;
  min-width: 0;
}
.sec-tight .sec-body { padding-top: 6px; padding-bottom: 6px; }

/* Ranking status */
.rank-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-flow: column;
  grid-template-rows: repeat(3, auto);
  gap: 6px 24px;
  padding: 2px 0 8px;
}
.rank-grid label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 16px; }
.rank-grid label.is-disabled { color: #8a8f94; cursor: not-allowed; }
.rank-grid .hint { color: var(--ink-soft); font-size: 13px; }
.rank-best {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-top: 1px dashed #7aa;
  padding-top: 8px;
  font-size: 14px;
  cursor: pointer;
}
.rank-best input { margin-top: 1px; }

/* Web search */
.web-row { display: flex; align-items: center; gap: 16px; justify-content: space-between; font-size: 14px; }
.yesno { display: flex; gap: 18px; font-weight: 700; flex: none; padding-right: 10px; }
.yesno label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.yesno.static { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; }

/* Providers — column-major grid on desktop, cards on mobile */
.prov-more { margin-top: auto; }
.prov-more input { margin-left: 4px; }
.prov {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(6, auto);
  grid-template-columns: 150px repeat(4, minmax(0, 1fr));
  border-top: var(--rule);
  margin-left: -12px;
}
.prov-labels, .prov-col { display: contents; }
.pr {
  padding: 5px 8px;
  border-bottom: var(--rule);
  border-left: var(--rule);
  min-height: 31px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.prov-labels .pr { border-left: 0; font-size: 13px; padding-left: 12px; }
.prov-labels .pr b { margin-right: 4px; }
.pr-head { justify-content: center; font-weight: 800; font-size: 14px; }
.pr-val { background: var(--field); font-family: var(--mono); font-size: 14.5px; }
.pr-name { font-weight: 700; }
.pr-checks { font-size: 13px; flex-wrap: wrap; gap: 4px 12px; }
.pr-checks span { display: inline-flex; gap: 5px; align-items: center; }
.pr-checks .box { width: 15px; height: 15px; }
.pr-checks .box.is-x::after { font-size: 13px; }
.pr[data-label]::before { display: none; }
.prov-col.is-empty .pr-val { color: transparent; }
.prov-extra { font-size: 13.5px; padding: 8px 0 0; }

/* ───────── Results: the leaderboard lines ───────── */

.sec-results .attach { font-size: 13px; }
.callout {
  margin-top: 12px;
  border: 1px solid var(--ink);
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 13px;
  margin-right: -6px;
  background: #fff;
}

.lines {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  margin: -8px 0 -10px -12px;
  width: calc(100% + 12px);
}

.lines th, .lines td { padding: 0; }

.lines thead th {
  vertical-align: bottom;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.15;
  border-bottom: var(--rule);
  padding: 6px 4px 5px;
  text-align: left;
}
.lines .c-ln { width: 40px; padding-left: 12px; }
.lines .c-box { width: 38px; }
.lines .c-amt { width: 98px; }
.lines thead .c-desc { font-size: 13px; padding-left: 6px; }
.lines thead .c-amt { border-left: var(--rule); text-align: center; padding: 0; }
.lines thead .c-amt button {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  width: 100%;
  height: 100%;
  min-height: 58px;
  padding: 6px 6px 5px;
  cursor: pointer;
  text-align: center;
}
.lines thead .c-amt button:hover { background: var(--mint-deep); }
.lines thead .c-amt button:focus-visible { outline: 2px solid var(--ink-blue); outline-offset: -2px; }
.lines thead .c-amt .col-letter { font-weight: 800; font-size: 13px; }
.lines thead .c-amt.is-active button { background: var(--ink); color: #fff; }
.col-pick, .pick-hint { display: none; }
.lines thead .c-amt .sort-dir { font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.8; }

.lines tbody td { height: 36px; vertical-align: middle; }

.line .c-ln { font-weight: 800; font-size: 15px; }
.line .c-desc { padding-right: 8px; }

.desc {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 8px;
  width: 100%;
  padding: 7px 0 6px 6px;
  cursor: pointer;
  font-size: 16px;
}
.desc:focus-visible { outline: 2px solid var(--ink-blue); outline-offset: -2px; }
.desc .nm { font-weight: 500; white-space: nowrap; }
.dots {
  flex: 1 1 28px;
  min-width: 28px;
  height: 4px;
  align-self: baseline;
  background-image: radial-gradient(circle, var(--ink) 0.9px, transparent 1.2px);
  background-size: 11px 4px;
  background-repeat: repeat-x;
  background-position: right center;
  opacity: 0.85;
}

.ws, .cov {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  font-stretch: semi-condensed;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  padding: 1px 4px 0;
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: 1px;
}
.ws { color: var(--ink-blue); }
.cov { color: #8a4b00; }

.lines .c-box {
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  border-left: var(--rule);
}
.lines tbody .c-box, .lines tfoot .c-box { border-bottom: var(--rule); background: var(--mint); }

.lines tbody .c-amt, .lines tfoot .c-amt {
  position: relative;
  background: var(--field);
  border-left: var(--rule);
  border-bottom: var(--rule);
  text-align: right;
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 15px;
  white-space: nowrap;
}
.c-amt .v { position: relative; }
.c-amt .bar {
  position: absolute;
  left: 6px;
  bottom: 4px;
  height: 4px;
  width: calc((100% - 12px) * var(--w, 0));
  background: var(--ink-blue);
  opacity: 0.55;
  transition: width 380ms cubic-bezier(.2, .8, .2, 1);
}
.c-amt.is-active { font-weight: 700; }
.c-amt.is-best .v { font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.c-amt.is-empty::after { content: ""; }

.line:hover .c-ln, .line:hover .c-desc, .line.is-open .c-ln, .line.is-open .c-desc { background: var(--mint-deep); }
.line:hover .c-amt, .line.is-open .c-amt { background-color: var(--field-deep); }

.line.is-new { animation: line-in 360ms ease-out both; animation-delay: calc(var(--i, 0) * 14ms); }
@keyframes line-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .line.is-new { animation: none; } .c-amt .bar { transition: none; } }

.lines tfoot td { height: 38px; border-top: var(--rule-2); }
.lines tfoot .c-ln { font-weight: 800; }
.lines tfoot .c-desc { padding: 0 8px 0 6px; font-size: 14px; }
.lines tfoot .c-desc .desc-static { display: flex; align-items: baseline; gap: 8px; }

.empty-line td { height: 64px; text-align: center; font-size: 14px; color: var(--ink-soft); }

/* Schedule M (expanded line) */
.sched td { padding: 6px 10px 14px 12px; background: var(--mint-deep); border-bottom: var(--rule); }
.schm { background: #fff; border: var(--rule); font-size: 14px; animation: sched-in 220ms ease-out both; }
@keyframes sched-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.schm-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  border-bottom: var(--rule-2);
}
.schm-tab {
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  font-stretch: semi-condensed;
  padding: 6px 10px;
  font-size: 15px;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.05;
}
.schm-tab small { font-weight: 500; font-size: 10.5px; letter-spacing: 0; }
.schm-title { padding: 6px 12px; display: flex; flex-direction: column; justify-content: center; }
.schm-title b { font-size: 17px; font-stretch: semi-condensed; }
.schm-title span { font-size: 12px; color: var(--ink-soft); }
.schm-yr { font-size: 26px; font-weight: 800; font-stretch: semi-condensed; padding: 4px 12px; border-left: var(--rule); display: flex; align-items: center; }

.schm-lines { display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(140px, 0.9fr); }
.schm-lines > * { border-bottom: 1px solid #9aa; padding: 6px 8px; min-width: 0; }
.schm-lines > :nth-last-child(-n+3) { border-bottom: 0; }
.schm-n { font-weight: 800; }
.schm-d { display: flex; align-items: baseline; gap: 8px; }
.schm-v { background: var(--field); font-family: var(--mono); border-left: var(--rule); overflow-wrap: anywhere; }
.schm-v .box { margin-right: 4px; }
.schm-v .gap { display: inline-block; width: 12px; }
.ranks { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.ranks span b { font-family: var(--sans); font-size: 12px; margin-right: 3px; }
.schm-notes {
  border-top: var(--rule);
  padding: 8px 12px 10px;
  font-size: 13px;
  line-height: 1.45;
  background: #fbfbf7;
}
.schm-notes p + p { margin-top: 6px; }
.schm-notes .lbl { font-weight: 800; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; display: block; margin-bottom: 2px; }

/* ───────── Page footer & page 2 ───────── */

.ff {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  padding-top: 5px;
}
.ff b { font-size: 14px; font-weight: 900; font-stretch: semi-condensed; }

.p2-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  border-bottom: var(--rule-2);
  padding-bottom: 4px;
}

.pl {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 40px 190px;
  align-items: stretch;
  margin-left: -12px;
  min-height: 36px;
}
.pl-n { font-weight: 800; padding: 8px 0 0 12px; }
.pl-d { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px 6px 0; font-size: 15px; }
.pl-box { border-left: var(--rule); border-bottom: var(--rule); text-align: center; font-weight: 800; font-size: 13px; display: grid; place-content: center; }
.pl-v {
  background: var(--field);
  border-left: var(--rule);
  border-bottom: var(--rule);
  font: 700 16px/1 var(--mono);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px;
}
.pl-v.is-shade { background: var(--shade); }
.pl-wide {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 6px 10px 6px 0;
  font-size: 15px;
}
.pl-wide .inline-field {
  background: var(--field);
  font-family: var(--mono);
  padding: 4px 8px;
  min-width: 180px;
  border-bottom: var(--rule);
}
.pl-wide .grow { flex: 1; }
.pl-wide label { display: inline-flex; gap: 6px; align-items: center; }

.designee-q { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 14px; padding-bottom: 8px; }

.grid-fields {
  display: grid;
  margin: 0 0 -10px -12px;
  border-top: var(--rule);
}
.grid-fields .f { border-bottom: 0; border-top: 0; box-shadow: 0 1px 0 var(--ink); }
.grid-fields .f:last-child { border-right: 0; }
.designee { grid-template-columns: 1.6fr 1.2fr 0.8fr; }
.sign { grid-template-columns: 1.7fr 0.7fr 1.2fr 1.4fr; }
.sign .f:nth-child(4) { border-right: 0; }
.preparer { grid-template-columns: 1.2fr 1.2fr 1fr 1.1fr; }
.preparer .f:nth-child(4) { border-right: 0; }
.preparer .f:nth-child(6) { grid-column: span 2; }
.preparer .f:nth-child(7) { border-right: 0; }

.perjury { font-size: 13px; line-height: 1.35; padding-bottom: 8px; }

.f-value.sig {
  font-family: var(--sig);
  font-size: 34px;
  line-height: 1;
  color: var(--ink-blue);
  padding: 2px 10px 0;
  min-height: 40px;
  overflow: visible;
  white-space: nowrap;
}

/* ───────── Instructions sheet ───────── */

.instr { padding-top: 30px; }
.instr-head {
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 4px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 18px;
}
.instr-head .instr-year { font-size: 64px; font-weight: 800; font-stretch: semi-condensed; line-height: 0.9; letter-spacing: -0.02em; }
.instr-head h2 { margin: 0; font-size: 34px; font-weight: 900; font-stretch: semi-condensed; line-height: 1; }
.instr-head p { font-size: 15px; margin-top: 4px; }

.instr-cols {
  columns: 2;
  column-gap: 40px;
  font-size: 14.5px;
  line-height: 1.5;
}
.instr-cols section > * + * { margin-top: 10px; }
.instr-cols p, .instr-cols li { break-inside: avoid; }
.instr-cols h3, .instr-cols h4 { break-after: avoid; }
.instr-bar {
  background: var(--ink);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  font-stretch: semi-condensed;
  padding: 3px 8px;
  margin: 18px 0 0;
}
.instr-cols section:first-child > .instr-bar:first-child { margin-top: 0; }
.instr-cols h4 { margin: 14px 0 0; font-size: 15px; font-weight: 800; }
.instr-line b { font-weight: 800; }
.instr-notes { padding-left: 18px; margin: 10px 0 0; }
.instr-notes li + li { margin-top: 8px; }
.instr-small { font-size: 13px; color: var(--ink-soft); }
.noscript { padding: 16px 12px; font-size: 15px; }

/* ───────── Responsive ───────── */

@media (max-width: 1120px) {
  .lines .opt-md:not(.is-active) { display: none; }
}

@media (max-width: 980px) {
  :root { --gutter: 120px; }
  .sheet { padding: 26px 24px 22px; }
  .fh { grid-template-columns: auto 1fr auto 200px; }
  .fh-omb { display: none; }
  .fh-title h1 { font-size: 25px; }
  .ident {
    grid-template-columns: 1fr 1fr 1fr 210px;
    grid-template-areas:
      "name name last ssn"
      "pub  paper paper contact"
      "addr addr apt camp"
      "city state zip camp";
  }
  .prov { grid-template-columns: 120px repeat(4, minmax(0, 1fr)); }
  .lines .opt-lg:not(.is-active) { display: none; }
  .sign { grid-template-columns: 1fr 0.6fr 1fr; }
  .sign .f:nth-child(4), .sign .f:nth-child(8) { grid-column: 1 / -1; border-right: 0; }
  .sign .f:nth-child(3), .sign .f:nth-child(7) { border-right: 0; }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .desk { padding: 16px 16px 40px; gap: 20px; }
  .sheet { padding: 14px 12px 14px; }

  /* Phone: compact header so the leaderboard starts in the first screen. */
  .fh {
    position: relative;
    min-height: 0;
    grid-template-columns: auto 1fr;
    grid-template-areas: "num year" "title title";
  }
  .fh-num { grid-area: num; border-right: 0; }
  .fh-big { font-size: 42px; }
  .fh-year { grid-area: year; justify-content: flex-end; border-right: 0; font-size: 42px; }
  .fh-title { grid-area: title; border-right: 0; border-top: var(--rule); padding: 6px 8px 7px; gap: 4px; }
  .fh-dept { max-width: 54%; min-height: 43px; font-size: 11.5px; line-height: 1.25; }
  .fh-title h1 { font-size: 23px; }
  .fh-irs { display: contents; }
  .fh-irs > span { display: none; }
  .stamp { top: auto; bottom: 38px; right: 10px; padding: 3px 9px 2px; }
  .stamp-top, .stamp-bot { font-size: 10px; }
  .stamp-date { font-size: 16px; }

  .strip { font-size: 13px; flex-wrap: wrap; gap: 4px 12px; }
  .strip-year { display: none; }
  .strip-editions { gap: 6px 22px; padding: 7px 6px; }
  .strip-editions .ed-note { display: none; }

  /* Only search and provider stay above the table; the rest repeats elsewhere. */
  .ident { grid-template-columns: 1fr 1fr; grid-template-areas: "name last"; }
  .f-ssn, .f-pub, .f-paper, .f-contact, .f-addr, .f-apt, .f-city, .f-state, .f-zip, .campaign { display: none; }
  .f-name { border-right: var(--rule); border-bottom: 0; }
  .f-last { border-right: 0; border-bottom: 0; }
  .ident .f-label { font-size: 11.5px; }
  .ident .f-input { font-size: 16px; min-height: 34px; } /* 16px stops iOS zooming on focus */

  /* Leaderboard first; the other controls follow it. */
  #form { display: flex; flex-direction: column; }
  #form > .sec-results { order: 1; }
  #form > .sec-rank { order: 2; }
  #form > .sec-web { order: 3; }
  #form > .sec-providers { order: 4; }
  #form > .ff { order: 5; }

  /* Tap the highlighted column header to change the ranking. */
  .lines thead .c-amt.is-active { position: relative; }
  .col-pick { display: block; position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; cursor: pointer; }
  .pick-hint { display: block; font-size: 10px; text-decoration: underline; text-underline-offset: 2px; }

  .sec { grid-template-columns: 1fr; }
  .sec-label { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 0 6px; }
  .sec-label h2 { font-size: 21px; }
  .sec-label .callout, .sec-label .prov-more, .sec-results .sec-label p:not(.callout) { display: none; }
  .sec-results .sec-label .callout { display: block; margin: 0 0 0 auto; padding: 4px 8px; font-size: 12px; border-radius: 10px; }
  .sec-body { padding-left: 8px; padding-right: 0; }

  .rank-grid { grid-template-columns: 1fr; grid-auto-flow: row; grid-template-rows: none; }
  .rank-grid label { font-size: 15px; }
  .web-row { flex-direction: column; align-items: flex-start; gap: 8px; }

  .prov { display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: row; grid-template-rows: none; gap: 8px; border-top: 0; margin-left: 0; padding-right: 8px; }
  .prov-labels { display: none; }
  .prov-col { display: block; border: var(--rule); background: var(--mint); }
  .prov-col.is-empty { display: none; }
  .prov-col .pr { border-left: 0; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 0; }
  .prov-col .pr:last-child { border-bottom: 0; }
  .prov-col .pr[data-label]::before { display: block; content: attr(data-label); font-family: var(--sans); font-size: 11px; color: var(--ink-soft); }
  .pr-head { align-items: center !important; }

  .lines { margin-left: -8px; width: calc(100% + 8px); }
  .lines .c-ln { width: 30px; padding-left: 6px; }
  .lines .c-box { width: 28px; }
  .lines .c-amt { width: 92px; }
  .lines .c-amt:not(.is-active) { display: none; }
  .desc { font-size: 15px; padding-left: 4px; }
  .lines tbody .c-amt, .lines tfoot .c-amt { font-size: 14px; padding: 0 6px; }
  .lines tfoot .c-desc { font-size: 13px; }
  .sched td { padding: 6px 6px 12px 6px; }
  .schm-head { grid-template-columns: auto 1fr; }
  .schm-yr { display: none; }
  .schm-lines { grid-template-columns: 28px minmax(0, 1fr); }
  .schm-lines .schm-v { grid-column: 2; border-left: 0; margin-bottom: 4px; }
  .schm-lines > * { border-bottom: 0; padding: 4px 6px; }
  .schm-lines .schm-v { border-bottom: 1px solid #9aa; }

  .pl { grid-template-columns: 34px minmax(0, 1fr) 30px 110px; margin-left: -8px; }
  .pl-n { padding-left: 8px; }
  .pl-d { font-size: 14px; }
  .pl-v { font-size: 14px; padding: 0 6px; }
  .pl-wide .inline-field { min-width: 0; }
  .designee-q { flex-direction: column; align-items: flex-start; }
  .grid-fields, .designee, .sign, .preparer { grid-template-columns: 1fr 1fr; margin-left: -8px; }
  .grid-fields .f { border-right: var(--rule) !important; }
  .grid-fields .f:nth-child(2n) { border-right: 0 !important; }
  .grid-fields .f, .sign .f:nth-child(n), .preparer .f:nth-child(n) { grid-column: auto; }
  .sign .f:nth-child(4), .sign .f:nth-child(8), .preparer .f:nth-child(6) { grid-column: 1 / -1; border-right: 0 !important; }
  .designee .f:last-child { grid-column: 1 / -1; }
  .preparer .f-blank { display: none; }
  .grid-fields .f-value:not(.sig) { font-size: 14px; }
  .preparer .f:nth-child(3) { border-right: var(--rule) !important; }
  .preparer .f:nth-child(5) { border-right: 0 !important; }
  .preparer .f:nth-child(7) { grid-column: 1 / -1; border-right: 0 !important; }
  .ff { font-size: 11px; }

  .instr-head { gap: 12px; }
  .instr-head .instr-year { font-size: 44px; }
  .instr-head h2 { font-size: 24px; }
  .instr-cols { columns: 1; font-size: 14px; }
}

@media print {
  body { background: #fff; }
  .desk { padding: 0; gap: 0; }
  .sheet { box-shadow: none; max-width: none; page-break-after: always; }
  .stamp { animation: none; }
}
