/* booth2 phase 2 (12 Oct 2026, UAT design review). Everything here is gated by <html data-d2="flag flag ..."> (UAT: ?d2=s1a,v3,h,... on the page address).
   Without a flag NOTHING in this file applies. Flags: s1a s1b (first-screen search) · v3 (your village in 3 lines) · h (curiosity hooks) · c45 (4:5 card, in the share script)
   · k1 k2 (cookie bar) · tb (tab bar not sticky on phones) · ad (booth addresses) · m (measurement pings, no styles).
   "s1" is added by the page's flag script whenever s1a or s1b is on. Mobile first; the phone rules are limited to < 1000 px, where the desktop keeps its two columns. */

/* ================= item 1: the first screen = search + chips (s1a, s1b) ================= */
.p2-top { display: none; }
.p2-strip { display: none; }
@media (max-width: 999.98px) {
  /* A: the find box moves up, between the seat card and the mosaic. The page's own order is kept in the HTML (crawlers read the same order); this is only the visual order */
  html[data-d2~="s1"] .tw { display: flex; flex-direction: column; margin-top: 0; }
  html[data-d2~="s1"] .tw > * { order: 6; }
  html[data-d2~="s1"] .tw > .tw-side { order: 1; }
  html[data-d2~="s1"] .tw > .tw-panel { order: 3; margin-top: 14px; }
  html[data-d2~="s1"] .tw > .tw-after { order: 4; }
  html[data-d2~="s1"] .tw-side { display: block; contain: none; }
  html[data-d2~="s1"] .tw-find { margin-top: 12px; padding: 12px 12px 12px; scroll-margin-top: 72px; }
  /* B: a one-line seat strip first, the find box next, the mosaic after it, and the big seat card below the mosaic */
  html[data-d2~="s1b"] .tw { display: contents; }
  html[data-d2~="s1b"] .bw-wrap[data-booth2] > * { order: 7; }
  html[data-d2~="s1b"] .bw-wrap[data-booth2] > .bw-crumbs, html[data-d2~="s1b"] .bw-wrap[data-booth2] > .bw-head { order: 0; }
  html[data-d2~="s1b"] .bw-wrap[data-booth2] > .p2-strip { order: 1; display: block; }
  html[data-d2~="s1b"] .tw > .tw-side { order: 2; }
  html[data-d2~="s1b"] .tw > .tw-panel { order: 3; }
  html[data-d2~="s1b"] .tw > .tw-after { order: 4; }
  html[data-d2~="s1b"] .bw-wrap[data-booth2] > .hx { order: 5; margin: 14px 0 12px; }

  /* the label is the input's placeholder; the heading stays in the page for screen readers and crawlers */
  html[data-d2~="s1"] .tw-find .tw-h { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  html[data-d2~="s1"] .tw-find p.tw-tip { display: none !important; }   /* the page's own hint is position:fixed (a class shared with the map tooltip): with the find box this high it would sit on top of the first result */
  html[data-d2~="s1"] .tw-find .tw-search { margin: 30px 0 4px; }          /* the gap holds the label, so the label can arrive later without moving anything */
  html[data-d2~="s1"] .p2-qlab { position: absolute; left: 2px; top: -29px; max-width: 100%; white-space: nowrap; font-size: clamp(13px, 4.1vw, 16px); font-weight: 800; line-height: 1.3; color: #1a1410; }
  html[data-d2~="s1"] .tw-find .tw-search input { height: 56px; font-size: 16px; font-weight: 600; border-radius: 16px; }
  html[data-d2~="s1"] .tw-find .tw-search input::placeholder { color: #6a5a45; font-weight: 600; }
  html[data-d2~="s1"] .tw-find .tw-search input:placeholder-shown { padding-right: 12px; }

  /* the page's floating share button (shared script, untouched) sat on top of the search box's right end and its clear button: while someone searches or reads a village it is hidden (audit issue 10) */
  html[data-d2~="s1"]:not([data-p2s="c"]) .tn-fab-stack { display: none !important; }
  /* states, set by booth-two-p2.js on <html data-p2s>: c = compact (nothing typed, nothing open) · s = results · o = a village is open · a = the full list */
  html[data-d2~="s1"][data-p2s="c"] .tw-find :is(.tw-tabs, .tw-sort, .tw-vlegend, .vt-head, .tw-tip, .tw-vl, .tw-bl, .pgbar, .tw-none, .tw-dym, .tw-more) { display: none !important; }
  html[data-d2~="s1"][data-p2s="s"] .tw-find :is(.tw-tabs, .tw-sort, .tw-vlegend) { display: none !important; }
  html[data-d2~="s1"][data-p2s="o"] .tw-find :is(.tw-tabs, .tw-sort, .tw-vlegend, .vt-head, .tw-tip, .pgbar, .tw-none, .tw-dym, .tw-more, .eg-top) { display: none !important; }
  html[data-d2~="s1"][data-p2s="o"] .tw-find .tw-vl > li:not(.open) { display: none !important; }
  html[data-d2~="s1"][data-p2s="c"] .p2-top .p2-chips, html[data-d2~="s1"][data-p2s="c"] .p2-top .p2-hooks, html[data-d2~="s1"][data-p2s="c"] .p2-top .p2-all { display: flex; }
  html[data-d2~="s1"][data-p2s="c"] .p2-top .p2-hooks { display: block; }
  html[data-d2~="s1"][data-p2s="a"] .p2-top { display: block; }
  html[data-d2~="s1"][data-p2s="a"] .p2-top > :not(.p2-less) { display: none; }
  html[data-d2~="s1"] .p2-less { display: none; }
  html[data-d2~="s1"][data-p2s="a"] .p2-less { display: flex; }
}
.p2-top { margin: 2px 0 0; }
html[data-d2~="h"]:not([data-d2~="s1"]) .p2-top { display: block; }
html[data-d2~="h"]:not([data-d2~="s1"]) .p2-top :is(.p2-all, .p2-less, .p2-chips) { display: none; }
html[data-d2~="s1"][data-p2s="c"] .p2-top { display: block; }
.p2-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 0; }
.p2-chips .p2-k { flex: 1 0 100%; margin: 0; font-size: 12.5px; font-weight: 700; color: var(--tw-soft, #4a3e2f); }
.p2-chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; max-width: 100%; padding: 4px 14px; border: 1.5px solid #1a1410; border-radius: 999px; background: #fffaf0; color: #1a1410; font: inherit; font-weight: 800; font-size: 15px; line-height: 1.2; cursor: pointer; text-align: center; }
.p2-chip small { font-size: 12px; font-weight: 700; color: #4a3e2f; }
@media (max-width: 340px) { .p2-chip { padding: 4px 11px; font-size: 14px; } .p2-chip:nth-of-type(4) { display: none; } }   /* a 320 px phone: three buttons, not four stacked ones */
.p2-chip:hover, .p2-chip:active { background: #fff1cf; }
.p2-chip:focus-visible, .p2-hk:focus-visible, .p2-all:focus-visible, .p2-less:focus-visible { outline: 3px solid #4b2fb3; outline-offset: 2px; }
.p2-hooks-ph { background: #fffaf0; }
.p2-hooks { margin: 14px 0 0; padding: 10px 10px 8px; border: 1.5px solid #d9c39a; border-radius: 16px; background: #fffaf0; min-height: 300px; }
.p2-hooks .p2-hh { margin: 0 0 6px; font-size: 13.5px; font-weight: 800; color: #4b2fb3; line-height: 1.3; display: flex; align-items: center; gap: 7px; }
.p2-hooks .p2-hh::before { content: ""; width: 5px; height: 14px; border-radius: 3px; background: #4b2fb3; flex: none; }
.p2-hk { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 6px 8px; margin: 0; border: 0; border-top: 1px solid #eadbb8; background: none; color: #1a1410; font: inherit; font-size: 14.5px; font-weight: 700; line-height: 1.3; text-align: left; cursor: pointer; }
.p2-hk:first-of-type { border-top: 0; }
.p2-hk b { font-weight: 800; font-variant-numeric: tabular-nums; }
.p2-hk .p2-n { flex: none; min-width: 22px; height: 22px; border-radius: 50%; background: #ece6ff; color: #2f1b84; font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.p2-hk .p2-t { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.p2-hk .p2-t small { font-size: 12.5px; font-weight: 600; color: #4a3e2f; display: block; }
.p2-hk-sw { flex-wrap: wrap; row-gap: 0; }
.p2-hk-sw .p2-t { flex: 1 1 auto; overflow-wrap: normal; }
.p2-hk .p2-d { flex: 0 0 auto; margin-left: auto; font-size: 12.5px; font-weight: 600; color: #4a3e2f; white-space: nowrap; }
.p2-hk .p2-d b { font-weight: 800; color: #1a1410; }
.p2-hk::after { content: "\203A"; flex: none; font-size: 20px; font-weight: 700; color: #7a6a55; margin-left: 2px; }
.p2-hk:hover, .p2-hk:active { background: #fff1cf; }
.p2-hk-sw::after { display: none; }
.p2-hk-sw .p2-d { padding-left: 0; }
.p2-hooks .p2-hs { margin: 12px 0 4px; font-size: 14px; font-weight: 800; color: #1a1410; line-height: 1.3; }
.p2-hooks .p2-hs span { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--tw-soft, #4a3e2f); line-height: 1.4; }
.p2-all, .p2-less { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin: 12px 0 0; padding: 6px 14px; border: 1.5px solid #1a1410; border-radius: 14px; background: #fff; color: #1a1410; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.p2-all:hover, .p2-less:hover { background: #fff1cf; }
.p2-all small { font-weight: 600; font-size: 12px; opacity: .7; }
/* the strip of design B */
.p2-strip { margin: 2px 0 12px; padding: 10px 12px; border: 1.5px solid #1a1410; border-radius: 16px; background: #fff; }
.p2-strip .p2-s1 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; line-height: 1.3; color: #4a3e2f; }
.p2-strip .p2-s1 b { font-weight: 800; color: #1a1410; font-size: 15px; }
.p2-strip .p2-s2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 5px; }
.p2-strip .p2-win { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px; color: #fff; font-weight: 800; font-size: 14px; line-height: 1.3; }
.p2-strip .p2-m { font-size: 14px; font-weight: 700; color: #1a1410; }
.p2-strip .p2-m b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.p2-strip .p2-dt { flex: 1 0 100%; font-size: 13px; font-weight: 800; color: #4b2fb3; }
/* desktop: the hooks fill the empty right-hand panel, the search stays where it is */
@media (min-width: 1000px) {
  .tf-empty .p2-hooks { margin-top: 18px; text-align: left; min-height: 0; }
  .p2-top { display: none !important; }
}

/* ================= item 2: your village in 3 lines (v3) ================= */
.p2-v3 { margin: 0 0 12px; padding: 12px 12px 12px; border: 2px solid #0d2c43; border-radius: 18px; background: #fffdf8; color: #1a1410; }
.p2-v3 .p2-v3h { margin: 0 0 8px; font-size: 14px; font-weight: 800; color: #0d2c43; line-height: 1.3; display: flex; align-items: center; gap: 7px; }
.p2-v3 .p2-v3h::before { content: ""; width: 5px; height: 15px; border-radius: 3px; background: #4b2fb3; flex: none; }
.p2-v3 ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.p2-v3 li { padding: 8px 0 8px; border-top: 1px solid #eadbb8; }
.p2-v3 li:first-child { border-top: 0; padding-top: 0; }
.p2-v3 .p2-lab { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 800; color: #4b2fb3; line-height: 1.3; }
.p2-v3 .p2-lab.a { color: #4a3e2f; }
.p2-v3 .p2-no { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #0d2c43; color: #fff; font-weight: 800; font-size: 12px; display: grid; place-items: center; }
.p2-v3 .p2-tx { display: block; margin: 3px 0 0 30px; font-size: 15px; line-height: 1.4; font-weight: 600; }
.p2-v3 .p2-tx b { font-weight: 800; }
.p2-v3 .p2-tx .num { font-weight: 800; font-variant-numeric: tabular-nums; }
.p2-v3 .p2-tx .up { color: #0b6b3a; font-weight: 800; }
.p2-v3 .p2-tx .dn { color: #b3261e; font-weight: 800; }
.p2-v3 .p2-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.p2-v3 .p2-sh { font-weight: 700; color: #4a3e2f; white-space: nowrap; }
.p2-v3 .p2-rank { display: inline-block; margin-top: 6px; padding: 3px 11px; border-radius: 14px; background: #ece6ff; color: #2f1b84; font-weight: 700; font-size: 14px; line-height: 1.35; }
.p2-v3 .p2-rank b { font-weight: 800; }
.p2-v3 .p2-rule { margin: 4px 0 0; font-size: 11.5px; line-height: 1.45; color: #5b4d3a; }
.p2-v3 .v-share.p2-share { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; margin: 10px 0 0; padding: 8px 16px; border: 0; border-radius: 16px; background: #0d2c43; color: #fff; font: inherit; font-size: 17px; font-weight: 800; cursor: pointer; box-shadow: 0 6px 16px -8px rgba(13, 44, 67, .7); }
.p2-v3 .v-share.p2-share:hover, .p2-v3 .v-share.p2-share:active { background: #14405e; }
.p2-v3 .v-share.p2-share svg { width: 22px; height: 22px; flex: none; }
html[data-d2~="v3"] .dt > .v-share:not(.p2-share) { display: none; }
@media (max-width: 999.98px) {
  html[data-d2~="v3"] .tw-vl > li.open .vlr, html[data-d2~="v3"] .tw-vl > li.open .vbars { display: none; }
}

/* ================= item 5: the cookie bar, compact (k1 = two short rows, k2 = one row). The page's own consent.js builds the bar; this file only restyles it and the p2 script
   adds "close = no / scroll = no". Page-scoped: loaded with the booth page's own stylesheet, never in the shared files. ================= */
html[data-d2~="k1"] .cookie-banner.cb-compact > p, html[data-d2~="k2"] .cookie-banner.cb-compact > p,
html[data-d2~="k1"] .cookie-banner.cb-compact > .cookie-banner-actions, html[data-d2~="k2"] .cookie-banner.cb-compact > .cookie-banner-actions { display: none; }
html[data-d2~="k1"] .cookie-banner.cb-compact, html[data-d2~="k2"] .cookie-banner.cb-compact { left: 0; right: 0; bottom: 0; max-width: none; border-radius: 0; min-height: 0;
  padding: 4px max(10px, env(safe-area-inset-right, 0px)) calc(2px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px)); }
.p2-ck { display: none; }
html[data-d2~="k1"] .cookie-banner .p2-ck, html[data-d2~="k2"] .cookie-banner .p2-ck { display: block; }
.p2-ck .p2-ck-t { margin: 0; font-size: 12.5px; line-height: 1.3; color: inherit; }
.p2-ck .p2-ck-b { display: flex; align-items: center; gap: 6px; }
.p2-ck button, .p2-ck a.p2-pr { flex: none; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 700; font-size: 13.5px; color: #fff; }
.p2-ck button { min-width: 44px; padding: 0 12px; border-radius: 10px; border: 1.5px solid rgba(255, 255, 255, .55); background: transparent; cursor: pointer; }
.p2-ck button.p2-yes { background: #c9531e; border-color: #c9531e; }
.p2-ck a.p2-pr { padding: 0 6px; text-decoration: underline; font-weight: 600; font-size: 12.5px; }
.p2-ck button.p2-x { margin-left: auto; border: 0; font-size: 20px; padding: 0 6px; opacity: .9; }
/* k1: the sentence on one line, the buttons under it (about 70 px); k2: sentence and buttons on one row (about 48 px) */
html[data-d2~="k2"] .cookie-banner .p2-ck { display: flex; align-items: center; gap: 4px; }
html[data-d2~="k2"] .p2-ck .p2-ck-t { flex: 1 1 auto; min-width: 0; font-size: 12.5px; }
html[data-d2~="k2"] .p2-ck .p2-ck-b { flex: none; gap: 4px; }
html[data-d2~="k2"] .p2-ck a.p2-pr { display: none; }
html[data-d2~="k2"] .p2-ck button { padding: 0 9px; font-size: 13px; }
html[data-d2~="k2"] .p2-ck button.p2-x { margin-left: 0; }
@media (min-width: 700px) {
  html[data-d2~="k1"] .cookie-banner.cb-compact, html[data-d2~="k2"] .cookie-banner.cb-compact { left: 12px; right: auto; bottom: 12px; max-width: 560px; border-radius: 14px; padding: 6px 12px 6px; }
  html[data-d2~="k2"] .p2-ck a.p2-pr { display: inline-flex; }
}

/* ================= item 6: the in-village tab bar stops covering candidate rows (tb) ================= */
@media (max-width: 999.98px) {
  html[data-d2~="tb"] .dt-seg { position: static; box-shadow: none; }
}
html[data-d2~="tb"] .dt-pane, html[data-d2~="tb"] .vs2-bar-row { scroll-margin-top: 124px; }

/* ================= item 7: booth addresses (ad). The ECI list is English only; the Tamil village name leads, the English text says what it is ================= */
html[data-d2~="ad"] .bbd .bx .p2-bv { display: block; font-size: 15px; font-weight: 800; line-height: 1.3; margin: 0 0 1px; }
html[data-d2~="ad"] :lang(ta) .bbd .ad::before, html[lang="ta"][data-d2~="ad"] .bbd .ad::before { content: "ECI முகவரி (ஆங்கிலம்)"; display: block; font-size: 11.5px; font-weight: 700; color: #7a6a55; letter-spacing: 0; margin: 1px 0 0; }
html[data-d2~="ad"] .bbd .bx .ad { font-size: 13px; line-height: 1.35; color: #3a2f20; }
html[data-d2~="ad"] .bbd .bx .bv:not(.p2-bv) { font-size: 15px; font-weight: 800; display: block; line-height: 1.3; }

/* booth2 phase 4 (13 Oct 2026, UAT): "one screen, one idea". Appended to booth-two-p2.css by scripts/engage_booth2_1012.py.
   EVERYTHING here is gated by <html data-d2~="p4"> (the default of the UAT page; ?d2=p1 and ?d2=p2 do not carry it), so the phase 1 and phase 2 looks stay as they were.
   The screen contract (what must be visible in the first 390x844 and 360x740 viewport of each state) is in work/engage-1012/p4/REPORT.md and is tested by
   work/engage-1012/p4/screen_contract.js. Mobile first; the desktop (>= 1000 px) keeps its two columns and only gets the rules that make sense there.
   Order of the phone screens:  S1 result summary (crumbs, H1, seat card, search button, cue)  >  S2 the animated dot mosaic  >  S3 hooks + search + chips  >  list / opened village / opened booth. */

/* ===================================================================================================================================================
   0. things that must never cover the content (phones): the shared floating share button (46 px, fixed at the right edge: it hid the 5th swing row and the
      fold buttons) is hidden here; the page has its own big share buttons (S1, village, booth, follow row) which are the real calls to action. */
@media (max-width: 999.98px) {
  html[data-d2~="p4"] .tn-fab-stack { display: none !important; }
}
.p4-cue { display: none; }

/* ===================================================================================================================================================
   1. S1: the result summary in ONE screen (phones). H1, who won the by-election and in April (with margins), both elections' party shares, the search
      button and the cue to the dots. Sizes grow with the screen height (svh) so a 740 px phone and an 844 px phone both end on the cue, with no empty band.
      (the long selectors beat the older rules: .bw-wrap[data-booth2] ... in booth-two.css and [data-variant="d"] ... in booth-two-variants.css) */
@media (max-width: 999.98px) {
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .bw-crumbs { margin: 0; padding: 0; min-height: 44px; font-size: 13px; line-height: 1.2; flex-wrap: nowrap; gap: 0 3px; overflow: hidden; align-items: center; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .bw-crumbs > a:not(.eg-lang) { min-height: 44px; display: inline-flex; align-items: center; padding: 0 1px; white-space: nowrap; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .bw-crumbs > strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .bw-crumbs > .sep { flex: none; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .bw-crumbs > .sep:last-of-type { display: none; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .bw-crumbs a.eg-lang { margin-left: auto; min-height: 44px; padding: 0 14px; font-size: 14px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .bw-head { margin: 0 0 6px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .bw-head .bw-eyebrow { font-size: 12.5px; line-height: 1.4; padding: 1px 9px 1px 8px; margin: 0 0 4px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .bw-head h1 { font-size: clamp(17.5px, 5vw, 21px); line-height: 1.22; margin: 2px 0 0; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .hx { margin: 0; padding: 10px 10px 8px; border-radius: 18px; }
  /* the seat line: map (small) + seat name + one-line counts */
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-top { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-map, html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-map svg.shape { width: 44px; height: 44px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-t { font-size: 18px; margin: 0; line-height: 1.2; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-k { font-size: 12.5px; line-height: 1.25; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-wins[data-p4] { display: none; }    /* replaced by the two result rows below (built by p4.js from the same words) */
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-line { margin: 1px 0 0; font-size: 12.5px; }
  /* the two result rows: by-election first, then April; label (election + date), winner, margin */
  html[data-d2~="p4"] .p4-res { display: grid; gap: 5px; margin: 8px 0 0; }
  html[data-d2~="p4"] .p4-r { --c: #af6004; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 10px; padding: 5px 12px; padding: calc(4px + .3svh) 12px; border-radius: 14px; color: #fff; background: var(--c); background: color-mix(in srgb, var(--c) 84%, #000); }
  html[data-d2~="p4"] .p4-r .p4-rl { grid-column: 1; font-size: 12.5px; font-weight: 700; line-height: 1.25; }
  html[data-d2~="p4"] .p4-r .p4-rw { grid-column: 1; font-size: 17px; font-weight: 800; line-height: 1.2; min-width: 0; }
  html[data-d2~="p4"] .p4-r .p4-rm { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-size: 12px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
  html[data-d2~="p4"] .p4-r .p4-rm b { display: block; font-size: 17px; line-height: 1.15; font-weight: 800; font-variant-numeric: tabular-nums; }
  /* the table: by-election column first (it is the news), April second; rows that grow with the screen height */
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs { margin: 6px 0 0; padding: 7px 8px 6px; border-radius: 14px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs2-h, html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs2-row { grid-template-columns: minmax(0, 7.1em) minmax(0, 1fr) minmax(0, 1fr); column-gap: 8px; }
  html[data-d2~="p4"] .hx .vs2-h { margin: 0 0 3px; align-items: end; }
  html[data-d2~="p4"] .hx .vs2-h > span:first-child { order: -2; }
  html[data-d2~="p4"] .hx .vs2-h .vs2-hc.o { order: -1; }
  html[data-d2~="p4"] .hx .vs2-row > .vs-p { order: -2; }
  html[data-d2~="p4"] .hx .vs2-row > .vs2-c.o { order: -1; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs2-hc b { font-size: 12.5px; letter-spacing: 0; white-space: nowrap; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs2-hc small { font-size: 12px; font-weight: 700; color: #4a3e2f; white-space: nowrap; }
  html[data-d2~="p4"] .hx .vs2-list { gap: 0; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs2-row { min-height: 30px; min-height: calc(22px + .9svh); align-items: center; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs2-row .vs-p { font-size: 13px; gap: 5px; letter-spacing: -.01em; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs2-p { font-size: 15px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs2 .vs-n { display: block; margin: 4px 2px 0; font-size: 12.5px; line-height: 1.35; color: #3a2f20; }
  /* the search button and the cue */
  html[data-d2~="p4"] .p4-cue { display: block; margin: 8px 0 0; text-align: center; }
  html[data-d2~="p4"] .p4-find { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid #1a1410; border-radius: 14px; background: #fffaf0; color: #1a1410; font: inherit; font-size: 15px; font-weight: 700; text-align: left; cursor: pointer; }
  html[data-d2~="p4"] .p4-find svg { width: 18px; height: 18px; flex: none; color: #4a3e2f; }
  html[data-d2~="p4"] .p4-find span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html[data-d2~="p4"] .p4-swipe { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 2px auto 0; min-height: 44px; padding: 0 10px; border: 0; background: none; color: #4b2fb3; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
  html[data-d2~="p4"] .p4-swipe i { width: 10px; height: 10px; border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg); margin-top: -4px; flex: none; }
}
/* narrow phones: the last crumb (the page you are on) goes, so the language pill never gets cut */
@media (max-width: 479.98px) {
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .bw-crumbs > strong, html[data-d2~="p4"] .bw-wrap[data-booth2] > .bw-crumbs > .sep:nth-of-type(2) { display: none; }
}
/* short phones (740 px and below 800 px tall): the "updated" chip and the map go, the rest tightens, so the cue still ends the screen */
@media (max-width: 999.98px) and (max-height: 830px) {
  html[data-d2~="p4"] .bw-wrap[data-booth2] .bw-head .bw-eyebrow { display: none; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .bw-head h1 { font-size: clamp(17px, 4.9vw, 19px); margin: 0; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-top { grid-template-columns: minmax(0, 1fr); }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-map { display: none; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .hx { padding: 8px 10px 6px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-t { font-size: 17px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-k { display: inline; font-size: 12.5px; }
  html[data-d2~="p4"] .p4-res { margin-top: 6px; }
  html[data-d2~="p4"] .p4-r { padding: 3px 12px; }
  html[data-d2~="p4"] .p4-cue { margin-top: 6px; }
  html[data-d2~="p4"] .p4-find { min-height: 46px; }
  html[data-d2~="p4"] .p4-swipe { min-height: 44px; margin-top: -2px; }
  html[data-d2~="p4"] .p4-res { gap: 4px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs2-row { min-height: 28px; min-height: calc(20px + .9svh); }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .bw-head { margin-bottom: 4px; }
}
/* very short screens (an in-app browser with its own bars): the counts line and the district line go; the note under the table stays */
@media (max-width: 999.98px) and (max-height: 725px) {
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-line, html[data-d2~="p4"] .bw-wrap[data-booth2] .hx-k { display: none; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .bw-head h1 { font-size: clamp(16px, 4.7vw, 18px); }
}
@media (max-width: 999.98px) and (prefers-reduced-motion: no-preference) {
  html[data-d2~="p4"] .p4-swipe i { animation: p4-nudge 1.8s ease-in-out 1.2s 3; }
  @keyframes p4-nudge { 0%, 100% { transform: translateY(0) rotate(45deg); } 40% { transform: translateY(5px) rotate(45deg); } }
}

/* ===================================================================================================================================================
   2. order of the screens, S2 (the animated dot mosaic) and S3 (hooks + search + chips in ONE screen). The page's own order in the HTML is kept. */
@media (max-width: 999.98px) {
  html[data-d2~="p4"] .tw > .tw-panel { order: 1; margin-top: 8px; }
  html[data-d2~="p4"] .tw > .tw-after { order: 2; margin: 6px 2px 0; }
  html[data-d2~="p4"] .tw > .tw-side { order: 3; }
  html[data-d2~="p4"] .tw-after .tw-note { font-size: 12px; margin: 0; text-align: center; }
  html[data-d2~="p4"] .tw-find { margin-top: 10px; scroll-margin-top: 58px; }
  html[data-d2~="p4"] .tw-seg button small { font-size: 12px; }
}
html[data-d2~="p4"] .tw-panel { scroll-margin-top: 58px; }
/* S2 intro (p4.js): the lamps start dark and light up booth by booth in April's colours, then the same lamps turn to the by-election's colours. Once per visit, only when the
   mosaic comes into view, stopped by any touch, never with prefers-reduced-motion. */
html[data-d2~="p4"] .tw.p4-pre .tw-mo i { background: var(--ghost) !important; box-shadow: none !important; transition: none !important; }
html[data-d2~="p4"] .tw.p4-intro .tw-mo i { transition-duration: .6s, .6s, .25s, .2s, .4s; transition-delay: calc(var(--i, 0) * 3.4ms), calc(var(--i, 0) * 3.4ms), 0s, 0s, 0s; }
/* short phones: S3 (search, four village buttons, the hooks box) still fits one 740 px screen */
@media (max-width: 999.98px) and (max-height: 800px) {
  html[data-d2~="p4"] .tw-find { padding: 10px 10px 10px; }
  html[data-d2~="p4"] .tw-find .tw-search { margin: 26px 0 2px; }
  html[data-d2~="p4"] .p2-qlab { top: -25px; font-size: 15px; }
  html[data-d2~="p4"] .tw-find .tw-search input { height: 50px; }
  html[data-d2~="p4"] .p2-chips { margin: 4px 0 0; gap: 6px; }
  html[data-d2~="p4"] .p2-chips .p2-k { font-size: 12px; line-height: 1.2; }
  html[data-d2~="p4"] .p2-hooks { margin: 8px 0 0; padding: 6px 10px 2px; min-height: 0; }
  html[data-d2~="p4"] .p2-hooks .p2-hh { margin: 0 0 0; }
  html[data-d2~="p4"] .p2-hk { padding: 2px 6px; font-size: 14px; }
  html[data-d2~="p4"] .p2-hooks .p2-hs { margin: 8px 0 2px; font-size: 13.5px; }
  html[data-d2~="p4"] .p2-hooks .p2-hs span { font-size: 12.5px; margin-top: 1px; }
}

/* ===================================================================================================================================================
   3. an opened village = ONE screen. The row header (village name, big and first; booths and votes; the "changed" chip) + the summary built by p4.js:
      by-election leader and margin, April leader and margin, what changed, rank, one big share button. Nothing else above the fold. */
.p4-pn::before { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--c, #6b7280); margin-right: 5px; vertical-align: -1px; }
.p4-vs { margin: 2px 0 10px; }
.p4-vr { position: relative; margin: 0 0 6px; padding: 7px 10px 8px 15px; border: 1.5px solid #eadbb8; border-radius: 12px; background: #fff; }
.p4-vr::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 5px; border-radius: 3px; background: #4b2fb3; }
.p4-vr.a::before { background: repeating-linear-gradient(180deg, #8a7d6a 0 4px, #d9ceb4 4px 8px); }
.p4-vr.c::before { background: #0d2c43; }
.p4-vl { display: block; font-size: 12.5px; font-weight: 800; line-height: 1.3; color: #4b2fb3; }
.p4-vr.a .p4-vl { color: #4a3e2f; }
.p4-vr.c .p4-vl { color: #0d2c43; }
.p4-vt { display: block; margin-top: 2px; font-size: 16px; line-height: 1.35; font-weight: 600; color: #1a1410; }
.p4-vt b { font-weight: 800; }
.p4-sh { font-weight: 700; color: #4a3e2f; white-space: nowrap; }
.p4-vs2 { font-size: 14px; font-weight: 600; color: #3a2f20; }
.p4-vs .up { color: #0b6b3a; font-weight: 800; } .p4-vs .dn { color: #b3261e; font-weight: 800; }
.p4-sb { display: flex; height: 7px; margin-top: 6px; border-radius: 4px; overflow: hidden; background: #efe8d8; }
.p4-sb i { display: block; height: 100%; }
.p4-rank { display: block; width: fit-content; max-width: 100%; margin: 2px 0 8px; padding: 4px 12px; border-radius: 14px; background: #ece6ff; color: #2f1b84; font-size: 14px; font-weight: 700; line-height: 1.35; }
.p4-rank b { font-weight: 800; }
.p4-vs .v-share.p4-share { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 54px; margin: 0; padding: 8px 16px; border: 0; border-radius: 16px; background: #0d2c43; color: #fff; font: inherit; font-size: 17px; font-weight: 800; cursor: pointer; box-shadow: 0 6px 16px -8px rgba(13, 44, 67, .7); }
.p4-vs .v-share.p4-share svg { width: 22px; height: 22px; flex: none; }
.p4-vs .v-share.p4-share:hover, .p4-vs .v-share.p4-share:active { background: #14405e; }
.p4-note { margin: 8px 2px 0; font-size: 12.5px; line-height: 1.45; color: #3a2f20; }
.p4-adc { margin: 0 0 6px; font-size: 12.5px; line-height: 1.35; font-weight: 600; color: #4a3e2f; }
/* the fold with the candidate-by-candidate numbers */
.p4-full { margin: 10px 0 0; border: 1.5px solid #d9c39a; border-radius: 14px; background: #fff; }
.p4-full > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 6px 14px; font-size: 15px; font-weight: 800; cursor: pointer; }
.p4-full > summary::-webkit-details-marker { display: none; }
.p4-full > summary::after { content: ""; flex: none; width: 10px; height: 10px; border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .2s; }
.p4-full[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.p4-full-b { padding: 0 10px 12px; }
.p4-full-b .dt-seg { position: static; box-shadow: none; margin: 0 0 10px; }

@media (max-width: 999.98px) {
  /* the open village is the whole screen: no search box above it, the find card loses its frame, the card takes the width */
  html[data-d2~="p4"][data-p2s="o"] .tw-find { padding: 0; border: 0; background: none; box-shadow: none; margin-top: 6px; }
  html[data-d2~="p4"][data-p2s="o"] .tw-find :is(.tw-search, .p2-qlab, .tw-bhit) { display: none !important; }
  html[data-d2~="p4"] .tw-vl > li.open { margin: 0; border: 2px solid #4b2fb3; border-radius: 18px; box-shadow: none; background: #fffdf8; scroll-margin-top: 58px; }
  html[data-d2~="p4"] .tw-vl > li.open > .tw-vb { padding: 10px 62px 4px 12px; gap: 2px 8px; align-items: center; }
  html[data-d2~="p4"] .tw-vl > li.open > .tw-vb .vn { flex: 1 0 100%; padding-right: 0; font-size: clamp(17px, calc((100vw - 126px) / 11.6), 26px); line-height: 1.15; overflow-wrap: anywhere; }
  html[data-d2~="p4"] .tw-vl > li.open > .tw-vb .vm { order: 2; flex: 0 1 auto; font-size: 14px; font-weight: 600; color: #3a2f20; }
  html[data-d2~="p4"] .tw-vl > li.open > .tw-vb .vf { order: 3; font-size: 12.5px; }
  html[data-d2~="p4"] .tw-vl > li.open > .tw-vb :is(.vlr, .vbars, .vc) { display: none; }
  html[data-d2~="p4"] .tw-vl > li.open > .tw-vb .tapc { top: 8px; right: 8px; width: 44px; height: 44px; background-size: 18px; }
  html[data-d2~="p4"] .tw-vl > li.open .tw-in { padding: 0 10px 12px; }
  /* inside the village: summary, "next", booths, then the fold with the full numbers */
  html[data-d2~="p4"] .tw-in .dt { display: flex; flex-direction: column; }
  html[data-d2~="p4"] .tw-in .dt > .p4-vs { order: 0; }
  html[data-d2~="p4"] .tw-in .dt > .eg { order: 1; }
  html[data-d2~="p4"] .tw-in .dt > .tws-h4 { order: 2; }
  html[data-d2~="p4"] .tw-in .dt > .p4-adc { order: 3; }
  html[data-d2~="p4"] .tw-in .dt > .tap-hint { display: none; }
  html[data-d2~="p4"] .tw-in .dt > .bl2 { order: 4; }
  html[data-d2~="p4"] .tw-in .dt > .pgbar { order: 5; }
  html[data-d2~="p4"] .tw-in .dt > .p4-full { order: 6; }
  html[data-d2~="p4"] .tw-in .dt > .v-link { order: 7; }
  html[data-d2~="p4"] .tw-in .dt > .p4-note { order: 8; }
  html[data-d2~="p4"] .tw-in .dt > .dt-top, html[data-d2~="p4"] .tw-in .dt > .v-share:not(.p4-share) { display: none; }
  html[data-d2~="p4"] .tw-in .dt > .tws-h4 { margin: 12px 0 4px; font-size: 16px; }
  html[data-d2~="p4"] .tw-in .dt > .eg { margin: 0 0 4px; }
}

/* ===================================================================================================================================================
   4. booth rows (closed) and an opened booth = ONE screen. Closed row: number, address, the two leaders. Opened: village (Tamil) big and first with the booth number,
      the state line, the by-election scoreboard and bars, the same booth in April as a compact row; address, share and neighbours on the next scroll. */
.p4-bs { margin: 0 0 8px; font-size: 18px; line-height: 1.35; font-weight: 600; color: #1a1410; }
.p4-bs b { font-weight: 800; }
.p4-bs.tie { font-weight: 800; }
.p4-fl { display: inline-block; vertical-align: 1px; margin-left: 4px; padding: 2px 10px; border-radius: 999px; background: #ece6ff; color: #2f1b84; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.p4-ba { margin: 8px 0 0; padding: 7px 10px 8px 15px; position: relative; border: 1.5px solid #eadbb8; border-radius: 12px; background: #fff; }
.p4-ba::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 5px; border-radius: 3px; background: repeating-linear-gradient(180deg, #8a7d6a 0 4px, #d9ceb4 4px 8px); }
.p4-ba .p4-vl { color: #4a3e2f; }
.p4-ba .p4-vt { font-size: 16px; }
.p4-ar { display: block; margin-top: 3px; font-size: 13.5px; line-height: 1.4; color: #3a2f20; }
.p4-ar b { font-weight: 800; font-variant-numeric: tabular-nums; }
.p4-bt { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.p4-bt button { flex: 1 1 120px; text-wrap: balance; min-height: 44px; padding: 4px 12px; border: 1.5px solid #1a1410; border-radius: 12px; background: #fffaf0; color: #1a1410; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.p4-bt button[aria-pressed="true"] { background: #0d2c43; border-color: #0d2c43; color: #fff; }
.p4-ad { margin: 10px 0 0; font-size: 13.5px; line-height: 1.45; color: #1a1410; }
.p4-ad b { display: block; font-size: 12.5px; font-weight: 800; color: #4a3e2f; margin-bottom: 1px; }
.p4-ad span { display: block; overflow-wrap: anywhere; }
.p4-pnote { display: none; }
.p4-adc.flat { display: none; }
.tw-find[data-tab="b"] .p4-adc.flat { display: block; margin: 0 0 6px; }

/* inside an opened booth the panes: the by-election numbers always; April / compare only when asked for (the buttons under the April row) */
html[data-d2~="p4"] .tw-find .bd > .dt-pane:not([data-p="oct"]) { display: none; }
html[data-d2~="p4"] .tw-find .bd > .dt-pane[data-p="oct"] { display: block; }
html[data-d2~="p4"] .tw-find .bd[data-bv="apr"] > .dt-pane[data-p="apr"], html[data-d2~="p4"] .tw-find .bd[data-bv="cmp"] > .dt-pane[data-p="cmp"] { display: block; margin-top: 10px; }
html[data-d2~="p4"] .bd .sb-lead, html[data-d2~="p4"] .bd .sb-third, html[data-d2~="p4"] .bd .sb-note { display: none; }
html[data-d2~="p4"] .bd .dt-pane[data-p="apr"] .sb-lead, html[data-d2~="p4"] .bd .dt-pane[data-p="apr"] .sb-third, html[data-d2~="p4"] .bd .dt-pane[data-p="apr"] .sb-note { display: none; }
html[data-d2~="p4"] .dt > .v-share:not(.p4-share) { display: none; }
html[data-d2~="p4"] .dt > .tap-hint { display: none; }

/* opened booth, every width: header = the village name (Tamil, big, first) with the badge "சாவடி 128" under it; the leaders row and the address go (they come again below) */
html[data-d2~="p4"] .tw-find .bl2 > li.is-open { margin: 0; border: 2px solid #4b2fb3; border-radius: 16px; background: #fffdf8; scroll-margin-top: 58px; }
/* the opened booth card clips its corners with overflow: clip (it keeps the rounded look but is not a scroll container, so the pinned name bar inside it can stick); older browsers fall back to visible */
html[data-d2~="p4"] .tw-find .bl2 > li.is-open { overflow: visible; overflow: clip; }
html[data-d2~="p4"] .tw-find .bl2 > li.is-open > .bbd { grid-template-columns: minmax(0, 1fr) 44px; grid-template-rows: auto auto; gap: 4px 8px; padding: 10px 8px 2px 12px; min-height: 0; align-items: center; }
html[data-d2~="p4"] .tw-find .bl2 > li.is-open > .bbd .bx { display: block; grid-column: 1; grid-row: 1; min-width: 0; }
html[data-d2~="p4"] .tw-find .bl2 > li.is-open > .bbd .bv { display: block; font-size: clamp(16px, calc((100vw - 136px) / 11.6), 23px); font-weight: 800; line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
html[data-d2~="p4"] .tw-find .bl2 > li.is-open > .bbd .no { display: inline-flex; align-items: baseline; gap: 7px; justify-self: start; grid-column: 1; grid-row: 2; line-height: 1.15; font-size: 22px; padding: 3px 12px 4px; min-width: 0; border-radius: 10px; }
html[data-d2~="p4"] .tw-find .bl2 > li.is-open > .bbd .no::before { content: attr(data-l); font-size: 14px; font-weight: 800; color: #6b5b3d; }
html[data-d2~="p4"] .tw-find .bl2 > li.is-open > .bbd :is(.ad, .lv, .fp) { display: none; }
html[data-d2~="p4"] .tw-find .bl2 > li.is-open > .bbd .tapc { grid-column: 2; grid-row: 1 / span 2; align-self: start; width: 44px; height: 44px; background-size: 18px; }
html[data-d2~="p4"] .tw-find .bl2 > li.is-open .bd { display: flex; flex-direction: column; padding: 0 10px 12px; }
html[data-d2~="p4"] .tw-find .bd[hidden] { display: none; }
html[data-d2~="p4"] .tw-find .bd > .dt-pane[data-p="oct"] { order: 1; }
html[data-d2~="p4"] .tw-find .bd > .p4-ba { order: 2; }
html[data-d2~="p4"] .tw-find .bd > .dt-pane[data-p="apr"], html[data-d2~="p4"] .tw-find .bd > .dt-pane[data-p="cmp"] { order: 3; }
html[data-d2~="p4"] .tw-find .bd > .p4-ad { order: 4; }
html[data-d2~="p4"] .tw-find .bd > .b-share { order: 5; }
html[data-d2~="p4"] .tw-find .bd > .bnav { order: 6; }
/* the by-election pane: label, state line, a compact board, one-line bars */
html[data-d2~="p4"] .tw-find .bd .dt-pl { margin: 2px 0 4px; font-size: 13.5px; }
html[data-d2~="p4"] .tw-find .bd .dt-res { margin: 0; }
html[data-d2~="p4"] .tw-find .bd .sb-board { padding: 7px 8px 7px; border-radius: 12px; box-shadow: none; }
html[data-d2~="p4"] .tw-find .bd .sb-p { font-size: 15px; }
html[data-d2~="p4"] .tw-find .bd .sb-n { font-size: 30px; margin-top: 0; line-height: 1.1; }
html[data-d2~="p4"] .tw-find .bd .vs2-bars { margin-top: 8px; padding: 6px 8px; gap: 5px; border-radius: 12px; }
html[data-d2~="p4"] .tw-find .bd .vs2-bar-row, html[data-d2~="p4"] .tw-find .bd .vs2-nota-row { grid-template-columns: 74px minmax(0, 1fr) auto auto; row-gap: 2px; column-gap: 8px; }
html[data-d2~="p4"] .tw-find .bd .vs2-bar-row > :nth-child(1), html[data-d2~="p4"] .tw-find .bd .vs2-nota-row > :nth-child(1) { font-size: 12px; padding: 3px 3px; letter-spacing: 0; }
html[data-d2~="p4"] .tw-find .bd .vs2-bar-row > :nth-child(2), html[data-d2~="p4"] .tw-find .bd .vs2-nota-row > :nth-child(2) { font-size: 13.5px; }
html[data-d2~="p4"] .tw-find .bd .vs2-bar-row > :nth-child(5), html[data-d2~="p4"] .tw-find .bd .vs2-nota-row > :nth-child(5) { height: 6px; }
html[data-d2~="p4"] .tw-find .bd .vs2-nota-row { padding-top: 5px; margin-top: 0; }
html[data-d2~="p4"] .tw-find .bd .vs2-foot { margin-top: 6px; padding: 0 4px; font-size: 13px; line-height: 1.4; border: 0; background: none; text-align: center; color: #3a2f20; }
.p4-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html[data-d2~="p4"] .tw-find .bd .b-share { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; margin: 10px 0 0; padding: 6px 16px; border: 0; border-radius: 16px; background: #0d2c43; color: #fff; font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; }
html[data-d2~="p4"] .tw-find .bd .b-share svg { width: 20px; height: 20px; }
html[data-d2~="p4"] .tw-find .bd .bnav { margin: 8px 0 0; }

@media (max-width: 999.98px) {
  /* closed rows: [number] address [chevron] / the two leaders / (changed chip). The village name is the header above, so it is not repeated on 60 rows. */
  html[data-d2~="p4"] .tw-in .bl2 > li { scroll-margin-top: 58px; }
  html[data-d2~="p4"] .tw-in .bl2 > li:not(.is-open) > .bbd { grid-template-columns: 52px minmax(0, 1fr) 44px; grid-template-rows: auto auto auto; gap: 3px 10px; padding: 9px 8px 9px 10px; min-height: 0; align-items: start; }
  html[data-d2~="p4"] .tw-in .bl2 > li:not(.is-open) > .bbd .no { grid-column: 1; grid-row: 1; font-size: 18px; padding: 4px 4px; min-width: 0; align-self: start; }
  html[data-d2~="p4"] .tw-in .bl2 > li:not(.is-open) > .bbd .bx { display: contents; }
  html[data-d2~="p4"] .tw-in .bl2 > li:not(.is-open) .p2-bv { display: none; }
  html[data-d2~="p4"] .tw-in .bl2 > li:not(.is-open) > .bbd .ad { grid-column: 2; grid-row: 1; align-self: center; font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  html[lang][data-d2~="p4"] .tw-in .bl2 .bbd .ad::before { display: none; }
  html[data-d2~="p4"] .tw-in .bl2 > li:not(.is-open) > .bbd .tapc { grid-column: 3; grid-row: 1; align-self: center; }
  html[data-d2~="p4"] .tw-in .bl2 > li:not(.is-open) > .bbd .lv { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 10px; margin-top: 2px; }
  html[data-d2~="p4"] .tw-in .bl2 > li:not(.is-open) > .bbd .fp { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
  html[data-d2~="p4"] .tw-in .bl2 .bbd .lv small { font-size: 12px; font-weight: 700; color: #4a3e2f; line-height: 1.25; }
  /* the list of all 320 booths (the "சாவடிகள்" tab): village name first, then the address, then the two leaders */
  html[data-d2~="p4"] .tw-find > .tf-left > .bl2.tw-bl > li:not(.is-open) > .bbd { grid-template-columns: 52px minmax(0, 1fr) 44px; grid-template-rows: auto auto auto auto; gap: 2px 10px; padding: 9px 8px 9px 10px; min-height: 0; align-items: start; }
  html[data-d2~="p4"] .tw-find > .tf-left > .bl2.tw-bl > li:not(.is-open) > .bbd .no { grid-column: 1; grid-row: 1 / span 2; font-size: 18px; padding: 4px 4px; min-width: 0; align-self: start; }
  html[data-d2~="p4"] .tw-find > .tf-left > .bl2.tw-bl > li:not(.is-open) > .bbd .bx { display: contents; }
  html[data-d2~="p4"] .tw-find > .tf-left > .bl2.tw-bl > li:not(.is-open) > .bbd .bv { grid-column: 2; grid-row: 1; font-size: 15.5px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
  html[data-d2~="p4"] .tw-find > .tf-left > .bl2.tw-bl > li:not(.is-open) > .bbd .ad { grid-column: 2; grid-row: 2; font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  html[lang][data-d2~="p4"] .tw-find > .tf-left > .bl2.tw-bl .bbd .ad::before { display: none; }
  html[data-d2~="p4"] .tw-find > .tf-left > .bl2.tw-bl > li:not(.is-open) > .bbd .tapc { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
  html[data-d2~="p4"] .tw-find > .tf-left > .bl2.tw-bl > li:not(.is-open) > .bbd .lv { grid-column: 1 / -1; grid-row: 3; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 10px; margin-top: 2px; }
  html[data-d2~="p4"] .tw-find > .tf-left > .bl2.tw-bl > li:not(.is-open) > .bbd .fp { grid-column: 1 / -1; grid-row: 4; justify-self: start; }
  html[data-d2~="p4"] .tw-find > .tf-left > .bl2.tw-bl .bbd .lv small { font-size: 12px; font-weight: 700; color: #4a3e2f; line-height: 1.25; }
}
@media (min-width: 1000px) {
  html[data-d2~="p4"] .tw-find .bl2 > li.is-open > .bbd .bv { font-size: 22px; }
}

/* ===================================================================================================================================================
   5. small text and small buttons: nothing the visitor needs is under 12 px, every button is at least 44 px (the older rules used 10.5 to 11.5 px labels and 34 to 40 px buttons) */
html[data-d2~="p4"] .tw-seg button small, html[data-d2~="p4"] .dt-seg button small { font-size: 12px; opacity: .9; }
html[data-d2~="p4"] .tw-tabs small, html[data-d2~="p4"] .tw-sort small { font-size: 12.5px; }
html[data-d2~="p4"] .vt-head, html[data-d2~="p4"] .vt-head .vt-k { font-size: 12.5px; }
html[data-d2~="p4"] .vt-head .vt-t { font-size: 12.5px; }
html[data-d2~="p4"] .cmpd th, html[data-d2~="p4"] .cmpd th small, html[data-d2~="p4"] .cmpd th:first-child { font-size: 12px; }
html[data-d2~="p4"] .pt-table thead th .th-d, html[data-d2~="p4"] .pt-table thead th { font-size: 12.5px; }
html[data-d2~="p4"] .b2o-chg, html[data-d2~="p4"] .b2o-same, html[data-d2~="p4"] .ct-table .ct-chg .b2o-chg, html[data-d2~="p4"] .ct-table .ct-chg .b2o-same { font-size: 12.5px; }
html[data-d2~="p4"] .tw-vb .vlc .vld, html[data-d2~="p4"] [data-variant="d"] .tw-vb .vlc .vld { font-size: 12px; }
html[data-d2~="p4"] [data-variant="d"] .tw-vb .vf, html[data-d2~="p4"] .tw-vb .vf { font-size: 12.5px; }
html[data-d2~="p4"] .bbd .lv small, html[data-d2~="p4"] [data-variant="d"] .bbd .lv small { font-size: 12px; }
html[data-d2~="p4"] .tw-lr li.tr { min-height: 44px; }
html[data-d2~="p4"] [data-variant="d"] .tw-lr li { min-height: 36px; }
html[data-d2~="p4"] [data-variant="d"] .tw-lr li.tr { min-height: 44px; }
html[data-d2~="p4"] .bsh-ov .bsh-btn { min-height: 44px; font-size: 14px; }
html[data-d2~="p4"] .bsh-cap { font-size: 12.5px; }
html[data-d2~="p4"] .tap-hint, html[data-d2~="p4"] .tw-tip { font-size: 13px; }
html[data-d2~="p4"] .cmpd .rk { font-size: 12px; width: 22px; height: 22px; }
html[data-d2~="p4"] .foot-nav-h { font-size: 12px; }
/* the compare table on a phone (village and booth): the party column is single-line, the three number columns are wide enough for their own headings */
@media (max-width: 999.98px) {
  html[data-d2~="p4"] .cmpd { table-layout: fixed; width: 100%; }
  html[data-d2~="p4"] .cmpd .rk { display: none; }
  html[data-d2~="p4"] .cmpd th, html[data-d2~="p4"] .cmpd td { padding-left: 2px; padding-right: 2px; }
  html[data-d2~="p4"] .cmpd th:nth-child(1), html[data-d2~="p4"] .cmpd td:nth-child(1) { width: 25%; max-width: none; }
  html[data-d2~="p4"] .cmpd th:nth-child(2), html[data-d2~="p4"] .cmpd td:nth-child(2), html[data-d2~="p4"] .cmpd th:nth-child(3), html[data-d2~="p4"] .cmpd td:nth-child(3) { width: 28%; }
  html[data-d2~="p4"] .cmpd th:nth-child(4), html[data-d2~="p4"] .cmpd td:nth-child(4) { width: 19%; text-align: right; }
  html[data-d2~="p4"] .cmpd th { font-size: 12px; font-weight: 800; line-height: 1.25; letter-spacing: -.03em; vertical-align: bottom; white-space: normal; }
  html[data-d2~="p4"] .cmpd th small { display: block; font-size: 12px; font-weight: 600; white-space: normal; letter-spacing: -.02em; }
  html[data-d2~="p4"] .cmpd td:first-child { white-space: normal; font-size: 13px; border-left: 4px solid var(--c, #8b93a0); padding-left: 5px; letter-spacing: -.02em; }
  html[data-d2~="p4"] .cmpd td:first-child .dt { display: none; }
  html[data-d2~="p4"] .cmpd td.sw { font-size: 13px; white-space: nowrap; }
  html[data-d2~="p4"] .cmpd td b { font-size: 14px; }
  html[data-d2~="p4"] .p4-full { overflow: hidden; }
  html[data-d2~="p4"] .p4-full-b { padding: 0 2px 10px; }
  html[data-d2~="p4"] .tw-vl > li.open .tw-in { padding: 0 6px 12px; }
  html[data-d2~="p4"] .tw-in .bl2 > li.is-open .bd { padding: 0 6px 12px; }
}
@media (max-width: 999.98px) {
  html[data-d2~="p4"] .cmpd th { letter-spacing: -.045em; padding-left: 1px; padding-right: 1px; }
  html[data-d2~="p4"] .cmpd th small { letter-spacing: -.03em; }
  html[data-d2~="p4"] .tw-in .bl2 > li.is-open .bd { padding: 0 4px 12px; }
  html[data-d2~="p4"] .ct-table .ct-ch { white-space: normal; }
}

/* ===================================================================================================================================================
   6. desktop (>= 1000 px): the same order in the right-hand detail, two result rows side by side, the candidate fold open */
@media (min-width: 1000px) {
  html[data-d2~="p4"] .tf-detail .dt { display: flex; flex-direction: column; }
  html[data-d2~="p4"] .tf-detail .dt > .dt-top { order: -2; }
  html[data-d2~="p4"] .tf-detail .dt > .p4-vs { order: -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px; margin: 4px 0 12px; }
  html[data-d2~="p4"] .tf-detail .dt > .p4-vs .p4-vr { margin: 0; }
  html[data-d2~="p4"] .tf-detail .dt > .p4-vs .p4-vr.c, html[data-d2~="p4"] .tf-detail .dt > .p4-vs .p4-rank, html[data-d2~="p4"] .tf-detail .dt > .p4-vs .p4-share { grid-column: 1 / -1; }
  html[data-d2~="p4"] .tf-detail .dt > .p4-vs .p4-rank { margin: 0; }
  html[data-d2~="p4"] .tf-detail .dt > .p4-full { order: 1; }
  html[data-d2~="p4"] .tf-detail .dt > .eg { order: 2; }
  html[data-d2~="p4"] .tf-detail .dt > .tws-h4 { order: 3; }
  html[data-d2~="p4"] .tf-detail .dt > .p4-adc { order: 4; }
  html[data-d2~="p4"] .tf-detail .dt > .bl2 { order: 5; }
  html[data-d2~="p4"] .tf-detail .dt > .pgbar { order: 6; }
  html[data-d2~="p4"] .tf-detail .dt > .v-link { order: 7; }
  html[data-d2~="p4"] .tf-detail .dt > .p4-note { order: 8; }
  html[data-d2~="p4"] .tf-detail .dt-seg { position: static; box-shadow: none; }
}
/* in the village's own full numbers the lead sentence and the third-place line repeat the summary above: they go (the postal note stays once) */
html[data-d2~="p4"] .p4-full .sb-lead, html[data-d2~="p4"] .p4-full .sb-third { display: none; }
html[data-d2~="p4"] .tw-clear { width: 44px; height: 44px; right: 3px; font-size: 16px; }
html[data-d2~="p4"] .tw-find .tw-search input { padding-right: 52px; }
@media (max-width: 999.98px) {
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs2-c { grid-template-columns: minmax(0, 1fr) 46px; column-gap: 4px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] .hx .vs2-p { text-align: right; white-space: nowrap; }
}
@media (max-width: 340px) {
  html[data-d2~="p4"] .cmpd th { letter-spacing: -.06em; }
  html[data-d2~="p4"] .cmpd th small { letter-spacing: -.05em; }
  html[data-d2~="p4"] .cmpd td:first-child { font-size: 12px; letter-spacing: -.04em; }
}
html[data-d2~="p4"] .dt-x { min-height: 44px; min-width: 44px; }
html[data-d2~="p4"] .b2-page .tn-fab { width: 44px; height: 44px; }
html[data-d2~="p4"] .hx .vs2-hc small { font-size: 12px; }
html[data-d2~="p4"] .hx .vs2 .vs-n { font-size: 12.5px; }

@media (max-width: 999.98px) {
  html[data-d2~="p4"] .eg [data-p4x] { display: none; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .bw-crumbs .p4-pshare { flex: none; margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1.5px solid #cdbb98; border-radius: 999px; background: #fff; color: #1a1410; cursor: pointer; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .bw-crumbs .p4-pshare svg { width: 20px; height: 20px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .bw-crumbs .p4-pshare + a.eg-lang { margin-left: 6px; }
}
/* one clear button, not two: the browser's own cross in a search box goes (the page's own 44 px button stays) */
html[data-d2~="p4"] .tw-search input::-webkit-search-cancel-button, html[data-d2~="p4"] .tw-search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }

/* ===================================================================================================================================================
   7. no layout jump while the script builds S1 (a slow phone paints before the script runs): until the script has finished (it sets data-p4r on the seat card), the seat card
      already has the final heights: the two winner pills are as tall as the result rows will be, the table heads keep one quiet line, and the room of the search button and the cue is reserved. */
@media (max-width: 999.98px) {
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .hx:not([data-p4r]) { margin-bottom: 96px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .hx:not([data-p4r]) .hx-wins { display: grid; gap: 5px; margin-top: 8px; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .hx:not([data-p4r]) .hx-win { display: flex; align-items: center; min-height: 48px; margin: 0; padding: 4px 12px; border-radius: 14px; font-size: 14px; line-height: 1.25; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .hx:not([data-p4r]) .vs2-hc small { display: block; height: 15px; overflow: hidden; font-size: 0; }
  html[data-d2~="p4"] .bw-wrap[data-booth2] > .hx:not([data-p4r]) .hx-top { margin-bottom: 0; }
}

/* ===================================================================================================================================================
   8. the empty band above the footer (72 px under the last block + 60 px over the footer) is trimmed on this page: no decorative gap */
html[data-d2~="p4"] main.bw-wrap[data-booth2] { padding-bottom: 16px; }
html[data-d2~="p4"] main.bw-wrap[data-booth2] ~ footer, html[data-d2~="p4"] main.bw-wrap[data-booth2] + footer { margin-top: 24px; }

/* ===================================================================================================================================================
   9. the card that opens when a dot is tapped on a phone: village (Tamil) and booth number first, then the two leaders, then the labelled address, then the buttons */
@media (max-width: 999.98px) {
  html[data-d2~="p4"] .tw-pick { display: flex; flex-direction: column; }
  html[data-d2~="p4"] .tw-pick[hidden] { display: none; }
  html[data-d2~="p4"] .tw-pick .pk-t { order: 0; }
  html[data-d2~="p4"] .tw-pick .pk-lv { order: 1; margin-top: 6px; }
  html[data-d2~="p4"] .tw-pick .pk-ad { order: 2; margin: 8px 0 0; font-size: 13.5px; }
  html[lang="ta"][data-d2~="p4"] .tw-pick .pk-ad::before { content: "ECI முகவரி (ஆங்கிலம்): "; font-weight: 800; color: #4a3e2f; }
  html[lang="en"][data-d2~="p4"] .tw-pick .pk-ad::before { content: "ECI address (English): "; font-weight: 800; color: #4a3e2f; }
  html[data-d2~="p4"] .tw-pick .pk-go { order: 3; margin-top: 10px; }
  html[data-d2~="p4"] .tw-pick .pk-nav { order: 4; }
  html[data-d2~="p4"] .tw-pick .pk-x { width: 44px; height: 44px; }
}
html[data-d2~="p4"] .tw-pick .pk-lv small, html[data-d2~="p4"] .tw-pick .pk-lv .lc small, html[data-d2~="p4"] .tw-pick .pk-lv .tp, html[data-d2~="p4"] .tw-pick .pk-lv .tie2 small { font-size: 12px; }
html[data-d2~="p4"] .tw-pick .pk-lv .fp { font-size: 12.5px; }

/* 15 Oct 2026: the pinned place name (phones and desktop). A zero-height sticky wrapper under the site header (its height comes from the script: --p4-hh); the bar shows only while pinned. */
html[data-d2~="p4"] .p4-ctx { position: sticky; top: var(--p4-hh, 51px); z-index: 8; height: 0; margin: 0; padding: 0; order: -1; pointer-events: none; }
html[data-d2~="p4"] .p4-cb { position: absolute; left: -2px; right: -2px; top: 0; display: none; align-items: center; gap: 8px; min-height: 40px; padding: 5px 12px; background: #fffaf0;
  border-bottom: 2px solid #d9c39a; box-shadow: 0 6px 10px -8px rgba(26, 20, 16, .45); font-size: 15px; line-height: 1.25; }
html[data-d2~="p4"] .p4-ctx.on .p4-cb { display: flex; }
html[data-d2~="p4"] .p4-cn { flex: 1 1 auto; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-d2~="p4"] .p4-cl { flex: none; max-width: 62%; font-size: 12.5px; font-weight: 700; color: #4a3e2f; background: #f1e6cf; border-radius: 999px; padding: 2px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-d2~="p4"] .p4-cl[hidden] { display: none; }
@media (min-width: 900px) {
  html[data-d2~="p4"] .p4-cb { min-height: 46px; padding: 6px 16px; font-size: 17px; border: 2px solid #d9c39a; border-top: 0; border-radius: 0 0 14px 14px; }
  html[data-d2~="p4"] .p4-cl { font-size: 13.5px; padding: 3px 12px; }
}
