@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;500;700;800&display=swap');

:root {
  --bg-primary: #070913;
  --bg-secondary: rgba(15, 21, 39, 0.55);
  --bg-card-hover: rgba(22, 31, 58, 0.7);
  --border-color: rgba(255, 255, 255, 0.07);
  --border-active: rgba(96, 165, 250, 0.3);
  
  --color-green: #00ff87;
  --color-green-glow: rgba(0, 255, 135, 0.25);
  --color-red: #ff3366;
  --color-red-glow: rgba(255, 51, 102, 0.25);
  --color-neutral: #94a3b8;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-display: 'Outfit', sans-serif;
  --font-sans: 'Inter', sans-serif;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-primary);
}

body {
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Subtle tech ambient glow */
body::before {
  content: "";
  position: absolute;
  top: 15%;
  left: 10%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(40px);
}

body::after {
  content: "";
  position: absolute;
  bottom: 10%;
  right: 5%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(0, 255, 135, 0.08) 0%, rgba(0, 0, 0, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(50px);
}

/* App Layout */
.app-container {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  flex-grow: 1;
  position: relative;
  z-index: 1;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
  position: relative;
  z-index: 100;
}

/* Desktop Navigation Menu */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.header-nav-link:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.header-nav-link.link-x {
  padding: 0.45rem 0.55rem;
  justify-content: center;
}

.header-nav-link.link-x svg {
  width: 14px;
  height: 14px;
}

.header-nav-link.link-x:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

.header-nav-link.link-cafe {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.05);
}

.header-nav-link.link-cafe:hover {
  background: rgba(251, 191, 36, 0.16);
  border-color: rgba(251, 191, 36, 0.45);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.2);
}

/* Hamburger Button */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  transition: var(--transition-smooth);
  z-index: 110;
}

.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.hamburger-line {
  display: block;
  width: 19px;
  height: 2px;
  background-color: #ffffff;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Mobile Nav Drawer & Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 16, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.open {
  display: block;
  opacity: 1;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: -300px;
  width: 275px;
  height: 100vh;
  background: rgba(15, 21, 39, 0.98);
  border-left: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.6);
  z-index: 999;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.mobile-nav-drawer.open {
  right: 0;
}

.mobile-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.2rem;
}

.mobile-nav-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.btn-close-menu {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-close-menu:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition-smooth);
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.mobile-nav-item.link-x {
  color: #e2e8f0;
}

.mobile-nav-item.link-x:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.mobile-nav-item.link-cafe {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.2);
  background: rgba(251, 191, 36, 0.04);
}

.mobile-nav-item.link-cafe:hover {
  background: rgba(251, 191, 36, 0.14);
  color: #fde047;
}



/* Breaking News Ticker */
.news-ticker {
  display: flex;
  align-items: center;
  width: 100%;
  height: 42px;
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.18) 0%, rgba(15, 21, 39, 0.88) 18%, rgba(15, 21, 39, 0.88) 100%);
  border: 1px solid rgba(239, 68, 68, 0.32);
  border-left: 4px solid #ef4444;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ticker-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: #ffffff;
  padding: 0 0.9rem;
  height: 100%;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 3px 0 12px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.ticker-badge-dot {
  width: 7px;
  height: 7px;
  background: #ffffff;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #ffffff;
  animation: ticker-pulse 1.3s ease-in-out infinite;
}

@keyframes ticker-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.75); }
}

.ticker-track-wrapper {
  display: flex;
  align-items: center;
  overflow: hidden;
  flex-grow: 1;
  height: 100%;
  position: relative;
  mask-image: linear-gradient(90deg, transparent 0%, black 15px, black calc(100% - 15px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 15px, black calc(100% - 15px), transparent 100%);
}

.ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  animation: ticker-scroll 110s linear infinite;
  will-change: transform;
}

.news-ticker:hover .ticker-track {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 1.25rem;
  font-size: 0.82rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.ticker-item strong {
  font-weight: 600;
  color: #ffffff;
}

.ticker-icon {
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.ticker-separator {
  color: rgba(255, 255, 255, 0.2);
  margin: 0 0.35rem;
  font-size: 0.75rem;
  user-select: none;
}

.ticker-tag-up {
  color: #ff4d6d;
  font-weight: 700;
  background: rgba(255, 77, 109, 0.15);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.76rem;
  border: 1px solid rgba(255, 77, 109, 0.25);
}

.ticker-tag-down {
  color: #00ff87;
  font-weight: 700;
  background: rgba(0, 255, 135, 0.15);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.76rem;
  border: 1px solid rgba(0, 255, 135, 0.25);
}

.ticker-tag-neutral {
  color: #94a3b8;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.12);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.76rem;
}

@media (max-width: 640px) {
  .news-ticker {
    height: 38px;
    border-radius: 6px;
  }
  .ticker-badge {
    padding: 0 0.55rem;
  }
  .ticker-badge-text {
    display: none;
  }
  .ticker-item {
    font-size: 0.76rem;
    padding: 0 0.85rem;
  }
}

.logo-container {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
  position: relative;
}

@media (min-width: 861px) {
  .logo-container {
    padding-right: 1.5rem;
  }

  .logo-container::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 36px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.02) 100%);
  }
}

.logo-container:hover {
  opacity: 0.9;
  transform: translateY(-0.5px);
}

.logo-img {
  width: 38px;
  height: 38px;
  min-width: 38px;
  flex-shrink: 0;
  display: block;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.3));
}

.logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  justify-content: center;
}

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0;
  padding: 0;
  text-align: left;
  background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1;
  margin: 0.2rem 0 0 0;
  padding: 0;
  text-align: left;
}

@media (max-width: 860px) {
  .header-nav {
    display: none !important;
  }

  header {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-bottom: 0.75rem !important;
    margin-bottom: 0.25rem !important;
    width: 100% !important;
  }

  .logo-container {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    gap: 0.55rem !important;
    margin: 0 !important;
    padding: 0 !important;
    text-decoration: none !important;
  }

  .logo-container::after {
    display: none !important;
  }

  .logo-img {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    flex-shrink: 0 !important;
    display: block !important;
    margin: 0 !important;
  }

  .logo-text {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .logo-text h1 {
    font-size: 1.15rem !important;
    line-height: 1.1 !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    white-space: nowrap !important;
  }

  .logo-text p {
    font-size: 0.6rem !important;
    line-height: 1 !important;
    letter-spacing: 0.08em !important;
    margin: 0.15rem 0 0 0 !important;
    padding: 0 !important;
    text-align: left !important;
    white-space: nowrap !important;
  }

  .hamburger-btn {
    display: flex !important;
    width: 38px !important;
    height: 38px !important;
    gap: 4.5px !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
  }

  .hamburger-line {
    width: 18px !important;
    height: 2px !important;
  }
}

/* Install Button */
.btn-install {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-install:hover {
  background: rgba(56, 189, 248, 0.2);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
  transform: translateY(-1px);
}

.btn-install svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Main Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.9fr;
  gap: 2rem;
  align-items: stretch;
}

/* Glassmorphic Cards */
.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 2.25rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}

.panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
}

/* Left Panel - Current Value */
.current-value-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.current-value-panel .panel-header,
.text-center {
  text-align: center;
}

.panel-header {
  margin-bottom: 1.5rem;
}

.panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--text-secondary);
}

.risk-number-container {
  margin: 1.25rem 0;
  text-align: center;
}

.status-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
}

.risk-number {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #ffffff;
  position: relative;
  display: inline-block;
  text-align: center;
}

.risk-number.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 10%;
  transform: translateX(-50%);
  width: 120px;
  height: 4.5rem;
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 12px;
}

/* Variation Status */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  transition: var(--transition-smooth);
}

.status-badge.up {
  color: var(--color-red);
  background: rgba(255, 51, 102, 0.08);
  border: 1px solid rgba(255, 51, 102, 0.2);
  box-shadow: 0 0 15px rgba(255, 51, 102, 0.05);
}

.status-badge.down {
  color: var(--color-green);
  background: rgba(0, 255, 135, 0.08);
  border: 1px solid rgba(0, 255, 135, 0.2);
  box-shadow: 0 0 15px rgba(0, 255, 135, 0.05);
}

.status-badge.equal {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-badge svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Metadata / Details */
.meta-section {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.meta-label {
  color: var(--text-muted);
}

.meta-value {
  font-weight: 500;
  color: var(--text-primary);
}

/* Right Panel - Chart */
.chart-panel {
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Right side of chart header: tabs + fullscreen button */
.chart-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Fullscreen icon button */
.btn-fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.btn-fullscreen:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.btn-fullscreen:active {
  transform: scale(0.92);
}

/* ---- Fullscreen state: usamos position:fixed para no afectar el grid ---- */
/* El backdrop cubre la página detrás del gráfico */
.chart-fs-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--bg-primary);
}

.chart-fs-backdrop.active {
  display: block;
}

/* El panel se pone encima de todo, ocupando la pantalla completa */
.chart-panel.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
  border: none;
  padding: 1.75rem 2rem 1.5rem;
  overflow: hidden;
  /* Mantener layout flex para que el chart-wrapper pueda crecer */
  display: flex;
  flex-direction: column;
}

.chart-panel.is-fullscreen .chart-wrapper {
  flex-grow: 1;
  min-height: 0;
}

/* Tab Selector */
.chart-tabs {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  border-radius: 9999px;
  display: flex;
  position: relative;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 9999px;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-sans);
  position: relative;
  z-index: 2;
}

.tab-btn:hover {
  color: #ffffff;
}

.tab-btn.active {
  color: #ffffff;
  font-weight: 600;
  background: #1e293b;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chart-wrapper {
  position: relative;
  flex-grow: 1;
  min-height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Loading Spinner & Shimmer */
.chart-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(56, 189, 248, 0.1);
  border-radius: 50%;
  border-top-color: #38bdf8;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.1);
}

/* Bottom info banner */
footer {
  margin-top: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1.75rem 0 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  width: 100%;
}

.footer-copy {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Shimmer Animation */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive Styles */
@media (max-width: 968px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .current-value-panel {
    min-height: auto;
  }
}

@media (max-width: 576px) {
  .app-container {
    padding: 1.5rem 1rem;
    gap: 1.5rem;
  }
  
  .panel {
    padding: 1.5rem;
  }
  
  .risk-number {
    font-size: 4rem;
  }
  
  .chart-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
  }

  .chart-controls {
    width: 100%;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
  }
  
  .chart-tabs {
    flex: 1;
    width: auto;
    justify-content: space-between;
    padding: 0.2rem;
    box-sizing: border-box;
  }
  
  .tab-btn {
    flex: 1;
    padding: 0.45rem 0.25rem;
    font-size: 0.75rem;
    text-align: center;
    white-space: nowrap;
    min-width: 0;
  }

  /* Mobile ranking table optimizations */
  .ranking-table {
    font-size: 0.8rem;
  }

  .ranking-table th,
  .ranking-table td {
    padding: 0.5rem 0.25rem;
  }

  .col-rank-head,
  .col-rank {
    width: 38px;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
  }

  .col-country-head,
  .col-country {
    padding-left: 0.2rem;
    padding-right: 0.2rem;
  }

  .col-value-head,
  .col-value {
    width: 65px;
    padding-left: 0.15rem;
    padding-right: 0.2rem;
  }

  .col-delta-head,
  .col-delta {
    width: 50px;
    padding-left: 0.15rem;
    padding-right: 0.25rem;
  }

  .country-cell {
    gap: 0.35rem;
    white-space: nowrap;
  }

  .country-cell img {
    margin-right: 0.35rem !important;
    width: 20px !important;
    height: 15px !important;
  }

  .country-name-full {
    display: none !important;
  }

  .country-name-short {
    display: inline !important;
    font-weight: 600;
  }
  
  header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
  }
  
  .logo-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
  }

  .current-value-panel {
    align-items: center;
    text-align: center;
  }

  .panel-header {
    text-align: center;
    width: 100%;
  }

  .meta-section {
    align-items: center;
    width: 100%;
  }

  .meta-row {
    width: 100%;
    justify-content: center;
    gap: 0.5rem;
  }

  .btn-nav {
    width: auto;
    padding: 0.65rem 2rem;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  /* Centrado para la sección de búsqueda/consulta */
  .search-panel {
    align-items: center;
    text-align: center;
  }

  .search-panel .panel-header {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100%;
    gap: 1rem !important;
  }

  .search-panel .panel-title {
    margin: 0 auto !important;
  }

  .btn-back {
    margin: 0 auto !important;
  }

  .search-inputs {
    justify-content: center !important;
    width: 100%;
  }

  .date-group {
    align-items: center !important;
    width: 100%;
  }

  .input-date {
    text-align: center !important;
    width: 100% !important;
    max-width: 280px;
  }

  .search-table {
    text-align: center !important;
  }

  .search-table th {
    text-align: center !important;
  }
}


.dashboard-left-col {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.search-panel {
  display: flex;
  flex-direction: column;
}

.date-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.date-group label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-date {
  background: rgba(7, 9, 19, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition-smooth);
}

.input-date:focus {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

/* Scrollable Table styles */
.table-wrapper {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: #070913; /* Solid background, no transparency */
}

/* Custom Scrollbar for the table wrapper */
.table-wrapper::-webkit-scrollbar {
  width: 6px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.search-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.825rem;
}

.search-table th, .search-table td {
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.search-table th {
  background: #0f172a; /* Solid slate-blue header, no transparency */
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 10;
}

.search-table td {
  background: #070913; /* Solid row backgrounds */
}

.search-table tr:nth-child(even) td {
  background: #0d1226; /* Solid alternate row backgrounds */
}

.search-table tr:last-child td {
  border-bottom: none;
}

.table-placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0 !important;
}

.val-up {
  color: var(--color-red);
  font-weight: 500;
}

.val-down {
  color: var(--color-green);
  font-weight: 500;
}

.val-equal {
  color: var(--text-muted);
}

/* America Ranking Specific Panel Styles */
.america-panel {
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
  padding: 0.65rem 1rem 0.5rem;
}

.ranking-table th, 
.ranking-table td {
  padding: 0.32rem 0.75rem;
}

.ranking-meta-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.35rem;
  padding-top: 0.25rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Navigation Buttons */
.btn-nav {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  padding: 0.65rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 100%;
  margin-top: 1.5rem;
  text-align: center;
  box-sizing: border-box;
}

.btn-nav:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
  transform: translateY(-1px);
}

.btn-nav svg {
  width: 16px;
  height: 16px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition-smooth);
  margin-bottom: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
}

.btn-back:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-back svg {
  width: 16px;
  height: 16px;
}

/* Footer Links & Icons (Glow Action Badges) */
.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  margin-top: 0.5rem;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.footer-link.link-x:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.footer-link.link-cafe:hover {
  background: rgba(244, 164, 96, 0.08);
  border-color: rgba(244, 164, 96, 0.45);
  color: #f4a460;
  box-shadow: 0 0 15px rgba(244, 164, 96, 0.15);
  transform: translateY(-2px);
}

.footer-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Flatpickr Custom Dark Theme overrides */
.flatpickr-calendar {
  background: #0f172a !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
  font-family: var(--font-sans) !important;
}

.flatpickr-day.selected, 
.flatpickr-day.startRange, 
.flatpickr-day.endRange, 
.flatpickr-day.selected.inRange, 
.flatpickr-day.startRange.inRange, 
.flatpickr-day.endRange.inRange, 
.flatpickr-day.selected:focus, 
.flatpickr-day.startRange:focus, 
.flatpickr-day.endRange:focus, 
.flatpickr-day.selected:hover, 
.flatpickr-day.startRange:hover, 
.flatpickr-day.endRange:hover, 
.flatpickr-day.prevMonthDay.selected, 
.flatpickr-day.nextMonthDay.selected {
  background: #38bdf8 !important;
  border-color: #38bdf8 !important;
  color: #020617 !important;
  font-weight: 600;
}

.flatpickr-day.today {
  border-color: rgba(56, 189, 248, 0.4) !important;
}

.flatpickr-day.today:hover {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #ffffff !important;
}

.flatpickr-months .flatpickr-month {
  color: #ffffff !important;
}

.flatpickr-current-month .numInputWrapper span.arrowUp:after {
  border-bottom-color: #ffffff !important;
}

.flatpickr-current-month .numInputWrapper span.arrowDown:after {
  border-top-color: #ffffff !important;
}

.flatpickr-calendar.arrowTop:before {
  border-bottom-color: var(--border-color) !important;
}

.flatpickr-calendar.arrowTop:after {
  border-bottom-color: #0f172a !important;
}

.flatpickr-day {
  color: var(--text-primary) !important;
}

.flatpickr-day.flatpickr-disabled, 
.flatpickr-day.flatpickr-disabled:hover {
  color: rgba(255, 255, 255, 0.15) !important;
}

.flatpickr-weekday {
  color: var(--text-secondary) !important;
}

/* Install PWA Modal */
.install-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 9, 19, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  padding: 1.5rem;
}

.install-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.install-modal-card {
  background: #0f1527;
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  max-width: 450px;
  width: 100%;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.install-modal-overlay.active .install-modal-card {
  transform: translateY(0);
}

.install-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.install-modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.install-modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.install-modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.75rem;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.install-modal-title h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.install-modal-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.install-instructions {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.instruction-step {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.step-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.step-text strong {
  color: var(--text-primary);
}

.btn-modal-action {
  width: 100%;
  background: #38bdf8;
  border: none;
  color: #070913;
  padding: 0.75rem;
  border-radius: 0.75rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-align: center;
}

.btn-modal-action:hover {
  background: #7dd3fc;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}
/* FAQ Accordion Styles */
.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.faq-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.faq-item.active {
  border-color: var(--border-active);
}

.faq-question-btn {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 1.25rem 1.5rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  outline: none;
}

.faq-question-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  transition: transform 0.3s ease;
  flex-shrink: 0;
  margin-left: 1rem;
}

.faq-item.active .faq-question-btn svg {
  transform: rotate(180deg);
}

.faq-answer-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.faq-answer-content {
  padding: 1.25rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* FAQ Tier Selector Tab Bar */
.faq-tabs {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 0.2rem;
  border-radius: 9999px;
  align-self: flex-start;
  margin-bottom: 0.5rem;
}

.faq-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-sans);
}

.faq-tab-btn:hover {
  color: #ffffff;
}

.faq-tab-btn.active {
  color: #ffffff;
  background: #1e293b;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Response levels styling */
.faq-level-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  animation: fadeInFaq 0.2s ease-in-out;
  text-align: left;
}

.faq-level-text strong {
  color: var(--text-primary);
}

@keyframes fadeInFaq {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 576px) {
  .faq-tabs {
    width: 100%;
    justify-content: space-around;
    align-self: center;
  }
  
  .faq-tab-btn {
    flex-grow: 1;
    text-align: center;
  }
  
  .faq-question-btn {
    font-size: 1rem;
    padding: 1.1rem 1rem;
  }
  
  .faq-answer-content {
    padding: 1rem;
  }
  
  .faq-level-text {
    font-size: 0.9rem;
    text-align: center; /* centrado en celular */
  }
}

/* Header link to FAQ */
.faq-header-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition-smooth);
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.05);
  color: #38bdf8;
  padding: 0.45rem 1rem;
  border-radius: 9999px;
}

.faq-header-link:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
  transform: translateY(-0.5px);
}

/* Highlight Argentina row in America ranking */
tr.highlight-row {
  background: rgba(56, 189, 248, 0.08) !important;
  border-left: 4px solid #38bdf8;
}

tr.highlight-row td {
  color: #38bdf8 !important;
}


/* =====================================================
   Ranking table (Riesgo País en América)
   ===================================================== */
.ranking-table {
  font-size: 0.9rem;
  width: 100%;
}

/* Override search-table fixed left-align for specific columns */
.ranking-table th,
.ranking-table td {
  vertical-align: middle;
  padding: 0.65rem 0.75rem;
}

/* Puesto column – centered */
.col-rank-head,
.col-rank {
  text-align: center;
  width: 60px;
  font-weight: 700;
  font-family: var(--font-display);
}

/* País column – left aligned */
.col-country-head,
.col-country {
  text-align: left;
}

/* Riesgo column – centered */
.col-value-head,
.col-value {
  text-align: center;
  width: 100px;
  font-weight: 700;
  font-family: var(--font-display);
}

/* Variación column – centered */
.col-delta-head,
.col-delta {
  text-align: center;
  width: 75px;
}

/* Country cell inner layout */
.country-cell {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.country-name-full {
  display: inline;
}

.country-name-short {
  display: none;
}

/* Override table-wrapper max-height for the ranking (show all rows) */
.ranking-table + * {
  max-height: none;
}

/* Ranking Table Footer Info & Tooltip */
.ranking-meta-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 100%;
}

.info-tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s ease;
  outline: none;
}

.info-tooltip-wrapper:hover,
.info-tooltip-wrapper:focus {
  color: #38bdf8;
}

.info-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Tooltip popup box */
.info-tooltip-wrapper .tooltip-text {
  visibility: hidden;
  opacity: 0;
  width: 240px;
  background-color: #0f172a;
  color: var(--text-primary);
  text-align: left;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  position: absolute;
  z-index: 100;
  bottom: 135%;
  right: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  font-weight: 400;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  transform: translateY(4px);
  pointer-events: none;
}

/* Arrow on bottom right of tooltip */
.info-tooltip-wrapper .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 4px;
  border-width: 5px;
  border-style: solid;
  border-color: #0f172a transparent transparent transparent;
}

.info-tooltip-wrapper:hover .tooltip-text,
.info-tooltip-wrapper:focus .tooltip-text {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

/* ==================================================== */
/* Semáforo / Termómetro de Zonas de Financiamiento     */
/* ==================================================== */
.credit-zone-card {
  background: rgba(15, 21, 39, 0.65);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
}

.credit-zone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.credit-zone-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.credit-zone-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-yellow {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-orange {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.gauge-track-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.gauge-track {
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  position: relative;
  overflow: visible;
  padding: 0;
}

.gauge-seg {
  height: 100%;
  flex: 1;
  transition: opacity 0.3s ease;
}

.gauge-seg:first-child {
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
}

.gauge-seg:last-child {
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}

.seg-green { background: linear-gradient(90deg, #059669, #10b981); }
.seg-yellow { background: linear-gradient(90deg, #d97706, #f59e0b); }
.seg-orange { background: linear-gradient(90deg, #ea580c, #f97316); }
.seg-red { background: linear-gradient(90deg, #dc2626, #ef4444); }

.gauge-indicator {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 0 4px rgba(0, 0, 0, 0.8);
  border: 3px solid #0f172a;
  transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 5;
  pointer-events: none;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 2px;
}

.credit-zone-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin: 0;
}

/* ==================================================== */
/* Botones de Compartir en Redes                        */
/* ==================================================== */
.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.btn-share-x:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-share-wa {
  color: #25d366;
  border-color: rgba(37, 211, 102, 0.2);
}

.btn-share-wa:hover {
  background: rgba(37, 211, 102, 0.1);
  border-color: rgba(37, 211, 102, 0.35);
  transform: translateY(-1px);
}

/* ==================================================== */
/* Panel de Mandatos Presidenciales                    */
/* ==================================================== */
.presidents-panel {
  margin-top: 1rem;
  width: 100%;
}

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

.president-card {
  background: rgba(15, 21, 39, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.president-card:hover {
  background: rgba(22, 31, 58, 0.7);
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.president-card.current {
  border-color: rgba(56, 189, 248, 0.35);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08) 0%, rgba(15, 21, 39, 0.7) 100%);
}

.president-card-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.pres-status-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.president-card-main {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin: 0.2rem 0;
}

.president-avatar {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
  background: #0f172a;
}

.president-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.president-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.1rem;
  line-height: 1.2;
}

.president-period {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pres-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}

.pres-badge-down {
  background: rgba(0, 255, 135, 0.15);
  color: #00ff87;
  border: 1px solid rgba(0, 255, 135, 0.25);
}

.pres-badge-up {
  background: rgba(255, 51, 102, 0.15);
  color: #ff3366;
  border: 1px solid rgba(255, 51, 102, 0.25);
}

.president-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}

.pres-metric {
  display: flex;
  flex-direction: column;
}

.pres-metric-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.pres-metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f1f5f9;
  font-family: var(--font-display);
}

.pres-range-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.5rem;
}

.pres-range-row span strong {
  color: #ffffff;
}

/* ==================================================== */
/* Subpágina de Presidentes - Vista Detallada Interactiva */
/* ==================================================== */
.president-card {
  cursor: pointer;
}

.president-card:hover {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 10px 28px rgba(56, 189, 248, 0.18);
}

.president-card-hint {
  font-size: 0.72rem;
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  margin-top: -0.2rem;
  font-weight: 600;
  opacity: 0.85;
}

.presidents-split-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 1.5rem;
  align-items: stretch;
  width: 100%;
  animation: fadeIn 0.35s ease;
}

.presidents-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(15, 21, 39, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 0.85rem;
  backdrop-filter: blur(12px);
  height: 100%;
  box-sizing: border-box;
}

#sidebarPresidentsList {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  gap: 0.35rem;
}

.btn-back-to-grid {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 0.4rem;
  transition: var(--transition-smooth);
  width: 100%;
  justify-content: center;
}

.btn-back-to-grid:hover {
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
}

.sidebar-pres-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.sidebar-pres-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-pres-item.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(15, 21, 39, 0.8) 100%);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.15);
}

.sidebar-pres-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  border: 2px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  background: #0f172a;
}

.sidebar-pres-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.sidebar-pres-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-pres-period {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Detail Panel */
.president-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: rgba(15, 21, 39, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(12px);
}

.detail-header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.detail-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.detail-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  border: 3px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  background: #0f172a;
}

.detail-name-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.2rem;
}

.detail-chart-wrapper {
  position: relative;
  width: 100%;
  height: 380px;
}

@media (max-width: 768px) {
  .presidents-split-layout {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    width: 100%;
    max-width: 100%;
  }

  .presidents-sidebar {
    flex-direction: column;
    padding: 0.75rem 0.5rem;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
  }

  .btn-back-to-grid {
    width: 100%;
    margin-bottom: 0.25rem;
    padding: 0.55rem;
    font-size: 0.85rem;
    box-sizing: border-box;
  }

  #sidebarPresidentsList {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 0.6rem 0.25rem;
    justify-items: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
  }

  .sidebar-pres-item {
    width: auto;
    padding: 0.15rem;
    background: transparent;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    box-shadow: none;
  }

  .sidebar-pres-item.active {
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .sidebar-pres-avatar {
    width: 48px;
    height: 48px;
    border-width: 2px;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  }

  .sidebar-pres-item.active .sidebar-pres-avatar {
    border-color: #38bdf8;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.7);
    transform: scale(1.12);
  }

  .sidebar-pres-info,
  .sidebar-pres-badge {
    display: none !important;
  }

  .president-detail-panel {
    padding: 1rem 0.75rem;
    gap: 0.85rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .detail-header-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
  }

  .detail-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
  }

  .detail-header-right {
    width: 100% !important;
    align-items: flex-start !important;
    gap: 0.35rem;
  }

  .detail-avatar-lg {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
  }

  .detail-name-title {
    font-size: 1.15rem;
  }

  .detail-chart-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 250px;
    overflow: hidden;
    box-sizing: border-box;
  }
}

/* ==================================================== */
/* Timeline Section (Viaje en el Tiempo / Hitos)        */
/* ==================================================== */
.timeline-hero-panel {
  padding: 0.85rem 1.25rem 0.65rem;
  margin-bottom: 0.75rem;
  width: 100%;
}

.timeline-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.65rem;
}

.timeline-filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.timeline-filter-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.timeline-filter-btn.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.timeline-section {
  width: 100%;
  position: relative;
  max-height: calc(100vh - 270px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 1rem 2rem;
  box-sizing: border-box;
  margin-bottom: 0.5rem;
  scroll-behavior: smooth;
}

/* Custom sleek scrollbar for timeline */
.timeline-section::-webkit-scrollbar {
  width: 6px;
}

.timeline-section::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 99px;
}

.timeline-section::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 99px;
}

.timeline-section::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.6);
}

.timeline-container {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: 0.5rem 0 1.5rem;
}

.timeline-container::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.1) 0%, rgba(56, 189, 248, 0.4) 15%, rgba(56, 189, 248, 0.4) 85%, rgba(56, 189, 248, 0.1) 100%);
  transform: translateX(-50%);
  z-index: 1;
}

.timeline-item {
  position: relative;
  width: 50%;
  padding: 0.75rem 2rem;
  box-sizing: border-box;
  z-index: 2;
  animation: fadeIn 0.35s ease;
}

.timeline-left {
  left: 0;
  text-align: right;
}

.timeline-right {
  left: 50%;
  text-align: left;
}

.timeline-dot {
  position: absolute;
  top: 1.5rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  z-index: 5;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.15);
  border-color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
}

.timeline-left .timeline-dot {
  right: -19px;
}

.timeline-right .timeline-dot {
  left: -19px;
}

.timeline-card {
  background: rgba(15, 21, 39, 0.65);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  backdrop-filter: blur(12px);
  text-align: left;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.timeline-card:hover {
  background: rgba(22, 31, 58, 0.8);
  border-color: rgba(56, 189, 248, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45);
}

.timeline-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.timeline-date-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.timeline-date {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.timeline-risk-val {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  white-space: nowrap;
}

.timeline-badge-neutral {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.timeline-badge-success {
  background: rgba(0, 255, 135, 0.14);
  color: #00ff87;
  border: 1px solid rgba(0, 255, 135, 0.3);
}

.timeline-badge-warning {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.timeline-badge-danger {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.timeline-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0.2rem 0 0.4rem 0;
  line-height: 1.3;
}

.timeline-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0 0 0.6rem 0;
}

.timeline-stat-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.74rem;
}

.timeline-stat-lbl {
  color: var(--text-muted);
  font-weight: 500;
}

.timeline-stat-val {
  color: #ffffff;
  font-weight: 700;
}

@media (max-width: 768px) {
  .timeline-container::before {
    left: 20px;
  }

  .timeline-item {
    width: 100%;
    padding-left: 55px;
    padding-right: 0.5rem;
  }

  .timeline-left,
  .timeline-right {
    left: 0;
    text-align: left;
  }

  .timeline-left .timeline-dot,
  .timeline-right .timeline-dot {
    left: 1px;
    right: auto;
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  .timeline-filters-bar {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.4rem;
  }

  .timeline-section {
    max-height: calc(100vh - 240px);
    padding: 0.25rem 0.5rem 1.5rem;
  }

  .timeline-filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* =========================================================
   America Page: Vertical Layout, Side Time Nav & Chart Below
   ========================================================= */

.america-vertical-container {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  width: 100%;
}

.ranking-stage-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1.25rem;
  width: 100%;
  position: relative;
}

/* Barra de viaje en el tiempo móvil (oculta por defecto en PC) */
.time-nav-mobile-bar {
  display: none;
}

/* Paneles laterales en PC Desktop */
.time-nav-side {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: sticky;
  top: 100px;
  padding: 0.85rem 0.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  z-index: 10;
  min-width: 105px;
}

.time-nav-side-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: center;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-color);
}

.btn-side-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
  white-space: nowrap;
}

.btn-side-nav:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.2);
}

.btn-side-nav:disabled {
  opacity: 0.22;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-side-today {
  background: rgba(0, 255, 135, 0.12);
  border-color: rgba(0, 255, 135, 0.35);
  color: #00ff87;
}

.btn-side-today:hover:not(:disabled) {
  background: rgba(0, 255, 135, 0.22);
  border-color: rgba(0, 255, 135, 0.55);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(0, 255, 135, 0.3);
}

.america-panel-card {
  flex: 1;
  max-width: 820px;
  width: 100%;
  margin: 0;
  padding: 1.15rem 1.6rem 0.85rem;
}

.ranking-header-prominent {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.ranking-header-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.ranking-main-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
  margin: 0;
}

.ranking-prominent-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.95rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(56, 189, 248, 0.05) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.ranking-prominent-date-badge.is-historical {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.08) 100%);
  border-color: rgba(251, 191, 36, 0.5);
  color: #fde047;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.22);
}

.date-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #00ff87;
  box-shadow: 0 0 8px #00ff87;
  flex-shrink: 0;
}

.ranking-prominent-date-badge.is-historical .date-badge-dot {
  background-color: #fbbf24;
  box-shadow: 0 0 8px #fbbf24;
}

@media (max-width: 960px) {
  .ranking-stage-layout {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  /* En Mobile ocultamos los paneles laterales verticales de PC */
  .time-nav-side {
    display: none !important;
  }

  /* En Mobile mostramos la barra horizontal unificada con 3 botones amplios y cómodos */
  .time-nav-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background: rgba(13, 19, 38, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.4rem 0.5rem;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  }

  .time-nav-mobile-bar .btn-side-nav {
    flex: 1;
    max-width: 130px;
    padding: 0.42rem 0.6rem;
    font-size: 0.78rem;
    border-radius: 10px;
    gap: 0.35rem;
    justify-content: center;
  }

  .ranking-header-prominent {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .ranking-header-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
  }

  .ranking-main-title {
    font-size: 1.02rem;
    line-height: 1.25;
  }

  .ranking-header-right-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.45rem;
  }

  .btn-race-trigger {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 0.76rem;
    padding: 0.38rem 0.6rem;
  }

  .ranking-prominent-date-badge {
    flex-shrink: 0;
    font-size: 0.76rem;
    padding: 0.3rem 0.65rem;
  }
}


/* FLIP sliding animation for ranking rows */
.ranking-table tbody tr {
  position: relative;
  will-change: transform;
  transition: background-color 0.3s ease;
}

.ranking-table tbody tr.row-sliding {
  transition: transform 0.45s cubic-bezier(0.2, 0, 0.2, 1), background-color 0.3s ease !important;
}

/* Large Full-Width Historical Chart Panel */
.america-chart-panel {
  display: flex;
  flex-direction: column;
  padding: 1.75rem 2rem 1.5rem;
  min-height: 620px;
}

.america-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.america-chart-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
}

.america-chart-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.scale-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.scale-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.scale-toggle-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

/* Presets Bar */
.chart-presets-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.chart-presets-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.2rem;
}

.btn-preset {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
}

.btn-preset:hover {
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

/* Country Filter Chips */
.country-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.country-chips-container::-webkit-scrollbar {
  width: 4px;
}

.country-chips-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.country-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
  opacity: 0.55;
}

.country-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  opacity: 0.85;
}

.country-chip.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--chip-color, #38bdf8);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.chip-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--chip-color, #38bdf8);
  flex-shrink: 0;
  box-shadow: 0 0 6px var(--chip-color, #38bdf8);
}

.country-chip:not(.active) .chip-color-dot {
  opacity: 0.4;
  box-shadow: none;
}

.america-chart-wrapper {
  position: relative;
  width: 100%;
  flex-grow: 1;
  min-height: 440px;
  height: 440px;
}

@media (max-width: 768px) {
  .america-panel-card {
    padding: 1.25rem 1rem 1rem;
  }

  .america-chart-panel {
    padding: 1.25rem 1rem;
    min-height: 480px;
  }

  .america-chart-wrapper {
    height: 320px;
    min-height: 320px;
  }

  .ranking-time-controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .time-nav-btn-group {
    justify-content: center;
  }
}

.ranking-header-right-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ---- Fullscreen States for America Page ---- */
.ranking-stage-layout.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  background: var(--bg-primary) !important;
  padding: 1.5rem 2rem !important;
  overflow-y: auto !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}

.ranking-stage-layout.is-fullscreen .america-panel-card {
  max-width: 860px !important;
  box-shadow: 0 12px 45px rgba(0, 0, 0, 0.65) !important;
  background: #0b1022 !important;
}

.ranking-stage-layout.is-fullscreen .time-nav-side {
  position: sticky !important;
  top: 1.5rem !important;
  background: #0e152e !important;
}

.america-chart-panel.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  border-radius: 0 !important;
  border: none !important;
  padding: 1.75rem 2.5rem 1.5rem !important;
  background: var(--bg-primary) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
}

.america-chart-panel.is-fullscreen .america-chart-wrapper {
  flex-grow: 1 !important;
  min-height: 480px !important;
  height: 100% !important;
}

/* =========================================================
   Bar Chart Race: Carrera Histórica Animada (2007 - Presente)
   ========================================================= */

.btn-race-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.85rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.18) 0%, rgba(168, 85, 247, 0.18) 100%);
  border: 1px solid rgba(236, 72, 153, 0.4);
  color: #f472b6;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.2);
  white-space: nowrap;
}

.btn-race-trigger:hover {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
  color: #ffffff;
  border-color: rgba(236, 72, 153, 0.6);
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.35);
  transform: translateY(-1px);
}

/* Bloquear scroll del documento y ocultar barras de scroll cuando la animación esté activa */
html.race-modal-open,
body.race-modal-open {
  overflow: hidden !important;
  height: 100vh !important;
  max-height: 100vh !important;
}

.race-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  z-index: 10000;
  background: radial-gradient(circle at 50% 20%, #0d1532 0%, #060914 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
  box-sizing: border-box;
  user-select: none;
}

.race-giant-watermark-bg {
  position: absolute;
  right: 4vw;
  bottom: 8vh;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  line-height: 0.82;
  z-index: 1;
  user-select: none;
}

.race-giant-day-bg {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6.5vw, 6rem);
  font-weight: 900;
  color: rgba(251, 191, 36, 0.08);
  margin-bottom: -0.05em;
  line-height: 0.82;
  letter-spacing: 0.02em;
}

.race-giant-month-bg {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 9.5vw, 8.5rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(56, 189, 248, 0.055);
  margin-bottom: -0.05em;
  line-height: 0.82;
}

.race-giant-year-bg {
  font-family: var(--font-display);
  font-size: clamp(5.5rem, 15vw, 14.5rem);
  font-weight: 900;
  color: rgba(255, 255, 255, 0.04);
  letter-spacing: -0.04em;
  line-height: 0.82;
}



.race-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem 0.8rem;
  background: rgba(11, 16, 34, 0.8);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  gap: 1rem;
  flex-wrap: wrap;
}

.race-header-title-box {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.race-header-title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.race-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.race-hidden-countries-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(15, 23, 42, 0.75);
  border: 1px dashed rgba(56, 189, 248, 0.4);
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

.race-hidden-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.race-hidden-chips-list {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.race-hidden-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.12rem 0.45rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 9999px;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
}

.race-hidden-chip:hover {
  background: rgba(56, 189, 248, 0.28);
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

.race-hidden-chip .chip-restore-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #00ff87;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.race-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.race-header-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 1.25rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18) 0%, rgba(56, 189, 248, 0.05) 100%);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}

.btn-close-race {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-close-race:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  transform: scale(1.05);
}

/* Race Main 2-Column Layout */
.race-main-layout {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  overflow: hidden;
  gap: 1.25rem;
  padding: 0.4rem 1.5rem 0.2rem;
  box-sizing: border-box;
}

/* Sidebar de Bitácora de Hitos */
.race-events-sidebar {
  width: 320px;
  min-width: 290px;
  max-width: 340px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(13, 19, 38, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  flex-shrink: 0;
}

.race-sidebar-header {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.race-sidebar-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.race-sidebar-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8;
  animation: blinkDot 1.2s infinite alternate;
}

.race-sidebar-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.race-sidebar-subtitle {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.race-events-feed {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.race-events-feed::-webkit-scrollbar {
  width: 4px;
}
.race-events-feed::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Tarjeta de Hito en la Bitácora (Estática y Clara) */
.race-event-card {
  background: rgba(18, 26, 51, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.race-event-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 14px rgba(56, 189, 248, 0.2);
}

.race-event-card:active {
  transform: scale(0.98);
}

.race-event-card.card-critical {
  border-left: 3.5px solid #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.16) 0%, rgba(18, 26, 51, 0.95) 100%);
}

.race-event-card.card-tension {
  border-left: 3.5px solid #f97316;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.14) 0%, rgba(18, 26, 51, 0.95) 100%);
}

.race-event-card.card-cooling {
  border-left: 3.5px solid #eab308;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.12) 0%, rgba(18, 26, 51, 0.95) 100%);
}

.race-event-card.card-resolved {
  border-left: 3.5px solid #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14) 0%, rgba(18, 26, 51, 0.95) 100%);
}

.race-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.race-card-country-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
}

.race-card-phase-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.race-card-phase-badge.phase-critical {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.6);
}

.race-card-phase-badge.phase-tension {
  background: rgba(249, 115, 22, 0.25);
  color: #fdba74;
  border: 1px solid rgba(249, 115, 22, 0.6);
}

.race-card-phase-badge.phase-cooling {
  background: rgba(234, 179, 8, 0.25);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.6);
}

.race-card-phase-badge.phase-resolved {
  background: rgba(16, 185, 129, 0.25);
  color: #86efac;
  border: 1px solid rgba(16, 185, 129, 0.6);
}

.race-card-title {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.25;
}

.race-card-desc {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.race-sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  gap: 0.65rem;
}

.race-sidebar-empty-icon {
  font-size: 1.8rem;
  opacity: 0.6;
}

.race-sidebar-empty-text {
  font-size: 0.76rem;
  line-height: 1.4;
}

/* Modal Pop-up de Detalle de Hito en Grande */
.event-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
  animation: fadeInModal 0.2s ease;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.event-detail-card {
  width: 100%;
  max-width: 540px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 30px rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleUpDetail 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUpDetail {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.event-detail-header {
  padding: 1.1rem 1.35rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.event-detail-country-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.event-detail-country-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

.btn-close-detail {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-close-detail:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
  color: #ef4444;
  transform: scale(1.08);
}

.event-detail-body {
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.event-detail-period {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.event-detail-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  line-height: 1.3;
}

.event-detail-desc {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.event-detail-footer {
  padding: 1rem 1.35rem;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
}

.btn-resume-race {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.35rem;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transition: var(--transition-smooth);
}

.btn-resume-race:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5);
}

@media (max-width: 1024px) {
  .race-events-sidebar {
    display: none;
  }
}

/* Arena Layout */
.race-arena-wrapper {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  overflow: hidden;
  padding: 0.2rem 1.5rem 0.2rem 0;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  min-height: 0;
  box-sizing: border-box;
}

.race-arena {
  position: relative;
  width: 100%;
  margin: 0 auto;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}

.race-lane {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  transition: transform 0.24s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.2s ease;
  will-change: transform, opacity;
}

.race-lane-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-right: 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #38bdf8;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
  padding: 0;
  z-index: 5;
  user-select: none;
}

.race-lane-toggle-btn:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(239, 68, 68, 0.65);
  color: #f87171;
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.race-bar-track {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 8px;
  overflow: visible;
  display: flex;
  align-items: center;
}

.race-bar-fill {
  height: 100%;
  border-radius: 8px;
  background: var(--lane-color, #38bdf8);
  box-shadow: 0 0 12px var(--lane-color, #38bdf8);
  transition: width 0.24s cubic-bezier(0.2, 0, 0.2, 1);
  min-width: 110px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.race-bar-inner-content {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.12rem 0.55rem;
  margin-right: 0.45rem;
  background: rgba(7, 10, 22, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  z-index: 2;
}

.race-bar-country-name {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
  letter-spacing: -0.01em;
}

.race-val-wrapper {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  pointer-events: none;
}

.race-val-label {
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.race-event-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.12rem 0.55rem;
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
  z-index: 5;
}

/* FASE 1: Crisis Crítica / Estallido (Rojo) */
.race-event-badge.state-critical {
  background: rgba(220, 38, 38, 0.3);
  border: 1px solid rgba(239, 68, 68, 0.9);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.6);
  color: #fecaca;
  animation: pulseCritical 1s infinite ease-in-out;
}
.race-event-badge.state-critical .race-event-pulse {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

/* FASE 2: Tensión / Impacto prolongado (Naranja) */
.race-event-badge.state-tension {
  background: rgba(234, 88, 12, 0.28);
  border: 1px solid rgba(249, 115, 22, 0.85);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
  color: #fed7aa;
  animation: pulseTension 1.4s infinite ease-in-out;
}
.race-event-badge.state-tension .race-event-pulse {
  background: #f97316;
  box-shadow: 0 0 8px #f97316;
}

/* FASE 3: Distensión / Enfriamiento (Amarillo) */
.race-event-badge.state-cooling {
  background: rgba(202, 138, 4, 0.25);
  border: 1px solid rgba(234, 179, 8, 0.85);
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.45);
  color: #fef08a;
  animation: pulseCooling 1.8s infinite ease-in-out;
}
.race-event-badge.state-cooling .race-event-pulse {
  background: #eab308;
  box-shadow: 0 0 6px #eab308;
}

/* FASE 4: Normalización / Resuelto (Verde) */
.race-event-badge.state-resolved {
  background: rgba(16, 185, 129, 0.24);
  border: 1px solid rgba(16, 185, 129, 0.9);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.55);
  color: #a7f3d0;
  animation: pulseResolved 2s infinite ease-in-out;
}
.race-event-badge.state-resolved .race-event-pulse {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

@keyframes pulseCritical {
  0% { transform: scale(1); box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 18px rgba(239, 68, 68, 0.9); }
  100% { transform: scale(1); box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
}

@keyframes pulseTension {
  0% { transform: scale(1); box-shadow: 0 0 6px rgba(249, 115, 22, 0.4); }
  50% { transform: scale(1.03); box-shadow: 0 0 14px rgba(249, 115, 22, 0.8); }
  100% { transform: scale(1); box-shadow: 0 0 6px rgba(249, 115, 22, 0.4); }
}

@keyframes pulseCooling {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes pulseResolved {
  0% { transform: scale(1); box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }
  50% { transform: scale(1.03); box-shadow: 0 0 14px rgba(16, 185, 129, 0.7); }
  100% { transform: scale(1); box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }
}

.race-event-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: blinkDot 0.7s infinite alternate;
}

@keyframes blinkDot {
  0% { opacity: 0.2; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.2); }
}

.race-event-icon {
  font-size: 0.78rem;
  line-height: 1;
}

.race-event-text {
  letter-spacing: -0.01em;
}

/* ============================================================ */
/* COLORES BANDERA SÓLIDOS Y DEGRADADOS PARA CADA PAÍS         */
/* ============================================================ */

/* Argentina - Celeste Bandera */
.flag-bar-ARG {
  background: linear-gradient(90deg, #38bdf8 0%, #0284c7 100%) !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
}

/* Brasil - Verde Canarinho */
.flag-bar-BRA {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%) !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Uruguay - Azul Celeste */
.flag-bar-URU {
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%) !important;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Chile - Rojo Estrella */
.flag-bar-CHL {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%) !important;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Paraguay - Rojo Tricolor */
.flag-bar-PRY {
  background: linear-gradient(90deg, #f43f5e 0%, #e11d48 100%) !important;
  box-shadow: 0 0 14px rgba(244, 63, 94, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Perú - Rojo Bicolor */
.flag-bar-PER {
  background: linear-gradient(90deg, #dc2626 0%, #b91c1c 100%) !important;
  box-shadow: 0 0 14px rgba(220, 38, 38, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Colombia - Amarillo Dorado */
.flag-bar-COL {
  background: linear-gradient(90deg, #fbbf24 0%, #d97706 100%) !important;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Venezuela - Naranja / Rojo Cálido */
.flag-bar-VEN {
  background: linear-gradient(90deg, #f97316 0%, #ea580c 100%) !important;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Ecuador - Amarillo Oro */
.flag-bar-ECU {
  background: linear-gradient(90deg, #facc15 0%, #ca8a04 100%) !important;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Bolivia - Verde Selva Tricolor */
.flag-bar-BOL {
  background: linear-gradient(90deg, #059669 0%, #047857 100%) !important;
  box-shadow: 0 0 14px rgba(5, 150, 105, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* México - Verde Bandera */
.flag-bar-MEX {
  background: linear-gradient(90deg, #16a34a 0%, #15803d 100%) !important;
  box-shadow: 0 0 14px rgba(22, 163, 74, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Panamá - Azul Océano */
.flag-bar-PAN {
  background: linear-gradient(90deg, #2563eb 0%, #1d4ed8 100%) !important;
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Costa Rica - Azul Bandera */
.flag-bar-CRI {
  background: linear-gradient(90deg, #1d4ed8 0%, #1e40af 100%) !important;
  box-shadow: 0 0 14px rgba(29, 78, 216, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Guatemala - Celeste Maya */
.flag-bar-GTM {
  background: linear-gradient(90deg, #0ea5e9 0%, #0284c7 100%) !important;
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Honduras - Azul Turquesa */
.flag-bar-HND {
  background: linear-gradient(90deg, #06b6d4 0%, #0891b2 100%) !important;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* El Salvador - Azul Índigo */
.flag-bar-SLV {
  background: linear-gradient(90deg, #4f46e5 0%, #4338ca 100%) !important;
  box-shadow: 0 0 14px rgba(79, 70, 229, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Rep. Dominicana - Azul Ultramar */
.flag-bar-DOM {
  background: linear-gradient(90deg, #1e40af 0%, #1e3a8a 100%) !important;
  box-shadow: 0 0 14px rgba(30, 64, 175, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Argentina Highlighting */
.race-lane.is-argentina .race-bar-inner-content {
  background: rgba(7, 14, 30, 0.9);
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.5);
}

.race-lane.is-argentina .race-bar-country-name {
  color: #ffffff;
  font-weight: 900;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.95);
}

.race-lane.is-argentina .race-val-label {
  color: #38bdf8;
  font-weight: 900;
  font-size: 0.88rem;
}

/* Controls Footer */
.race-controls-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
  background: rgba(11, 16, 34, 0.9);
  border-top: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  gap: 1.5rem;
  flex-wrap: wrap;
}

.race-controls-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-race-control {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-race-control:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.btn-race-play {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
}

.btn-race-play.is-playing {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.45);
  color: #ef4444;
}

.race-scrubber-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 240px;
}

.scrubber-year-label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.race-timeline-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}

.race-timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #38bdf8;
  cursor: pointer;
  box-shadow: 0 0 8px #38bdf8;
  transition: transform 0.15s ease;
}

.race-timeline-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.race-speed-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.race-speed-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 0.2rem;
}

.btn-speed-opt {
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-speed-opt:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-speed-opt.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
}

@media (max-width: 768px) {
  .race-header {
    padding: 0.6rem 0.85rem;
  }

  .race-title {
    font-size: 0.95rem;
  }

  .race-main-layout {
    padding: 0.2rem 0.5rem;
    gap: 0;
  }

  .race-arena-wrapper {
    padding: 0.2rem 0.35rem 0.2rem 0.2rem;
    overflow: hidden;
  }

  /* Ocultar nombre del país en mobile: solo se ve la bandera */
  .race-bar-country-name {
    display: none !important;
  }

  /* Cápsula de la bandera compacta en mobile */
  .race-bar-inner-content {
    padding: 0.08rem 0.25rem;
    margin-right: 0.2rem;
    gap: 0;
  }

  .race-bar-inner-content img {
    margin: 0;
    width: 18px;
    height: 13px;
  }

  /* Ancho mínimo de barra en mobile para que quepa la bandera */
  .race-bar-fill {
    min-width: 28px !important;
  }

  /* Posición y tamaño del valor en bps en mobile */
  .race-val-wrapper {
    left: calc(100% + 4px);
    gap: 0;
  }

  .race-val-label {
    font-size: 0.7rem;
    font-weight: 800;
  }

  /* En mobile no aparecen las advertencias */
  .race-event-badge {
    display: none !important;
  }

  /* En mobile no aparecen los botones de ocultar ni la barra de países ocultos */
  .race-lane-toggle-btn {
    display: none !important;
  }
  .race-hidden-countries-bar {
    display: none !important;
  }

  /* Marca de agua de fondo más chica en mobile */
  .race-giant-watermark-bg {
    bottom: 4rem;
    right: 0.75rem;
  }
  .race-giant-year-bg {
    font-size: 14vw;
  }
  .race-giant-month-bg {
    font-size: 6vw;
  }
  .race-giant-day-bg {
    font-size: 4vw;
  }

  .race-controls-footer {
    padding: 0.65rem 0.85rem;
    gap: 0.5rem;
  }

  .race-speed-group {
    display: none; /* Ocultar selector de velocidad en mobile para simplificar controles */
  }

  .race-scrubber-container {
    flex: 1 1 100%;
    order: 3;
  }
}




