/* ═══════════════════════════════════════════════════════════════
   FLEX LEVEL-UP MODAL — CoD-style XP popup
   ═══════════════════════════════════════════════════════════════ */

/* ── Card ── */
.flex-lu {
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(
    175deg,
    rgba(18, 18, 18, 0.98) 0%,
    rgba(8, 8, 8, 0.99) 100%
  );
  border: 1px solid rgba(255, 200, 0, 0.12);
  box-shadow:
    0 0 60px rgba(255, 200, 0, 0.1),
    0 24px 48px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.modal-content.flex-lu {
  border: 1px solid rgba(255, 200, 0, 0.12) !important;
}

/* ── Body ── */
.flex-lu__body {
  padding: 1.5rem 1.5rem 1rem;
  text-align: center;
}

/* ── Header block (kicker + reason) ── */
.flex-lu__headerBlock {
  margin-bottom: 4px;
}

.flex-lu__kicker {
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  font-weight: 800;
  color: #ffc800;
  text-shadow: 0 0 20px rgba(255, 200, 0, 0.6);
  animation: kickerPulse 2.5s ease-in-out infinite;
  text-transform: uppercase;
}

@keyframes kickerPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; text-shadow: 0 0 30px rgba(255, 200, 0, 0.9); }
}

/* ── Breakdown / Reason area ── */
.flex-lu__reason {
  margin-top: 4px;
  min-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.4s ease;
  max-height: 0;
  opacity: 0;
}

.flex-lu__reason.is-visible {
  max-height: 999px;
  opacity: 1;
}

.flex-lu__reason-title {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: rgba(255, 200, 0, 0.6);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-transform: uppercase;
}

.flex-lu__reason-lines {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 320px;
  margin: 0 auto;
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scroll-behavior: smooth;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 8%,
    black 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 8%,
    black 100%
  );
  padding-top: 4px;
  padding-bottom: 2px;
}

/* When all items are visible and no scroll needed, remove the mask */
.flex-lu__reason-lines.no-overflow {
  -webkit-mask-image: none;
  mask-image: none;
}

/* Custom scrollbar — subtle gold theme */
.flex-lu__reason-lines::-webkit-scrollbar {
  width: 4px;
}
.flex-lu__reason-lines::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}
.flex-lu__reason-lines::-webkit-scrollbar-thumb {
  background: rgba(255, 200, 0, 0.25);
  border-radius: 4px;
  transition: background 0.2s;
}
.flex-lu__reason-lines::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 200, 0, 0.45);
}

/* Firefox scrollbar */
.flex-lu__reason-lines {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 200, 0, 0.25) rgba(255, 255, 255, 0.03);
}

.flex-lu__reason-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  will-change: transform, opacity;
  border: 1px solid transparent;
}

.flex-lu__reason-line.is-pr {
  background: linear-gradient(135deg, rgba(255, 200, 0, 0.1), rgba(255, 150, 0, 0.05));
  border-color: rgba(255, 200, 0, 0.2);
}

.flex-lu__reason-line.is-pr .flex-lu__reason-icon {
  color: #ffc800;
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(255, 200, 0, 0.5));
}

.flex-lu__reason-line.is-pr .flex-lu__reason-label {
  color: rgba(255, 230, 150, 0.95);
}

.flex-lu__reason-line.is-pr .flex-lu__reason-xp {
  color: #ffc800;
  text-shadow: 0 0 8px rgba(255, 200, 0, 0.35);
}

.flex-lu__reason-line.is-slamming {
  animation: luPrSlam 0.6s ease-out;
}

@keyframes luPrSlam {
  0%   { box-shadow: 0 0 0 0 rgba(255, 200, 0, 0); }
  20%  { box-shadow: 0 0 20px 3px rgba(255, 200, 0, 0.35), inset 0 0 14px rgba(255, 200, 0, 0.12); }
  100% { box-shadow: 0 0 0 0 rgba(255, 200, 0, 0); }
}

.flex-lu__reason-icon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  opacity: 0.5;
  color: rgba(255, 255, 255, 0.65);
}

.flex-lu__reason-label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.flex-lu__reason-xp {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
  min-width: 54px;
  text-align: right;
}

/* ── Level number + XP badge row ── */
.flex-lu__topline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 6px;
  margin-bottom: 2px;
}

.flex-lu__level {
  text-align: center;
}

.flex-lu__levelNum {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 0 12px rgba(255, 200, 0, 0.4),
    0 0 32px rgba(255, 200, 0, 0.2);
  transition: all 0.3s ease;
}

.flex-lu__levelNum.is-glowing {
  color: #ffc800;
  text-shadow:
    0 0 20px rgba(255, 200, 0, 1),
    0 0 40px rgba(255, 200, 0, 0.8),
    0 0 60px rgba(255, 200, 0, 0.5);
  animation: levelGlow 0.5s ease-out;
}

@keyframes levelGlow {
  0%  { transform: scale(1.3); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.flex-lu__xpGain {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(255, 200, 0, 0.2),
    rgba(255, 150, 0, 0.1)
  );
  border: 1px solid rgba(255, 200, 0, 0.4);
  color: #ffc800;
  box-shadow: 0 0 16px rgba(255, 200, 0, 0.15);
  white-space: nowrap;
}

.flex-lu__xpGainPlus {
  opacity: 0.85;
  margin-right: 1px;
}

.flex-lu__xpGainUnit {
  opacity: 0.7;
  margin-left: 5px;
  font-weight: 800;
  font-size: 0.9rem;
}

/* ── Progress bar ── */
.flex-lu__barWrap {
  margin-top: 16px;
}

.flex-lu__barTrack {
  position: relative;
  height: 22px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 200, 0, 0.25);
  background: rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

.flex-lu__barFill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, #e6a800 0%, #ffc800 40%, #ffdd00 100%);
  box-shadow:
    0 0 12px rgba(255, 200, 0, 0.5),
    0 0 24px rgba(255, 200, 0, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.2),
    inset 0 2px 4px rgba(255, 255, 255, 0.25);
  position: relative;
  transition: width 320ms ease-out;
}

.flex-lu__barFill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 100%);
  border-radius: 4px 4px 0 0;
}

.flex-lu__barShine {
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%);
  animation: barShine 2.2s ease-in-out infinite;
}

@keyframes barShine {
  0% { left: -50%; }
  100% { left: 150%; }
}

.flex-lu__barWrap.is-animating .flex-lu__barShine {
  opacity: 1;
  animation: barShine 1.2s ease-in-out infinite;
}

.flex-lu__barMeta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
}

.flex-lu__metaLabel {
  opacity: 0.6;
  font-weight: 700;
  margin-right: 5px;
  color: #ffc800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.flex-lu__metaSlash {
  opacity: 0.4;
  margin: 0 5px;
}

.flex-lu__total {
  opacity: 0.85;
}

/* ── Level-Up Flash ── */
.flex-lu__flash {
  margin-top: 16px;
  display: none;
}

.flex-lu__flash.is-on {
  display: block;
}

.flex-lu__flashInner {
  text-align: center;
  font-weight: 950;
  font-size: 1.6rem;
  letter-spacing: 0.18em;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 200, 0, 0.25), rgba(255, 150, 0, 0.15));
  border: 2px solid rgba(255, 200, 0, 0.5);
  color: #ffc800;
  text-shadow: 0 0 24px rgba(255, 200, 0, 1), 0 0 48px rgba(255, 200, 0, 0.5);
  box-shadow: 0 0 40px rgba(255, 200, 0, 0.35), inset 0 0 20px rgba(255, 200, 0, 0.08);
  animation: flexLuFlash 1200ms ease-out both;
}

@keyframes flexLuFlash {
  0%  { transform: scale(0.8); opacity: 0; filter: brightness(2); }
  20% { transform: scale(1.1); opacity: 1; filter: brightness(1.5); }
  40% { transform: scale(0.95); filter: brightness(1.2); }
  60% { transform: scale(1.02); filter: brightness(1); }
  100% { transform: scale(1); opacity: 1; filter: brightness(1); }
}

/* ── Card pulse ── */
.flex-lu__pulse {
  animation: flexLuPulse 820ms ease-out both;
}

@keyframes flexLuPulse {
  0%  { transform: scale(1); box-shadow: 0 0 60px rgba(255, 200, 0, 0.1); }
  40% { transform: scale(1.015); box-shadow: 0 0 80px rgba(255, 200, 0, 0.3); }
  100% { transform: scale(1); box-shadow: 0 0 60px rgba(255, 200, 0, 0.1); }
}

/* ── Yellow flash overlay ── */
.flex-lu__yellowFlash {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, rgba(255, 200, 0, 0.5) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

.flex-lu__yellowFlash.is-flashing {
  animation: yellowFlashPulse 800ms ease-out;
}

@keyframes yellowFlashPulse {
  0%  { opacity: 0; transform: scale(0.8); }
  15% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.2); }
}

/* ── Footer / Continue button ── */
.flex-lu__footer {
  padding: 0 1.5rem 1.25rem;
  justify-content: center;
}

.flex-lu__btn {
  color: #ffc800 !important;
  background: rgba(255, 200, 0, 0.1) !important;
  border: 1px solid rgba(255, 200, 0, 0.35) !important;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  padding: 10px 36px;
  border-radius: 10px;
  text-transform: uppercase;
  box-shadow: 0 0 16px rgba(255, 200, 0, 0.15);
  transition: all 0.2s ease;
}

.flex-lu__btn:hover,
.flex-lu__btn:focus {
  background: rgba(255, 200, 0, 0.2) !important;
  border-color: rgba(255, 200, 0, 0.6) !important;
  color: #ffc800 !important;
  transform: scale(1.04);
  box-shadow: 0 0 28px rgba(255, 200, 0, 0.35);
}

/* ═══════════════════════════════════════════════════════════════
   DEDUCTION OVERRIDES (red theme)
   ═══════════════════════════════════════════════════════════════ */
.flex-lu--deduction .flex-lu__xpGain {
  color: #ef4444 !important;
  background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(220,38,38,0.08)) !important;
  border-color: rgba(239,68,68,0.35) !important;
  box-shadow: 0 0 12px rgba(239,68,68,0.15) !important;
}
.flex-lu--deduction .flex-lu__barFill {
  background: linear-gradient(90deg, #ef4444, #dc2626) !important;
  box-shadow: 0 0 10px rgba(239,68,68,0.5), inset 0 -2px 4px rgba(0,0,0,0.2), inset 0 2px 4px rgba(255,255,255,0.15) !important;
}
.flex-lu--deduction .flex-lu__kicker {
  color: #ef4444 !important;
  text-shadow: 0 0 16px rgba(239,68,68,0.5) !important;
}
.flex-lu--deduction .flex-lu__barTrack {
  border-color: rgba(239,68,68,0.25) !important;
}
.flex-lu--deduction .flex-lu__metaLabel {
  color: #ef4444 !important;
}
.flex-lu--deduction .flex-lu__flash .flex-lu__flashInner {
  color: #ef4444 !important;
  text-shadow: 0 0 20px rgba(239,68,68,0.5) !important;
  border-color: rgba(239,68,68,0.4) !important;
  background: linear-gradient(135deg, rgba(239,68,68,0.2), rgba(220,38,38,0.1)) !important;
}
.flex-lu--deduction .flex-lu__yellowFlash.is-flashing {
  background: radial-gradient(ellipse at center, rgba(239,68,68,0.25) 0%, transparent 70%) !important;
}
.flex-lu--deduction .flex-lu__levelNum.is-glowing {
  color: #ef4444 !important;
  text-shadow: 0 0 16px rgba(239,68,68,0.6) !important;
}
.flex-lu--deduction .flex-lu__reason-title {
  color: rgba(239,68,68,0.6) !important;
}
.flex-lu--deduction .flex-lu__reason-line {
  background: rgba(239,68,68,0.05);
}
.flex-lu--deduction .flex-lu__reason-xp {
  color: rgba(239,68,68,0.7);
}
.flex-lu--deduction .flex-lu__btn {
  color: #ef4444 !important;
  background: rgba(239,68,68,0.1) !important;
  border-color: rgba(239,68,68,0.3) !important;
  box-shadow: 0 0 12px rgba(239,68,68,0.12) !important;
}
.flex-lu--deduction .flex-lu__btn:hover {
  background: rgba(239,68,68,0.18) !important;
  border-color: rgba(239,68,68,0.5) !important;
}
.flex-lu--deduction {
  border-color: rgba(239,68,68,0.12) !important;
  box-shadow: 0 0 60px rgba(239,68,68,0.08), 0 24px 48px rgba(0,0,0,0.6) !important;
}