:root {
  --bg: #030712;
  --bg-accent: #0f172a;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.4);
  --success: #10b981;
  --danger: #ef4444;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --glass: rgba(17, 24, 39, 0.7);
  --stroke: rgba(255, 255, 255, 0.08);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 10% 10%, rgba(99, 102, 241, 0.1), transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(16, 185, 129, 0.05), transparent 40%);
  z-index: -1;
}

.container { max-width: 1000px; margin: 0 auto; padding: 2rem; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--stroke);
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.title-contest {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  background: linear-gradient(to right, #fff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px var(--accent-glow);
}

.option-grid { display: grid; gap: 1rem; margin-top: 2rem; }

/* Leaderboard & Podium */
.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 3rem;
    padding-top: 2rem;
}

.podium-item {
    flex: 1;
    max-width: 120px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--stroke);
    border-radius: 16px 16px 0 0;
    padding: 1.5rem 1rem;
    text-align: center;
    position: relative;
    animation: slideIn 0.8s ease-out forwards;
}

.podium-item.first { height: 180px; border-color: #ffd700; background: linear-gradient(to top, rgba(255, 215, 0, 0.1), transparent); order: 2; }
.podium-item.second { height: 140px; border-color: #c0c0c0; order: 1; }
.podium-item.third { height: 120px; border-color: #cd7f32; order: 3; }

.podium-rank {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    border: 2px solid inherit;
}

.first .podium-rank { background: #ffd700; color: #000; box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
.second .podium-rank { background: #c0c0c0; color: #000; }
.third .podium-rank { background: #cd7f32; color: #000; }

/* Interactive Elements */
.option-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.option-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.option-item.selected {
    background: rgba(79, 70, 229, 0.2);
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.option-item.correct {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.option-item.selected::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border: 2px solid var(--accent);
    border-radius: 16px;
    animation: borderPulse 2s infinite;
}

@keyframes borderPulse {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* Timer Pulsing */
.timer-wrap.critical {
    animation: timerPanic 0.5s infinite;
}

@keyframes timerPanic {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.02); filter: brightness(1.5); }
    100% { transform: scale(1); filter: brightness(1); }
}

.timer-fill.critical {
    background: linear-gradient(90deg, #ef4444, #b91c1c);
}

/* Entrance Animations */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-entrance {
    animation: slideIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.timer-wrap { width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin-bottom: 2rem; overflow: hidden; }
.timer-fill { height: 100%; background: var(--accent); width: 100%; transition: width 0.1s linear; }

.leaderboard-row {
    display: flex !important; /* Force flex to override any legacy grid */
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    margin-bottom: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.leaderboard-row:hover {
    background: rgba(255,255,255,0.06);
    transform: translateX(8px);
    border-color: var(--accent);
}

.leaderboard-row.is-me {
    background: rgba(79, 70, 229, 0.15);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.3);
}

.podium-item.is-me {
    background: rgba(79, 70, 229, 0.2);
    box-shadow: 0 0 40px rgba(79, 70, 229, 0.5);
}

/* Haptic & Feedback Animations */
@keyframes hapticShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.shake {
    animation: hapticShake 0.2s ease-in-out 2;
    border-color: #ef4444 !important;
}

@keyframes successRipple {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.success-glow {
    animation: successRipple 1s infinite;
    border-color: var(--success) !important;
    background: rgba(16, 185, 129, 0.2) !important;
}
