/* ============ Roll Call — broadsheet newspaper style ============ */

:root {
  --paper: #f9f7f1;
  --ink: #191919;
  --ink-soft: #444036;
  --ink-faint: #77715f;
  --hairline: #191919;
  --hairline-minor: #cdc8ba;
  --link-navy: #1c5687;
  --yea-green: #1e5f3e;
  --nay-red: #952722;
  --highlight: #f3ecd9;
  --display: "Playfair Display", "Didot", Georgia, serif;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Libre Franklin", "Franklin Gothic Medium", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
}

.paper-grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 40;
  opacity: .16; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.40 0 0 0 0 0.34 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--link-navy); }

/* ---------------- Masthead ---------------- */

.masthead {
  max-width: 1020px; margin: 0 auto; padding: 18px 20px 0;
  text-align: center;
}

.dateline {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--sans); font-size: 10.5px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 4px 2px;
}
.dateline-center { letter-spacing: .5em; font-size: 9px; color: var(--ink-soft); }

.masthead-title {
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  font-size: clamp(46px, 9.2vw, 92px);
  letter-spacing: .015em;
  line-height: 1.04;
  margin: 8px 0 6px;
}

.masthead-tagline {
  display: flex; justify-content: center; align-items: baseline; gap: 12px;
  font-family: var(--serif); font-style: italic; font-size: 15px;
  color: var(--ink-soft);
  padding: 6px 0;
  border-top: 3px double var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.tagline-sep { color: var(--ink-faint); }

/* ---------------- Layout ---------------- */

main { max-width: 1020px; margin: 0 auto; padding: 28px 20px 60px; }

.screen { animation: rise .45s cubic-bezier(.2,.7,.3,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

/* ---------------- Cover screen ---------------- */

.era-banner {
  text-align: center; font-family: var(--sans); font-size: 11px; font-weight: 600;
  letter-spacing: .28em; text-transform: uppercase; color: var(--link-navy);
  margin-bottom: 10px;
}

.puzzle-title {
  text-align: center; font-family: var(--display); font-weight: 800;
  font-size: clamp(36px, 6.4vw, 60px); line-height: 1.06;
  letter-spacing: -.005em;
  max-width: 820px; margin: 0 auto;
}

.puzzle-intro {
  max-width: 640px; margin: 16px auto 8px; text-align: center;
  font-size: 18.5px; line-height: 1.6; color: var(--ink-soft);
  font-style: italic;
}

.section-rule {
  display: flex; align-items: center; gap: 16px; margin: 34px 0 0;
  font-family: var(--sans); font-size: 10.5px; font-weight: 700;
  letter-spacing: .3em; text-transform: uppercase; color: var(--ink);
}
.section-rule::before, .section-rule::after {
  content: ""; flex: 1;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  height: 4px;
}

/* Senator profiles: news-brief columns with vertical rules */

.senator-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 0; margin-top: 22px;
}

.senator-card {
  padding: 4px 16px 10px;
  border-left: 1px solid var(--hairline-minor);
  animation: rise .45s cubic-bezier(.2,.7,.3,1) both;
}
.senator-card:first-child { border-left: none; padding-left: 0; }
.senator-card:last-child { padding-right: 0; }
.senator-grid .senator-card:nth-child(2) { animation-delay: .06s; }
.senator-grid .senator-card:nth-child(3) { animation-delay: .12s; }
.senator-grid .senator-card:nth-child(4) { animation-delay: .18s; }
.senator-grid .senator-card:nth-child(5) { animation-delay: .24s; }

.portrait-frame {
  position: relative; margin: 2px auto 10px; width: 104px;
  border: 1px solid var(--hairline-minor); padding: 4px; background: #fff;
}
.portrait-frame img {
  display: block; width: 100%; aspect-ratio: 225/275; object-fit: cover;
  filter: contrast(1.04) saturate(.95);
}
.party-seal {
  position: absolute; bottom: -8px; right: -8px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  font-family: var(--sans); font-size: 11px; font-weight: 700; color: var(--paper);
  background: var(--ink); border: 1.5px solid var(--paper);
}
.party-D, .party-R, .party-I { background: var(--ink); }

.senator-name {
  font-family: var(--display); font-weight: 700; font-size: 17.5px;
  line-height: 1.12; text-align: center;
}
.senator-meta {
  font-family: var(--sans); font-size: 9.5px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint);
  margin: 4px 0 9px; text-align: center;
}
.senator-blurb {
  font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); text-align: left;
}

/* ---------------- Buttons ---------------- */

.action-row { text-align: center; margin-top: 34px; }

.btn-primary {
  font-family: var(--sans); font-size: 12.5px; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--paper); background: var(--ink);
  border: 1px solid var(--ink); padding: 15px 36px; cursor: pointer;
  transition: background .15s, color .15s, opacity .2s;
}
.btn-primary:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.btn-primary:disabled { opacity: .3; cursor: not-allowed; }

.btn-ghost {
  font-family: var(--sans); font-size: 11.5px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  background: none; color: var(--ink);
  border: 1px solid var(--ink); padding: 13px 24px; cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

/* ---------------- Bill screen (article layout) ---------------- */

.bill-progress {
  display: flex; justify-content: center; gap: 10px; margin-bottom: 20px;
  font-family: var(--sans); font-size: 10px; font-weight: 600;
  letter-spacing: .26em; text-transform: uppercase; color: var(--ink-faint);
  align-items: center;
}
.pip { width: 8px; height: 8px; border: 1px solid var(--ink); border-radius: 50%; }
.pip.done { background: var(--ink); }
.pip.now { background: var(--nay-red); border-color: var(--nay-red); }

.docket {
  border-top: 3px double var(--hairline);
  padding: 20px 0 8px;
}

.docket-eyebrow {
  font-family: var(--sans); font-size: 10.5px; font-weight: 700;
  letter-spacing: .28em; text-transform: uppercase; color: var(--nay-red);
  margin-bottom: 10px;
}
.docket-title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(30px, 5vw, 48px); line-height: 1.06; margin-bottom: 8px;
  max-width: 860px;
}
.docket-date {
  font-family: var(--sans); font-size: 10.5px; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline-minor);
}
.docket-desc {
  font-size: 17px; line-height: 1.62; color: var(--ink-soft);
  margin-bottom: 8px;
}
.docket-desc::first-letter {
  font-family: var(--display); font-weight: 700;
  font-size: 3.1em; line-height: .82;
  float: left; padding: 4px 8px 0 0; color: var(--ink);
}

.whip-note {
  text-align: center; font-style: italic; color: var(--ink-faint);
  font-size: 15px; margin: 26px 0 0;
}

/* ---- ballot rows ---- */

.ballot { margin-top: 18px; border-top: 1px solid var(--hairline); }

.ballot-row {
  display: grid; grid-template-columns: 58px 1fr auto;
  gap: 16px; align-items: center;
  padding: 13px 2px;
  border-bottom: 1px solid var(--hairline-minor);
}

.ballot-portrait {
  width: 58px; height: 68px; object-fit: cover; object-position: top;
  border: 1px solid var(--hairline-minor); background: #fff; padding: 2px;
  filter: contrast(1.04) saturate(.95);
}

.ballot-id .senator-name { font-size: 18.5px; text-align: left; }
.ballot-id .senator-meta { text-align: left; margin: 2px 0 5px; }
.ballot-blurb { font-size: 13.5px; color: var(--ink-soft); line-height: 1.45; max-width: 560px; }

.stamp-pair { display: flex; gap: 8px; align-items: center; }

.stamp {
  font-family: var(--sans); font-weight: 700; font-size: 12px;
  letter-spacing: .18em; padding: 11px 18px;
  border: 1.5px solid var(--ink-faint); color: var(--ink-faint);
  background: transparent; cursor: pointer;
  transition: color .12s, border-color .12s, background .12s, transform .12s;
}
.stamp:hover { color: var(--ink); border-color: var(--ink); }

.stamp.stamped-yea {
  color: #fff; border-color: var(--yea-green); background: var(--yea-green);
  transform: rotate(-3deg) scale(1.03);
  animation: slam .18s cubic-bezier(.3,1.6,.5,1) both;
}
.stamp.stamped-nay {
  color: #fff; border-color: var(--nay-red); background: var(--nay-red);
  transform: rotate(2.5deg) scale(1.03);
  animation: slam .18s cubic-bezier(.3,1.6,.5,1) both;
}
@keyframes slam {
  from { transform: scale(1.6) rotate(-8deg); opacity: .2; }
}
.stamp.faded { opacity: .35; }

/* ---- reveal ---- */

.verdict {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 14px; font-weight: 700; color: #fff;
  animation: slam .25s cubic-bezier(.3,1.6,.5,1) both;
}
.verdict.hit { background: var(--yea-green); }
.verdict.miss { background: var(--nay-red); }

.reveal-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.reveal-label {
  font-family: var(--sans); font-size: 8px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint);
}
.your-call {
  font-family: var(--sans); font-size: 11.5px; font-weight: 700; letter-spacing: .16em;
  padding: 8px 13px; border: 1.5px dashed var(--ink-faint); color: var(--ink-soft);
}
.your-call.wrong { text-decoration: line-through; }

.actual-stamp {
  font-family: var(--sans); font-size: 11.5px; font-weight: 700; letter-spacing: .16em;
  padding: 8px 13px; border: 1.5px solid;
  animation: slam .25s cubic-bezier(.3,1.6,.5,1) both;
}
.actual-stamp.yea { color: var(--yea-green); border-color: var(--yea-green); transform: rotate(-3deg); }
.actual-stamp.nay { color: var(--nay-red); border-color: var(--nay-red); transform: rotate(2.5deg); }

.vote-note {
  grid-column: 1 / -1; font-size: 13.5px; font-style: italic;
  color: var(--ink-soft); background: var(--highlight);
  border-left: 3px solid var(--ink); padding: 8px 12px; margin-top: 4px;
}

.tally-banner {
  margin-top: 22px; padding: 12px 18px; text-align: center;
  border-top: 1px solid var(--hairline);
  border-bottom: 3px double var(--hairline);
  font-family: var(--sans); font-size: 12px; letter-spacing: .08em;
  animation: rise .4s .15s both;
}
.tally-banner strong { font-size: 14px; letter-spacing: .18em; font-weight: 700; }
.tally-round-score {
  color: var(--link-navy); font-weight: 600; margin-top: 4px; display: block;
  text-transform: uppercase; font-size: 11px; letter-spacing: .18em;
}

/* ---------------- Summary ---------------- */

.summary-score {
  text-align: center; margin: 6px 0 0;
  font-family: var(--display); font-weight: 900;
  font-size: clamp(70px, 13vw, 128px); line-height: 1;
}
.summary-score .of { font-size: .36em; color: var(--ink-faint); font-weight: 600; }

.summary-rank {
  text-align: center; font-family: var(--display); font-style: italic;
  font-weight: 700; font-size: clamp(24px, 4vw, 34px);
  margin: 4px 0 2px;
}
.summary-rank-note {
  text-align: center; color: var(--ink-faint); font-style: italic;
  margin-bottom: 30px; font-size: 15px;
}

.result-table {
  border-collapse: collapse; margin: 0 auto;
  font-family: var(--sans); font-size: 11.5px;
  border-top: 3px double var(--hairline);
  border-bottom: 3px double var(--hairline);
}
.result-table th, .result-table td { padding: 8px 12px; text-align: center; }
.result-table th {
  font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  font-size: 9.5px; color: var(--ink);
  border-bottom: 1px solid var(--hairline);
}
.result-table td { border-bottom: 1px solid var(--hairline-minor); }
.result-table tr:last-child td { border-bottom: none; }
.result-table td.hit { color: var(--yea-green); font-weight: 700; }
.result-table td.miss { color: var(--nay-red); font-weight: 700; }
.result-table td.bill-name {
  text-align: left; font-family: var(--serif); font-size: 14px; font-style: italic;
}

.share-row { display: flex; gap: 12px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.share-feedback {
  text-align: center; font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  color: var(--yea-green); margin-top: 12px; min-height: 16px; letter-spacing: .2em;
}

/* ---------------- Utility bar, stats modal ---------------- */

.utility-bar {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 10px; padding: 0 2px 8px;
}
.bmc-link { margin-right: auto; text-decoration: none; gap: 7px; }
.bmc-link .cup { font-size: 13px; line-height: 0; }

.games-menu { position: relative; }
.games-dropdown {
  display: none; position: absolute; top: 100%; right: 0; z-index: 50;
  min-width: 100%; background: var(--paper);
  border: 1.5px solid var(--ink); border-top: none;
  box-shadow: 0 6px 18px rgba(25,25,25,.18);
}
.games-menu:hover .games-dropdown,
.games-menu:focus-within .games-dropdown { display: block; }
.games-dropdown a {
  display: block; padding: 10px 16px;
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; white-space: nowrap;
  border-top: 1px solid var(--hairline-minor);
}
.games-dropdown a:first-child { border-top: none; }
.games-dropdown a:hover { background: var(--ink); color: var(--paper); }
.utility-link {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--ink); padding: 0 16px; cursor: pointer;
  height: 34px; display: inline-flex; align-items: center;
  box-sizing: border-box; line-height: 1;
  transition: background .15s, color .15s;
}
.utility-link:hover { background: var(--ink); color: var(--paper); }
#auth-link { background: var(--ink); color: var(--paper); }
#auth-link:hover { background: var(--paper); color: var(--ink); }

.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(25, 25, 25, .45);
  display: grid; place-items: center; padding: 20px;
  animation: rise .2s ease both;
}
.modal-card {
  position: relative; background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 0 14px 50px rgba(0,0,0,.35);
  max-width: 560px; width: 100%; max-height: 82vh; overflow: auto;
  padding: 24px 28px 20px;
}
.modal-close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; cursor: pointer;
  font-size: 26px; line-height: 1; color: var(--ink-faint);
}
.modal-close:hover { color: var(--ink); }

.stat-row {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 6px; margin: 18px 0 20px; text-align: center;
}
.stat-num {
  font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.1;
}
.stat-label {
  font-family: var(--sans); font-size: 8.5px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint);
  margin-top: 3px;
}

.history-scroll { max-height: 300px; overflow-y: auto; }
.history-scroll .result-table { width: 100%; }
.history-scroll .result-table td { text-align: left; }

.practice-note {
  text-align: center; font-family: var(--sans); font-size: 11px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--gold, #8d6b2d);
  border: 1px solid var(--hairline-minor); padding: 8px 14px;
  max-width: 460px; margin: 0 auto 24px;
}

.sync-note {
  text-align: center; font-family: var(--sans); font-size: 10px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint);
  margin-top: 14px;
}

@media (max-width: 560px) {
  .stat-row { grid-template-columns: repeat(3, 1fr); row-gap: 14px; }
}

/* ---------------- Colophon ---------------- */

.colophon {
  max-width: 1020px; margin: 0 auto; padding: 14px 20px 44px;
  border-top: 1px solid var(--hairline);
  font-family: var(--sans); font-size: 11px; letter-spacing: .02em;
  color: var(--ink-faint); text-align: center;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 860px) {
  .senator-grid { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
  .senator-card:nth-child(odd) { border-left: none; padding-left: 0; }
  .senator-card:nth-child(even) { padding-right: 0; }
}

@media (max-width: 720px) {
  .ballot-row { grid-template-columns: 48px 1fr; }
  .ballot-portrait { width: 48px; height: 56px; align-self: start; }
  .stamp-pair { grid-column: 1 / -1; justify-content: flex-end; }
  .masthead-tagline { flex-direction: column; gap: 0; }
  .tagline-sep { display: none; }
}

@media (max-width: 500px) {
  .senator-grid { grid-template-columns: 1fr; }
  .senator-card { border-left: none; padding: 0 0 16px;
    border-bottom: 1px solid var(--hairline-minor); }
  .senator-card:last-child { border-bottom: none; }
}

/* ---------------- Court edition ---------------- */

.bench-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 18px 14px; margin-top: 22px; max-width: 720px; margin-left: auto; margin-right: auto;
}

.question-box {
  border: 2px solid var(--ink); padding: 16px 22px; margin: 6px 0 4px;
  background: var(--highlight);
}
.question-label {
  font-family: var(--sans); font-size: 9.5px; font-weight: 700;
  letter-spacing: .28em; text-transform: uppercase; color: var(--nay-red);
  margin-bottom: 6px;
}
.question-text {
  font-family: var(--display); font-style: italic; font-weight: 600;
  font-size: clamp(17px, 2.6vw, 22px); line-height: 1.35;
}

.held-banner {
  margin-top: 22px; padding: 14px 18px; text-align: center;
  border-top: 3px double var(--hairline);
  border-bottom: 3px double var(--hairline);
  animation: rise .4s .15s both;
}
.held-line {
  font-family: var(--display); font-weight: 800; font-size: clamp(20px, 3.4vw, 28px);
}
.held-line .held-yes { color: var(--yea-green); }
.held-line .held-no { color: var(--nay-red); }
.tally-bonus {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; margin-top: 6px;
}
.tally-bonus.hit { color: var(--yea-green); }
.tally-bonus.miss { color: var(--ink-faint); }

@media (max-width: 560px) { .bench-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- Court: horizontal bench on desktop, live yes/no count ---- */

.live-count {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 55; display: flex; gap: 12px; align-items: baseline;
  background: var(--paper); border: 2px solid var(--ink);
  padding: 10px 22px; box-shadow: 0 6px 20px rgba(25,25,25,.28);
  font-family: var(--sans); font-size: 12px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; white-space: nowrap;
}
.lc-yes { color: var(--yea-green); }
.lc-no { color: var(--nay-red); }
.lc-left { color: var(--ink-faint); font-weight: 600; }
.lc-sep { color: var(--hairline-minor); }

/* keep the decision button clear of the fixed counter */
.screen.has-count { padding-bottom: 92px; }
.screen.has-count .action-row { margin-bottom: 12px; }
