/* The live screen. Built for a 16:9 screen in full screen (office TV, Firefox kiosk). */
:root {
  --bg: #0b0f17; --panel: #121826; --panel2: #182033; --line: #263049;
  --text: #e8ecf4; --sub: #9aa6bf; --muted: #6c7894; --accent: #f5c542;
  --good: #3ccf91; --bad: #ff6b6b; --glow: #ffd166;
  font-size: clamp(11px, 1.05vw, 22px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
body.idle, body.idle * { cursor: none !important; }

.live { height: 100vh; width: 100vw; overflow: hidden; display: grid; gap: .8rem; padding: .8rem;
  grid-template-columns: 22% 1fr 22%;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "bar bar bar" "brk brk brk" "left center right" "bottom bottom bottom"; }
.bar { grid-area: bar; display: grid; grid-template-columns: 1.3fr 1.2fr 1.2fr auto; gap: 1rem;
  align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: .7rem;
  padding: .6rem 1rem; }
.title { font-size: 1.7rem; font-weight: 700; letter-spacing: .01em; display: flex; align-items: center; gap: .6rem; }
.dot { width: .75rem; height: .75rem; border-radius: 50%; background: var(--bad); display: inline-block;
  box-shadow: 0 0 .6rem var(--bad); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 50% { opacity: .35; } }
#date { font-size: 1.35rem; font-weight: 600; }
.month { height: .35rem; background: var(--line); border-radius: .2rem; margin: .35rem 0 .25rem; overflow: hidden; }
.month i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1s; }
.sub { color: var(--sub); font-size: .9rem; }
#countdown { font-size: 1.15rem; font-weight: 600; }
#countdown b { color: var(--accent); font-size: 1.5rem; }
.tools { display: flex; gap: .6rem; align-items: center; }
.tools a, .tools button { background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: .4rem; padding: .35rem .7rem; font: inherit; font-size: .9rem; cursor: pointer; }
:fullscreen .tools { display: none; }

.breaking { grid-area: brk; background: #b3261e; color: #fff; border-radius: .6rem; padding: .55rem 1rem;
  font-size: 1.25rem; font-weight: 600; display: flex; gap: 1rem; align-items: center;
  animation: flash 1.6s ease-in-out 3; }
.breaking b { background: #fff; color: #b3261e; padding: .1rem .5rem; border-radius: .3rem;
  font-size: .9rem; letter-spacing: .08em; }
@keyframes flash { 50% { filter: brightness(1.35); } }

section { min-height: 0; overflow: hidden; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  margin: .2rem 0 .5rem; font-weight: 600; }
.left, .right { background: var(--panel); border: 1px solid var(--line); border-radius: .7rem;
  padding: .7rem .9rem; display: flex; flex-direction: column; gap: .3rem; }
.left { grid-area: left; } .right { grid-area: right; }
.center { grid-area: center; position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: .7rem; display: flex; flex-direction: column; padding: .5rem; }

/* co-presidents */
.cp { display: grid; grid-template-columns: 3.2rem 1fr; gap: .2rem .7rem; margin-bottom: .7rem; }
.av { width: 3.2rem; height: 3.2rem; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 1.15rem; color: #fff; grid-row: span 2;
  box-shadow: inset 0 0 0 .2rem rgba(255,255,255,.18); }
.cp .nm { font-weight: 650; font-size: 1.05rem; line-height: 1.2; }
.cp .pf { color: var(--sub); font-size: .85rem; }
.cp q { grid-column: 1 / -1; font-style: italic; color: var(--sub); font-size: .9rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.appr { display: flex; justify-content: space-between; font-size: .9rem; color: var(--sub); margin: -.2rem 0 .6rem; }
.appr b { color: var(--text); }

/* congress half circles */
.ch { margin-bottom: .5rem; }
.ch svg { width: 100%; height: auto; display: block; }
.ch .cap { display: flex; justify-content: space-between; font-size: .85rem; color: var(--sub); }
.ch .cap b { color: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: .25rem .7rem; font-size: .8rem; color: var(--sub); }
.legend i { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .3rem;
  vertical-align: -.05rem; }

/* map */
#map { flex: 1; width: 100%; min-height: 0; }
#map .rg path { stroke: var(--bg); stroke-width: 4; cursor: pointer; transition: filter .3s, opacity .3s; }
#map .rg:hover path { filter: brightness(1.25); }
#map .rg.hot path { animation: glow 2.4s ease-in-out infinite; }
/* Over the painted island: regions are a light tint of the governor's party with a pale
   border, so the painting shows through; hovering deepens the tint. */
#map.painted .rg path { fill-opacity: .26; stroke: rgba(255,255,255,.85); stroke-width: 2; }
#map.painted .rg:hover path { fill-opacity: .55; filter: none; }
@keyframes glow { 0%,100% { filter: drop-shadow(0 0 0 var(--glow)); }
  50% { filter: drop-shadow(0 0 14px var(--glow)) brightness(1.18); } }
#map text { fill: #fff; font-size: 22px; font-weight: 700; text-anchor: middle; pointer-events: none;
  paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: 4px; }
#map text.s { font-size: 15px; font-weight: 500; fill: #e8ecf4; }
#map circle.ev { fill: var(--glow); stroke: #000; stroke-width: 2; }
#map text.evn { font-size: 13px; fill: #000; stroke: none; }
#map .lake { fill: #4f86b8; opacity: .85; pointer-events: none; }
#map .river { fill: none; stroke: #6aa2d4; stroke-width: 3; opacity: .8; pointer-events: none; }
#map .peak { fill: rgba(255,255,255,.28); pointer-events: none; }
#map circle.cty { fill: #ffd54a; stroke: #000; stroke-width: 1.5; pointer-events: none; }
#map circle.cty.nat { fill: #fff; }
#map text.ctyn { font-size: 14px; font-weight: 600; }
#mapinfo { text-align: center; min-height: 2.6em; padding: .2rem .6rem; }
#mapinfo b { color: var(--text); }

/* stats */
.st { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 0 .5rem;
  padding: .3rem 0; border-bottom: 1px solid var(--line); }
.st:last-child { border-bottom: 0; }
.st .lb { color: var(--sub); font-size: .85rem; }
.st .v { font-weight: 650; font-size: 1.05rem; text-align: right; }
.st .v small { font-size: .7rem; margin-left: .25rem; }
.st svg { grid-column: 1 / -1; width: 100%; height: 1.5rem; }
.up { color: var(--good); } .down { color: var(--bad); } .flat { color: var(--muted); }

/* world */
.wl { display: grid; grid-template-columns: 1fr 3.5rem 2rem; gap: .4rem; align-items: center; font-size: .85rem;
  padding: .12rem 0; }
.wl .b { height: .4rem; background: var(--line); border-radius: .2rem; position: relative; overflow: hidden; }
.wl .b i { position: absolute; top: 0; bottom: 0; }
.wl .n { text-align: right; color: var(--sub); }

/* bottom */
.bottom { grid-area: bottom; display: grid; grid-template-columns: 24% 24% 1fr; gap: .8rem; }
.bottom:not(:has(.onair:not([hidden]))) { grid-template-columns: 28% 1fr; }
.onair[hidden] { display: none; }
.floor, .ticker, .onair { background: var(--panel); border: 1px solid var(--line); border-radius: .7rem;
  padding: .5rem .9rem; overflow: hidden; display: flex; gap: .8rem; align-items: center; min-width: 0; }
.onair > b, .floor > b, .ticker > b { flex: none; color: var(--accent); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
#floor { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
#floor .s { color: var(--sub); font-size: .8rem; margin-left: .4rem; }
.track { flex: 1; overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); }
#ticker { display: inline-block; white-space: nowrap; font-size: 1.05rem; will-change: transform; }  /* moved by live.js */
#ticker span { margin-right: 2.5rem; }
#ticker span em { font-style: normal; color: var(--muted); font-size: .8rem; margin-right: .4rem; }
#ticker span.hi { color: var(--accent); }
#ticker span.mt { border-left: 4px solid var(--c, #888); padding-left: .5rem; }
#ticker span.mt em { color: var(--c, var(--muted)); font-weight: 600; }
#ticker span.mt small { color: var(--muted); font-size: .7rem; }
#onair { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
#onair a { color: var(--text); border-left: 4px solid var(--c, #888); padding-left: .5rem; }
#onair .s { color: var(--sub); font-size: .8rem; margin-left: .4rem; }

/* election night board, over the map and right column */
.board { grid-area: 3 / 2 / 4 / 4; z-index: 5; background: var(--panel); border: 2px solid var(--accent);
  border-radius: .7rem; padding: .8rem 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1.2rem;
  grid-template-rows: auto 1fr; overflow: hidden; }
.board[hidden] { display: none; }
.board header { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; }
.board header h1 { margin: 0; font-size: 1.6rem; }
.board header button { background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: .4rem; padding: .25rem .6rem; font: inherit; font-size: .85rem; cursor: pointer; }
.board .col { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: .35rem; }
.tk { display: grid; grid-template-columns: 1fr 4rem; gap: .2rem .6rem; align-items: center; }
.tk .nm { font-weight: 650; }
.tk .nm.won::after { content: " ✓ wins"; color: var(--good); font-weight: 700; }
.tk .pct { text-align: right; font-weight: 700; font-size: 1.2rem; }
.hb { grid-column: 1 / -1; height: .7rem; background: var(--line); border-radius: .35rem; overflow: hidden; }
.hb i { display: block; height: 100%; transition: width 1.2s; }
.rr { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem; align-items: center; font-size: .9rem; }
.rr .sb { display: flex; height: .9rem; border-radius: .2rem; overflow: hidden; background: var(--line); }
.rr .sb i { height: 100%; }
.rr .wait { color: var(--muted); font-style: italic; }
.race { display: grid; grid-template-columns: 1fr auto; gap: .4rem; font-size: .9rem; padding: .25rem .4rem;
  border-left: .3rem solid var(--c, var(--line)); background: var(--panel2); border-radius: .2rem;
  animation: drop .6s ease-out; }
.race .o { color: var(--sub); font-size: .78rem; }
@keyframes drop { from { opacity: 0; transform: translateY(-.5rem); } }
.count2 { color: var(--sub); font-size: .9rem; }

.stale { position: fixed; right: 1rem; bottom: 4.5rem; background: #3a2a00; color: #ffd98a;
  border: 1px solid #806000; border-radius: .5rem; padding: .4rem .8rem; font-size: .85rem; z-index: 9; }

/* small screens: stack and scroll */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  :root { font-size: 15px; }
  .live { height: auto; min-height: 100vh; overflow: visible; grid-template-columns: 1fr;
    grid-template-areas: "bar" "brk" "center" "left" "right" "bottom"; }
  .bar { grid-template-columns: 1fr; }
  .center { min-height: 60vw; }
  .board { grid-area: center; grid-template-columns: 1fr; }
  .bottom { grid-template-columns: 1fr; }
}
