:root {
  /* Design Tokens from CTF_LAB */
  --bg-color: #03060b;
  --surface-color: #0b101a;
  --border-color: #162235;
  --primary: #00e676;
  --primary-dim: #00c853;
  --secondary: #00b0ff;
  --accent: #ff66b2;
  --accent-dim: #ff3399;
  --danger: #ff3366;
  --warning: #ffc400;
  --text: #d0dbe8;
  --text-dim: #6b829e;

  /* Typography */
  --font-sans: 'Rajdhani', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-brand: 'Orbitron', monospace;

  /* Animation Overrides */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

/* 1. NAVBAR */
.navbar-ctf {
  transition: backdrop-filter 0.5s var(--ease-out-expo), 
              background-color 0.5s var(--ease-out-expo), 
              border-bottom 0.5s var(--ease-out-expo), 
              box-shadow 0.5s var(--ease-out-expo);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}

.navbar-ctf.scrolled-nav {
  background-color: rgba(11, 16, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 230, 118, 0.15);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

.nav-link-ctf {
  position: relative;
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-link-ctf::after {
  content: '';
  position: absolute;
  bottom: -4px; 
  left: 0;
  width: 100%; 
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease-out-expo);
}

.nav-link-ctf:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* 2. CTF CARDS (Glassmorphism + Smooth 3D) */
.ctf-card {
  background: rgba(11, 16, 26, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: transform 0.6s var(--ease-out-expo), 
              box-shadow 0.6s var(--ease-out-expo), 
              border-color 0.4s var(--ease-in-out-soft),
              background 0.4s var(--ease-in-out-soft);
  position: relative;
  overflow: hidden;
  will-change: transform, box-shadow;
}

.ctf-card:hover {
  background: rgba(11, 16, 26, 0.75);
  transform: translateY(-8px) perspective(1000px) rotateX(4deg) rotateY(-2deg);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(0, 230, 118, 0.1),
    inset 0 0 15px rgba(0, 230, 118, 0.05);
  border-color: rgba(0, 229, 255, 0.4);
  z-index: 10;
}

.ctf-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.05) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.ctf-card:hover::before {
  opacity: 1;
}

.ctf-card .bi {
  transition: transform 0.5s var(--ease-out-expo), color 0.3s ease;
}

.ctf-card:hover .bi {
  transform: scale(1.15) rotate(8deg);
  color: var(--primary);
}

/* 3. BUTTONS (Modern Glow Pulse) */
.btn-ctf {
  font-family: var(--font-brand);
  font-size: 0.85rem;
  letter-spacing: 1px;
  position: relative;
  transition: all 0.3s var(--ease-out-expo);
  overflow: hidden;
}

.btn-ctf-full {
  background: linear-gradient(135deg, var(--primary-dim), var(--secondary));
  background-size: 200% auto;
  border: none;
  box-shadow: 0 4px 15px rgba(0, 230, 118, 0.2);
}

.btn-ctf-full:hover {
  background-position: right center;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 230, 118, 0.4), 0 0 15px rgba(0, 229, 255, 0.3);
}

.btn-ctf-full:active {
  transform: translateY(0) scale(0.98);
}

/* 4. SCOREBOARD PAGE */
.score-row {
  border-bottom: 1px solid rgba(22, 34, 53, 0.5);
  transition: background 0.3s var(--ease-in-out-soft);
}

.score-row:hover {
  background: rgba(0, 230, 118, 0.03);
}

.score-row.rank-1 {
  border-left: 4px solid var(--warning);
  background: linear-gradient(90deg, rgba(255, 196, 0, 0.08), transparent);
  box-shadow: inset 10px 0 20px -10px rgba(255, 196, 0, 0.2);
}

/* 5. CHALLENGE CARDS */
.badge-diff {
  transition: all 0.3s var(--ease-out-expo);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.badge-diff:hover {
  filter: brightness(1.2);
  transform: scale(1.05);
}

.ctf-card.solved {
  background-image: repeating-linear-gradient(45deg, transparent, transparent 15px, rgba(0, 230, 118, 0.04) 15px, rgba(0, 230, 118, 0.04) 30px);
  border-color: rgba(0, 230, 118, 0.3);
}

/* 6. PAGE TITLES */
.page-title {
  font-family: var(--font-brand);
  background: linear-gradient(to right, var(--primary), var(--secondary), var(--accent));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: titleGlow 4s linear infinite;
}

@keyframes titleGlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* 7. FORMS (Organic Cybernetic) */
.ctf-label {
  font-family: var(--font-sans);
  font-weight: 600;
  transition: all 0.3s var(--ease-out-expo);
  pointer-events: none;
}

.ctf-input {
  background: rgba(3, 6, 11, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text);
  font-family: var(--font-mono);
  transition: all 0.4s var(--ease-out-expo);
}

.ctf-input:focus {
  outline: none;
  background: rgba(11, 16, 26, 0.8);
  border-color: var(--secondary);
  box-shadow: 
    0 0 0 1px var(--secondary),
    0 0 20px rgba(0, 176, 255, 0.15),
    inset 0 0 10px rgba(0, 176, 255, 0.05);
}

.ctf-input:focus + .ctf-label,
.ctf-label:has(+ .ctf-input:focus) {
  color: var(--primary);
  transform: translateY(-4px) scale(0.95);
  text-shadow: 0 0 8px rgba(0, 230, 118, 0.5);
}

/* 8. BACKGROUND EFFECTS */
.glow-orb {
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--primary), var(--secondary));
  opacity: 0.06;
  filter: blur(100px);
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  animation: orbFloat 20s infinite ease-in-out;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(10%, 10%); }
  66% { transform: translate(-5%, 15%); }
}

/* ANIMATIONS & KEYFRAMES */
@media (prefers-reduced-motion: no-preference) {
  .navbar-brand { animation: floatLogo 4s infinite ease-in-out; }
  @keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px) scale(1.02); }
  }

  .ctf-card:hover::after { animation: shimmerSweep 0.8s var(--ease-out-expo) forwards; }
  @keyframes shimmerSweep { 
    0% { left: -100%; opacity: 0; }
    50% { opacity: 1; }
    100% { left: 200%; opacity: 0; } 
  }

  .btn-ctf::after {
    content: '';
    position: absolute;
    inset: -2px;
    border: 2px solid var(--secondary);
    border-radius: inherit;
    opacity: 0;
    pointer-events: none;
  }

  .btn-ctf:hover::after {
    animation: pulseRing 1.5s infinite var(--ease-out-expo);
  }

  @keyframes pulseRing {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 0; }
  }

  .score-row {
    animation: rowSlideIn 0.6s var(--ease-out-expo) both;
    animation-delay: calc(var(--row-index, 0) * 0.05s);
  }
  @keyframes rowSlideIn {
    0% { opacity: 0; transform: translateX(-30px); }
    100% { opacity: 1; transform: translateX(0); }
  }

  .ctf-footer::after { animation: matrixRain 12s linear infinite; }
  @keyframes matrixRain {
    0% { transform: translateY(-100%); opacity: 0; }
    10% { opacity: 0.15; }
    90% { opacity: 0.15; }
    100% { transform: translateY(1000%); opacity: 0; }
  }

  .navbar-brand .char {
    display: inline-block;
    animation: charReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--char-index) * 0.04s);
  }
  @keyframes charReveal {
    0% { opacity: 0; transform: translateY(15px) skewY(10deg); filter: blur(5px); }
    100% { opacity: 1; transform: translateY(0) skewY(0); filter: blur(0); }
  }
}
