:root {
  --bg-dark: #070a12;
  --bg-panel: #0f1626;
  --bg-bezel: #0b101d;
  --border-subtle: rgba(148, 163, 184, 0.16);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-cyan: #38bdf8;
  /* Modern Web Guidance (`visual-effects`): Fallback tokens for gradient color space interpolation */
  --in-oklab: ;
  --in-oklch: ;
}

@supports (background: linear-gradient(in oklab, white, black)) {
  :root {
    --in-oklab: in oklab;
    --in-oklch: in oklch;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  /* Modern Web Guidance (`responsive-design`): Use dynamic viewport units (dvh) instead of vh */
  min-block-size: 100dvh;
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(circle at 50% 0% var(--in-oklab), rgba(239, 68, 68, 0.14), transparent 60%),
    linear-gradient(to bottom var(--in-oklab), #070a12, #0d1322);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
}

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: clip;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   HEADER + BARRA DE BÚSQUEDA Y ACTUALIZACIÓN INTUITIVA Y DESTACADA
   ========================================================================== */
.top-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: safe center;
  gap: 0.85rem 1.25rem;
  padding: 0.75rem 1rem 0.75rem 0.65rem;
  background: rgba(11, 16, 29, 0.94);
  border-block-end: 1px solid rgba(56, 189, 248, 0.22);
  backdrop-filter: blur(12px);
  position: sticky;
  inset-block-start: 0;
  z-index: 30;
}

.brand-lockup {
  display: flex;
  align-items: safe center;
  gap: 0.7rem;
  min-inline-size: 0;
}

.live-dot {
  inline-size: 12px;
  block-size: 12px;
  border-radius: 50%;
  background: var(--accent-red);
  flex-shrink: 0;
  /* Modern Web Guidance (`visual-effects`): Use drop-shadow for glowing non-rectangular indicators */
  filter: drop-shadow(0 0 8px #ef4444);
  animation: pulse-dot 1.8s infinite ease-in-out;
  /* Modern Web Guidance (`individual-transform-properties`): Identity transform on animated element */
  scale: 1;
}

@keyframes pulse-dot {
  0%, 100% { scale: 1; opacity: 1; }
  50% { scale: 1.3; opacity: 0.65; }
}

.brand-lockup h1 {
  /* Modern Web Guidance (`responsive-design`): Combine viewport-relative and font-relative units in clamp() */
  font-size: clamp(1rem, 0.85rem + 0.85vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  gap: 0.5rem;
}

.badge-poc {
  font-size: 0.68rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: linear-gradient(to right var(--in-oklab), #dc2626, #f59e0b);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.subtitle {
  font-size: clamp(0.73rem, 0.68rem + 0.2vw, 0.84rem);
  color: var(--text-muted);
}

/* Barra de comandos de búsqueda y actualización súper visible */
.search-command-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  gap: 0.55rem 0.7rem;
  flex: 1 1 540px;
  max-inline-size: 820px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 0.85rem;
  padding: 0.55rem 0.75rem;
  box-shadow: 0 6px 20px -6px rgba(14, 165, 233, 0.25);
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1 1 340px;
  min-inline-size: 0;
}

.search-input-group {
  display: flex;
  align-items: safe center;
  gap: 0.45rem;
  flex: 1 1 230px;
  min-inline-size: 0;
  background: #050811;
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  border-radius: 0.6rem;
  padding: 0.15rem 0.65rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input-group:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

.search-icon-prefix {
  font-size: 1rem;
  flex-shrink: 0;
}

.search-input-group input {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 0.45rem 0.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  inline-size: 100%;
  min-inline-size: 0;
}

.search-input-group input::placeholder {
  color: #94a3b8;
}

.search-input-group input:focus {
  outline: none;
}

.btn-scan,
.btn-refresh {
  cursor: pointer;
  border-radius: 0.6rem;
  padding: 0.55rem 1rem;
  font-weight: 800;
  font-size: 0.86rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: safe center;
  justify-content: center;
  gap: 0.35rem;
  transition: scale 0.2s ease, filter 0.2s ease;
  /* Identity transform to avoid stacking context jump on hover */
  translate: 0px;
  rotate: 0deg;
  scale: 1;
}

.btn-scan {
  border: 1px solid rgba(56, 189, 248, 0.6);
  background: linear-gradient(to right var(--in-oklab), #2563eb, #0284c7);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}

.btn-refresh {
  border: 1px solid rgba(16, 185, 129, 0.55);
  background: linear-gradient(to right var(--in-oklab), rgba(16, 185, 129, 0.22), rgba(15, 23, 42, 0.95));
  color: #6ee7b7;
}

@supports (translate: 0px) {
  .btn-scan:hover,
  .btn-refresh:hover {
    scale: 1.03;
    filter: brightness(1.1);
  }
}

@supports not (translate: 0px) {
  .btn-scan:hover,
  .btn-refresh:hover {
    transform: scale(1.03);
    filter: brightness(1.1);
  }
}

.quick-tags-row {
  inline-size: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  gap: 0.35rem;
  padding-block-start: 0.15rem;
}

.quick-tags-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.quick-tag-btn {
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.7);
  color: #bae6fd;
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.quick-tag-btn:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
}

/* ==========================================================================
   APP SHELL LAYOUT: SIDEBAR IZQUIERDO PEGADO AL BORDE IZQUIERDO + MAIN
   Modern Web Guidance (`css-layout`): Use grid-template-areas for named page regions
   ========================================================================== */
.app-layout {
  inline-size: 100%;
  max-inline-size: 100%;
  margin-inline: 0;
  padding: 0.75rem 1rem 1.25rem 0.45rem;
  display: grid;
  grid-template-columns: 265px minmax(0, 1fr);
  grid-template-areas: "sidebar main";
  gap: 1rem;
  align-items: start;
  flex: 1 0 auto;
}

/* Sidebar Menu pegado a la izquierda */
.leaders-sidebar {
  grid-area: sidebar;
  background: rgba(15, 22, 38, 0.92);
  border: 1px solid var(--border-subtle);
  border-radius: 0.85rem;
  padding: 0.75rem;
  position: sticky;
  inset-block-start: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-inline-size: 0;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-block-end: 0.45rem;
  border-block-end: 1px solid rgba(148, 163, 184, 0.14);
}

.sidebar-header h2 {
  font-size: 0.84rem;
  font-weight: 800;
  color: #e2e8f0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.source-pill {
  font-size: 0.69rem;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.16rem 0.5rem;
  border-radius: 0.45rem;
  line-height: 1.3;
  overflow: clip;
  text-overflow: ellipsis;
}

.leader-menu {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  max-block-size: calc(100dvh - 11rem);
  overflow-y: auto;
  /* Modern Web Guidance (`css-layout`): Reserve scrollbar space and contain scroll chaining */
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.leader-card {
  display: flex;
  align-items: safe center;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  background: rgba(7, 10, 18, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 0.65rem;
  cursor: pointer;
  text-align: start;
  color: var(--text-main);
  min-inline-size: 0;
  /* Modern Web Guidance (`individual-transform-properties`): Base identity transforms */
  translate: 0px;
  rotate: 0deg;
  scale: 1;
  transition: translate 0.2s ease, scale 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

@supports (translate: 0px) {
  .leader-card:hover {
    translate: 2px 0;
    scale: 1.01;
  }
}

@supports not (translate: 0px) {
  .leader-card:hover {
    transform: translate(2px, 0) scale(1.01);
  }
}

.leader-card.active {
  border-color: var(--accent-red);
  background: linear-gradient(to right var(--in-oklab), rgba(239, 68, 68, 0.22), rgba(15, 22, 38, 0.95));
  box-shadow: 0 6px 16px -6px rgba(239, 68, 68, 0.4);
}

.leader-card-thumb {
  display: block;
  inline-size: 38px;
  block-size: 38px;
  /* Modern Web Guidance (`responsive-design`): Use aspect-ratio to prevent CLS */
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: #1e293b;
  flex-shrink: 0;
}

.leader-card-info {
  flex: 1 1 auto;
  min-inline-size: 0;
}

.leader-card-name {
  font-weight: 700;
  font-size: 0.83rem;
  white-space: nowrap;
  overflow: clip;
  text-overflow: ellipsis;
}

.leader-card-sub {
  font-size: 0.69rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: clip;
  text-overflow: ellipsis;
}

.leader-card-rpm {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
  font-size: 0.74rem;
  padding: 0.16rem 0.38rem;
  border-radius: 0.38rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

/* Main Workspace (Cluster arriba + paneles abajo) */
.main-workspace {
  grid-area: main;
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  min-inline-size: 0;
}

/* ==========================================================================
   TABLERO PRINCIPAL ("TERMÓMETRO" CON CALIBRACIÓN GEOMÉTRICA EXACTA)
   ========================================================================== */
.car-cluster-Housing {
  container: cluster / inline-size;
}

.cluster-bezel {
  background:
    radial-gradient(circle at 50% 45% var(--in-oklab), #131c31 0%, #070b14 75%),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.015) 0 4px, transparent 0 8px);
  border: 2px solid #26334d;
  border-radius: 1.5rem;
  padding: 0.85rem 1.1rem;
  /* Modern Web Guidance (`visual-effects`): Layer multiple shadows for realistic depth */
  box-shadow:
    inset 0 4px 24px rgba(0, 0, 0, 0.85),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 16px 36px -14px rgba(0, 0, 0, 0.8);
  position: relative;
}

/* Warning lights bar */
.warning-lights-bar {
  display: flex;
  flex-wrap: wrap;
  flex-wrap: balance;
  justify-content: center;
  gap: 0.5rem;
  padding-block-end: 0.7rem;
  margin-block-end: 0.7rem;
  border-block-end: 1px dashed rgba(148, 163, 184, 0.18);
}

.warning-light {
  display: flex;
  align-items: safe center;
  gap: 0.4rem;
  padding: 0.24rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.15);
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.warning-light.on-warning {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.1);
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.35));
}

.warning-light.on-critical {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.65);
  background: rgba(239, 68, 68, 0.14);
  filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.5));
  animation: blink-warning 1.4s infinite ease-in-out;
}

@keyframes blink-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* 3-Column Gauge Grid */
.cluster-gauges-grid {
  display: grid;
  grid-template-columns: 1fr 1.08fr 1fr;
  grid-template-areas: "rpm hud mph";
  align-items: center;
  gap: 0.9rem;
}

#rpm-pod { grid-area: rpm; }
#center-hud-pod { grid-area: hud; }
#mph-pod { grid-area: mph; }

@container cluster (inline-size < 760px) {
  .cluster-gauges-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "hud hud"
      "rpm mph";
    gap: 0.75rem;
  }
}

@container cluster (inline-size < 420px) {
  .cluster-gauges-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hud"
      "rpm"
      "mph";
  }
}

.gauge-pod {
  display: flex;
  justify-content: center;
  align-items: safe center;
  min-inline-size: 0;
}

.gauge-dial {
  position: relative;
  inline-size: 100%;
  max-inline-size: 285px;
  aspect-ratio: 260 / 225;
  background: radial-gradient(circle at 50% 55% var(--in-oklab), #111a2e 0%, #060911 78%);
  border-radius: 50% 50% 42% 42%;
  border: 2px solid rgba(148, 163, 184, 0.2);
  box-shadow: inset 0 6px 20px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: safe center;
  justify-content: center;
  padding: 0.35rem;
}

.gauge-svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
  overflow: visible;
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.18));
}

#rpm-active-arc,
#mph-active-arc {
  transition: stroke-dashoffset 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.dial-numbers text {
  fill: #cbd5e1;
  font-size: 11.5px;
  font-weight: 800;
  text-anchor: middle;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dial-numbers text.redline-num {
  fill: #ef4444;
}

/* Aguja SVG calibrada al centro matemático exacto (130, 135) del viewBox */
.svg-needle {
  transform-box: view-box;
  transform-origin: 130px 135px;
  /* MANDATORY base identity transformations (`individual-transform-properties`) */
  translate: 0px;
  rotate: -120deg;
  scale: 1;
  transition: rotate 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.85));
}

.svg-needle.redline-jitter {
  animation: needle-vibration 0.18s infinite alternate ease-in-out;
}

@keyframes needle-vibration {
  0% { translate: -0.75px 0; }
  100% { translate: 0.75px 0; }
}

.gauge-digital-readout {
  position: absolute;
  inset-block-end: 5%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: safe center;
}

.digital-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(1.15rem, 0.9rem + 1vw, 1.6rem);
  font-weight: 900;
  color: #f8fafc;
  letter-spacing: 0.03em;
}

.digital-unit {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

/* Center HUD Display */
.center-hud {
  background: linear-gradient(to bottom var(--in-oklab), rgba(15, 23, 42, 0.92), rgba(7, 10, 18, 0.96));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 1.15rem;
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: safe center;
  text-align: center;
  gap: 0.38rem;
  box-shadow: inset 0 0 24px rgba(14, 165, 233, 0.08);
  min-inline-size: 0;
}

.hud-top-status {
  display: flex;
  align-items: safe center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.hud-party {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.45);
  color: #93c5fd;
  text-transform: uppercase;
}

.hud-redline-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.22);
  border: 1px solid #ef4444;
  color: #fca5a5;
}

.leader-portrait-frame {
  position: relative;
  inline-size: 78px;
  block-size: 78px;
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(#ef4444, #f59e0b, #38bdf8, #ef4444);
}

.leader-photo,
.leader-photo-fallback {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  background: #0f172a;
  display: flex;
  align-items: safe center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.4rem;
  color: #fff;
}

.hud-leader-name {
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
  font-weight: 800;
}

.hud-leader-role {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.hud-hashtags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
}

.hashtag-pill {
  font-size: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 0.1rem 0.45rem;
  border-radius: 0.35rem;
}

/* Temperature Bar */
.temp-gauge-block {
  inline-size: 100%;
  margin-block-start: 0.15rem;
}

.temp-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-block-end: 0.18rem;
}

.temp-bar-track {
  inline-size: 100%;
  block-size: 7px;
  background: #1e293b;
  border-radius: 999px;
  overflow: clip;
}

.temp-bar-fill {
  block-size: 100%;
  inline-size: 65%;
  background: linear-gradient(to right var(--in-oklab), #38bdf8, #f59e0b, #ef4444);
  transition: width 0.6s ease;
}

/* Digital Odometer */
.odometer-box {
  inline-size: 100%;
  background: #050811;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.6rem;
  padding: 0.35rem 0.55rem;
  margin-block-start: 0.15rem;
}

.odo-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

.odometer-digits {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #34d399;
}

.odo-sub {
  display: block;
  font-size: 0.66rem;
  color: #94a3b8;
}

/* Horn Button */
.horn-btn {
  margin-block-start: 0.25rem;
  inline-size: 100%;
  cursor: pointer;
  border: 1px solid rgba(239, 68, 68, 0.6);
  background: linear-gradient(to right var(--in-oklab), #dc2626, #ea580c);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.48rem 0.8rem;
  border-radius: 0.6rem;
  display: flex;
  align-items: safe center;
  justify-content: center;
  gap: 0.45rem;
  /* Identity transforms (`individual-transform-properties`) */
  translate: 0px;
  rotate: 0deg;
  scale: 1;
  transition: scale 0.15s ease;
}

@supports (translate: 0px) {
  .horn-btn:hover { scale: 1.02; }
  .horn-btn:active { scale: 0.96; }
}

@supports not (translate: 0px) {
  .horn-btn:hover { transform: scale(1.02); }
  .horn-btn:active { transform: scale(0.96); }
}

.honk-badge {
  background: rgba(0, 0, 0, 0.35);
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

/* Cluster Footer Keywords */
.cluster-footer-bar {
  margin-block-start: 0.8rem;
  padding-block-start: 0.65rem;
  border-block-start: 1px dashed rgba(148, 163, 184, 0.18);
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  gap: 0.5rem;
}

.footer-tag-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #f87171;
  letter-spacing: 0.05em;
}

.keywords-chips {
  display: flex;
  flex-wrap: wrap;
  flex-wrap: balance;
  gap: 0.4rem;
}

.keyword-chip {
  font-size: 0.72rem;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

/* Lower Grid: Live Feed & Accessible Comparison Table */
.lower-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.05rem;
  min-inline-size: 0;
}

.panel-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-inline-size: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: safe center;
  gap: 0.5rem;
}

.panel-header h2 {
  font-size: clamp(0.95rem, 0.85rem + 0.35vw, 1.12rem);
}

.panel-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  white-space: nowrap;
}

.panel-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.posts-feed {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-block-size: 380px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  padding-inline-end: 0.25rem;
}

.post-item {
  background: rgba(7, 10, 18, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 0.6rem;
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: safe center;
  gap: 0.35rem;
  font-size: 0.71rem;
  color: var(--text-muted);
}

.post-source-tag {
  font-weight: 700;
  color: #38bdf8;
}

.post-anger-pill {
  font-weight: 800;
  padding: 0.08rem 0.42rem;
  border-radius: 0.35rem;
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

.post-title-link {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
}

.post-title-link:hover {
  color: #38bdf8;
  text-decoration: underline;
}

/* Accessible Ranking Table */
.table-wrapper {
  overflow-x: auto;
  overscroll-behavior: contain;
}

.ranking-table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.ranking-table caption {
  text-align: start;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-block-end: 0.45rem;
}

.ranking-table th,
.ranking-table td {
  padding: 0.55rem 0.6rem;
  text-align: start;
  border-block-end: 1px solid rgba(148, 163, 184, 0.14);
}

.ranking-table th {
  color: #cbd5e1;
  font-weight: 700;
  background: rgba(7, 10, 18, 0.5);
}

.ranking-table tr.active-row {
  background: rgba(239, 68, 68, 0.12);
}

/* ==========================================================================
   ESPACIOS PUBLICITARIOS (GOOGLE ADSENSE / ADMOB WEB READY)
   Modern Web Guidance (`performance`): Use `contain: layout style paint` and reserved min-block-size to prevent CLS
   ========================================================================== */
.ad-slot-container {
  contain: layout style paint;
  background: rgba(11, 16, 29, 0.78);
  border: 1px dashed rgba(148, 163, 184, 0.28);
  border-radius: 0.8rem;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: safe center;
  justify-content: center;
  text-align: center;
  min-inline-size: 0;
}

.ad-slot-leaderboard {
  min-block-size: 96px;
  inline-size: 100%;
}

.ad-slot-sidebar {
  min-block-size: 180px;
  inline-size: 100%;
  margin-block-start: 0.35rem;
}

.ad-placeholder-box {
  display: flex;
  flex-direction: column;
  align-items: safe center;
  justify-content: center;
  gap: 0.25rem;
}

.ad-badge-tag {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.ad-placeholder-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #e2e8f0;
}

.ad-placeholder-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ad-placeholder-meta code {
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ==========================================================================
   FOOTER: LEYENDA DEL TERMÓMETRO Y NIVEL DE PIQUIÑA
   ========================================================================== */
.site-footer {
  background: rgba(7, 10, 18, 0.96);
  border-block-start: 1px solid rgba(56, 189, 248, 0.22);
  padding: 1.5rem 1.25rem 2.25rem;
  margin-block-start: 0.75rem;
}

.footer-inner {
  max-inline-size: 1440px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.footer-header h2 {
  font-size: clamp(1rem, 0.9rem + 0.4vw, 1.2rem);
  color: #f8fafc;
  margin-block-end: 0.35rem;
}

.footer-header p {
  font-size: 0.84rem;
  color: var(--text-muted);
  max-inline-size: 95ch;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.legend-card {
  background: rgba(15, 22, 38, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 0.85rem;
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.legend-card h3 {
  font-size: 0.9rem;
  color: #38bdf8;
  border-block-end: 1px solid rgba(148, 163, 184, 0.14);
  padding-block-end: 0.4rem;
}

.legend-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.8rem;
  color: #cbd5e1;
}

.legend-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  line-height: 1.4;
}

.legend-dot {
  inline-size: 12px;
  block-size: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-block-start: 0.22rem;
}

.dot-green {
  background: #10b981;
  filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.6));
}

.dot-amber {
  background: #f59e0b;
  filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.6));
}

.dot-red {
  background: #ef4444;
  filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.7));
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVENESS
   ========================================================================== */
@media (max-width: 960px) {
  .app-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "sidebar"
      "main";
    padding: 0.6rem 0.75rem;
    gap: 0.8rem;
  }

  .leaders-sidebar {
    position: static;
    padding: 0.6rem 0.7rem;
  }

  .sidebar-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: safe center;
    padding-block-end: 0.35rem;
  }

  .leader-menu {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    max-block-size: none;
    padding-block-end: 0.25rem;
    gap: 0.5rem;
  }

  .leader-card {
    flex: 0 0 210px;
    padding: 0.5rem 0.6rem;
  }

  .ad-slot-sidebar {
    display: none;
  }

  .lower-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .top-bar {
    padding: 0.6rem 0.75rem;
  }

  .search-command-bar {
    inline-size: 100%;
    padding: 0.5rem;
  }

  .search-form {
    inline-size: 100%;
  }

  .btn-scan,
  .btn-refresh {
    inline-size: 100%;
  }

  .cluster-bezel {
    padding: 0.75rem 0.6rem;
    border-radius: 1.15rem;
  }

  .warning-light {
    font-size: 0.66rem;
    padding: 0.2rem 0.45rem;
  }
}
