/* ============================================
   QUIZ PYTHON DIVERTIDO - Estilos Cartoon
   ============================================ */

body { font-family: 'Fredoka', 'Inter', system-ui, sans-serif; }
.font-inter { font-family: 'Inter', sans-serif; }

/* ===== ANIMATIONS ===== */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-15px) rotate(3deg); }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(-8deg); }
  50%      { transform: rotate(8deg); }
}
@keyframes wiggle-slow {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}
@keyframes bounce-soft {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-10px) scale(1.05); }
}
@keyframes pop-in {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}
@keyframes pop {
  0%   { transform: scale(0.9); }
  60%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}
@keyframes fire-pulse {
  0%, 100% { transform: scale(1) rotate(-12deg); }
  50%      { transform: scale(1.25) rotate(12deg); }
}
@keyframes score-bounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.6) rotate(-10deg); }
  60%  { transform: scale(1.2) rotate(10deg); }
  100% { transform: scale(1); }
}
@keyframes shine {
  0%   { left: -100%; }
  100% { left: 200%; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes rainbow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.anim-fade-in     { animation: fadeIn 0.5s ease-out; }
.anim-bounce-soft { animation: bounce-soft 2.5s ease-in-out infinite; }
.anim-wiggle      { animation: wiggle 2.5s ease-in-out infinite; }
.anim-wiggle-slow { animation: wiggle-slow 4s ease-in-out infinite; }
.anim-pop         { animation: pop-in 0.6s cubic-bezier(.34,1.56,.64,1); }
.anim-pop-soft    { animation: pop 0.4s cubic-bezier(.34,1.56,.64,1); }
.anim-fire        { animation: fire-pulse 0.6s ease-in-out infinite; display: inline-block; }
.anim-score       { animation: score-bounce 0.6s ease-out; display: inline-block; }
.anim-spin-slow   { animation: spin-slow 8s linear infinite; }

/* ===== CARTOON GLOSSY BUTTONS ===== */
.btn-cartoon {
  position: relative;
  border: 4px solid #fff;
  border-radius: 1.5rem;
  font-weight: 700;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-shadow: 0 2px 0 rgba(0,0,0,0.15);
  overflow: hidden;
  cursor: pointer;
}
.btn-cartoon::before {
  content: '';
  position: absolute;
  top: 3px; left: 4px; right: 4px;
  height: 45%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.55), rgba(255,255,255,0));
  border-radius: 1.2rem 1.2rem 60% 60% / 1.2rem 1.2rem 40% 40%;
  pointer-events: none; z-index: 1;
}
.btn-cartoon > * { position: relative; z-index: 2; }

.btn-pink    { background: linear-gradient(to bottom, #FF6BA0, #FF4D8D); box-shadow: 0 6px 0 #C73E6F, 0 8px 16px rgba(199,62,111,0.35); }
.btn-pink:hover { transform: translateY(-3px); box-shadow: 0 9px 0 #C73E6F, 0 12px 22px rgba(199,62,111,0.45); }
.btn-pink:active { transform: translateY(3px); box-shadow: 0 3px 0 #C73E6F; }

.btn-blue    { background: linear-gradient(to bottom, #5CC4F5, #3BB4F2); box-shadow: 0 6px 0 #1E7AAA, 0 8px 16px rgba(30,122,170,0.35); }
.btn-blue:hover { transform: translateY(-3px); box-shadow: 0 9px 0 #1E7AAA; }
.btn-blue:active { transform: translateY(3px); box-shadow: 0 3px 0 #1E7AAA; }

.btn-yellow  { background: linear-gradient(to bottom, #FFE066, #FFD93D); box-shadow: 0 6px 0 #C9A30D, 0 8px 16px rgba(201,163,13,0.35); color: #5a3e00; }
.btn-yellow > * { text-shadow: 0 2px 0 rgba(255,255,255,0.4); }

.btn-green   { background: linear-gradient(to bottom, #B5EE85, #9CE65C); box-shadow: 0 6px 0 #5BA92B, 0 8px 16px rgba(91,169,43,0.35); color: #1f4309; }
.btn-green > * { text-shadow: 0 2px 0 rgba(255,255,255,0.4); }

.btn-purple  { background: linear-gradient(to bottom, #C084FC, #A855F7); box-shadow: 0 6px 0 #7E22CE, 0 8px 16px rgba(126,34,206,0.35); }
.btn-red     { background: linear-gradient(to bottom, #FF8585, #FF6B6B); box-shadow: 0 6px 0 #C73838, 0 8px 16px rgba(199,56,56,0.35); }

.btn-rainbow {
  background: linear-gradient(90deg, #FF4D8D, #FFD93D, #9CE65C, #3BB4F2, #A855F7, #FF4D8D);
  background-size: 300% 100%;
  animation: rainbow 4s linear infinite;
  box-shadow: 0 6px 0 #6b21a8, 0 8px 16px rgba(126,34,206,0.35);
}

/* ===== CARTOON CARD ===== */
.card-cartoon {
  background: #fff;
  border-radius: 2rem;
  border: 4px solid #fff;
  box-shadow: 0 8px 0 rgba(147, 51, 234, 0.18), 0 12px 28px rgba(147, 51, 234, 0.15);
}

/* ===== OPTION BUTTONS ===== */
.opt-cartoon {
  background: linear-gradient(to bottom, #ffffff, #f1f5f9);
  border: 4px solid #e2e8f0;
  box-shadow: 0 4px 0 #cbd5e1;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}
.opt-cartoon:hover:not(:disabled) {
  transform: translateY(-3px) rotate(-0.5deg);
  border-color: #c4b5fd;
  box-shadow: 0 7px 0 #cbd5e1;
  background: linear-gradient(to bottom, #faf5ff, #f3e8ff);
}
.opt-cartoon:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #cbd5e1; }
.opt-correct {
  background: linear-gradient(to bottom, #B5EE85, #9CE65C) !important;
  border-color: #fff !important;
  box-shadow: 0 5px 0 #5BA92B, 0 0 24px rgba(156, 230, 92, 0.5) !important;
  color: #14532D !important;
}
.opt-correct .opt-bubble { background: #fff !important; color: #14532D !important; }
.opt-wrong {
  background: linear-gradient(to bottom, #FFA8A8, #FF6B6B) !important;
  border-color: #fff !important;
  box-shadow: 0 5px 0 #C73838, 0 0 24px rgba(255, 107, 107, 0.5) !important;
  color: #7F1D1D !important;
}
.opt-wrong .opt-bubble { background: #fff !important; color: #7F1D1D !important; }
.opt-faded { opacity: 0.5; filter: grayscale(0.5); }
.opt-bubble {
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  background: linear-gradient(to bottom, #f8fafc, #e2e8f0);
  border: 3px solid #fff; box-shadow: 0 2px 0 rgba(0,0,0,0.1);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; color: #475569;
  margin-right: 0.75rem; flex-shrink: 0;
  font-family: 'Fredoka', sans-serif;
}

/* ===== PROGRESS BAR ===== */
.progress-track {
  background: #fff; border: 4px solid #fff; border-radius: 999px;
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.12), 0 4px 0 rgba(147, 51, 234, 0.15);
  overflow: hidden; height: 1.5rem;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(to bottom, #FBBF24, #F59E0B);
  background-size: 200% 100%;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 999px; position: relative; overflow: hidden;
}
.progress-fill::after {
  content: ''; position: absolute;
  top: 2px; left: 4px; right: 4px; height: 35%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.6), transparent);
  border-radius: 999px;
}

/* ===== CATEGORY BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 1rem; border-radius: 999px;
  font-weight: 700; border: 3px solid #fff;
  box-shadow: 0 3px 0 rgba(0,0,0,0.12); font-size: 0.85rem;
}
.badge-blue   { background: linear-gradient(to bottom, #5CC4F5, #3BB4F2); color: #fff; box-shadow: 0 3px 0 #1E7AAA; }
.badge-yellow { background: linear-gradient(to bottom, #FFE066, #FFD93D); color: #5a3e00; box-shadow: 0 3px 0 #C9A30D; }
.badge-green  { background: linear-gradient(to bottom, #B5EE85, #9CE65C); color: #14532D; box-shadow: 0 3px 0 #5BA92B; }
.badge-pink   { background: linear-gradient(to bottom, #FF6BA0, #FF4D8D); color: #fff; box-shadow: 0 3px 0 #C73E6F; }
.badge-purple { background: linear-gradient(to bottom, #C084FC, #A855F7); color: #fff; box-shadow: 0 3px 0 #7E22CE; }
.badge-orange { background: linear-gradient(to bottom, #FFB570, #FF8A3D); color: #fff; box-shadow: 0 3px 0 #C76418; }

/* ===== INPUT ===== */
.input-cartoon {
  background: #fff; border: 4px solid #fcd34d; border-radius: 1.25rem;
  font-weight: 600; font-size: 1.15rem;
  padding: 1rem 1.25rem; transition: all 0.15s ease;
  box-shadow: 0 4px 0 rgba(252, 211, 77, 0.4); width: 100%;
}
.input-cartoon:focus {
  outline: none; border-color: #FF4D8D;
  box-shadow: 0 4px 0 #FF4D8D, 0 0 0 4px rgba(255, 77, 141, 0.2);
  transform: translateY(-2px);
}

/* ===== STATS CARD ===== */
.stat-card {
  background: linear-gradient(to bottom, #fff, #f8fafc);
  border: 3px solid #fff; border-radius: 1.25rem;
  box-shadow: 0 4px 0 rgba(0,0,0,0.08), 0 6px 12px rgba(0,0,0,0.06);
  padding: 0.75rem; text-align: center;
}

/* ===== LEADERBOARD ===== */
.lb-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.85rem; background: #fff;
  border: 3px solid #fff; border-radius: 1rem;
  box-shadow: 0 4px 0 rgba(0,0,0,0.08);
  transition: all 0.2s;
}
.lb-row.is-me {
  background: linear-gradient(to bottom, #FFE066, #FFD93D);
  box-shadow: 0 4px 0 #C9A30D, 0 0 0 3px rgba(255, 77, 141, 0.4);
}
.lb-rank { width: 2.25rem; text-align: center; font-size: 1.4rem; flex-shrink: 0; }
.lb-avatar {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: linear-gradient(to bottom, #C084FC, #A855F7);
  border: 3px solid #fff; box-shadow: 0 2px 0 rgba(0,0,0,0.15);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; flex-shrink: 0;
}
.lb-avatar.gold   { background: linear-gradient(to bottom, #FFE066, #FFB700); color: #5a3e00; }
.lb-avatar.silver { background: linear-gradient(to bottom, #E5E7EB, #9CA3AF); color: #1F2937; }
.lb-avatar.bronze { background: linear-gradient(to bottom, #FCA378, #C76418); color: #fff; }

/* ===== CUSTOM SCROLLBAR ===== */
.custom-scroll::-webkit-scrollbar { width: 8px; }
.custom-scroll::-webkit-scrollbar-track { background: #fef3c7; border-radius: 4px; }
.custom-scroll::-webkit-scrollbar-thumb { background: linear-gradient(to bottom, #FF6BA0, #FF4D8D); border-radius: 4px; }
.custom-scroll::-webkit-scrollbar-thumb:hover { background: #FF4D8D; }

/* ===== SHINE EFFECT ===== */
.shine-effect { position: relative; overflow: hidden; }
.shine-effect::after {
  content: ''; position: absolute; top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  animation: shine 3s ease-in-out infinite;
  pointer-events: none;
}

/* ===== CODE BLOCK ===== */
.code-cartoon {
  background: linear-gradient(to bottom, #1e293b, #0f172a);
  color: #e2e8f0; border-radius: 1.25rem;
  border: 4px solid #fff;
  box-shadow: 0 6px 0 rgba(15, 23, 42, 0.3), 0 8px 16px rgba(0,0,0,0.2);
  padding: 1rem 1.25rem; overflow: visible;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem; line-height: 1.5;
  white-space: pre; position: relative;
}
.code-cartoon::before {
  content: '🐍 code.py'; position: absolute;
  top: -24.5px; left: 16px; background: #0f172a; color: #94a3b8;
  font-family: 'Fredoka', sans-serif; font-size: 0.75rem;
  padding: 2px 10px; border-radius: 8px 8px 0 0;
  border: 3px solid #fff; border-bottom: none; font-weight: 600;
}

/* ===== HEADING ===== */
.heading-cartoon {
  font-weight: 700; color: #1f2937; letter-spacing: -0.02em;
  text-shadow: 0 2px 0 rgba(255,255,255,0.8);
}

[x-cloak] { display: none !important; }
::selection { background: #FFD93D; color: #1f2937; }

/* ===== TIMER BAR ===== */
.timer-bar-normal {
  background: linear-gradient(to bottom, #5CC4F5, #3BB4F2);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.4);
}
.timer-bar-danger {
  background: linear-gradient(to bottom, #FF8585, #FF4D4D);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.4);
  animation: pulse-danger 0.5s ease-in-out infinite alternate;
}
@keyframes pulse-danger {
  from { box-shadow: inset 0 2px 0 rgba(255,255,255,0.4), 0 0 0 rgba(255, 77, 77, 0); }
  to   { box-shadow: inset 0 2px 0 rgba(255,255,255,0.4), 0 0 8px rgba(255, 77, 77, 0.6); }
}

/* ===== MODAL OVERLAY ===== */
[x-show][style*="display: flex"] { animation: fadeIn 0.2s ease-out; }

/* ===== COUNTDOWN DE EMERGENCIA (esquina inferior derecha) ===== */
.countdown-emergency {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 40;
  pointer-events: none;
  animation: countdown-bounce 0.5s cubic-bezier(.34,1.56,.64,1);
}
.countdown-circle {
  background: linear-gradient(to bottom, #FF6B6B, #DC2626);
  color: #fff;
  border-radius: 1.75rem;
  padding: 1.25rem 1.5rem;
  border: 4px solid #fff;
  box-shadow:
    0 8px 0 #991B1B,
    0 12px 32px rgba(220, 38, 38, 0.5),
    inset 0 3px 0 rgba(255,255,255,0.4);
  text-align: center;
  min-width: 140px;
  animation: countdown-pulse 0.6s ease-in-out infinite alternate;
}
.countdown-number {
  font-family: 'Fredoka', sans-serif;
  text-shadow: 0 3px 0 rgba(0,0,0,0.3);
}
@keyframes countdown-pulse {
  from { transform: scale(1); box-shadow: 0 8px 0 #991B1B, 0 12px 32px rgba(220, 38, 38, 0.5), inset 0 3px 0 rgba(255,255,255,0.4); }
  to   { transform: scale(1.08); box-shadow: 0 10px 0 #991B1B, 0 16px 40px rgba(220, 38, 38, 0.7), inset 0 3px 0 rgba(255,255,255,0.5); }
}
@keyframes countdown-bounce {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}