/* Phase 4 design-system layer: shared visual polish and low-risk normalization. */
:root{
  --cmep-radius-sm:10px;
  --cmep-radius-md:14px;
  --cmep-radius-lg:18px;
  --cmep-radius-xl:24px;
  --cmep-gap-xs:.35rem;
  --cmep-gap-sm:.6rem;
  --cmep-gap-md:1rem;
  --cmep-gap-lg:1.5rem;
  --cmep-control-height:42px;
  --cmep-map-control-size:32px;
  --cmep-map-control-bg:rgba(255,255,255,.96);
  --cmep-map-control-border:rgba(15,23,42,.14);
  --cmep-map-control-shadow:0 10px 24px rgba(15,23,42,.12);
}

/* Shared interactive treatment. Avoids rewriting page-specific visual systems while making controls feel related. */
:where(.btn,.button,button:not(.maplibregl-ctrl button):not(.mapboxgl-ctrl button),[role="button"]){
  font-weight:800;
  border-radius:999px;
}
:where(.card,.race-card,.contest-card,.result-card,.state-card,.district-card,.projection-card,.featured-card,.method-card){
  border-radius:var(--cmep-radius-lg);
}
:where(.pill,.badge,.tag,.party-pill){
  border-radius:999px;
  font-weight:800;
}

/* Shared table/card behavior for desktop and mobile. */
:where(table){border-collapse:separate;border-spacing:0}
:where(th){font-weight:900;letter-spacing:.01em}
:where(td,th){vertical-align:middle}
@media (max-width:720px){
  :where(.card,.race-card,.contest-card,.result-card,.state-card,.district-card,.projection-card,.featured-card,.method-card){border-radius:var(--cmep-radius-md)}
  :where(.btn,.button,button,[role="button"]){line-height:1.15}
}

/* Standardized map controls across MapLibre and custom SVG maps. */
:where(.maplibregl-ctrl-group,.mapboxgl-ctrl-group){
  border-radius:12px!important;
  overflow:hidden!important;
  box-shadow:var(--cmep-map-control-shadow)!important;
  border:1px solid var(--cmep-map-control-border)!important;
}
:where(.maplibregl-ctrl button,.mapboxgl-ctrl button){
  width:var(--cmep-map-control-size)!important;
  height:var(--cmep-map-control-size)!important;
  min-width:var(--cmep-map-control-size)!important;
  min-height:var(--cmep-map-control-size)!important;
  border-radius:0!important;
  background-color:var(--cmep-map-control-bg)!important;
}
:where(.maplibregl-ctrl button:hover,.mapboxgl-ctrl button:hover){background-color:#f8fafc!important}
:where(.cmep-map-reset,.gov-map-btn,.gov-map-icon-btn,#cmep-governor-map-reset,#cmep-governor-map-ak-reset,#cmep-governor-map-hi-reset){
  min-height:32px!important;
  height:32px;
  padding:.42rem .72rem!important;
  border-radius:999px!important;
  font-size:12px!important;
  line-height:1!important;
  font-weight:900!important;
  box-shadow:var(--cmep-map-control-shadow);
  border:1px solid var(--cmep-map-control-border)!important;
  background:var(--cmep-map-control-bg)!important;
  color:var(--text-strong,#0f172a)!important;
}
:where(.cmep-map-reset,.gov-map-btn,.gov-map-icon-btn,#cmep-governor-map-reset,#cmep-governor-map-ak-reset,#cmep-governor-map-hi-reset):hover{
  transform:translateY(-1px);
  background:#f8fafc!important;
}

/* Homepage House arc tooltip resilience. The arc uses SVG circles; keep hit testing precise. */
#cmep-house-arc-native svg,
#cmep-house-arc-native .arc-wrap,
#cmep-house-arc-native .seat,
#cmep-house-arc-native .seat-group{pointer-events:auto}
#cmep-house-arc-native .seat{cursor:pointer}
#cmep-house-arc-tooltip{z-index:10050!important;will-change:left,top,transform}
#cmep-house-arc-tooltip.is-visible{display:block!important}

/* Prevent generic mobile rules from distorting maps and arcs. */
:where(.maplibregl-canvas,.mapboxgl-canvas){max-width:none!important}
:where(svg .seat,svg [data-dist],svg [data-state]){pointer-events:auto}

/* Phase 4 correction pass: standardized pills, map controls, arc tooltips, and mobile path controls. */
:root{
  --cmep-tooltip-bg:rgba(255,255,255,.96);
  --cmep-tooltip-border:rgba(15,23,42,.12);
  --cmep-tooltip-shadow:0 18px 42px rgba(15,23,42,.18);
}
@media (prefers-color-scheme:dark){
  :root{
    --cmep-map-control-bg:rgba(15,23,42,.96);
    --cmep-map-control-border:rgba(255,255,255,.16);
    --cmep-tooltip-bg:rgba(2,6,23,.94);
    --cmep-tooltip-border:rgba(255,255,255,.16);
    --cmep-tooltip-shadow:0 22px 48px rgba(0,0,0,.55);
  }
}

/* Keep map controls visually consistent in both light and dark mode. */
:where(.maplibregl-ctrl-group,.mapboxgl-ctrl-group){
  background:var(--cmep-map-control-bg)!important;
  border-color:var(--cmep-map-control-border)!important;
}
:where(.maplibregl-ctrl button,.mapboxgl-ctrl button){
  background:var(--cmep-map-control-bg)!important;
  color:var(--text-strong,#0f172a)!important;
}
:where(.maplibregl-ctrl button:hover,.mapboxgl-ctrl button:hover){background:color-mix(in srgb,var(--cmep-map-control-bg) 82%,var(--text-strong,#0f172a) 8%)!important}
@media (prefers-color-scheme:dark){
  :where(.maplibregl-ctrl button,.mapboxgl-ctrl button){filter:invert(1) hue-rotate(180deg)}
  :where(.cmep-map-reset,.gov-map-btn,.gov-map-icon-btn,#cmep-governor-map-reset,#cmep-governor-map-ak-reset,#cmep-governor-map-hi-reset){
    background:var(--cmep-map-control-bg)!important;
    border-color:var(--cmep-map-control-border)!important;
    color:var(--text-strong,#f9fafb)!important;
  }
  :where(.cmep-map-reset,.gov-map-btn,.gov-map-icon-btn,#cmep-governor-map-reset,#cmep-governor-map-ak-reset,#cmep-governor-map-hi-reset):hover{
    background:rgba(30,41,59,.98)!important;
  }
}

/* Pills: rating pills should always use white text; pivotal/flip pills intentionally remain black. */
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).solid-D,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).solid-d,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).likely-D,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).likely-d,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).lean-D,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).lean-d,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).toss-up,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).lean-R,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).lean-r,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).likely-R,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).likely-r,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).solid-R,
:where(.rating-pill,.cl-pill,.ct-chip,.pill,.badge,.tag).solid-r,
:where(.cl-pill-lean-d,.cl-pill-lean-r,.cl-pill-likely-d,.cl-pill-likely-r,.cl-pill-solid-d,.cl-pill-solid-r,.cl-pill-toss-up){
  color:#fff!important;
}
:where(.pill-flip,.flip-pill,.pivotal-pill,.majority-pill,.pivotal-race,.flip-cell){
  color:#000!important;
}

/* Shared tooltip shell used by the sitewide fallback and legacy tooltip IDs. */
:where(.cmep-site-tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,#cmep-senate-arc-native #tooltip){
  border-radius:18px!important;
  border:1px solid var(--cmep-tooltip-border)!important;
  background:var(--cmep-tooltip-bg)!important;
  color:var(--text-main,#111827)!important;
  box-shadow:var(--cmep-tooltip-shadow)!important;
  max-width:min(330px,calc(100vw - 16px))!important;
  font-size:.9rem!important;
  line-height:1.25!important;
}
@supports ((-webkit-backdrop-filter:blur(1px)) or (backdrop-filter:blur(1px))){
  :where(.cmep-site-tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,#cmep-senate-arc-native #tooltip){
    -webkit-backdrop-filter:blur(12px);
    backdrop-filter:blur(12px);
  }
}
.cmep-site-tooltip{
  position:fixed;
  left:0;
  top:0;
  z-index:100000;
  display:none;
  min-width:220px;
  padding:.72rem .82rem;
  pointer-events:none;
  transform:translate3d(0,0,0);
}
.cmep-site-tooltip.is-visible{display:block}
.cmep-site-tooltip.mobile{
  left:50%!important;
  right:auto!important;
  top:auto!important;
  bottom:24px!important;
  width:min(330px,calc(100vw - 16px));
  min-width:0;
  pointer-events:auto;
  transform:translateX(-50%)!important;
}
@supports (padding-bottom:env(safe-area-inset-bottom)){
  .cmep-site-tooltip.mobile{bottom:calc(env(safe-area-inset-bottom) + 20px)!important}
}
.cmep-site-tooltip .ct-head{font-weight:900;font-size:.95rem;letter-spacing:-.01em;color:var(--text-strong,#000);margin:0 0 .35rem}
.cmep-site-tooltip .ct-summary{display:flex;flex-wrap:wrap;gap:.35rem;margin:0 0 .45rem}
.cmep-site-tooltip .ct-chip{display:inline-flex;align-items:center;justify-content:center;padding:.18rem .5rem;border-radius:999px;border:1px solid var(--border-subtle,rgba(148,163,184,.35));background:var(--bg-card-subtle,rgba(148,163,184,.12));color:var(--text-muted,#64748b);font-size:.72rem;font-weight:850;line-height:1.1}
.cmep-site-tooltip .ct-chip.solid-D,.cmep-site-tooltip .ct-chip.solid-d{background:var(--solid-d,#0076BA);border-color:transparent;color:#fff}
.cmep-site-tooltip .ct-chip.likely-D,.cmep-site-tooltip .ct-chip.likely-d{background:var(--likely-d,#00A2FF);border-color:transparent;color:#fff}
.cmep-site-tooltip .ct-chip.lean-D,.cmep-site-tooltip .ct-chip.lean-d{background:var(--lean-d,#56C1FF);border-color:transparent;color:#fff}
.cmep-site-tooltip .ct-chip.toss-up{background:var(--toss-up,#929292);border-color:transparent;color:#fff}
.cmep-site-tooltip .ct-chip.lean-R,.cmep-site-tooltip .ct-chip.lean-r{background:var(--lean-r,#FF968D);border-color:transparent;color:#fff}
.cmep-site-tooltip .ct-chip.likely-R,.cmep-site-tooltip .ct-chip.likely-r{background:var(--likely-r,#FF644E);border-color:transparent;color:#fff}
.cmep-site-tooltip .ct-chip.solid-R,.cmep-site-tooltip .ct-chip.solid-r{background:var(--solid-r,#EE220C);border-color:transparent;color:#fff}
.cmep-site-tooltip .ct-rows{display:grid;gap:.36rem}
.cmep-site-tooltip .ct-row{display:flex;align-items:center;justify-content:space-between;gap:.8rem}
.cmep-site-tooltip .ct-name{font-weight:850;color:var(--text-strong,#000);line-height:1.15}
.cmep-site-tooltip .ct-sub{color:var(--text-muted,#64748b);font-size:.76rem;font-weight:750;line-height:1.15}
.cmep-site-tooltip .ct-right{text-align:right;white-space:nowrap}
.cmep-site-tooltip .ct-pct{font-weight:900;font-variant-numeric:tabular-nums}
.cmep-site-tooltip .ct-pct.d{color:var(--solid-d,#0076BA)}
.cmep-site-tooltip .ct-pct.r{color:var(--solid-r,#EE220C)}
.cmep-site-tooltip .cmep-tooltip-link{display:flex;align-items:center;justify-content:center;margin-top:.65rem;padding:.55rem .7rem;border-radius:999px;background:var(--text-strong,#0f172a);color:var(--bg-card,#fff)!important;text-decoration:none;font-weight:900;font-size:.8rem}

/* Arc hit testing and mobile path controls. */
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(svg,.arc-wrap,.seat,.seat-group,circle){pointer-events:auto!important}
:where(#cmep-house-arc-native,#cmep-senate-arc-native) .seat{cursor:pointer;touch-action:manipulation}
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-dot){
  min-width:0!important;
  min-height:0!important;
  padding:0!important;
  flex:0 0 auto!important;
  aspect-ratio:1/1;
  border-radius:999px!important;
}
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-dots){
  max-width:100%;
  overflow-x:auto;
  overflow-y:visible;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
:where(#cmep-house-arc-native,#cmep-senate-arc-native) .mobile-path-dots::-webkit-scrollbar{display:none}
@media (max-width:640px), (hover:none), (pointer:coarse){
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(#cmep-house-arc-path-controls,#path-controls){
    width:100%;
    max-width:100%;
    box-sizing:border-box;
    padding-inline:8px;
    gap:12px!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.path-button){
    min-width:0!important;
    min-height:0!important;
    width:clamp(78px,31vw,96px)!important;
    height:clamp(78px,31vw,96px)!important;
    max-width:42vw!important;
    flex:0 0 auto!important;
    aspect-ratio:1/1!important;
    padding:.35rem!important;
    white-space:normal!important;
    overflow:hidden!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-majority,.mobile-path-cards){
    max-width:100%!important;
    box-sizing:border-box!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-card){
    max-width:calc(100vw - 32px)!important;
    box-sizing:border-box!important;
  }
}

/* Phase 4 standardization correction: authoritative shared controls, no page-width blowouts. */
html,body{max-width:100%;overflow-x:hidden}
:where(#cmep-house-arc-native,#cmep-senate-arc-native){max-width:100%;overflow-x:hidden;box-sizing:border-box}
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.arc-card,.arc-panel,.arc-wrap,.chart-wrap,.shell,.card){max-width:100%;box-sizing:border-box}
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(svg){max-width:100%;height:auto}
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.cmep-seat-link){cursor:pointer;outline:none;pointer-events:auto}
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.cmep-seat-link .seat){pointer-events:auto}
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.cmep-seat-link:focus-visible .seat){stroke:var(--flip-gold,#F6CE46)!important;stroke-width:2!important}

/* Keep native arc tooltip content authoritative. The shared layer only standardizes the shell. */
:where(#tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,.chart-tooltip,#cmep-global-tooltip){
  border-radius:18px!important;
  border:1px solid var(--cmep-tooltip-border,rgba(15,23,42,.13))!important;
  background:var(--cmep-tooltip-bg,rgba(255,255,255,.96))!important;
  color:var(--text-main,#111827)!important;
  box-shadow:var(--cmep-tooltip-shadow,0 18px 45px rgba(15,23,42,.20))!important;
}
@media (prefers-color-scheme:dark){
  :root{--cmep-tooltip-bg:rgba(2,6,23,.94);--cmep-tooltip-border:rgba(255,255,255,.14);--cmep-map-control-bg:rgba(15,23,42,.96);--cmep-map-control-border:rgba(255,255,255,.16)}
  :where(#tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,.chart-tooltip,#cmep-global-tooltip){color:var(--text-main,#e5e7eb)!important}
}

/* Structural fix: mobile Path-to-Majority cards must scroll inside the module, not widen the page. */
@media (max-width:820px), (hover:none), (pointer:coarse){
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-majority){
    display:none;
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-majority.show){display:block!important}
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-cards){
    display:flex!important;
    flex-wrap:nowrap!important;
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    overscroll-behavior-x:contain;
    scroll-snap-type:x mandatory;
    -webkit-overflow-scrolling:touch;
    box-sizing:border-box!important;
    padding:2px 12px 8px!important;
    gap:12px!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-card){
    flex:0 0 min(320px, calc(100vw - 48px))!important;
    width:min(320px, calc(100vw - 48px))!important;
    min-width:min(320px, calc(100vw - 48px))!important;
    max-width:min(320px, calc(100vw - 48px))!important;
    scroll-snap-align:center;
    box-sizing:border-box!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-dots){
    display:flex!important;
    flex-wrap:nowrap!important;
    justify-content:center!important;
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    box-sizing:border-box!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-dot){
    min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;padding:0!important;line-height:0!important;
  }
}

/* Fully standardize MapLibre controls and custom map reset controls in dark mode. */
:where(.maplibregl-ctrl-group,.mapboxgl-ctrl-group){background:var(--cmep-map-control-bg,rgba(255,255,255,.96))!important;border-color:var(--cmep-map-control-border,rgba(15,23,42,.14))!important}
:where(.maplibregl-ctrl button,.mapboxgl-ctrl button){background-color:var(--cmep-map-control-bg,rgba(255,255,255,.96))!important;color:var(--text-strong,#0f172a)!important}
:where(.maplibregl-ctrl button:hover,.mapboxgl-ctrl button:hover){background-color:color-mix(in srgb,var(--cmep-map-control-bg,white) 86%,var(--text-strong,#0f172a) 14%)!important}
:where(.maplibregl-ctrl button .maplibregl-ctrl-icon,.mapboxgl-ctrl button .mapboxgl-ctrl-icon){filter:none!important}
@media (prefers-color-scheme:dark){
  :where(.maplibregl-ctrl button .maplibregl-ctrl-icon,.mapboxgl-ctrl button .mapboxgl-ctrl-icon){filter:invert(1) brightness(1.35)!important}
  :where(.cmep-map-reset,.gov-map-btn,.gov-map-icon-btn,#cmep-governor-map-reset,#cmep-governor-map-ak-reset,#cmep-governor-map-hi-reset,.map-reset,.reset-map){
    background:rgba(15,23,42,.96)!important;color:#f8fafc!important;border-color:rgba(255,255,255,.16)!important;
  }
}

/* Rating pills: enforce consistent contrast while preserving pivotal/flip gold black text. */
:where(.solid-D,.solid-d,.likely-D,.likely-d,.lean-D,.lean-d,.toss-up,.lean-R,.lean-r,.likely-R,.likely-r,.solid-R,.solid-r,
.rating-solid-D,.rating-solid-d,.rating-likely-D,.rating-likely-d,.rating-lean-D,.rating-lean-d,.rating-toss-up,.rating-lean-R,.rating-lean-r,.rating-likely-R,.rating-likely-r,.rating-solid-R,.rating-solid-r,
.cl-pill-lean-d,.cl-pill-lean-r,.cl-pill-likely-d,.cl-pill-likely-r,.cl-pill-solid-d,.cl-pill-solid-r,.cl-pill-toss-up){color:#fff!important}
:where(.pill-flip,.flip-pill,.pivotal-pill,.majority-pill,.pivotal-race,.flip-cell,.majority-maker){color:#000!important}

/* --------------------------------------------------------------------------
   Phase 4D sitewide design-system enforcement
   -------------------------------------------------------------------------- */
:root{
  --cmep-radius-sm:10px;
  --cmep-radius-md:14px;
  --cmep-radius-lg:20px;
  --cmep-radius-xl:24px;
  --cmep-control-bg:rgba(255,255,255,.96);
  --cmep-control-fg:#0f172a;
  --cmep-control-border:rgba(15,23,42,.16);
  --cmep-control-shadow:0 12px 28px rgba(15,23,42,.14);
  --cmep-tooltip-bg:rgba(255,255,255,.97);
  --cmep-tooltip-fg:var(--text-main,#111827);
  --cmep-tooltip-border:rgba(15,23,42,.14);
  --cmep-tooltip-shadow:0 18px 45px rgba(15,23,42,.22);
}
@media (prefers-color-scheme:dark){
  :root{
    --cmep-control-bg:rgba(15,23,42,.98);
    --cmep-control-fg:#f8fafc;
    --cmep-control-border:rgba(255,255,255,.18);
    --cmep-control-shadow:0 14px 34px rgba(0,0,0,.45);
    --cmep-tooltip-bg:rgba(2,6,23,.96);
    --cmep-tooltip-fg:var(--text-main,#e5e7eb);
    --cmep-tooltip-border:rgba(255,255,255,.16);
    --cmep-tooltip-shadow:0 18px 48px rgba(0,0,0,.55);
  }
}

/* Buttons: shared shape, while preserving page colors. */
:where(button,.btn,.cmep-btn,.nav-button,.tab-button,.filter-btn,.seg-btn,.toggle-btn,.state-btn,.race-btn){
  border-radius:999px;
  font-weight:800;
  letter-spacing:.01em;
}
:where(button,.btn,.cmep-btn,.nav-button,.tab-button,.filter-btn,.seg-btn,.toggle-btn,.state-btn,.race-btn):focus-visible,
:where(a,.cmep-seat-link,.mobile-path-card,.maplibregl-ctrl button,.mapboxgl-ctrl button):focus-visible{
  outline:3px solid color-mix(in srgb,var(--flip-gold,#F6CE46) 72%, white 28%)!important;
  outline-offset:3px!important;
}

/* Tooltip shell: one visual language, native page code owns content. */
:where(#tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,.chart-tooltip,.cmep-site-tooltip,.cmep-tooltip){
  border-radius:18px!important;
  border:1px solid var(--cmep-tooltip-border)!important;
  background:var(--cmep-tooltip-bg)!important;
  color:var(--cmep-tooltip-fg)!important;
  box-shadow:var(--cmep-tooltip-shadow)!important;
  -webkit-backdrop-filter:blur(14px);
  backdrop-filter:blur(14px);
  max-width:min(340px,calc(100vw - 28px))!important;
  box-sizing:border-box!important;
  z-index:9999!important;
}
:where(#tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,.chart-tooltip,.cmep-site-tooltip,.cmep-tooltip) :where(.ct-chip,.rating-pill,.pill,.race-rating-pill){
  border-radius:999px!important;
}

/* Arc seats must behave like links but keep native tooltip handlers intact. */
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(svg,.arc-wrap,.seat,.seat-group,circle,a.cmep-seat-link){pointer-events:auto!important;}
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(a.cmep-seat-link){cursor:pointer;}
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(a.cmep-seat-link:hover .seat,.seat:hover){filter:brightness(1.08) drop-shadow(0 0 4px rgba(15,23,42,.22));}

/* Path-to-Majority mobile layout: cards must scroll inside the module, never widen the page. */
@media (max-width:820px), (hover:none), (pointer:coarse){
  :where(#cmep-house-arc-native,#cmep-senate-arc-native){
    width:100%!important;
    max-width:100%!important;
    overflow-x:clip!important;
    contain:layout paint;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-majority){
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-cards){
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:nowrap!important;
    gap:12px!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    box-sizing:border-box!important;
    padding:2px 12px 8px!important;
    scroll-snap-type:x mandatory!important;
    overscroll-behavior-x:contain!important;
    -webkit-overflow-scrolling:touch!important;
    scrollbar-width:none!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) .mobile-path-cards::-webkit-scrollbar{display:none!important;}
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-card){
    display:block!important;
    flex:0 0 min(320px, calc(100vw - 48px))!important;
    width:min(320px, calc(100vw - 48px))!important;
    min-width:min(320px, calc(100vw - 48px))!important;
    max-width:min(320px, calc(100vw - 48px))!important;
    box-sizing:border-box!important;
    scroll-snap-align:center!important;
    white-space:normal!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-dots){
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    flex-wrap:nowrap!important;
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    box-sizing:border-box!important;
    gap:10px!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-dot){
    width:var(--cmep-path-dot-size,16px)!important;
    height:var(--cmep-path-dot-size,16px)!important;
    min-width:var(--cmep-path-dot-size,16px)!important;
    min-height:var(--cmep-path-dot-size,16px)!important;
    max-width:var(--cmep-path-dot-size,16px)!important;
    max-height:var(--cmep-path-dot-size,16px)!important;
    padding:0!important;
    line-height:0!important;
    flex:0 0 auto!important;
  }
}

/* Map controls: apply to MapLibre/Mapbox and custom reset buttons on every prediction/election page. */
:where(.maplibregl-ctrl-group,.mapboxgl-ctrl-group){
  background:var(--cmep-control-bg)!important;
  border:1px solid var(--cmep-control-border)!important;
  box-shadow:var(--cmep-control-shadow)!important;
  border-radius:12px!important;
  overflow:hidden!important;
}
:where(.maplibregl-ctrl button,.mapboxgl-ctrl button){
  background:var(--cmep-control-bg)!important;
  color:var(--cmep-control-fg)!important;
  border-color:var(--cmep-control-border)!important;
}
:where(.maplibregl-ctrl button + button,.mapboxgl-ctrl button + button){border-top:1px solid var(--cmep-control-border)!important;}
:where(.maplibregl-ctrl button:hover,.mapboxgl-ctrl button:hover){
  background:color-mix(in srgb,var(--cmep-control-bg) 84%,var(--cmep-control-fg) 16%)!important;
}
@media (prefers-color-scheme:dark){
  :where(.maplibregl-ctrl-icon,.mapboxgl-ctrl-icon){filter:invert(1) brightness(1.6) contrast(1.08)!important;}
}
:where(.cmep-map-reset,.gov-map-btn,.gov-map-icon-btn,#cmep-governor-map-reset,#cmep-governor-map-ak-reset,#cmep-governor-map-hi-reset,.map-reset,.reset-map,.reset-btn,.map-zoom-reset){
  background:var(--cmep-control-bg)!important;
  color:var(--cmep-control-fg)!important;
  border:1px solid var(--cmep-control-border)!important;
  box-shadow:var(--cmep-control-shadow)!important;
  border-radius:999px!important;
}

/* Pills: one contrast contract across prediction and election pages. */
:where(.solid-D,.solid-d,.likely-D,.likely-d,.lean-D,.lean-d,.toss-up,.tossup,.lean-R,.lean-r,.likely-R,.likely-r,.solid-R,.solid-r,
.rating-solid-D,.rating-solid-d,.rating-likely-D,.rating-likely-d,.rating-lean-D,.rating-lean-d,.rating-toss-up,.rating-tossup,.rating-lean-R,.rating-lean-r,.rating-likely-R,.rating-likely-r,.rating-solid-R,.rating-solid-r,
.cl-pill-lean-d,.cl-pill-lean-r,.cl-pill-likely-d,.cl-pill-likely-r,.cl-pill-solid-d,.cl-pill-solid-r,.cl-pill-toss-up,.cl-pill-tossup,
.rating-pill.solid-D,.rating-pill.likely-D,.rating-pill.lean-D,.rating-pill.toss-up,.rating-pill.lean-R,.rating-pill.likely-R,.rating-pill.solid-R,
.pill.solid-D,.pill.likely-D,.pill.lean-D,.pill.toss-up,.pill.lean-R,.pill.likely-R,.pill.solid-R){
  color:#fff!important;
}
:where(.pill-flip,.flip-pill,.pivotal-pill,.majority-pill,.pivotal-race,.flip-cell,.majority-maker,.mm-pill,.pivotal){
  color:#000!important;
}



/* Consolidated stabilization rules. */
/* Phase 4F stabilization: rollback fragile Phase 4E interaction changes and keep safe visual standardization. */
:root{
  --cmep-card-shadow:none;
  --cmep-control-shadow:none;
  --cmep-tooltip-shadow:none;
}
html,body{max-width:100%;overflow-x:hidden;}

/* Remove heavy decorative shadows that made the interface muddy. */
:where(.skip-link,.card,.race-card,.contest-card,.result-card,.state-card,.district-card,.projection-card,.featured-card,.method-card,
.arc-card,.map-card,.path-button,.mobile-path-card,.mobile-path-dot,.cmep-share-btn,.tooltip,.map-tooltip,.county-tooltip,.chart-tooltip,
#tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,#cmep-house-national-map-tooltip,#cmep-global-tooltip,
.maplibregl-ctrl-group,.mapboxgl-ctrl-group,.cmep-map-reset,.gov-map-btn,.gov-map-icon-btn,.map-reset,.reset-map){
  box-shadow:none!important;
}
:where(.path-button:hover,.mobile-path-card:hover,.cmep-map-reset:hover,.gov-map-btn:hover,.gov-map-icon-btn:hover,.map-reset:hover,.reset-map:hover){
  transform:none!important;
}

/* Tooltips: keep page-native positioning/logic; standardize only the shell and contrast. */
:where(#tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,#cmep-house-national-map-tooltip,#cmep-global-tooltip,
.chart-tooltip,.county-tooltip,.map-tooltip,.cmep-site-tooltip,.maplibregl-popup-content,.mapboxgl-popup-content){
  border-radius:14px!important;
  border:1px solid var(--cmep-tooltip-border,rgba(15,23,42,.16))!important;
  background:var(--cmep-tooltip-bg,rgba(255,255,255,.97))!important;
  color:var(--text-main,#111827)!important;
  box-shadow:none!important;
  max-width:min(340px,calc(100vw - 20px))!important;
}
@media (prefers-color-scheme:dark){
  :root{--cmep-tooltip-bg:rgba(15,23,42,.97);--cmep-tooltip-border:rgba(255,255,255,.18);}
  :where(#tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,#cmep-house-national-map-tooltip,#cmep-global-tooltip,
  .chart-tooltip,.county-tooltip,.map-tooltip,.cmep-site-tooltip,.maplibregl-popup-content,.mapboxgl-popup-content){color:#f8fafc!important;}
}

/* Pill contrast, including no-election/not-up/election-night tooltip pills. */
:where(.solid-D,.solid-d,.likely-D,.likely-d,.lean-D,.lean-d,.toss-up,.lean-R,.lean-r,.likely-R,.likely-r,.solid-R,.solid-r,
.rating-solid-D,.rating-solid-d,.rating-likely-D,.rating-likely-d,.rating-lean-D,.rating-lean-d,.rating-toss-up,.rating-lean-R,.rating-lean-r,.rating-likely-R,.rating-likely-r,.rating-solid-R,.rating-solid-r,
.cl-pill-lean-d,.cl-pill-lean-r,.cl-pill-likely-d,.cl-pill-likely-r,.cl-pill-solid-d,.cl-pill-solid-r,.cl-pill-toss-up,
.ct-chip.solid-D,.ct-chip.solid-d,.ct-chip.likely-D,.ct-chip.likely-d,.ct-chip.lean-D,.ct-chip.lean-d,.ct-chip.toss-up,.ct-chip.lean-R,.ct-chip.lean-r,.ct-chip.likely-R,.ct-chip.likely-r,.ct-chip.solid-R,.ct-chip.solid-r,
.tooltip-pill,.tooltip-chip,.race-pill,.rating-pill,.pill.rating,.pill.lean-D,.pill.lean-R,.pill.likely-D,.pill.likely-R,.pill.solid-D,.pill.solid-R,.pill.toss-up){
  color:#fff!important;
}
:where(.noel-d,.noel-r,.notup-D,.notup-R,.notup-d,.notup-r,.leg-no-election-d,.leg-no-election-r,.no-election-D,.no-election-R,.no-election-d,.no-election-r,.ct-chip.no-election,.ct-chip.no-election-D,.ct-chip.no-election-R){
  color:#fff!important;
  text-shadow:none!important;
}
:where(.pill-flip,.flip-pill,.pivotal-pill,.pivotal-race,.flip-cell,.majority-pill,.leg-majority,.majority-maker,.majority-seat-label){
  color:#111827!important;
  text-shadow:none!important;
}
:where(.majority-pill,.leg-majority,.majority-maker,.majority-seat-label) *{color:inherit!important;}

/* Majority Maker legend/pill consistency between Senate and House. */
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.leg-majority,.majority-pill,.majority-maker,.majority-seat-label,.path-majority-label){
  color:#111827!important;
  font-weight:900!important;
  letter-spacing:.015em!important;
  text-transform:none!important;
}

/* Restore original Path-to-Majority dot cascade: do not force a universal dot size. */
:where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-dot){
  min-width:0!important;
  min-height:0!important;
  padding:0!important;
  aspect-ratio:1/1!important;
  flex:0 0 auto!important;
}

/* Homepage Path layout: mimic Senate/House pages; horizontal scrolling belongs inside the card strip only. */
@media (max-width:820px), (hover:none), (pointer:coarse){
  :where(#cmep-house-arc-native,#cmep-senate-arc-native){width:100%!important;max-width:100%!important;overflow-x:hidden!important;box-sizing:border-box!important;}
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-majority){width:100%!important;max-width:100%!important;overflow:hidden!important;box-sizing:border-box!important;}
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-cards){
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:nowrap!important;
    gap:12px!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior-x:contain!important;
    scroll-snap-type:x mandatory!important;
    box-sizing:border-box!important;
    padding:2px 8px 8px!important;
    scrollbar-width:none!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) .mobile-path-cards::-webkit-scrollbar{display:none!important;}
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-card){
    flex:0 0 min(320px, calc(100vw - 48px))!important;
    width:min(320px, calc(100vw - 48px))!important;
    max-width:min(320px, calc(100vw - 48px))!important;
    min-width:0!important;
    box-sizing:border-box!important;
    scroll-snap-align:center!important;
    white-space:normal!important;
  }
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(.mobile-path-dots){
    display:flex!important;
    align-items:flex-end!important;
    justify-content:center!important;
    flex-wrap:nowrap!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:visible!important;
    box-sizing:border-box!important;
  }
  /* Do not set width/height here; inline JS sizes should cascade naturally. */
}

/* Arc mobile: tap should not immediately navigate. Native/page tooltip behavior remains in charge. */
@media (hover:none), (pointer:coarse){
  :where(#cmep-house-arc-native,#cmep-senate-arc-native) :where(a.cmep-seat-link){cursor:default;}
}

/* MapLibre/Mapbox controls: consistent dark-mode +/- icons without heavy shadows. */
:where(.maplibregl-ctrl-group,.mapboxgl-ctrl-group){
  background:var(--cmep-map-control-bg,rgba(255,255,255,.96))!important;
  border:1px solid var(--cmep-map-control-border,rgba(15,23,42,.16))!important;
  box-shadow:none!important;
  border-radius:12px!important;
  overflow:hidden!important;
}
:where(.maplibregl-ctrl button,.mapboxgl-ctrl button){
  background-color:var(--cmep-map-control-bg,rgba(255,255,255,.96))!important;
  color:var(--text-strong,#0f172a)!important;
  box-shadow:none!important;
}
:where(.maplibregl-ctrl button .maplibregl-ctrl-icon,.mapboxgl-ctrl button .mapboxgl-ctrl-icon){filter:none!important;}
@media (prefers-color-scheme:dark){
  :root{--cmep-map-control-bg:rgba(15,23,42,.98);--cmep-map-control-border:rgba(255,255,255,.18);}
  :where(.maplibregl-ctrl button,.mapboxgl-ctrl button){color:#f8fafc!important;background-color:rgba(15,23,42,.98)!important;}
  :where(.maplibregl-ctrl button .maplibregl-ctrl-icon,.mapboxgl-ctrl button .mapboxgl-ctrl-icon){filter:invert(1) brightness(1.35)!important;}
  :where(.cmep-map-reset,.gov-map-btn,.gov-map-icon-btn,#cmep-governor-map-reset,#cmep-governor-map-ak-reset,#cmep-governor-map-hi-reset,.map-reset,.reset-map){
    background:rgba(15,23,42,.98)!important;
    color:#f8fafc!important;
    border-color:rgba(255,255,255,.18)!important;
    box-shadow:none!important;
  }
}



/* Consolidated tooltip rules. */
/* Phase 4G: tooltip positioning/styling stabilization.
   Goal: keep existing page tooltip engines, but normalize shell styling and fix House/mobile placement. */
:root{
  --cmep-tooltip-radius:14px;
  --cmep-tooltip-shadow:none;
}

/* Shared tooltip visual language. Keep placement/page logic intact unless explicitly scoped below. */
:where(#tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,#cmep-house-national-map-tooltip,#cmep-global-tooltip,
.chart-tooltip,.county-tooltip,.map-tooltip,.cmep-site-tooltip,.maplibregl-popup-content,.mapboxgl-popup-content){
  border-radius:var(--cmep-tooltip-radius)!important;
  border:1px solid var(--cmep-tooltip-border,rgba(15,23,42,.16))!important;
  background:var(--cmep-tooltip-bg,rgba(255,255,255,.97))!important;
  color:var(--text-main,#111827)!important;
  box-shadow:none!important;
  text-shadow:none!important;
  max-width:min(340px,calc(100vw - 20px))!important;
}
:where(#tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,#cmep-house-national-map-tooltip,#cmep-global-tooltip,
.chart-tooltip,.county-tooltip,.map-tooltip,.cmep-site-tooltip,.maplibregl-popup-content,.mapboxgl-popup-content) *{
  text-shadow:none!important;
}
@media (prefers-color-scheme:dark){
  :root{--cmep-tooltip-bg:rgba(15,23,42,.97);--cmep-tooltip-border:rgba(255,255,255,.18);}
  :where(#tooltip,#cmep-house-arc-tooltip,#cmep-governor-map-tooltip,#cmep-house-national-map-tooltip,#cmep-global-tooltip,
  .chart-tooltip,.county-tooltip,.map-tooltip,.cmep-site-tooltip,.maplibregl-popup-content,.mapboxgl-popup-content){
    color:#f8fafc!important;
  }
}

/* Desktop House arc: force pointer-following viewport positioning, matching Senate-style behavior. */
@media (hover:hover) and (pointer:fine){
  #cmep-house-arc-tooltip.is-visible,
  #cmep-house-arc-tooltip[style*="display: block"],
  #cmep-house-arc-tooltip[style*="display:block"]{
    position:fixed!important;
    right:auto!important;
    bottom:auto!important;
    transform:none!important;
    pointer-events:none!important;
    z-index:100000!important;
  }
}

/* Mobile arc tooltips: bottom sheet should be viewport-fixed, not trapped in the arc widget. */
@media (max-width:820px), (hover:none), (pointer:coarse){
  #cmep-house-arc-tooltip.mobile,
  #cmep-house-arc-tooltip.is-mobile,
  #cmep-house-arc-tooltip.is-visible,
  #cmep-senate-arc-native #tooltip.mobile,
  #cmep-senate-arc-native #tooltip.is-mobile,
  #cmep-senate-arc-native #tooltip.is-visible{
    position:fixed!important;
    left:50%!important;
    right:auto!important;
    top:auto!important;
    bottom:calc(14px + env(safe-area-inset-bottom,0px))!important;
    width:min(340px,calc(100vw - 24px))!important;
    max-width:calc(100vw - 24px)!important;
    transform:translateX(-50%)!important;
    z-index:100000!important;
    box-shadow:none!important;
  }
}

/* Election-night mobile bottom sheet: no persistent inactive bar. */
@media (max-width:820px), (hover:none), (pointer:coarse){
  .county-tooltip.mobile-popout:not(.show),
  body > .county-tooltip.mobile-popout:not(.show),
  .county-tooltip.mobile-center:not(.show),
  body > .county-tooltip.mobile-center:not(.show){
    display:none!important;
    visibility:hidden!important;
    opacity:0!important;
    pointer-events:none!important;
    transform:translateY(12px)!important;
  }
  .county-tooltip.mobile-popout.show,
  body > .county-tooltip.mobile-popout.show,
  .county-tooltip.mobile-center.show,
  body > .county-tooltip.mobile-center.show{
    display:block!important;
    visibility:visible!important;
    opacity:1!important;
  }
}

/* Remove remaining tooltip/card shadows from history odds and map popups. */
:where(.history-tooltip,.history-odds-tooltip,.odds-tooltip,.chart-tooltip,.county-tooltip,.map-tooltip,.cmep-site-tooltip){
  box-shadow:none!important;
}



/* Consolidated homepage Path parity rules. */
/* Phase 4H: Homepage Path-to-Majority parity
   Goal: make homepage Senate/House Path panels behave like the standalone /senate/ and /house/ pages.
   This is intentionally scoped to the homepage body class. */

.cmep-home-page,
.cmep-home-page .container,
.cmep-home-page .forecast-grid,
.cmep-home-page .cm-card,
.cmep-home-page section {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 820px), (hover: none), (pointer: coarse) {
  .cmep-home-page {
    overflow-x: hidden;
  }

  .cmep-home-page .forecast-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .cmep-home-page .cm-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  .cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    contain: none !important;
  }

  .cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(#cmep-share-root, #cmep-house-arc-share-root, .arc-wrap, .mobile-path-majority) {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.mobile-path-majority) {
    overflow: hidden !important;
    margin-top: 14px !important;
  }

  .cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.mobile-path-majority.show) {
    display: block !important;
  }

  /* Exact standalone-page behavior: contained horizontal strip, not page-level horizontal overflow. */
  .cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.mobile-path-cards) {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 2px 8px 6px !important;
    scrollbar-width: none !important;
    box-sizing: border-box !important;
    overscroll-behavior-x: contain !important;
  }

  .cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) .mobile-path-cards::-webkit-scrollbar {
    display: none !important;
  }

  .cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.mobile-path-card) {
    display: block !important;
    flex: 0 0 min(320px, calc(100% - 16px)) !important;
    width: min(320px, calc(100% - 16px)) !important;
    max-width: calc(100% - 16px) !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    scroll-snap-align: center !important;
    white-space: normal !important;
  }

  .cmep-home-page #cmep-senate-arc-native .mobile-path-dots {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    gap: 10px !important;
    margin: 0 0 14px !important;
    padding: 0 8px !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    scrollbar-width: none !important;
    box-sizing: border-box !important;
  }

  .cmep-home-page #cmep-house-arc-native .mobile-path-dots {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    gap: 9px !important;
    margin: 0 0 14px !important;
    padding: 0 8px !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    scrollbar-width: none !important;
    box-sizing: border-box !important;
  }

  .cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) .mobile-path-dots::-webkit-scrollbar {
    display: none !important;
  }

  /* Do not force one universal dot size. The JS inline width/height cascade is authoritative. */
  .cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.mobile-path-dot) {
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    padding: 0 !important;
    line-height: 0 !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
  }
}



/* Phase 4I production consolidation: final shared ownership rules. */
html, body { max-width: 100%; overflow-x: clip; }
.cm-card, .forecast-grid, .container, .arc-wrap, .cmep-senate-arc-native, .cmep-house-arc-native, #cmep-senate-arc-native, #cmep-house-arc-native { min-width: 0; }

/* Keep the skip link clean and functional without decorative shadows. */
.skip-link, .cmep-skip-link, a[href="#main"].skip-link, a[href="#main-content"].skip-link {
  box-shadow: none !important;
}

/* Standard tooltip surface, deliberately style-only. Page-specific engines keep positioning/content ownership. */
#tooltip,
#cmep-house-arc-tooltip,
.cmep-tooltip,
.tooltip,
.map-tooltip,
.county-tooltip,
.chart-tooltip,
.history-tooltip,
#stateTooltip,
#mapTooltip,
#districtTooltip,
.governor-tooltip,
.gov-tooltip,
.house-tooltip,
.state-tooltip {
  border-radius: 16px !important;
  box-shadow: none !important;
  border: 1px solid color-mix(in srgb, var(--border-strong, rgba(148,163,184,.38)) 76%, transparent) !important;
}

/* Rating and election-result pill contrast. Pivotal/majority-maker gold pills intentionally keep dark text. */
.cl-pill,
.ct-chip,
.rating-pill,
.rating-badge,
.result-pill,
.race-pill,
.tooltip-pill,
.map-pill,
[class*="pill"][class*="lean"],
[class*="pill"][class*="likely"],
[class*="pill"][class*="solid"],
[class*="pill"][class*="toss"],
[class*="badge"][class*="lean"],
[class*="badge"][class*="likely"],
[class*="badge"][class*="solid"],
[class*="badge"][class*="toss"] {
  color: #fff !important;
}
.majority-maker,
.pivotal,
.pivotal-race,
.flip-pill,
.flip-badge,
[class*="majority-maker"],
[class*="pivotal"] {
  color: #111827 !important;
}

/* No-election / not-up pills need explicit contrast in both color schemes. */
.no-election,
.not-up,
.no-election-pill,
.not-up-pill,
.ct-chip.no-election,
.ct-chip.not-up,
.rating-pill.no-election,
.rating-pill.not-up,
[class*="no-election"],
[class*="not-up"] {
  background: #475569 !important;
  border-color: #475569 !important;
  color: #fff !important;
}

/* Shared map-control treatment across MapLibre/Mapbox pages. */
.maplibregl-ctrl-group,
.mapboxgl-ctrl-group,
.maplibregl-ctrl button,
.mapboxgl-ctrl button,
.map-reset,
.reset-map,
.reset-btn,
.map-reset-btn,
button[id*="reset" i][class*="map" i] {
  box-shadow: none !important;
}
@media (prefers-color-scheme: dark) {
  .maplibregl-ctrl-group,
  .mapboxgl-ctrl-group,
  .maplibregl-ctrl button,
  .mapboxgl-ctrl button,
  .map-reset,
  .reset-map,
  .reset-btn,
  .map-reset-btn,
  button[id*="reset" i][class*="map" i] {
    background: rgba(15,23,42,.96) !important;
    color: #f8fafc !important;
    border-color: rgba(255,255,255,.18) !important;
  }
  .maplibregl-ctrl button span,
  .mapboxgl-ctrl button span { filter: invert(1) brightness(1.8) !important; }
}

/* Homepage Path-to-Majority must match standalone Senate/House container behavior, not viewport behavior. */
body.cmep-home-page .forecast-grid,
body.cmep-home-page .forecast-grid > *,
body.cmep-home-page .cm-card,
body.cmep-home-page #cmep-senate-arc-native,
body.cmep-home-page #cmep-house-arc-native,
body.cmep-home-page #cmep-senate-arc-native .arc-wrap,
body.cmep-home-page #cmep-house-arc-native .arc-wrap {
  min-width: 0 !important;
  max-width: 100% !important;
}
@media (max-width: 760px) {
  body.cmep-home-page #cmep-senate-arc-native .mobile-path-majority.show,
  body.cmep-home-page #cmep-house-arc-native .mobile-path-majority.show {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    contain: inline-size !important;
  }
  body.cmep-home-page #cmep-senate-arc-native .mobile-path-cards,
  body.cmep-home-page #cmep-house-arc-native .mobile-path-cards {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    box-sizing: border-box !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  body.cmep-home-page #cmep-senate-arc-native .mobile-path-cards::-webkit-scrollbar,
  body.cmep-home-page #cmep-house-arc-native .mobile-path-cards::-webkit-scrollbar { display: none !important; }
  body.cmep-home-page #cmep-senate-arc-native .mobile-path-card,
  body.cmep-home-page #cmep-house-arc-native .mobile-path-card {
    flex: 0 0 min(320px, calc(100% - 16px)) !important;
    width: min(320px, calc(100% - 16px)) !important;
    max-width: calc(100% - 16px) !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    scroll-snap-align: center !important;
  }
  body.cmep-home-page #cmep-senate-arc-native .mobile-path-dot,
  body.cmep-home-page #cmep-house-arc-native .mobile-path-dot,
  #cmep-senate-arc-native .mobile-path-dot,
  #cmep-house-arc-native .mobile-path-dot {
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    padding: 0 !important;
    line-height: 0 !important;
  }
}

/* Hide inactive election-night bottom tooltip shells. */
@media (max-width: 760px), (hover: none), (pointer: coarse) {
  .county-tooltip.mobile-popout:not(.show),
  .county-tooltip.mobile-center:not(.show),
  .county-tooltip:not(.show):empty {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* Phase 4J final stabilization: tooltip parity, path-dot cascade, pill readability, county controls. */
@media (hover:hover) and (pointer:fine){
  body #cmep-house-arc-tooltip,
  body #cmep-senate-arc-native #tooltip{
    position:fixed!important;
    right:auto!important;
    bottom:auto!important;
    transform:none!important;
    max-width:min(320px, calc(100vw - 16px))!important;
    pointer-events:none!important;
    z-index:100000!important;
  }
}
@media (hover:none), (pointer:coarse){
  body #tooltip.mobile,
  body #tooltip.is-mobile,
  body #cmep-house-arc-tooltip.mobile,
  body #cmep-house-arc-tooltip.is-mobile{
    position:fixed!important;
    left:12px!important;
    right:12px!important;
    top:auto!important;
    bottom:calc(env(safe-area-inset-bottom) + 12px)!important;
    width:auto!important;
    max-width:none!important;
    transform:none!important;
    z-index:100000!important;
    box-shadow:none!important;
  }
}

/* Let Path-to-Majority dots keep the exact generated inline width/height cascade. */
#cmep-senate-arc-native .mobile-path-dot,
#cmep-house-arc-native .mobile-path-dot{
  min-width:0!important;
  min-height:0!important;
  max-width:none!important;
  max-height:none!important;
  padding:0!important;
  flex:0 0 auto!important;
  aspect-ratio:auto!important;
  line-height:0!important;
}

/* Revert No Election D/R legend swatches to their original party-color design. */
#cmep-senate-arc-native .leg-no-election-d,
#cmep-house-arc-native .leg-no-election-d,
.legend-pill.noel-d{
  background:var(--solid-d,#0076BA)!important;
  border:2px solid var(--toss-up,#929292)!important;
  color:#fff!important;
}
#cmep-senate-arc-native .leg-no-election-r,
#cmep-house-arc-native .leg-no-election-r,
.legend-pill.noel-r{
  background:var(--solid-r,#EE220C)!important;
  border:2px solid var(--toss-up,#929292)!important;
  color:#fff!important;
}

/* Neutral No Election/Not Up tooltip pills: readable in light and dark mode. */
#tooltip .ct-chip:not(.solid-D):not(.likely-D):not(.lean-D):not(.toss-up):not(.lean-R):not(.likely-R):not(.solid-R),
#cmep-house-arc-tooltip .ct-chip:not(.solid-D):not(.likely-D):not(.lean-D):not(.toss-up):not(.lean-R):not(.likely-R):not(.solid-R),
.county-tooltip :where(.pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill):not([class*="solid"]):not([class*="likely"]):not([class*="lean"]):not([class*="toss"]),
.map-tooltip :where(.pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill):not([class*="solid"]):not([class*="likely"]):not([class*="lean"]):not([class*="toss"]){
  background:#475569!important;
  border-color:#475569!important;
  color:#fff!important;
}

/* Election-night tooltip candidate/result pills need explicit foreground contrast. */
.county-tooltip :where(.pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill),
.map-tooltip :where(.pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill),
.maplibregl-popup-content :where(.pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill),
.mapboxgl-popup-content :where(.pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill){
  color:#fff!important;
  text-shadow:none!important;
}
.county-tooltip :where(.pivotal,.pivotal-race,.majority-maker,[class*="pivotal"],[class*="majority-maker"]),
.map-tooltip :where(.pivotal,.pivotal-race,.majority-maker,[class*="pivotal"],[class*="majority-maker"]){
  color:#111827!important;
}

/* House election county sort controls: contain buttons instead of stretching page width. */
.county-toolbar,
.county-sort-group{
  max-width:100%!important;
  min-width:0!important;
  overflow-x:auto!important;
  overflow-y:visible!important;
  -webkit-overflow-scrolling:touch!important;
  scrollbar-width:none!important;
}
.county-toolbar::-webkit-scrollbar,
.county-sort-group::-webkit-scrollbar{display:none!important;}
.county-sort-group{
  display:flex!important;
  flex-wrap:nowrap!important;
  align-items:center!important;
  gap:.45rem!important;
}
.county-sort-btn{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:max-content!important;
  max-width:calc(100vw - 2rem)!important;
  min-height:2.25rem!important;
  padding:.45rem .7rem!important;
  white-space:nowrap!important;
  line-height:1.1!important;
}
@media (max-width:640px){
  .county-toolbar{display:block!important;}
  .county-sort-group{padding-bottom:.35rem!important;}
  .county-search-wrap{margin-top:.55rem!important;max-width:100%!important;}
}

/* Production fix 3: final narrow stabilization. */
/* Do not force mobile arc tooltips into viewport-fixed bottom sheets; that broke mobile page layout. */
@media (max-width:820px), (hover:none), (pointer:coarse){
  body #cmep-senate-arc-native #tooltip.mobile,
  body #cmep-senate-arc-native #tooltip.is-mobile,
  body #cmep-senate-arc-native #tooltip.is-visible,
  body #cmep-house-arc-tooltip.mobile,
  body #cmep-house-arc-tooltip.is-mobile,
  body #cmep-house-arc-tooltip.is-visible{
    width:auto!important;
    max-width:min(320px, calc(100vw - 24px))!important;
    box-shadow:none!important;
  }
}

/* Election-night tooltip pill readability: cover generated winner/call/held pills and SVG/icon children. */
.county-tooltip :where(.ct-winner-pill,.winner-pill,.cs-pill,.district-tile-pill-label,.district-tile-pill-wrap .winner-pill,
  .pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill,.rating-pill,.held-D,.held-R,.held-none),
.map-tooltip :where(.ct-winner-pill,.winner-pill,.cs-pill,.district-tile-pill-label,.district-tile-pill-wrap .winner-pill,
  .pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill,.rating-pill,.held-D,.held-R,.held-none),
.maplibregl-popup-content :where(.ct-winner-pill,.winner-pill,.cs-pill,.district-tile-pill-label,.district-tile-pill-wrap .winner-pill,
  .pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill,.rating-pill,.held-D,.held-R,.held-none),
.mapboxgl-popup-content :where(.ct-winner-pill,.winner-pill,.cs-pill,.district-tile-pill-label,.district-tile-pill-wrap .winner-pill,
  .pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill,.rating-pill,.held-D,.held-R,.held-none){
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
  text-shadow:none!important;
  border-color:rgba(255,255,255,.22)!important;
}
.county-tooltip :where(.ct-winner-pill,.winner-pill,.cs-pill,.district-tile-pill-label,.district-tile-pill-wrap .winner-pill,
  .pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill,.rating-pill,.held-D,.held-R,.held-none) *,
.map-tooltip :where(.ct-winner-pill,.winner-pill,.cs-pill,.district-tile-pill-label,.district-tile-pill-wrap .winner-pill,
  .pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill,.rating-pill,.held-D,.held-R,.held-none) *,
.maplibregl-popup-content :where(.ct-winner-pill,.winner-pill,.cs-pill,.district-tile-pill-label,.district-tile-pill-wrap .winner-pill,
  .pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill,.rating-pill,.held-D,.held-R,.held-none) *,
.mapboxgl-popup-content :where(.ct-winner-pill,.winner-pill,.cs-pill,.district-tile-pill-label,.district-tile-pill-wrap .winner-pill,
  .pill,.badge,.tooltip-pill,.result-pill,.race-pill,.map-pill,.rating-pill,.held-D,.held-R,.held-none) *{
  color:inherit!important;
  -webkit-text-fill-color:inherit!important;
  text-shadow:none!important;
}
.county-tooltip :where(.winner-pill-tossup,.held-none,.cs-close,.cs-watch,.pill.held-none),
.map-tooltip :where(.winner-pill-tossup,.held-none,.cs-close,.cs-watch,.pill.held-none),
.maplibregl-popup-content :where(.winner-pill-tossup,.held-none,.cs-close,.cs-watch,.pill.held-none),
.mapboxgl-popup-content :where(.winner-pill-tossup,.held-none,.cs-close,.cs-watch,.pill.held-none){
  background:#475569!important;
  border-color:#475569!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}
.county-tooltip :where(.pill-flip,.pivotal,.pivotal-race,.majority-maker,[class*="pivotal"],[class*="majority-maker"]),
.map-tooltip :where(.pill-flip,.pivotal,.pivotal-race,.majority-maker,[class*="pivotal"],[class*="majority-maker"]),
.maplibregl-popup-content :where(.pill-flip,.pivotal,.pivotal-race,.majority-maker,[class*="pivotal"],[class*="majority-maker"]),
.mapboxgl-popup-content :where(.pill-flip,.pivotal,.pivotal-race,.majority-maker,[class*="pivotal"],[class*="majority-maker"]){
  color:#111827!important;
  -webkit-text-fill-color:#111827!important;
}

/* Production fix 4: election-night metric pill contrast + mobile arc tooltip link behavior. */
/* Reporting/Votes chips in election-night tooltips are generated as plain .ct-chip, so force a readable neutral treatment. */
.election-night-page .county-tooltip .ct-chip,
.election-night-page .map-tooltip .ct-chip,
body[class*="election"] .county-tooltip .ct-chip,
body[class*="election"] .map-tooltip .ct-chip,
.county-tooltip.mobile-popout .ct-chip,
.county-tooltip.mobile-center .ct-chip,
.county-tooltip .ct-summary .ct-chip,
.map-tooltip .ct-summary .ct-chip,
.maplibregl-popup-content .ct-chip,
.mapboxgl-popup-content .ct-chip{
  background:#334155!important;
  border:1px solid rgba(255,255,255,.24)!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
  text-shadow:none!important;
}
.county-tooltip .ct-chip *,
.map-tooltip .ct-chip *,
.maplibregl-popup-content .ct-chip *,
.mapboxgl-popup-content .ct-chip *{
  color:inherit!important;
  -webkit-text-fill-color:inherit!important;
  text-shadow:none!important;
}
/* Keep party/rating chips readable if they carry specific rating classes. */
.county-tooltip .ct-chip:is(.solid-D,.solid-d,.likely-D,.likely-d,.lean-D,.lean-d,.toss-up,.lean-R,.lean-r,.likely-R,.likely-r,.solid-R,.solid-r),
.map-tooltip .ct-chip:is(.solid-D,.solid-d,.likely-D,.likely-d,.lean-D,.lean-d,.toss-up,.lean-R,.lean-r,.likely-R,.likely-r,.solid-R,.solid-r){
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
  border-color:transparent!important;
}
.county-tooltip .ct-votes,
.map-tooltip .ct-votes,
.county-tooltip .votes,
.map-tooltip .votes{
  color:#f8fafc!important;
  -webkit-text-fill-color:#f8fafc!important;
  text-shadow:none!important;
}
.county-tooltip .ct-meta,
.map-tooltip .ct-meta,
.county-tooltip .meta,
.map-tooltip .meta{
  color:#e2e8f0!important;
  -webkit-text-fill-color:#e2e8f0!important;
}
/* The tooltip itself is the mobile navigation target for arc seats. */
@media (hover:none), (pointer:coarse), (max-width:820px){
  #cmep-senate-arc-native #tooltip,
  #cmep-house-arc-tooltip{
    pointer-events:auto!important;
  }
  .cmep-mobile-arc-tooltip-link{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    margin-top:.7rem!important;
    min-height:42px!important;
    padding:.65rem .85rem!important;
    border-radius:999px!important;
    background:#111827!important;
    border:1px solid rgba(255,255,255,.16)!important;
    color:#fff!important;
    -webkit-text-fill-color:#fff!important;
    font-weight:900!important;
    font-size:.82rem!important;
    text-decoration:none!important;
    letter-spacing:.01em!important;
  }
  html[data-theme="dark"] .cmep-mobile-arc-tooltip-link,
  body.dark .cmep-mobile-arc-tooltip-link{
    background:#f8fafc!important;
    border-color:rgba(15,23,42,.2)!important;
    color:#0f172a!important;
    -webkit-text-fill-color:#0f172a!important;
  }
}

/* Production fix 5: mobile arc tooltip card standardization. */
@media (hover:none), (pointer:coarse), (max-width:820px){
  #cmep-senate-arc-native #tooltip .cmep-mobile-arc-tooltip-link,
  #cmep-house-arc-tooltip .cmep-mobile-arc-tooltip-link,
  .cmep-mobile-arc-tooltip-link{
    display:none!important;
  }
  #cmep-senate-arc-native #tooltip.cmep-mobile-arc-card-link,
  #cmep-house-arc-tooltip.cmep-mobile-arc-card-link{
    cursor:pointer!important;
    pointer-events:auto!important;
    touch-action:manipulation!important;
    outline:none!important;
  }
  #cmep-senate-arc-native #tooltip.cmep-mobile-arc-card-link:active,
  #cmep-house-arc-tooltip.cmep-mobile-arc-card-link:active{
    transform:translateY(1px)!important;
  }
  #cmep-senate-arc-native #tooltip.cmep-mobile-arc-card-link:focus-visible,
  #cmep-house-arc-tooltip.cmep-mobile-arc-card-link:focus-visible{
    box-shadow:0 0 0 3px rgba(59,130,246,.38)!important;
  }
}

/* Production fix 6: one standardized mobile arc tooltip card. */
#cmep-mobile-arc-unified-tooltip{display:none;}
@media (hover:none), (pointer:coarse), (max-width:820px){
  #cmep-mobile-arc-unified-tooltip{
    position:fixed!important;
    left:12px!important;
    right:12px!important;
    bottom:calc(env(safe-area-inset-bottom, 0px) + 12px)!important;
    z-index:2147483000!important;
    display:none;
    width:auto!important;
    max-width:none!important;
    padding:.9rem 1rem!important;
    border-radius:18px!important;
    background:rgba(255,255,255,.98)!important;
    border:1px solid rgba(15,23,42,.14)!important;
    color:#0f172a!important;
    -webkit-text-fill-color:#0f172a!important;
    box-shadow:none!important;
    cursor:pointer!important;
    pointer-events:auto!important;
    touch-action:manipulation!important;
  }
  #cmep-mobile-arc-unified-tooltip.is-visible{display:block!important;}
  html[data-theme="dark"] #cmep-mobile-arc-unified-tooltip,
  body.dark #cmep-mobile-arc-unified-tooltip{
    background:rgba(15,23,42,.98)!important;
    border-color:rgba(255,255,255,.16)!important;
    color:#f8fafc!important;
    -webkit-text-fill-color:#f8fafc!important;
  }
  #cmep-mobile-arc-unified-tooltip .ct-head{font-weight:900!important;font-size:1rem!important;line-height:1.15!important;margin:0 0 .45rem!important;color:inherit!important;-webkit-text-fill-color:currentColor!important;}
  #cmep-mobile-arc-unified-tooltip .ct-summary{display:flex!important;gap:.35rem!important;flex-wrap:wrap!important;margin:0 0 .55rem!important;}
  #cmep-mobile-arc-unified-tooltip .ct-chip{display:inline-flex!important;align-items:center!important;min-height:1.65rem!important;padding:.32rem .55rem!important;border-radius:999px!important;font-size:.72rem!important;font-weight:900!important;letter-spacing:.02em!important;line-height:1!important;color:#fff!important;-webkit-text-fill-color:#fff!important;border:1px solid transparent!important;background:#475569!important;}
  #cmep-mobile-arc-unified-tooltip .ct-chip.neutral{background:#475569!important;color:#fff!important;-webkit-text-fill-color:#fff!important;}

  #cmep-mobile-arc-unified-tooltip .ct-chip.no-election{background:#475569!important;border:2px solid #334155!important;color:#fff!important;-webkit-text-fill-color:#fff!important;min-height:1.9rem!important;padding:.38rem .72rem!important;}
  #cmep-mobile-arc-unified-tooltip .ct-chip.solid-D{background:var(--solid-d,#1d4ed8)!important;}
  #cmep-mobile-arc-unified-tooltip .ct-chip.likely-D{background:var(--likely-d,#2563eb)!important;}
  #cmep-mobile-arc-unified-tooltip .ct-chip.lean-D{background:var(--lean-d,#60a5fa)!important;}
  #cmep-mobile-arc-unified-tooltip .ct-chip.toss-up{background:var(--toss-up,#7c3aed)!important;}
  #cmep-mobile-arc-unified-tooltip .ct-chip.lean-R{background:var(--lean-r,#f87171)!important;}
  #cmep-mobile-arc-unified-tooltip .ct-chip.likely-R{background:var(--likely-r,#ef4444)!important;}
  #cmep-mobile-arc-unified-tooltip .ct-chip.solid-R{background:var(--solid-r,#b91c1c)!important;}
  #cmep-mobile-arc-unified-tooltip .ct-rows{display:grid!important;gap:.42rem!important;}
  #cmep-mobile-arc-unified-tooltip .ct-row{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:.8rem!important;}
  #cmep-mobile-arc-unified-tooltip .ct-name{font-weight:800!important;font-size:.82rem!important;line-height:1.15!important;color:inherit!important;-webkit-text-fill-color:currentColor!important;}
  #cmep-mobile-arc-unified-tooltip .ct-right{text-align:right!important;white-space:nowrap!important;}
  #cmep-mobile-arc-unified-tooltip .ct-pct{font-weight:950!important;font-variant-numeric:tabular-nums!important;}
  #cmep-mobile-arc-unified-tooltip .ct-pct.d{color:var(--solid-d,#1d4ed8)!important;-webkit-text-fill-color:var(--solid-d,#1d4ed8)!important;}
  #cmep-mobile-arc-unified-tooltip .ct-pct.r{color:var(--solid-r,#b91c1c)!important;-webkit-text-fill-color:var(--solid-r,#b91c1c)!important;}
}

/* --------------------------------------------------------------------------
   Homepage layout cohesion pass — 2026-06-20
   Scope: homepage only. Keeps existing forecast widgets, but reduces chrome,
   widens usable content, and makes mobile cards behave like section panels.
   -------------------------------------------------------------------------- */
body.cmep-home-page {
  background:
    radial-gradient(circle at top left, rgba(0, 118, 186, .055), transparent 34rem),
    var(--bg-page, #f3f4f6);
}

body.cmep-home-page .container {
  width: min(100%, 1360px) !important;
  max-width: 1360px !important;
  margin-inline: auto !important;
  padding-inline: clamp(.75rem, 1.45vw, 1.25rem) !important;
  padding-block: 1rem !important;
}

body.cmep-home-page .forecast-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: clamp(.85rem, 1.35vw, 1.25rem) !important;
  margin-top: .45rem !important;
  align-items: start !important;
}

body.cmep-home-page .cm-card {
  padding: clamp(.95rem, 1.2vw, 1.25rem) !important;
  border-radius: 22px !important;
  border-color: color-mix(in srgb, var(--border-subtle, #d4d4d8) 78%, transparent) !important;
  box-shadow: none !important;
  margin-bottom: clamp(.75rem, 1.2vw, 1.1rem) !important;
  overflow: clip !important;
}

body.cmep-home-page .cm-card > section {
  padding: 0 !important;
}

body.cmep-home-page section h2 {
  text-align: left !important;
  margin: 0 0 .75rem !important;
  font-size: clamp(1rem, 1.35vw, 1.15rem) !important;
  line-height: 1.12 !important;
  letter-spacing: -.025em !important;
}

body.cmep-home-page .cta-row:first-child {
  justify-content: flex-end !important;
  margin: 0 0 .65rem !important;
}

body.cmep-home-page .cta-row:first-child .cm-btn {
  min-height: 2.2rem !important;
  padding: .42rem .72rem !important;
  font-size: .78rem !important;
  color: var(--text-muted, #6b7280) !important;
  background: transparent !important;
  border-color: transparent !important;
}

body.cmep-home-page .cta-row:first-child .cm-btn:hover {
  color: var(--text-main, #111827) !important;
  background: rgba(148, 163, 184, .12) !important;
}

body.cmep-home-page .cm-btn,
body.cmep-home-page .changelog-seg,
body.cmep-home-page .cmep-share-row button {
  box-shadow: none !important;
}

body.cmep-home-page .cmep-share-row {
  margin-top: .35rem !important;
}

body.cmep-home-page .legend {
  gap: 6px !important;
  margin-bottom: .35rem !important;
}

body.cmep-home-page .legend-item {
  box-shadow: none !important;
}

body.cmep-home-page #changelog-section {
  margin-top: .1rem !important;
}

body.cmep-home-page #changelog-section .container,
body.cmep-home-page .container#changelog-section {
  padding-top: .25rem !important;
}

body.cmep-home-page .changelog-controls {
  justify-content: flex-start !important;
  margin-bottom: .75rem !important;
}

body.cmep-home-page .cl-card {
  background: transparent !important;
  border-color: color-mix(in srgb, var(--border-subtle, #d4d4d8) 70%, transparent) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  padding: 8px 10px !important;
}

body.cmep-home-page .cl-card:hover {
  box-shadow: none !important;
}

body.cmep-home-page .cl-day-group {
  margin-bottom: .85rem !important;
}

@media (max-width: 980px) {
  body.cmep-home-page .forecast-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 700px) {
  body.cmep-home-page .container {
    padding-inline: max(.45rem, env(safe-area-inset-left)) !important;
    padding-block: .55rem !important;
  }

  body.cmep-home-page .forecast-grid {
    gap: .65rem !important;
    margin-top: .25rem !important;
  }

  body.cmep-home-page .cm-card {
    padding: .78rem .58rem !important;
    border-radius: 16px !important;
    margin-bottom: .65rem !important;
  }

  body.cmep-home-page section h2 {
    font-size: 1rem !important;
    margin-bottom: .55rem !important;
  }

  body.cmep-home-page .cta-row:first-child {
    margin-bottom: .35rem !important;
  }

  body.cmep-home-page .legend {
    gap: 4px !important;
  }

  body.cmep-home-page .legend-item {
    padding: 5px 7px !important;
    font-size: .66rem !important;
  }

  body.cmep-home-page .cmep-share-row button,
  body.cmep-home-page .cm-btn {
    min-height: 2.3rem !important;
  }

  body.cmep-home-page .changelog-controls {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding-bottom: 1px !important;
  }

  body.cmep-home-page .changelog-controls::-webkit-scrollbar {
    display: none !important;
  }

  body.cmep-home-page .changelog-seg {
    flex: 0 0 auto !important;
  }

  body.cmep-home-page .cl-card {
    padding: 7px 6px !important;
    gap: 8px !important;
  }
}

@media (prefers-color-scheme: dark) {
  body.cmep-home-page {
    background:
      radial-gradient(circle at top left, rgba(0, 162, 255, .09), transparent 34rem),
      var(--bg-page, #020617);
  }

  body.cmep-home-page .cm-card {
    border-color: rgba(148, 163, 184, .22) !important;
  }

  body.cmep-home-page .cl-card {
    border-color: rgba(148, 163, 184, .18) !important;
  }
}

/* --------------------------------------------------------------------------
   Homepage internal forecast-card cohesion pass — 2026-06-20
   Scope: homepage only. This trims nested widget chrome inside the Senate,
   House, and changelog cards so the page reads as one dashboard system.
   -------------------------------------------------------------------------- */
body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) {
  --cmep-internal-border: color-mix(in srgb, var(--border-subtle, #d4d4d8) 62%, transparent);
  --cmep-internal-panel: color-mix(in srgb, var(--bg-page, #f3f4f6) 58%, transparent);
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.arc-wrap) {
  width: 100% !important;
  max-width: none !important;
  margin: .15rem auto .65rem !important;
  padding: 0 !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) svg {
  margin-inline: auto !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.legend) {
  max-width: none !important;
  justify-content: flex-start !important;
  padding: 0 !important;
  margin: 0 0 .55rem !important;
  gap: 5px !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.legend-item) {
  border-radius: 999px !important;
  padding: 5px 8px !important;
  font-size: .68rem !important;
  line-height: 1 !important;
  letter-spacing: .025em !important;
  box-shadow: none !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.legend-item.majority-pill, .legend-item.leg-majority) {
  background: transparent !important;
  color: var(--text-muted, #6b7280) !important;
  border-width: 1px !important;
}

body.cmep-house-page #cmep-house-arc-native :where(.legend-item.majority-pill, .legend-item.leg-majority) {
  border-radius: 999px !important;
  padding: 5px 8px !important;
  background: transparent !important;
  color: var(--text-muted, #6b7280) !important;
  border-width: 1px !important;
  font-size: .68rem !important;
  line-height: 1 !important;
  letter-spacing: .025em !important;
  box-shadow: none !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.vp-label) {
  max-width: none !important;
  padding: 0 !important;
  margin: .15rem 0 .35rem !important;
  text-align: left !important;
  font-size: .72rem !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.path-separator-line) {
  max-width: none !important;
  margin: .35rem 0 .55rem !important;
  border-bottom-width: 1px !important;
  opacity: .72 !important;
  filter: none !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.path-banner) {
  max-width: none !important;
  margin: .35rem 0 .5rem !important;
  padding: .55rem .65rem !important;
  border-radius: 13px !important;
  border: 1px solid var(--cmep-internal-border) !important;
  background: var(--cmep-internal-panel) !important;
  box-shadow: none !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.path-explainer) {
  max-width: none !important;
  margin: .45rem 0 0 !important;
  padding: .55rem .65rem !important;
  border-radius: 12px !important;
  border: 1px solid var(--cmep-internal-border) !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: .78rem !important;
  line-height: 1.35 !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.cmep-share-row) {
  max-width: none !important;
  justify-content: flex-start !important;
  margin: .15rem 0 .45rem !important;
  padding: 0 !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(#cmep-share-image, #cmep-house-arc-share-image) {
  min-height: 2rem !important;
  padding: .36rem .65rem !important;
  border: 1px solid var(--cmep-internal-border) !important;
  background: transparent !important;
  color: var(--text-muted, #6b7280) !important;
  font-size: .74rem !important;
  letter-spacing: .01em !important;
  box-shadow: none !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(#cmep-share-image, #cmep-house-arc-share-image):hover {
  background: var(--cmep-internal-panel) !important;
  color: var(--text-main, #111827) !important;
}

body.cmep-home-page :where(#cmep-senate-seats-native, #cmep-house-seats-native) {
  margin-top: .65rem !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.cmep-share-stack) {
  max-width: none !important;
  margin: .5rem 0 !important;
  padding: 0 !important;
}

body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.cmep-share-stack-inner) {
  border-color: var(--cmep-internal-border) !important;
  border-radius: 14px !important;
  box-shadow: none !important;
}

body.cmep-home-page .cl-stats {
  justify-content: flex-start !important;
  gap: .8rem !important;
  margin-bottom: .85rem !important;
  padding: .55rem .65rem !important;
  border-radius: 12px !important;
  background: transparent !important;
  border-color: color-mix(in srgb, var(--border-subtle, #d4d4d8) 62%, transparent) !important;
}

body.cmep-home-page .cl-stat {
  min-width: 3.2rem !important;
  text-align: left !important;
}

body.cmep-home-page .cl-stat-val {
  font-size: 1.05rem !important;
}

body.cmep-home-page .cl-stat-label {
  font-size: .6rem !important;
  letter-spacing: .045em !important;
}

body.cmep-home-page .cl-day-label {
  margin: 0 0 .45rem !important;
  padding-bottom: .35rem !important;
  border-bottom: 1px solid color-mix(in srgb, var(--border-subtle, #d4d4d8) 55%, transparent) !important;
  font-size: .72rem !important;
}

body.cmep-home-page .cl-card {
  align-items: center !important;
  min-height: 2.55rem !important;
}

body.cmep-home-page .cl-race-name {
  font-size: .82rem !important;
}

body.cmep-home-page .cl-race-sub {
  font-size: .68rem !important;
}

body.cmep-home-page .cl-pill {
  padding: .18rem .45rem !important;
  font-size: .62rem !important;
}

@media (min-width: 1120px) {
  body.cmep-home-page .forecast-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.legend) {
    min-height: 1.6rem !important;
  }
}

@media (max-width: 700px) {
  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.legend) {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    margin-inline: -.1rem !important;
    padding-inline: .1rem !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.legend)::-webkit-scrollbar {
    display: none !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.legend-item) {
    flex: 0 0 auto !important;
    padding: 4px 7px !important;
    font-size: .62rem !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.arc-wrap) {
    margin-bottom: .35rem !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.mobile-path-majority.show) {
    margin: .35rem 0 .15rem !important;
    padding: .45rem 0 0 !important;
    border-top: 1px solid var(--cmep-internal-border) !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.mobile-path-dots) {
    padding: 0 2px .35rem !important;
    gap: 4px !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.mobile-path-card) {
    flex-basis: calc(100% - 8px) !important;
    width: calc(100% - 8px) !important;
    max-width: calc(100% - 8px) !important;
    padding: .62rem .65rem !important;
    border-radius: 14px !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.mobile-path-card.majority-maker) {
    box-shadow: inset 0 0 0 1px rgba(246, 206, 70, .22) !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.ct-head) {
    font-size: .88rem !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.ct-row) {
    gap: .5rem !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.ct-name) {
    font-size: .82rem !important;
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(.ct-sub) {
    font-size: .7rem !important;
  }

  body.cmep-home-page .cl-stats {
    display: flex !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    padding: .5rem .55rem !important;
  }

  body.cmep-home-page .cl-stats::-webkit-scrollbar {
    display: none !important;
  }

  body.cmep-home-page .cl-card {
    align-items: flex-start !important;
    gap: 7px !important;
    min-height: 0 !important;
  }

  body.cmep-home-page .cl-pills {
    width: 100% !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    padding-left: 24px !important;
  }

  body.cmep-home-page .cl-race-name {
    white-space: normal !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
  }

  body.cmep-home-page .cl-race-sub {
    line-height: 1.2 !important;
  }

  body.cmep-home-page .cl-pill {
    font-size: .6rem !important;
  }
}

@media (prefers-color-scheme: dark) {
  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) {
    --cmep-internal-border: rgba(148, 163, 184, .18);
    --cmep-internal-panel: rgba(148, 163, 184, .07);
  }

  body.cmep-home-page :where(#cmep-senate-arc-native, #cmep-house-arc-native) :where(#cmep-share-image, #cmep-house-arc-share-image) {
    color: rgba(226, 232, 240, .74) !important;
  }
}

/* CMEP 2026-06-28: unified mobile arc tooltip final parity.
   One body-level tooltip owns both House and Senate mobile arc taps. */
@media (hover:none), (pointer:coarse), (max-width:820px){
  body.cmep-mobile-arc-tooltip-open #cmep-senate-arc-native #tooltip,
  body.cmep-mobile-arc-tooltip-open #cmep-house-arc-tooltip{
    display:none !important;
    opacity:0 !important;
    pointer-events:none !important;
  }
  body #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link{
    position:fixed !important;
    left:50% !important;
    right:auto !important;
    top:auto !important;
    bottom:calc(env(safe-area-inset-bottom, 0px) + 18px) !important;
    transform:translateX(-50%) !important;
    width:min(320px, calc(100vw - 28px)) !important;
    max-width:calc(100vw - 28px) !important;
    max-height:min(46vh, 320px) !important;
    overflow:auto !important;
    z-index:2147483000 !important;
    display:none !important;
    box-sizing:border-box !important;
    padding:.72rem .82rem !important;
    border-radius:20px !important;
    background:rgba(255,255,255,.98) !important;
    border:1px solid rgba(15,23,42,.14) !important;
    color:#0f172a !important;
    -webkit-text-fill-color:#0f172a !important;
    box-shadow:none !important;
    cursor:pointer !important;
    pointer-events:auto !important;
    touch-action:manipulation !important;
  }
  body #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link.is-visible{
    display:block !important;
  }
  html[data-theme="dark"] body #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link,
  html.dark body #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link,
  body.dark #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link,
  body.theme-dark #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link{
    background:rgba(15,23,42,.98) !important;
    border-color:rgba(255,255,255,.16) !important;
    color:#f8fafc !important;
    -webkit-text-fill-color:#f8fafc !important;
  }
  body #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link .ct-head{display:block!important;font-weight:900!important;font-size:1rem!important;line-height:1.15!important;margin:0 0 .45rem!important;color:inherit!important;-webkit-text-fill-color:currentColor!important;}
  body #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link .ct-summary{display:flex!important;gap:.35rem!important;flex-wrap:wrap!important;margin:0 0 .55rem!important;}
  body #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link .ct-rows{display:grid!important;gap:.36rem!important;}
  body #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link .ct-row{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:.8rem!important;}
  body #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link .ct-name{font-weight:800!important;font-size:.82rem!important;line-height:1.15!important;color:inherit!important;-webkit-text-fill-color:currentColor!important;}
  body #cmep-mobile-arc-unified-tooltip.cmep-mobile-arc-card-link .ct-right{text-align:right!important;white-space:nowrap!important;}
}
