@font-face { font-family: Barlow; src: url("/barlow.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: Inter; src: url("/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  color-scheme: light;
  --paper: #f5f1e5;
  --white: #fffcf2;
  --ink: #132c3a;
  --muted: #50616a;
  --border: #b7bcad;
  --teal: #087068;
  --ribbon: #edb856;
  --mist: #e1ebe6;
  --display: Barlow, "Arial Narrow", Inter, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 400 15px/1.49 Inter, system-ui, sans-serif; }
h1, h2, h3, h4, p, dl { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-underline-offset: .2em; }
a:hover { color: var(--teal); }
:focus-visible { outline: 3px solid #a06013; outline-offset: 3px; }
.shell { width: min(1220px, calc(100% - 102px)); margin-inline: auto; }
.skip { position: fixed; z-index: 5; left: 1rem; top: 1rem; padding: 10px; background: var(--ribbon); transform: translateY(-220%); }
.skip:focus { transform: none; }
.mast { color: #fff9e9; background: var(--ink); }
.mast-inner { display: flex; justify-content: space-between; align-items: center; min-height: 61px; gap: 12px; }
.brand { display: inline-flex; gap: 8px; align-items: center; font: 800 1.84rem/.9 var(--display); text-transform: uppercase; letter-spacing: .025em; text-decoration: none; }
.brand:hover, .mast nav a:hover { color: var(--ribbon); }
.mark { position: relative; display: inline-block; width: 25px; height: 25px; background: var(--ribbon); border-radius: 2px; }
.mark::after { position: absolute; left: 8px; top: 4px; width: 8px; height: 13px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); content: ""; }
.mast nav a { font-size: .83rem; font-weight: 650; text-decoration: none; }
.intro { display: grid; align-items: end; grid-template-columns: 1fr minmax(260px,.57fr); column-gap: 30px; padding: clamp(28px, 4.8vw, 58px) 0 27px; border-bottom: 1px solid #9ba8a2; }
.kicker { margin-bottom: 4px; font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); }
h1 { font: 800 clamp(3.4rem, 6.1vw, 6.1rem)/.81 var(--display); letter-spacing: -.025em; }
h1 span { color: var(--teal); }
.intro > p { color: var(--muted); max-width: 330px; padding: 0 0 2px; font-size: clamp(.91rem, 1.35vw, 1.02rem); }
.workbench { display: grid; align-items: start; grid-template-columns: minmax(0, .93fr) minmax(0, 1.18fr); gap: 14px; margin-top: 15px; }
.inputs, .count-panel { border: 1px solid #aab7ad; border-radius: 5px; min-width: 0; }
.inputs { background: var(--white); padding: 14px; }
.panel-head, .count-head, .round-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px 13px; }
.panel-head { margin-bottom: 11px; }
.panel-head h2, .count-head h2 { font: 800 clamp(1.84rem, 3.4vw, 2.43rem)/.91 var(--display); }
.select-example { display: flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 650; color: var(--muted); }
select { background: var(--white); border: 1px solid #9ca8a0; border-radius: 3px; padding: 5px 6px; min-height: 34px; font-size: .78rem; }
fieldset { min-width: 0; margin: 0 0 11px; padding: 0; border: 0; }
legend, .strong-label { font-size: .81rem; font-weight: 760; }
#candidates { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px 7px; margin: 4px 0 6px; }
.candidate {
  display: flex;
  align-items: center;
  min-width: 0;
  background: #f5f2e7;
  border: 1px solid #bbbeb0;
  border-radius: 3px;
}
.candidate label, .bar-code {
  display: grid;
  place-items: center;
  width: 26px;
  min-height: 32px;
  flex: none;
  font-size: .72rem;
  font-weight: 780;
}
.candidate input { flex: 1 1 auto; width: 0; min-width: 0; min-height: 34px; border: 0; border-left: 1px solid #c1c5b9; padding: 4px 6px; background: #fffdf5; font-size: .8rem; }
#remove-candidate { border: 0; min-height: 34px; min-width: 30px; background: transparent; border-left: 1px solid #c1c5b9; font-size: .9rem; }
#remove-candidate:hover { background: #f3d8c9; }
#ballot-format { color: var(--muted); font-size: .77rem; margin: 2px 0 5px; }
code { background: #ebe5ce; border-radius: 2px; padding: 1px 3px; font: .94em ui-monospace, Menlo, monospace; }
textarea {
  display: block;
  width: 100%;
  border: 1px solid #aeb6a7;
  min-height: 100px;
  resize: vertical;
  background: #f9f8ef;
  border-radius: 3px;
  padding: 7px 9px;
  font: .85rem/1.52 ui-monospace, Menlo, monospace;
}
#ballot-error, #import-error { color: #8d3126; font-size: .82rem; margin-top: 4px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 10px; margin-top: 9px; }
#setup-note { color: var(--muted); font-size: .71rem; }
.light-button, .dark-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 5px 9px;
  border: 1px solid #93a49c;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font-size: .77rem;
  font-weight: 710;
  text-decoration: none;
  text-align: center;
}
.light-button:hover { background: #e4e9df; }
.dark-button { min-height: 39px; background: var(--ink); color: #fff9ee; border-color: var(--ink); }
.dark-button:hover { background: #02665f; color: white; border-color: #02665f; }
button:disabled { opacity: .45; cursor: default; }
#add-candidate { min-height: 31px; }
.files { border-top: 1px solid #d2d7c7; margin-top: 10px; padding-top: 6px; font-size: .79rem; }
.files summary { cursor: pointer; font-weight: 680; }
.files-tools { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.count-panel { background: var(--mist); }
.count-head { padding: 9px 12px 10px; color: #fff9e9; background: var(--ink); border-radius: 4px 4px 0 0; }
.count-head .light-button { min-height: 32px; color: #f8edcc; border-color: #9eacaf; }
.count-head .light-button:hover { background: #304955; color: white; }
.count-inner { padding: 11px 13px 13px; }
.round-nav h3 { font: 800 1.85rem/.96 var(--display); }
.round-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.round-buttons .light-button { min-height: 36px; min-width: 41px; }
.round-buttons .dark-button { min-height: 36px; }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; margin-top: 8px; border-top: 1px solid #a9bcaf; border-bottom: 1px solid #a9bcaf; padding: 5px 0 6px; }
.stats > div { display: flex; align-items: baseline; justify-content: space-between; gap: 2px 6px; padding-inline: 4px; }
.stats > div + div { border-left: 1px solid #a9bcaf; }
.stats dt { color: var(--muted); font-size: .69rem; font-weight: 690; }
.stats dd { margin: 0; font: 800 1.5rem/.98 var(--display); white-space: nowrap; }
#stale { margin-top: 7px; padding: 5px; border-left: 3px solid #ad6c1d; background: #f8ebc5; color: #644016; font-size: .77rem; }
#tally { padding: 0; list-style: none; display: grid; gap: 6px; margin: 10px 0 11px; }
.tally-item {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  padding: 5px 6px;
  background: #fbfaf0;
  border: 1px solid #bdc8ba;
  border-radius: 3px;
}
.tally-item[data-code="A"], .candidate[data-code="A"] { --key: #00746a; --tag: #d1e9db; }
.tally-item[data-code="B"], .candidate[data-code="B"] { --key: #aa6a15; --tag: #f5dfad; }
.tally-item[data-code="C"], .candidate[data-code="C"] { --key: #664975; --tag: #e6d9ed; }
.tally-item[data-code="D"], .candidate[data-code="D"] { --key: #a24736; --tag: #f3dcd1; }
.tally-item[data-code="E"], .candidate[data-code="E"] { --key: #3a6383; --tag: #d9e8f5; }
.tally-item[data-code="F"], .candidate[data-code="F"] { --key: #537034; --tag: #e1eccd; }
.tally-item[data-code="G"], .candidate[data-code="G"] { --key: #8c5266; --tag: #f3dee4; }
.tally-item[data-code="H"], .candidate[data-code="H"] { --key: #6f5e44; --tag: #e7e0d2; }
.candidate label, .bar-code { background: var(--tag); }
.bar-code { width: 25px; min-height: 29px; border-radius: 3px; }
.bar-detail { min-width: 0; }
.bar-detail > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1px 6px; }
.bar-detail strong { font-size: .78rem; overflow-wrap: anywhere; }
.bar-detail span { color: var(--muted); font-size: .67rem; }
meter { width: 100%; height: 9px; display: block; border: 0; background: #dedfd1; color: var(--key); border-radius: 3px; margin-top: 3px; }
meter::-webkit-meter-bar { background: #dedfd1; border: 0; border-radius: 3px; }
meter::-webkit-meter-optimum-value { background: var(--key); border-radius: 2px; }
meter::-moz-meter-bar { background: var(--key); border-radius: 2px; }
.bar-number { text-align: right; min-width: 1.4rem; font: 800 1.7rem/.94 var(--display); }
.round-note { padding: 8px 10px; background: #f3e6bd; border-left: 3px solid #b87d23; border-radius: 1px 4px 4px 1px; }
.round-note h4 { font-size: .83rem; }
.round-note p { color: #4c4b3e; font-size: .76rem; margin-top: 3px; }
#tie-form { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 5px; }
#tie-form label { flex-basis: 100%; font-weight: 680; font-size: .74rem; }
#tie-select { max-width: 100%; }
.scope { color: var(--muted); font-size: .8rem; margin: 13px 0 17px; }
footer { border-top: 1px solid #b7c2b5; padding: 12px 0 21px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 12px; color: var(--muted); font-size: .79rem; }
footer span:first-child { font-weight: 740; }
.notice { background: var(--ribbon); padding: 9px; margin-block: 9px; }
dialog { width: min(457px, calc(100% - 24px)); color: var(--ink); background: var(--white); border: 1px solid var(--ink); border-radius: 5px; padding: 17px; }
dialog::backdrop { background: #132c3a99; }
dialog h2 { font: 800 2.35rem/.95 var(--display); margin-bottom: 11px; }
dialog label, dialog input, dialog p { display: block; margin: 6px 0; }
dialog input { width: 100%; font-size: .8rem; }
dialog p { font-size: .83rem; }
.guide { width: min(770px,100%); margin: clamp(34px, 6vw, 78px) auto 32px; }
.guide .lede { margin-top: 16px; font-size: 1.07rem; color: var(--muted); }
.guide section { margin-top: 21px; border-top: 1px solid var(--border); padding-top: 13px; }
.guide h2 { font: 800 clamp(1.9rem, 4vw, 2.48rem)/.94 var(--display); }
.guide section p { margin-top: 7px; color: var(--muted); }
.guide .guide-activity { padding: 14px; background: #f0e1b2; border: 1px solid #b8aa81; border-radius: 5px; }
.guide-activity .dark-button { margin-top: 11px; }
@media (max-width: 960px) {
  .shell { width: calc(100% - 64px); }
}
@media (max-width: 690px) {
  .shell { width: calc(100% - 24px); }
  .mast-inner { min-height: 52px; }
  .brand { font-size: 1.59rem; }
  .intro { grid-template-columns: 1fr; row-gap: 12px; padding: 24px 0 14px; }
  h1 { font-size: clamp(3.1rem, 10vw, 4.55rem); }
  .intro > p { max-width: 500px; }
  .workbench { grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
  .inputs, .count-inner { padding: 10px; }
  .count-head { padding-inline: 9px; }
  .controls .dark-button, .round-buttons button { min-height: 42px; }
  .candidate input { font-size: .83rem; }
}
@media (max-width: 360px) {
  .stats > div { display: grid; gap: 1px; }
  .stats dd { font-size: 1.32rem; }
  #candidates { gap: 5px; }
  .candidate label { width: 21px; }
  .candidate input { padding-inline: 4px; }
}
