/* =============================================
   RESET
   ============================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* =============================================
   CSS VARIABLES
   ============================================= */
:root {
  --bg-dark:          #0B0F1A;
  --bg-mid:           #111827;
  --bg-light:         #0F172A;

  --accent:           #6366F1;
  --accent-dark:      #4F46E5;
  --accent-light:     #A5B4FC;
  --purple:           #7C3AED;

  --success:          #22C55E;
  --success-light:    #4ADE80;
  --danger:           #EF4444;
  --danger-light:     #F87171;

  --text-primary:     #E2E8F0;
  --text-secondary:   #94A3B8;
  --text-muted:       #475569;

  --border:           rgba(255, 255, 255, 0.08);
  --bg-card:          rgba(255, 255, 255, 0.04);
  --bg-input:         rgba(255, 255, 255, 0.05);

  --potencias:        #F59E0B;
  --inecRacional:     #3B82F6;
  --inecCuadratica:   #8B5CF6;
  --modulo:           #EC4899;
  --complejos:        #A78BFA;
  --rectas:           #10B981;
  --intervalos:       #06B6D4;
  --circunferencia:   #F97316;
}

/* =============================================
   BASE
   ============================================= */
html {
  scroll-behavior: smooth;
}

body {
  background: linear-gradient(160deg, #0B0F1A 0%, #111827 40%, #0F172A 100%);
  font-family: 'Outfit', sans-serif;
  color: #E2E8F0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* =============================================
   LAYOUT LAYERS
   ============================================= */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#cursor-glow {
  position: fixed;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.12) 0%,
    rgba(124, 58, 237, 0.06) 30%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
}

#app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0);    }
}

@keyframes float {
  0%, 100% { transform: translateY(0);    }
  50%       { transform: translateY(-8px); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1);    }
}

@keyframes shimmer {
  0%   { background-position: 0%   center; }
  100% { background-position: 200% center; }
}

/* =============================================
   SCREENS
   ============================================= */
.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 20px;
  max-width: 600px;
  margin: 0 auto;
  animation: fadeIn 0.5s ease;
}

.screen-welcome,
.screen-register {
  justify-content: center;
  min-height: 100vh;
  text-align: center;
}

/* =============================================
   TITLE
   ============================================= */
.title-main {
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #E2E8F0 0%, #A5B4FC 50%, #E2E8F0 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
}

/* =============================================
   FORM
   ============================================= */
.form-group {
  width: 100%;
  max-width: 380px;
  margin-bottom: 10px;
  text-align: left;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #94A3B8;
  margin-bottom: 3px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #F1F5F9;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-group select option {
  background: #1E293B;
}

.form-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 380px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* =============================================
   PROGRESS BAR
   ============================================= */
.progress-bar {
  display: flex;
  gap: 4px;
  width: 100%;
}

.progress-bar > * {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  transition: background 0.3s;
}

/* =============================================
   CATEGORY BADGE
   ============================================= */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}

/* =============================================
   OPTION BUTTONS
   ============================================= */
.option-btn {
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #E2E8F0;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
  animation: fadeInScale 0.3s ease both;
}

.option-btn:nth-child(1) { animation-delay: 0s;     }
.option-btn:nth-child(2) { animation-delay: 0.05s;  }
.option-btn:nth-child(3) { animation-delay: 0.1s;   }
.option-btn:nth-child(4) { animation-delay: 0.15s;  }

@media (hover: hover) {
  .option-btn:hover {
    background: rgba(255, 255, 255, 0.07);
  }
}

.option-btn.selected {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.08);
}

.option-btn.correct {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.12);
  color: #4ADE80;
}

.option-btn.incorrect {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
  color: #F87171;
}

.option-btn[disabled] {
  cursor: default;
  pointer-events: none;
}

/* =============================================
   OPTION LETTER
   ============================================= */
.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn-primary {
  padding: 14px 40px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: white;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
}

.btn-primary:disabled {
  background: rgba(255, 255, 255, 0.06);
  color: #475569;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 40%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 60%
  );
  background-size: 200%;
  animation: shimmer 3s infinite;
}

.btn-secondary {
  padding: 14px 40px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: #CBD5E1;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* =============================================
   EXPLANATION BOX
   ============================================= */
.explanation-box {
  padding: 16px 18px;
  border-radius: 14px;
  animation: fadeIn 0.3s;
  margin-top: 16px;
  max-height: 280px;
  overflow-y: auto;
}

.explanation-box.correct-bg {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.explanation-box.incorrect-bg {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* =============================================
   RESULT ROW
   ============================================= */
.result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  width: 100%;
  animation: fadeInScale 0.3s ease both;
}

/* =============================================
   STARS
   ============================================= */
.stars-container {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.star-btn {
  font-size: 32px;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s;
  filter: grayscale(1) opacity(0.4);
}

.star-btn.active {
  filter: none;
  opacity: 1;
  transform: scale(1.1);
}

.star-btn:hover {
  transform: scale(1.2);
}

/* =============================================
   TIP BOX
   ============================================= */
.tip-box {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 14px;
  padding: 14px 18px;
  text-align: left;
  width: 100%;
  max-width: 480px;
}

/* =============================================
   FOOTER
   ============================================= */
.footer-text {
  padding: 24px 20px;
  font-size: 11px;
  color: #475569;
  text-align: center;
  line-height: 1.6;
}

/* =============================================
   KATEX
   ============================================= */
.katex {
  font-size: 1em !important;
}

.katex-display {
  margin: 8px 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
}

/* =============================================
   RESPONSIVE — mobile
   ============================================= */
@media (max-width: 480px) {
  .screen {
    padding: 16px 14px;
  }

  .option-btn {
    padding: 12px 14px;
    font-size: 14px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}
