/* ==========================================================================
   F1 LIVE TIMING - HORIZONTAL LEVEL UP BANNER (Minimalist Motorsport HUD)
   Versión Original Restaurada con Escala Optimizada (78px) y Soporte Dual
   Paleta: Fondo Oscuro (#0f1014), Rojo F1 (#d80d0d), Violeta XP (#8A29A4) y Blanco (#ffffff)
   ========================================================================== */

/* === GLOBAL OVERLAY CONTAINER === */
.levelup-overlay,
.cp-levelup-overlay {
  position: fixed;
  top: 25px;
  left: 0;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 999999;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-28px) scale(0.97);
  transition: opacity 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.38s ease;
}

.levelup-overlay.show,
.cp-levelup-overlay.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.levelup-overlay.hiding,
.cp-levelup-overlay.hiding {
  opacity: 0;
  visibility: visible;
  transform: translateY(-24px) scale(0.96);
  transition: opacity 0.32s cubic-bezier(0.7, 0, 0.84, 0),
              transform 0.32s cubic-bezier(0.7, 0, 0.84, 0);
}

/* === VIEW TOGGLE (MODERN VS CLASSIC VS STEAM) - AISLAMIENTO ESTRICTO FAIL-CLOSED === */
.levelup-overlay .levelup-hud-container,
.cp-levelup-overlay .levelup-hud-container {
  display: none !important;
}

.levelup-overlay.style-modern .levelup-view-modern,
.cp-levelup-overlay.style-modern .levelup-view-modern {
  display: flex !important;
}

.levelup-overlay.style-classic .levelup-view-classic,
.cp-levelup-overlay.style-classic .levelup-view-classic {
  display: flex !important;
}

.levelup-overlay.style-steam .levelup-view-steam,
.cp-levelup-overlay.style-steam .levelup-view-steam {
  display: flex !important;
}

/* ==========================================================================
   1. MODERN LIVE TIMING VIEW (VERSIÓN ORIGINAL ESCALADA)
   ========================================================================== */
.levelup-hud-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

/* Main Level Up Banner Card */
.levelup-banner-card {
  position: relative;
  display: flex;
  align-items: stretch;
  min-width: 620px;
  max-width: 90vw;
  height: 78px;
  background: rgba(15, 16, 20, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 5px solid var(--f1-red, #d80d0d);
  border-radius: 6px;
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.8),
    0 0 28px rgba(216, 13, 13, 0.22),
    0 0 16px rgba(138, 41, 164, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

/* Light Sweep Aura on Top Border */
.levelup-banner-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), #b342cc, transparent);
  animation: levelup-sweep 2.4s ease-in-out infinite;
}

@keyframes levelup-sweep {
  0% { left: -60%; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { left: 140%; opacity: 0; }
}

/* === LEFT: LEVEL BADGE BOX === */
.levelup-badge-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 100%;
  background: linear-gradient(135deg, rgba(216, 13, 13, 0.28) 0%, rgba(216, 13, 13, 0.08) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 10px;
  flex-shrink: 0;
}

.levelup-badge-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--f1-red, #d80d0d);
  letter-spacing: 1.5px;
  line-height: 1;
  margin-bottom: 2px;
}

.levelup-badge-val {
  font-family: 'Outfit', 'Titillium Web', sans-serif;
  font-size: 38px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.4);
}

/* === CENTER: USER & RANK INFO === */
.levelup-info-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 24px;
  gap: 4px;
  min-width: 0;
}

.levelup-username {
  font-family: 'Outfit', 'Titillium Web', sans-serif;
  font-size: 27px;
  font-weight: 900;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  line-height: 1.1;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.levelup-rank-badge {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.levelup-rank-prefix {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.8px;
  flex-shrink: 0;
}

.levelup-rank-title {
  font-family: 'Outfit', 'JetBrains Mono', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: var(--xp-accent, #b342cc);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  text-shadow: 0 0 10px rgba(179, 66, 204, 0.4);
  white-space: nowrap;
}

/* === RIGHT: XP DELTA & SPEED STREAKS === */
.levelup-stats-section {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px 0 12px;
  flex-shrink: 0;
}

.levelup-xp-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 17px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1.2px;
  background: rgba(138, 41, 164, 0.35);
  border: 1px solid rgba(179, 66, 204, 0.6);
  padding: 6px 16px;
  border-radius: 4px;
  text-shadow: 0 0 10px rgba(179, 66, 204, 0.8);
  box-shadow: 0 0 14px rgba(138, 41, 164, 0.35);
  white-space: nowrap;
}

.levelup-speed-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.speed-line {
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--f1-red, #d80d0d), var(--xp-accent, #b342cc));
  animation: speed-line-pulse 1.4s ease-in-out infinite alternate;
}

.speed-line.line-1 {
  width: 28px;
  animation-delay: 0s;
}

.speed-line.line-2 {
  width: 18px;
  animation-delay: 0.25s;
}

.speed-line.line-3 {
  width: 24px;
  animation-delay: 0.5s;
}

@keyframes speed-line-pulse {
  0% { transform: scaleX(0.7); opacity: 0.4; }
  100% { transform: scaleX(1.15); opacity: 1; }
}

/* ==========================================================================
   2. CLASSIC HUD VIEW (LEGACY)
   ========================================================================== */
.levelup-view-classic {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.levelup-view-classic .levelup-ghost-text {
  position: absolute;
  top: -20px;
  font-family: 'Outfit', 'Formula1', sans-serif;
  font-size: 48px;
  font-weight: 900;
  color: rgba(216, 13, 13, 0.12);
  letter-spacing: 8px;
  pointer-events: none;
  z-index: -1;
  text-transform: uppercase;
}

.levelup-view-classic .levelup-hud-content {
  display: flex;
  align-items: stretch;
  background: rgba(15, 16, 20, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8), 0 0 20px rgba(216, 13, 13, 0.25);
  min-width: 440px;
  overflow: hidden;
}

.levelup-view-classic .hud-bracket {
  width: 6px;
  background: var(--f1-red, #d80d0d);
}

.levelup-view-classic .hud-data-core {
  flex: 1;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.levelup-view-classic .hud-header {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.4);
}

.levelup-view-classic .hud-status {
  color: #2dd4bf;
  font-weight: 700;
}

.levelup-view-classic .hud-main-display {
  display: flex;
  align-items: center;
  gap: 16px;
}

.levelup-view-classic .hud-level-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(216, 13, 13, 0.2);
  border: 1px solid rgba(216, 13, 13, 0.4);
  padding: 4px 12px;
  border-radius: 4px;
}

.levelup-view-classic .hud-level-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #d80d0d;
  font-weight: 700;
}

.levelup-view-classic .hud-level-val {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 900;
  color: #ffffff;
}

.levelup-view-classic .hud-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.levelup-view-classic .hud-user-name {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 900;
  color: #ffffff;
  text-transform: uppercase;
}

.levelup-view-classic .hud-rank-tag {
  display: flex;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
}

.levelup-view-classic .hud-rank-lbl {
  color: rgba(255, 255, 255, 0.4);
}

.levelup-view-classic .hud-rank-val {
  color: #b342cc;
  font-weight: 800;
}

.levelup-view-classic .hud-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  color: rgba(255, 255, 255, 0.35);
}

.levelup-view-classic .hud-bit-line {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

/* === PARTICLES === */
.levelup-particles {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 20;
}

.data-bit {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--f1-red, #d80d0d);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--f1-red, #d80d0d);
  animation: bit-explode 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes bit-explode {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* === SHAKE IMPACT & FLASH EFFECTS === */
.container.shake-impact {
  animation: widget-shake 0.35s ease-in-out;
}

@keyframes widget-shake {
  0%, 100% { transform: translateX(0) scale(1) !important; }
  25% { transform: translateX(-1px) scale(1) !important; }
  75% { transform: translateX(1px) scale(1) !important; }
}

.level-up-effect {
  animation: f1-flash 0.4s ease-out;
}

@keyframes f1-flash {
  0% { filter: brightness(1.2); }
  100% { filter: brightness(1); }
}

/* ==========================================================================
   3. STEAM LEVEL UP VIEW (CYBER TELEMETRÍA)
   ========================================================================== */
.levelup-overlay.style-steam {
  top: 60px;
}

.levelup-overlay.style-steam .levelup-view-steam {
  display: flex !important;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.steam-levelup-card {
  display: flex;
  align-items: center;
  gap: 22px;
  position: relative;
  overflow: hidden;
  width: 560px;
  max-width: 90vw;
  min-height: 132px;
  background: rgba(15, 16, 20, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 20px 24px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.9), 0 0 1px rgba(255, 255, 255, 0.15);
  opacity: 0;
  transform: translateY(-40px) scale(0.95);
  transition: transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease-out;
}

.steam-levelup-card.steam-card-animate {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.steam-levelup-card.steam-card-hide {
  animation: steam-card-warp-exit 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  transform-origin: center center !important;
  pointer-events: none !important;
}

.steam-levelup-icon-box {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: 
      linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
      #0a0b0e;
  background-size: 8px 8px, 8px 8px, 100% 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  z-index: 2;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
}

.steam-levelup-icon-box::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background:
      linear-gradient(to right, #8A29A4 10px, transparent 10px) top left,
      linear-gradient(to bottom, #8A29A4 10px, transparent 10px) top left,
      linear-gradient(to left, #8A29A4 10px, transparent 10px) top right,
      linear-gradient(to bottom, #8A29A4 10px, transparent 10px) top right,
      linear-gradient(to right, #8A29A4 10px, transparent 10px) bottom left,
      linear-gradient(to top, #8A29A4 10px, transparent 10px) bottom left,
      linear-gradient(to left, #8A29A4 10px, transparent 10px) bottom right,
      linear-gradient(to top, #8A29A4 10px, transparent 10px) bottom right;
  background-size: 10px 2px, 2px 10px, 10px 2px, 2px 10px, 10px 2px, 2px 10px, 10px 2px, 2px 10px;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 4px rgba(138, 41, 164, 0.7));
}

.steam-lvl-tag {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 11px;
  font-weight: 800;
  color: #d8b4fe;
  letter-spacing: 1.5px;
  line-height: 1;
  text-transform: uppercase;
}

.steam-lvl-val {
  font-family: var(--font-f1turbo, "Formula1", "Outfit", sans-serif);
  font-size: 38px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 0 14px rgba(138, 41, 164, 0.9);
}

/* === STEAM LEVEL UP: BADGE DE POSICIÓN DESTACADO === */
.steam-levelup-card .steam-xp-block,
.steam-levelup-card .steam-pos-block {
  height: 28px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 11, 14, 0.85);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7), 0 0 14px rgba(138, 41, 164, 0.45);
}

.steam-levelup-card .steam-xp-lbl {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 11.5px;
  font-weight: 800;
  color: #d8b4fe;
  letter-spacing: 1.2px;
  padding: 0 8px;
}

.steam-levelup-card .steam-xp-val {
  font-family: var(--font-f1turbo, "Formula1", "Outfit", "JetBrains Mono", monospace);
  font-size: 17px;
  font-weight: 900;
  color: #ffffff;
  background: linear-gradient(135deg, #8A29A4 0%, #b342cc 100%);
  padding: 0 12px;
  letter-spacing: 0.8px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

.steam-levelup-card .steam-title {
  white-space: nowrap;
}

.steam-levelup-card .steam-marquee-track {
  animation: steam-marquee-continuous 8.5s linear infinite !important;
}

/* === RESPONSIVE RULES === */
@media (max-width: 680px) {
  .levelup-banner-card {
    min-width: 360px;
    height: 64px;
  }
  .levelup-badge-box {
    width: 70px;
  }
  .levelup-badge-val {
    font-size: 28px;
  }
  .levelup-username {
    font-size: 19px;
  }
  .levelup-rank-title {
    font-size: 12px;
  }
  .levelup-stats-section {
    padding-right: 14px;
  }
  .levelup-xp-val {
    font-size: 12px;
    padding: 4px 8px;
  }
}
