:root{
  --bg:#0f1b2e;
  --panel:#12233c;
  --accent:#3b82f6;
  --gold:#F6D64C;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --country-stroke:#ffffff;
  --country-neutral:#6b7280;
}

*{ box-sizing:border-box; }
html,body{ height:100%; margin:0; }
body{
  background:var(--bg);
  color:var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Top bar */
.toolbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 14px; background:#0c1729; border-bottom:1px solid #0a1321;
  position:sticky; top:0; z-index:10;
}
.toolbar .title{ font-weight:700; letter-spacing:.3px; }
.toolbar .left { display:flex; gap:8px; }
.toolbar button{
  background:var(--panel); color:var(--text); border:1px solid #1b2c49;
  border-radius:10px; padding:8px 12px; cursor:pointer;
}

.toolbar .title{
  font-weight:700;
  letter-spacing:.3px;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.credits{
  font-size:0.9rem;
  font-weight:500;
  color:var(--muted);
}

.credits a{
  color:var(--accent);
  text-decoration:none;
  transition:opacity .15s ease;
}

.credits a:hover{
  opacity:.8;
  text-decoration:underline;
}
.banner-img{
  height:38px;
  width:auto;
  display:block;
}
.toolbar button:hover{ background:#183055; }
.toolbar #btnFit{
  border-color:#3b2f07;
  box-shadow:0 0 0 1px #3b2f07 inset;
}
.toolbar #btnFit:hover{ outline:1px solid var(--gold); }

/* ===== LAYOUT: 3 columns (left stats | map | right list) ===== */
.layout{
  display:grid;
  grid-template-columns: 72px 1fr 340px;  /* narrow left panel */
  gap:12px;
  height: calc(100vh - 54px);
  padding:12px;
}



/* Map area */
#mapContainer{
  background:#0c1729; border:1px solid #0a1321; border-radius:12px;
  position:relative; overflow:hidden;
}
#mapSvg{
  width:100%; height:100%;
  display:block;
  background:#0c1729;
}
#mapSvg .country-shape{
  fill: var(--country-neutral);
  stroke: var(--country-stroke);
  stroke-width: 2.5;
  cursor: pointer;
  transition: fill .15s ease, opacity .15s ease;
  vector-effect: non-scaling-stroke;
}
#mapSvg .country-shape:hover{ opacity:.9; }

/* Marker for party selection (logo + ring) */
.logo-marker image{ pointer-events:none; }
.logo-marker .ring{ fill: currentColor; }

/* RIGHT: Parties panel */
#sidePanel{
  background:var(--panel);
  border:1px solid #0a1321;
  border-radius:12px;
  padding:14px;
  overflow:auto;
}
#sidePanel h2{
  margin:6px 2px 12px;
  font-weight:800;
  color:var(--gold);
}
.hint{ color:var(--muted); }

.party-list{ display:flex; flex-direction:column; gap:8px; }
.party-btn{
  display:flex; align-items:center; gap:10px;
  background:#10223f; border:1px solid #1b2c49; color:var(--text);
  border-radius:10px; padding:8px 10px; cursor:pointer;
}
.party-btn:hover{ background:#183055; }
.party-swatch{
  width:16px; height:16px; border-radius:4px; border:1px solid #0006;
  box-shadow:0 0 0 1px #0003 inset;
}
.party-logo{
  width:35px;
  height:35px;
  object-fit:contain;
  border-radius:6px;
  padding:3px;
  outline:1px solid #0006;
  flex-shrink:0;
}

.party-name{ font-weight:700; }

/* Only an EU group logo on the right */
.party-meta{ margin-left:auto; display:flex; align-items:center; }
.party-meta img.eu-logo{
  width:35px; height:35px; border-radius:4px; background:#0a1321; outline:1px solid #0006;
}

/* LEFT: Spectra panel */
#leftPanel{
  background:var(--panel);
  border:1px solid #0a1321;
  border-radius:12px;
  padding:6px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:16px;               /* more separation vertically */
  min-width:64px;
}

#leftPanel h2{
  margin:6px 2px 12px;
  font-weight:800;
  color:var(--gold);
}

/* Spectra layout */
#spectra{
  flex:1; /* fill remaining height */
  display:flex;
  gap:12px;
  justify-content:space-between;
  align-items:stretch;
}
.spectrum{
  width: calc((100% - 24px) / 3);
  display:flex; flex-direction:column;
}
.spectrum-title{
  font-weight:700;
  font-size:14px;
  margin-bottom:8px;
}

/* Vertical bar (stretches to full column height) */
.spectrum .bar{
  position:relative;
  background:#10223f;
  border:1px solid #1b2c49;
  border-radius:10px;
  padding:8px 12px;
  display:flex;
  align-items:stretch;
  justify-content:center;
  flex:1; /* key for full-height stretch */
}
.spectrum .bar::before{
  content:"";
  position:absolute;
  left:50%;
  top:8px; bottom:8px;
  width:4px;
  background:#183055;
  border-radius:4px;
  transform:translateX(-50%);
}

/* Axis labels (category labels only; no numbers) */
.axis-label{
  position:absolute;
  left:8px;
  font-size:12px;
  color:var(--muted);
  font-weight:600;
}
.axis-label.top{ top:6px; }
.axis-label.mid{ display:none; }
.axis-label.bottom{ bottom:6px; }

/* Markers */
.marker{
  position:absolute;
  left:50%;
  transform:translate(-50%,-50%);
  display:flex; align-items:center; gap:6px;
  pointer-events:none;
}
.marker.you .dot{
  width:12px; height:12px; border-radius:50%;
  background:var(--gold);
  box-shadow:0 0 0 2px #0006;
}
.marker.you .label{ font-size:12px; color:var(--gold); text-shadow:0 1px 0 #000; }

.marker.group img{
  width:20px; height:20px; border-radius:4px;
  background:#0a1321; outline:1px solid #0006;
}
.marker.group .label{
  font-size:11px; color:#cbd5e1; opacity:.9;
}

/* Legend */
.legend{
  margin-top:10px; font-size:12px; color:var(--muted);
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;
}
.legend .you-dot{ width:10px; height:10px; border-radius:50%; background:var(--gold); }
.legend .sep{ width:10px; height:1px; background:#244; display:inline-block; }
.spectrum-title{ display:none; }
.spectrum {
  display:flex;
  flex-direction:column;
  align-items:center;
}

/* Title above bar */
.spectrum .axis-label.top {
  position:static;     /* no absolute positioning */
  margin-bottom:4px;   /* spacing above the bar */
  font-size:12px;
  color:var(--muted);
  font-weight:600;
}

/* Bar stays in the middle */
.spectrum .bar {
  flex:1;
  position:relative;
  width:100%;
  background:#10223f;
  border:1px solid #1b2c49;
  border-radius:10px;
  display:flex;
  align-items:stretch;
  justify-content:center;
}

/* Title below bar */
.spectrum .axis-label.bottom {
  position:static;
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
  font-weight:600;
}

/* Hide the mid label still */
.spectrum .axis-label.mid { display:none; }
.party-meta{ margin-left:auto; display:flex; align-items:center; gap:6px; }
.party-meta img.eu-logo{ width:24px; height:24px; border-radius:4px;  }
/* === Spectrum Drawer & Overlay === */
#leftPanel.drawer-collapsed{
  width:48px;
  padding:8px;
  display:flex; align-items:center; justify-content:center;
}
#leftPanel .drawer-toggle{
  width:56px;                 /* a bit wider so tall words don’t clip */
  height:156px;               /* more vertical room */
  border:1px solid #1b2c49;
  border-radius:10px;
  background:#10223f;
  color:var(--text);
  cursor:pointer;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;                   /* more separation between label and chevron */
  padding:6px;
}



#leftPanel .drawer-toggle span:first-child{
  writing-mode:vertical-rl;   /* vertical text */
  text-orientation:mixed;
  white-space:nowrap;         /* don't wrap */
  font-weight:800;
  letter-spacing:.5px;
}

#leftPanel .drawer-toggle .chev{
  transform: rotate(180deg);     /* points “into” the page */
  transition: transform .25s ease;
}

#leftPanel .drawer-toggle.open .chev{
  transform: rotate(0deg);       /* flips when open */
}

/* extra spacing between the two buttons */
#leftPanel .drawer-toggle + .drawer-toggle{
  margin-top:4px;
}

#leftPanel .drawer-toggle + .drawer-toggle{
  margin-top:6px;
}

#leftPanel .drawer-toggle:hover{ background:#183055; }

#spectrumOverlay{
  position:absolute; inset:0;
  background:rgba(12,23,41,.98);
  border:1px solid #0a1321; border-radius:12px;
  display:none; /* shown when spectrum is open */
  z-index:5;   /* above the map but below toolbar */
  padding:12px;
}

/* Top bar inside spectrum overlay */
.spx-topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:8px; margin-bottom:8px;
}
.spx-topbar .title{
  font-weight:800; color:var(--gold); letter-spacing:.2px;
}
.spx-topbar .actions{ display:flex; gap:8px; }
.spx-btn{
  background:#10223f; color:var(--text); border:1px solid #1b2c49;
  border-radius:8px; padding:6px 10px; cursor:pointer;
}
.spx-btn:hover{ background:#183055; }

/* Plot area */
.spx-plot{
  position:relative; flex:1; min-height:360px;
  background:#0c1729; border:1px solid #0a1321; border-radius:12px;
  overflow:hidden;
}
/* Grid (major @ 1.0; domain is [-3,3] so 7 lines) */
.spx-grid{
  position:absolute; inset:24px;  /* plot padding */
  background:
    repeating-linear-gradient(to right, #183055 0, #183055 1px, transparent 1px, transparent calc((100%)/6)),
    repeating-linear-gradient(to bottom, #183055 0, #183055 1px, transparent 1px, transparent calc((100%)/6));
  border-radius:8px;
}
/* 0 lines emphasized */
.spx-grid::before,
.spx-grid::after{
  content:"";
  position:absolute; left:0; top:0; right:0; bottom:0; pointer-events:none;
}
.spx-grid::before{ /* vertical 0 */
  border-left:2px solid #245; left:50%;
  transform:translateX(-50%);
}
.spx-grid::after{ /* horizontal 0 */
  border-top:2px solid #245; top:50%;
  transform:translateY(-50%);
}

/* Axis titles */
.spx-axis-label{
  position:absolute; font-size:12px; color:var(--muted); font-weight:700;
  text-shadow:0 1px 0 #000;
}
.spx-axis-label.x-neg{ left:28px; bottom:8px; }
.spx-axis-label.x-pos{ right:28px; bottom:8px; text-align:right; }
.spx-axis-label.y-pos{ top:28px; right:8px; transform:rotate(-90deg) translateY(-4px); transform-origin:top right; }
.spx-axis-label.y-neg{ bottom:28px; right:8px; transform:rotate(90deg) translateY(-4px); transform-origin:bottom right; }

/* Legend */
.spx-legend{ margin-top:8px; font-size:12px; color:var(--muted); display:flex; gap:12px; align-items:center; }
.legend-dot{ width:10px; height:10px; border-radius:50%; background:var(--gold); display:inline-block; }
.legend-sq{ width:14px; height:14px; border-radius:3px; background:#0a1321; outline:1px solid #0006; display:inline-block; }

/* Plot items */
.spx-items{ position:absolute; inset:24px; }
.spx-item{ position:absolute; transform:translate(-50%,-50%); pointer-events:auto; }
.spx-item.you .dot{
  width:14px; height:14px; border-radius:50%; background:var(--gold); box-shadow:0 0 0 2px #0006;
}
.spx-item.group img{
  width:22px; height:22px; border-radius:4px; background:#0a1321; outline:1px solid #0006;
}
.spx-item.party .dot{
  width:10px; height:10px; border-radius:50%; outline:1px solid #0006;
}
.spx-item .label{
  margin-top:4px; font-size:11px; color:#cbd5e1; text-align:center; opacity:.9;
}

/* Right panel: Axis presets mode */
#sidePanel.axis-mode .party-list{ display:none; }
#axisPanel{ display:none; }
#sidePanel.axis-mode #axisPanel{ display:block; }

.axis-options{ display:grid; gap:8px; }
.axis-radio{
  display:flex; align-items:center; gap:8px;
  background:#10223f; border:1px solid #1b2c49; border-radius:10px; padding:8px; cursor:pointer;
}
.axis-radio:hover{ background:#183055; }
.axis-radio input{ margin:0; }
.axis-hint{ font-size:12px; color:var(--muted); }
.info-i{ display:inline-block; width:14px; height:14px; border-radius:50%; background:#244; color:#9ca3af; text-align:center; line-height:14px; font-size:10px; margin-left:6px; }
/* ========== Drawer toggle (left) ========== */
#leftPanel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  min-width: 44px;
}
.drawer-toggle {
  width: 100%;
  background: #0c1729;
  border: 1px solid #0a1321;
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  cursor: pointer;
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.drawer-toggle .chev {
  display: inline-block;
  transition: transform .25s ease;
}
.drawer-toggle.open .chev {
  transform: rotate(180deg);
}

/* ========== Spectrum overlay (slides) ========== */
#spectrumOverlay {
  position: absolute;
  inset: 0;
  display: none;             /* JS toggles .open to show */
  background: #0b1628ee;
  backdrop-filter: blur(1.5px);
  border: 1px solid #0a1321;
  border-radius: 12px;
  overflow: hidden;

  /* slide-in from the left */
  transform: translateX(-105%);
  transition: transform .35s ease;
}
#spectrumOverlay.open {
  display: block;
  transform: translateX(0);
}

.spx-topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 14px; background:#0c1729; border-bottom:1px solid #0a1321;
}
.spx-topbar .title{
  font-weight:800; color:var(--gold);
}

/* Axis title under topbar */
#axisPresetTitle{
  padding:8px 14px; color:#cbd5e1; font-weight:600;
  border-bottom:1px dashed #15253f;
}

/* Square plot, only axes at 0 */
.spx-plot{
  position:relative;
  height: calc(100% - 96px); /* topbar(44) + title(??) + legend(??); generous */
  padding: 18px;
  display:grid;
  place-items:center;
}
.spx-plot-inner{
  position: relative;
  aspect-ratio: 1 / 1;
  width: min(92vmin, 1100px);
  max-width: calc(100% - 28px);
  max-height: calc(100% - 28px);
  background:#0e1c33;
  border:1px solid #1b2c49;
  border-radius: 12px;
}

/* Only the two axes at 0, no gridlines */
.spx-axes::before,
.spx-axes::after{
  content:"";
  position:absolute;
  background:#264268;
  border-radius:2px;
  pointer-events:none;
}
/* y = 0 (horizontal center) */
.spx-axes::before{
  left: 8px; right: 8px; height: 3px;
  top: 50%; transform: translateY(-50%);
}
/* x = 0 (vertical center) */
.spx-axes::after{
  top: 8px; bottom: 8px; width: 3px;
  left: 50%; transform: translateX(-50%);
}

/* Axis end labels (+/-3) */
.spx-axis-cap{
  position:absolute; font-size:12px; color:#cbd5e1; font-weight:700;
  text-shadow:0 1px 0 #000;
  pointer-events:none;
}
.spx-cap-y-top   { top: 2px; left: 50%; transform: translateX(-50%); }
.spx-cap-y-bot   { bottom: 2px; left: 50%; transform: translateX(-50%); }
.spx-cap-x-left  { left:  2px; top: 50%; transform: translateY(-50%); }
.spx-cap-x-right { right: 2px; top: 50%; transform: translateY(-50%); }

/* Items */
.spx-items{ position:absolute; inset:8px; }

/* Bigger markers */
.spx-item { position:absolute; transform:translate(-50%,-50%); display:flex; align-items:center; gap:6px; }
.spx-item.you .dot{
  width:16px; height:16px; border-radius:50%; background:var(--gold); box-shadow:0 0 0 2px #0006;
}
.spx-item.you .label{ font-size:12px; color:var(--gold); }

/* EU group squares (no labels) */
.spx-item.group .sq{
  width:18px; height:18px; background:#9fb3d8; border:2px solid #203b66; border-radius:3px;
}

/* Legend */
.spx-legend{
  position:absolute; bottom:10px; left:12px;
  display:flex; align-items:center; gap:10px; font-size:12px; color:var(--muted);
}
.spx-legend .legend-dot{ width:10px; height:10px; border-radius:50%; background:var(--gold); }
.spx-legend .legend-sq{ width:12px; height:12px; background:#9fb3d8; border:2px solid #203b66; border-radius:2px; }

/* Right panel "Axis Presets"—clean labels & tooltip-only "i" */
#axisPanel .axis-options{
  display:flex; flex-direction:column; gap:8px;
}
.axis-radio{ display:flex; align-items:center; gap:8px; }
.axis-radio .info-i{
  margin-left: 2px; width:16px; height:16px; border-radius:50%;
  display:inline-grid; place-items:center;
  font-size:11px; color:#0c1729; background:#9fb3d8; cursor:help;
}
.axis-radio .axis-hint{ display:none; } /* hide inline hint; tooltip via title */
.spx-plot{
  position:absolute;
  inset:68px 16px 20px 16px;
  display:flex; align-items:center; justify-content:center;
}
.spx-plot-inner{
  position:relative;
  height:100%;
  aspect-ratio:1 / 1;
  max-width:100%;
  max-height:100%;
  width:min(100%, 900px);
  background:#0c1729;
  border:1px solid #0a1321;
  border-radius:12px;
}
/* EU group logos inside the spectrum */
#spectrumOverlay .spx-item.group .group-logo{
  width: 40px;              /* was smaller — make it big */
  height: 40px;
  border-radius: 8px;
  background:#0a1321;
  outline:1px solid #0006;
  box-shadow: 0 4px 14px #0008, 0 0 0 1px #0003 inset;
  image-rendering: auto;    /* keep them crisp */
  pointer-events: none;     /* don't block hover/clicks on canvas */
}

/* (optional) make the YOU dot a bit bigger to match scale */
#spectrumOverlay .spx-item.you .dot{
  width: 20px;
  height: 20px;
  box-shadow: 0 0 0 3px #0008;
}
/* ===== Spectrum lakes (hover) ===== */
.spx-plot .spx-plot-inner { position: relative; }

/* Layer order: axes (behind) -> lake svg -> markers (front) */
.spx-plot .lake-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none; /* never steal hover from markers */
}

.spx-plot .spx-items {
  position: absolute;
  inset: 0;
  z-index: 3;
}

/* Lake fill + outline */
.lake-fill {
  fill: var(--lake-color, rgba(0,0,255,0.20));
}

.lake-stroke {
  fill: none;
  stroke: white;
  stroke-opacity: 0.9;
  stroke-width: 2;
}

/* Density glow: many small dots, blurred & screened */
.lake-heat circle {
  /* the solid color used before blur; overridden via inline style */
  fill: #000;
  fill-opacity: 0.12;
}

/* Make group logos a bit bigger if you want (optional) */
.spx-item.group .group-logo {
  width: 34px;   /* tweak */
  height: 34px;  /* tweak */
  border-radius: 6px;
}
#matchesPanel .subhead { font-weight:600; margin: 8px 0; }
#matchesPanel .list { display:flex; flex-direction:column; gap:8px; }
#matchesPanel .row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
#matchesPanel .row-left { display:flex; align-items:center; gap:8px; min-width:0; }
#matchesPanel .row-right { display:flex; align-items:center; gap:8px; }
#matchesPanel .mini-logo { width:20px; height:20px; object-fit:contain; }
#matchesPanel .pct { width:42px; text-align:right; font-variant-numeric: tabular-nums; }
#matchesPanel .bar { width:120px; height:6px; background:#e6e6e6; border-radius:999px; overflow:hidden; }
#matchesPanel .bar > div { height:100%; background:#8888ff; } /* overridden per group */
#matchesPanel .muted { color:#777; }
#leftPanel { display:flex; flex-direction:column; gap:8px; }
#leftPanel .drawer-toggle { display:flex; align-items:center; justify-content:space-between; }
.party-btn { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.party-btn .party-name { flex:1 1 auto; }
.party-btn .party-pct { margin-left:auto; font-weight:600; }
/* Ensure vertical stack with breathing room */
#leftPanel .drawer-toggle {
  display: block;
  width: 100%;
  margin: 8px 0;   /* <-- prevents overlap */
}
#leftPanel { z-index: 20; }          /* stays above map */
#spectrumOverlay { z-index: 10; }    /* overlay below buttons */
#leftPanel { display:flex; flex-direction:column; gap:8px; }
#leftPanel .drawer-toggle { width:100%; }
/* ensure the two left drawer buttons never collide and the chevron rotates */
#leftPanel { z-index: 20; }              /* above map */
#spectrumOverlay { z-index: 10; }        /* below the drawer buttons */

#leftPanel .drawer-toggle {
  display: block;
  width: 100%;
  margin: 8px 0;                         /* vertical breathing room */
}
.drawer-toggle .chev {
  display: inline-block;
  transition: transform .25s ease;
}
.drawer-toggle.open .chev {
  transform: rotate(180deg);
}
/* right-panel: matches rows consistent with party list */
#matchesPanel .subhead { 
  font-weight: 600; 
  margin: 8px 0; 
}
#matchesPanel .list { 
  display: flex; 
  flex-direction: column; 
  gap: 8px; 
}

/* reuse .party-btn styling, but make the percent tidy */
.party-btn { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 8px; 
}
.party-btn .party-name { 
  flex: 1 1 auto; 
}
.party-btn .party-pct {             /* the % on the far right */
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums; 
  opacity: .95;
}
/* don't block hover with SVG images; you already have pointer-events: none on image */
.logo-marker.auto-match image { 
  opacity: .95; 
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); 
}
.logo-marker.manual image { 
  opacity: 1; 
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.25)); 
}
#mapSvg .country-shape{
  transition: fill .18s ease, opacity .15s ease; /* slightly faster, snappy */
}
/* spectrum layers: lake under items; never steals pointer */
.spx-plot .lake-svg { 
  z-index: 2; 
  pointer-events: none; 
}
.spx-plot .spx-items { 
  z-index: 3; 
}
/* Right panel: Matches mode */
#sidePanel.matches-mode .party-list { display: none; }   /* hide standard party list */
#sidePanel.matches-mode #matchesPanel { display: block; }/* always show matches tray */
/* Big titles */
.page-title h1 {
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 800;
  letter-spacing: 0.2px;
  margin: 0 0 6px;
}
.page-subtitle {
  font-size: 12px;
  opacity: 0.7;
  margin: 2px 0 16px;
}

/* Spectrum title */
#axisPresetTitle {
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 700;
  text-align: center;
  margin: 8px 0 10px;
}

/* Matches panel heading */
#matchesPanel .panel-title {
  font-size: clamp(18px, 2.2vw, 22px);
  font-weight: 700;
  margin: 0 0 6px;
}
#matchesPanel .panel-subtitle {
  font-size: 12px;
  opacity: 0.7;
  margin: 0 0 12px;
}
/* When Matches is open, show ONLY the Matches panel on the right */
#sidePanel.matches-mode > *:not(#matchesPanel) {
  display: none !important;
}

/* When Spectrum (axis-mode) is open, keep Matches hidden */
#sidePanel.axis-mode #matchesPanel {
  display: none !important;
}
/* === Spectrum axis segmented buttons === */
#axisPanel { margin-top: 0; }
#axisPanel h2 { margin: 8px 0 12px; }

.axis-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* Hide native radios but keep them accessible */
.axis-radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Label as button (based on your retakeBtn style) */
.axis-radio {
  position: relative;
  display: block;
}
.axis-radio label,
.axis-radio .axis-pill {
  display: inline-block;
  width: 100%;
  background-color: #111827;
  color: #fff;
  font-size: 16px;
  padding: 12px 16px;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-family: 'Poppins', Arial, sans-serif;
  box-sizing: border-box;
  min-width: 180px;
  text-align: center;
  transition: background-color .2s ease, transform .08s ease, box-shadow .2s ease;
  user-select: none;
}

/* hover/focus */
.axis-radio input[type="radio"] + .axis-pill:hover {
  background-color: #333333;
}
.axis-radio input[type="radio"]:focus-visible + .axis-pill {
  outline: 2px solid #6aa7ff;
  outline-offset: 2px;
}

/* selected */
.axis-radio input[type="radio"]:checked + .axis-pill {
  background-color: #1f2937;
  box-shadow: 0 0 0 2px #374151 inset;
  font-weight: 600;
}

/* Spectrum page title centered */
#spectrumOverlay #axisPresetTitle {
  text-align: center;
  font-weight: 600;
  font-size: 18px;
  margin: 8px 0 10px;
}

/* Hide default map copy in Spectrum mode */
body.spectrum-open #defaultSideCopy { display: none; }

/* Preview marker in plot (party hover from right list) */
.spx-preview-marker {
  position: absolute;
  width: 26px; height: 26px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(255,255,255,.75), 0 2px 6px rgba(0,0,0,.35);
  z-index: 5;
}
.spx-preview-marker img { width: 100%; height: 100%; display: block; }

/* =========================
   MOBILE / PHONE LAYOUT
   ========================= */

@media (max-width: 760px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 14px;
  }

  .toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 8px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .toolbar .left {
    order: 2;
    width: 100%;
    justify-content: center;
  }

  .toolbar .title {
    order: 1;
    width: 100%;
    text-align: center;
    font-size: 16px;
  }

  .toolbar button {
    min-width: 48px;
    min-height: 42px;
    padding: 8px 12px;
    font-size: 16px;
  }

  .layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 8px;
    height: auto;
    min-height: calc(100dvh - 92px);
    padding: 8px;
  }

  #leftPanel {
    order: 1;
    min-width: 0;
    width: 100%;
    padding: 6px;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    gap: 8px;
    overflow: visible;
  }

  #leftPanel .drawer-toggle {
    width: 50%;
    height: auto;
    min-height: 44px;
    margin: 0 !important;
    padding: 8px 10px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 8px;
  }

  #leftPanel .drawer-toggle span:first-child {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    white-space: normal;
    letter-spacing: 0;
  }

  #mapContainer {
    order: 2;
    width: 100%;
    height: 58dvh;
    min-height: 360px;
    max-height: 620px;
    border-radius: 12px;
    touch-action: none;
  }

  #mapSvg {
    width: 100%;
    height: 100%;
  }

  #sidePanel {
    order: 3;
    width: 100%;
    max-height: 38dvh;
    overflow-y: auto;
    padding: 12px;
    border-radius: 12px;
  }

  #sidePanel h2 {
    font-size: 20px;
    margin: 4px 0 10px;
  }

  .page-title h1 {
    font-size: 20px;
    text-align: center;
    margin-bottom: 8px;
  }

  .party-list {
    gap: 10px;
  }

  .party-btn {
    min-height: 56px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 15px;
  }

  .party-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .party-meta img.eu-logo {
    width: 28px;
    height: 28px;
  }

  .party-name {
    font-size: 15px;
    line-height: 1.15;
  }

  .hint {
    text-align: center;
    font-size: 13px;
  }

  /* Spectrum overlay on phone */
  #spectrumOverlay {
    inset: 0;
    border-radius: 12px;
    padding: 8px;
  }

  #spectrumOverlay.open {
    display: block;
  }

  .spx-topbar {
    padding: 8px 10px;
  }

  .spx-topbar .title {
    font-size: 15px;
  }

  #axisPresetTitle {
    font-size: 15px !important;
    margin: 6px 0;
    padding: 4px 8px;
  }

  .spx-plot {
    position: absolute;
    inset: 82px 8px 36px 8px;
  }

  .spx-plot-inner {
    width: min(92vw, 92dvh);
    height: auto;
    max-height: 100%;
  }

  #spectrumOverlay .spx-item.group .group-logo {
    width: 30px;
    height: 30px;
  }

  #spectrumOverlay .spx-item.you .dot {
    width: 18px;
    height: 18px;
  }

  .spx-legend {
    bottom: 6px;
    left: 8px;
    font-size: 11px;
  }

  /* Axis / Matches right panel content */
  .axis-options {
    gap: 8px;
  }

  .axis-radio .axis-pill {
    min-width: 0;
    width: 100%;
    font-size: 14px;
    padding: 11px 12px;
  }

  #matchesPanel .party-btn,
  #spxSelectionPanel .party-btn {
    min-height: 54px;
  }
}
@media (max-width: 430px) {
  #mapContainer {
    height: 54dvh;
    min-height: 320px;
  }

  #sidePanel {
    max-height: 42dvh;
  }

  .party-logo {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .party-btn {
    min-height: 52px;
    font-size: 14px;
  }

  .party-meta img.eu-logo {
    width: 24px;
    height: 24px;
  }

  #leftPanel .drawer-toggle {
    font-size: 13px;
    padding: 8px 6px;
  }
}

.party-section-title{
  margin:14px 2px 6px;
  font-size:12px;
  font-weight:800;
  color:var(--gold);
  text-transform:uppercase;
  letter-spacing:.6px;
  opacity:.9;
}

.minor-toggle-btn{
  margin:10px 0 4px;
  width:100%;
  background:#0f1b2e;
  color:var(--gold);
  border:1px solid #3b2f07;
  border-radius:10px;
  padding:9px 10px;
  cursor:pointer;
  font-weight:800;
}

.minor-toggle-btn:hover{
  background:#183055;
  outline:1px solid var(--gold);
}

.info-tip{
  display:inline-grid;
  place-items:center;
  width:16px;
  height:16px;
  margin-left:6px;
  border-radius:50%;
  background:#9fb3d8;
  color:#0c1729;
  font-size:11px;
  font-weight:800;
  cursor:help;
  position:relative;
}

.info-tip:hover::after{
  content:attr(data-tip);
  position:absolute;
  left:-50px;
  top:24px;
  width:240px;
  background:#0c1729;
  color:var(--text);
  border:1px solid #1b2c49;
  border-radius:8px;
  padding:8px 10px;
  font-size:12px;
  font-weight:500;
  line-height:1.3;
  z-index:9999;
  box-shadow:0 6px 20px #0008;
}

.info-tip2{
  display:inline-grid;
  place-items:center;
  width:16px;
  height:16px;
  margin-left:6px;
  border-radius:50%;
  background:#9fb3d8;
  color:#0c1729;
  font-size:11px;
  font-weight:800;
  cursor:help;
  position:relative;
}

.info-tip2:hover::after{
  content:attr(data-tip);
  position:absolute;
  right:0;
  top:24px;
  width:240px;
  background:#0c1729;
  color:var(--text);
  border:1px solid #1b2c49;
  border-radius:8px;
  padding:8px 10px;
  font-size:12px;
  font-weight:500;
  line-height:1.3;
  z-index:9999;
  box-shadow:0 6px 20px #0008;
}

.match-lock-btn{
  width:100%;
  margin:10px 0 12px;
  background:#111827;
  color:#fff;
  border:1px solid #374151;
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
  font-weight:800;
}

.match-lock-btn:hover{
  background:#1f2937;
}

.match-weight-box{
  background:#0f1b2e;
  border:1px solid #1b2c49;
  border-radius:12px;
  padding:10px;
  margin-bottom:14px;
}

.match-weight-title{
  font-weight:800;
  color:var(--gold);
  margin-bottom:8px;
  font-size:13px;
}

.weight-row{
  display:grid;
  grid-template-columns:75px 1fr 42px;
  align-items:center;
  gap:8px;
  margin:8px 0;
  font-size:13px;
}

.weight-row input{
  width:100%;
}

.weight-row strong{
  font-size:12px;
  text-align:right;
  color:#cbd5e1;
}