/* Bellwether, laid out like Pinpoint: the game fills the window below the site banner.
   A title bar with progress pips runs across the top. Wide screens show the precinct and
   running table on the left and the call card on the right, each scrolling on its own.
   Phones show one pane at a time, picked from a tab bar at the bottom. */
.tp-page {
  --tp-ink: var(--iv-page-text, #242220);
  --tp-paper: var(--iv-page-bg, #fafaf7);
  --tp-orange: var(--iv-orange, #de7441);
  --tp-soft: #f2b08e;
  --tp-rule: var(--iv-rule, #c3c3c3);
  --tp-tint: color-mix(in srgb, var(--tp-ink) 6%, var(--tp-paper));
  --tp-tint2: color-mix(in srgb, var(--tp-ink) 11%, var(--tp-paper));
  --tp-sel: color-mix(in srgb, var(--tp-orange) 20%, var(--tp-paper));
  --tp-dem: #3f67b5;
  --tp-rep: #b64545;
  --tp-dem-tint: color-mix(in srgb, var(--tp-dem) 18%, var(--tp-paper));
  --tp-rep-tint: color-mix(in srgb, var(--tp-rep) 18%, var(--tp-paper));
  --tp-sans: var(--iv-font-sans, "IBM Plex Sans", sans-serif);
  --tp-mono: var(--iv-font-mono, "JetBrains Mono", monospace);
  --tp-line: 1.11px;
}

.tp-page [hidden] { display: none !important; }
.tp-main {
  color: var(--tp-ink);
  font-family: var(--tp-sans);
}

/* Site defaults set span and label to mono and recolor p, strong and label. */
:where(.tp-main) span,
:where(.tp-main) label,
:where(.tp-main) strong,
:where(.tp-main) p {
  font-family: inherit;
  color: inherit;
}



.tp-mono,
.tp-main b.tp-mono { font-family: var(--tp-mono); font-weight: 650; font-size: 0.94em; }

/* Right or wrong, big and colored */
.tp-verdict {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-left: 6px solid var(--tp-ink);
  background: var(--tp-tint);
}
.tp-verdict.is-R { border-left-color: var(--tp-rep); background: var(--tp-rep-tint); }
.tp-verdict.is-D { border-left-color: var(--tp-dem); background: var(--tp-dem-tint); }
.tp-verdict.is-hit { border-left-color: #2e8b6e; background: color-mix(in srgb, #2e8b6e 20%, var(--tp-paper)); }
.tp-main .tp-verdict-title { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.tp-main .tp-verdict-body { margin: 0; font-size: 14px; line-height: 1.45; }
.tp-verdict-num {
  display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px;
  background: var(--tp-ink); color: var(--tp-paper); font: 750 12px var(--tp-mono);
}
.tp-verdict.is-R .tp-verdict-num { background: var(--tp-rep); color: #fff; }
.tp-verdict.is-D .tp-verdict-num { background: var(--tp-dem); color: #fff; }
.tp-verdict.is-hit .tp-verdict-num { background: #2e8b6e; color: #fff; }
.tp-verdict.is-pop { animation: tp-pop 0.45s ease-out; }
@keyframes tp-pop {
  0% { transform: scale(0.96); opacity: 0.2; }
  60% { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .tp-verdict.is-pop { animation: none; } }

.tp-main .tp-select,
.tp-main .tp-input {
  height: 40px;
  width: 100%;
  margin: 0;
  padding: 0 10px;
  border: var(--tp-line) solid var(--tp-ink);
  border-radius: 0;
  background: var(--tp-paper);
  color: var(--tp-ink);
  font-family: var(--tp-mono);
  font-size: 13px;
  text-align: left;
}

.tp-main .tp-race {
  font-family: var(--tp-mono);
  font-size: 12px;
  font-weight: 650;
  margin: 0 0 6px;
}

.tp-main .tp-place { font-family: var(--tp-mono); font-size: 12px; margin: -6px 0 10px; }

.tp-main .tp-answer {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}
.tp-answer .tp-mg { font-size: 0.9em; }

/* Tables */
.tp-scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.tp-t {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--tp-mono);
  font-size: 12px;
}

.tp-t th {
  text-align: left;
  font-weight: 750;
  padding: 0 8px 6px;
  vertical-align: bottom;
  white-space: nowrap;
}

.tp-t td {
  padding: 8px;
  background: var(--tp-tint);
  border-bottom: var(--tp-line) solid var(--tp-paper);
  vertical-align: middle;
}

.tp-t .r { text-align: right; white-space: nowrap; }
.tp-t tr.is-latest td { background: var(--tp-sel); }
.tp-demo-table td:first-child { font-family: var(--tp-sans); font-size: 14px; }

.tp-so-far td:first-child { white-space: nowrap; }
.tp-place-cell { display: inline-block; vertical-align: middle; margin-left: 8px; font-weight: 650; }
.tp-place-cell span { display: block; font-weight: 400; font-size: 11px; }

.tp-mg {
  font-family: var(--tp-mono);
  font-weight: 650;
  font-size: 12px;
  padding: 2px 6px;
  white-space: nowrap;
}
.tp-mg.D { background: var(--tp-dem-tint); }
.tp-mg.R { background: var(--tp-rep-tint); }

.tp-call { font-weight: 650; padding: 2px 6px; color: #fff; white-space: nowrap; }
.tp-call.is-R { background: var(--tp-rep); }
.tp-call.is-D { background: var(--tp-dem); }
.tp-call.is-hit { background: var(--tp-ink); color: var(--tp-paper); }

.tp-num-box {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  background: var(--tp-ink);
  color: var(--tp-paper);
  font: 750 11px var(--tp-mono);
}

/* Buttons: square, mono, invert on hover */
.tp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 16px;
  border: var(--tp-line) solid var(--tp-ink);
  border-radius: 0;
  background: var(--tp-paper);
  color: var(--tp-ink);
  font: 650 12px var(--tp-mono);
  cursor: pointer;
}
.tp-main a.tp-btn { text-decoration: none; }
.tp-btn:hover,
.tp-btn[aria-pressed="true"] { background: var(--tp-ink); color: var(--tp-paper); }
.tp-btn-soft { background: var(--tp-soft); border-color: var(--tp-soft); color: #242220; }
.tp-btn-soft:hover { background: var(--tp-ink); border-color: var(--tp-ink); color: var(--tp-paper); }
.tp-btn-icon { width: 32px; min-height: 32px; height: 32px; padding: 0; font-size: 15px; }
.tp-btn:disabled { cursor: default; opacity: 0.55; }
.tp-btn:disabled:hover { background: var(--tp-paper); color: var(--tp-ink); }
.tp-btn[aria-pressed="true"]:disabled:hover { background: var(--tp-ink); color: var(--tp-paper); }
.tp-btn-soft:disabled:hover { background: var(--tp-soft); color: #242220; }

.tp-seg { display: inline-flex; }
.tp-seg .tp-btn + .tp-btn { border-left: 0; }

/* Your call */
.tp-main .tp-readout { font-size: 20px; font-weight: 600; margin: 0 0 6px; }

.tp-scale { touch-action: none; cursor: ew-resize; user-select: none; }
.tp-scale[aria-disabled="true"] { cursor: default; }
.tp-scale svg { display: block; overflow: visible; }
.tp-scale-track { fill: var(--tp-tint2); }
.tp-scale-fill.is-d { fill: var(--tp-dem); }
.tp-scale-fill.is-r { fill: var(--tp-rep); }
.tp-scale-tick { stroke: var(--tp-rule); stroke-width: 1; }
.tp-scale-tick.is-major { stroke: var(--tp-ink); stroke-opacity: 0.55; }
.tp-scale-tick.is-zero { stroke: var(--tp-ink); stroke-width: 2; }
.tp-scale-label { font: 650 11px var(--tp-mono); fill: var(--tp-ink); text-anchor: middle; }
.tp-scale-side { font: 750 11px var(--tp-mono); }
.tp-scale-side.is-d { fill: var(--tp-dem); }
.tp-scale-side.is-r { fill: var(--tp-rep); }
.tp-scale-handle { fill: var(--tp-ink); stroke: var(--tp-paper); stroke-width: 2; }
.tp-scale-final { fill: var(--tp-orange); }
.tp-scale-mark line { stroke: var(--tp-ink); stroke-opacity: 0.35; stroke-width: 1; }
.tp-scale-mark rect { stroke: var(--tp-paper); stroke-width: 1.5; }
.tp-scale-mark text { font: 750 11px var(--tp-mono); text-anchor: middle; fill: #fff; }
.tp-scale-mark.is-R rect { fill: var(--tp-rep); }
.tp-scale-mark.is-D rect { fill: var(--tp-dem); }
.tp-scale-mark.is-hit rect { fill: var(--tp-ink); }
.tp-scale-mark.is-hit text { fill: var(--tp-paper); }

.tp-main .tp-key-line { font-family: var(--tp-mono); font-size: 11px; margin: 4px 0 14px; }
.tp-key-r, .tp-key-d { font-weight: 750; padding: 1px 5px; color: #fff; }
.tp-key-r { background: var(--tp-rep); }
.tp-key-d { background: var(--tp-dem); }

.tp-exact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.tp-by { display: flex; align-items: center; gap: 8px; font: 12px var(--tp-mono); }

.tp-main .tp-feedback { font-size: 14px; line-height: 1.45; margin: 0 0 12px; }
.tp-main .tp-feedback:empty { display: none; }

/* Result and map */
.tp-main .tp-result h2 { margin-bottom: 10px; }
.tp-main .tp-result h3 { margin: 24px 0 10px; }

.tp-share-text {
  margin: 0 0 10px;
  padding: 14px 16px;
  background: var(--tp-tint);
  color: var(--tp-ink);
  font: 12px/1.6 var(--tp-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

.tp-mapwrap { position: relative; border: var(--tp-line) solid var(--tp-rule); padding: 8px; }
.tp-map svg { display: block; width: 100%; height: auto; touch-action: none; }
.tp-precinct { stroke: var(--tp-rule); stroke-width: 0.8; vector-effect: non-scaling-stroke; }
.tp-precinct.is-revealed { stroke: var(--tp-ink); stroke-width: 2.2; }
.tp-mark { pointer-events: none; }
.tp-mark rect { fill: var(--tp-ink); stroke: var(--tp-paper); stroke-width: 1.2; }
.tp-mark text { font: 750 11px var(--tp-mono); text-anchor: middle; fill: var(--tp-paper); }
.tp-map-tools { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; }
.tp-map-tools .tp-btn + .tp-btn { border-top: 0; }

.tp-note { font-size: 14px; line-height: 1.5; margin: 0 0 10px; }

.tp-below p { font-size: 14px; line-height: 1.55; margin: 0 0 10px; }

.tp-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Standout measures */
.tp-dir { display: block; font-family: var(--tp-mono); font-size: 11px; margin-top: 2px; }
.tp-t td.tp-strong { font-weight: 750; }
.tp-top { font-size: 11.5px; line-height: 1.5; white-space: nowrap; }
.tp-demo-table th:nth-child(n+2) { width: 18%; }


/* ---------- Stage ---------- */
.tp-stage {
  position: relative;
  height: calc(100dvh - var(--tp-head, 72px));
  min-height: 560px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  background: var(--tp-tint);
}
.tp-topbar, .tp-left > .tp-pane, .tp-side {
  box-sizing: border-box;
  background: var(--tp-paper);
  border: var(--tp-line) solid var(--tp-ink);
}

/* Title bar */
.tp-topbar {
  position: relative;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 24px;
  padding: 12px 16px;
}
.tp-topbar-text { display: grid; gap: 6px; min-width: 0; }
.tp-main .tp-title { font-size: 26px; font-weight: 700; line-height: 1.02; letter-spacing: -0.045em; margin: 0; }
.tp-main .tp-top-line { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font: 650 12px var(--tp-mono); }
.tp-main .tp-pips { display: flex; gap: 4px; margin: 0; max-width: 520px; }
.tp-pip { flex: 1; height: 8px; border: var(--tp-line) solid var(--tp-ink); }
.tp-pip.is-now { background: var(--tp-sel); }

/* Other states: a row under the title bar that scrolls sideways */
.tp-states {
  position: absolute; z-index: 6; top: 100%; left: calc(-1 * var(--tp-line)); right: calc(-1 * var(--tp-line));
  background: var(--tp-paper); border: var(--tp-line) solid var(--tp-ink); border-top: 0;
}
.tp-states-row {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.tp-main a.tp-state-chip {
  flex: none; display: grid; gap: 2px; min-width: 132px; padding: 8px 12px 8px 10px; scroll-snap-align: start;
  border: var(--tp-line) solid var(--tp-ink); border-left: 4.44px solid var(--tp-rule);
  background: var(--tp-paper); color: var(--tp-ink); text-decoration: none;
}
.tp-main a.tp-state-chip:hover { background: var(--tp-tint2); }
.tp-main a.tp-state-chip[aria-current] { background: var(--tp-sel); }
.tp-main a.tp-state-chip.is-won { border-left-color: #2e8b6e; background: color-mix(in srgb, #2e8b6e 16%, var(--tp-paper)); }
.tp-main a.tp-state-chip.is-missed { border-left-color: #b8483e; background: color-mix(in srgb, #b8483e 13%, var(--tp-paper)); }
.tp-main a.tp-state-chip.is-started { border-left-color: var(--tp-orange); background: color-mix(in srgb, var(--tp-orange) 10%, var(--tp-paper)); }
.tp-main a.tp-state-chip.is-won .tp-state-status { color: color-mix(in srgb, #2e8b6e 75%, var(--tp-ink)); }
.tp-main a.tp-state-chip.is-missed .tp-state-status { color: color-mix(in srgb, #b8483e 75%, var(--tp-ink)); }
.tp-main a.tp-state-chip.is-started .tp-state-status { color: color-mix(in srgb, var(--tp-orange) 75%, var(--tp-ink)); }
.tp-main a.tp-state-chip:is(.is-won, .is-missed, .is-started):hover { filter: brightness(0.96); }
.tp-state-name { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.tp-state-status { font: 650 11px var(--tp-mono); white-space: nowrap; }
.tp-states-toggle { white-space: nowrap; }

/* Wide screens: two scrolling columns */
.tp-left { min-height: 0; overflow: auto; display: grid; gap: 8px; align-content: start; }
.tp-left > .tp-pane, .tp-side { padding: 16px 18px 18px; min-width: 0; }
.tp-side { min-height: 0; overflow: auto; align-self: stretch; white-space: normal; }
.tp-main .tp-pane h2,
.tp-main .tp-side h2 { margin: 0 0 12px; font-size: 24px !important; font-weight: 600 !important; letter-spacing: -0.03em !important; line-height: 1.15 !important; }
.tp-main .tp-round h2 { font-size: 28px !important; }
.tp-map-section { margin-top: 24px; }
.tp-more-panel, .tp-tabs { display: none; }
.tp-app.is-done .tp-call-card { display: none; }

.tp-status {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3; margin: 0;
  padding: 14px 18px; border: var(--tp-line) solid var(--tp-ink); background: var(--tp-paper);
  font: 12px var(--tp-mono);
}
.tp-verdict-go { display: none; }

/* Below the game */
.tp-below { padding: 8px 0 64px; max-width: 860px; }
.tp-block { margin-top: 40px; }
.tp-main .tp-block h2 { font-size: 24px !important; font-weight: 600 !important; letter-spacing: -0.04em !important; padding-bottom: 10px; border-bottom: var(--tp-line) solid var(--tp-rule); margin: 0 0 14px; }
.tp-below p { font-size: 15px; line-height: 1.55; margin: 0 0 10px; }
.tp-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 15px; line-height: 1.5; list-style: decimal; }
.tp-edition-pick { display: block; max-width: 280px; }
.tp-sync { margin: 12px 0 0; font-size: 14px; line-height: 1.45; color: var(--tp-ink); }
.tp-sync a { color: inherit; text-decoration: underline; text-decoration-color: var(--tp-orange); text-underline-offset: 3px; }

@media (max-width: 1100px) {
  .tp-stage { grid-template-columns: minmax(0, 1fr) 400px; }
}

/* Phones: a slim title bar, one full-screen pane, and tabs along the bottom */
@media (max-width: 820px) {
  .tp-page { --tp-toph: 62px; --tp-tabh: 48px; }
  .tp-stage { display: block; padding: 0; gap: 0; min-height: 520px; background: var(--tp-paper); }
  .tp-topbar {
    position: absolute; top: 0; left: 0; right: 0; height: var(--tp-toph);
    border-width: 0 0 var(--tp-line); padding: 6px 12px; grid-template-columns: minmax(0, 1fr) auto; gap: 10px;
  }
  .tp-topbar-text { gap: 3px; }
  .tp-main .tp-title { font-size: 17px; }
  .tp-main .tp-top-line { font-size: 11px; flex-wrap: nowrap; white-space: nowrap; }
  /* The call itself is on the Call tab, and the pips carry its color */
  #tp-last { display: none; }
  .tp-pip { height: 6px; }
  .tp-left { display: contents; }
  .tp-left > .tp-pane, .tp-side, .tp-more-panel {
    position: absolute; top: var(--tp-toph); bottom: var(--tp-tabh); left: 0; right: 0;
    border: 0; padding: 14px 14px 20px; overflow: auto; -webkit-overflow-scrolling: touch;
  }
  .tp-left > .tp-pane, .tp-side, .tp-more-panel { display: none; }
  .tp-stage[data-tab="precinct"] .tp-round,
  .tp-stage[data-tab="sofar"] .tp-sofar,
  .tp-stage[data-tab="call"] .tp-side,
  .tp-stage[data-tab="more"] .tp-more-panel { display: block; }
  .tp-more-panel { padding: 0; background: var(--tp-paper); }
  .tp-more-panel .tp-below { padding: 0 16px 32px; margin: 0; }
  .tp-more-panel .tp-block:first-child { margin-top: 20px; }

  .tp-tabs {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; height: var(--tp-tabh);
    background: var(--tp-paper); border-top: var(--tp-line) solid var(--tp-ink);
  }
  .tp-tab {
    border: 0; border-right: var(--tp-line) solid var(--tp-rule); border-radius: 0; background: var(--tp-paper); color: var(--tp-ink);
    font: 650 13px var(--tp-mono); display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; padding: 0 4px;
  }
  .tp-tab:last-child { border-right: 0; }
  .tp-tab[aria-pressed="true"] { background: var(--tp-ink); color: var(--tp-paper); }
  .tp-tab-new { padding: 1px 5px; background: var(--tp-orange); color: #fff; font: 750 10px var(--tp-mono); }
  .tp-verdict-go { display: inline-flex; margin-top: 10px; }

  .tp-main .tp-round h2 { font-size: 24px !important; }
  .tp-main .tp-verdict-title { font-size: 19px; }
  /* iOS Safari zooms into fields under 16px and stays zoomed. */
  .tp-main .tp-select,
  .tp-main .tp-input { font-size: 16px; height: 44px; }
  .tp-states-toggle { min-height: 38px; padding: 0 12px; }
  .tp-states-row { padding: 10px 12px; }
  .tp-main a.tp-state-chip { min-width: 118px; }
  .tp-btn { min-height: 44px; }
  .tp-main .tp-answer,
  .tp-main .tp-readout { font-size: 18px; }
  .tp-exact { grid-template-columns: auto minmax(0, 1fr); }
  .tp-exact .tp-btn-soft { grid-column: 1 / -1; }
  .tp-demo-table td:first-child { font-size: 13px; }
  .tp-t td { padding: 8px 6px; }
}
