/* Morfotron 2000 - Estilos visuales modernos, gamificados y accesibles */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-dark: #0b0f19;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #0b0f19 55%, #05070d 100%);
  min-height: 100vh;
  color: #f1f5f9;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Glassmorphism containers */
.glass-panel {
  background: rgba(17, 24, 39, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.5), 0 10px 15px -5px rgba(0, 0, 0, 0.3);
}

.glass-card {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Home Interactive Cards */
.mode-card {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.mode-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 30px -10px rgba(79, 70, 229, 0.35);
}

.mode-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  transition: left 0.6s ease;
}

.mode-card:hover::before {
  left: 100%;
}

/* Slogan Glow Effect */
.slogan-glow {
  text-shadow: 0 0 25px rgba(244, 63, 94, 0.4), 0 0 50px rgba(99, 102, 241, 0.3);
}

/* Letras y Cortador Interactivo */
.letter-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.85rem;
  height: 3.65rem;
  font-size: 1.9rem;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  border-radius: 0.65rem;
  box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.letter-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px -2px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

@media (max-width: 640px) {
  .letter-box {
    width: 2.1rem;
    height: 2.85rem;
    font-size: 1.4rem;
    border-radius: 0.45rem;
  }
}

/* Botón separador / corte */
.cut-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 3.65rem;
  margin: 0 2px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  border: none;
  outline: none;
  border-radius: 6px;
}

@media (max-width: 640px) {
  .cut-btn {
    width: 1.2rem;
    height: 2.85rem;
  }
}

.cut-btn::before {
  content: '';
  position: absolute;
  width: 3px;
  height: 55%;
  background: rgba(148, 163, 184, 0.25);
  border-radius: 3px;
  transition: all 0.2s ease;
}

.cut-btn:hover::before {
  height: 85%;
  background: #a5b4fc;
  box-shadow: 0 0 10px #6366f1;
}

.cut-btn.is-cut {
  background: rgba(99, 102, 241, 0.2);
}

.cut-btn.is-cut::before {
  width: 4px;
  height: 95%;
  background: #818cf8;
  box-shadow: 0 0 12px #6366f1, 0 0 24px rgba(99, 102, 241, 0.6);
}

.cut-btn.is-cut::after {
  content: '✂';
  position: absolute;
  top: -14px;
  font-size: 0.9rem;
  color: #a5b4fc;
  filter: drop-shadow(0 0 6px #4f46e5);
  animation: cut-pop 0.25s ease-out;
}

@keyframes cut-pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

/* Morfema Cero Bloque */
.zero-morpheme-pill {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #ffffff;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.5);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(124, 58, 237, 0.4); transform: scale(1); }
  50% { box-shadow: 0 0 18px rgba(124, 58, 237, 0.8); transform: scale(1.03); }
}

/* Segmentos cortados (Fase de etiquetado) */
.segment-card {
  transition: all 0.25s ease;
  border: 2px solid rgba(255, 255, 255, 0.08);
}

.segment-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.segment-card.is-correct {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.15) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.35);
}

.segment-card.is-warning {
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.15) !important;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
}

.segment-card.is-error {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.15) !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.35);
}

/* Colores semánticos para etiquetas de formantes */
.tag-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 0.375rem;
}

.tag-raiz { background: rgba(59, 130, 246, 0.2); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.4); }
.tag-prefijo { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.4); }
.tag-sufijo { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }
.tag-interfijo { background: rgba(249, 115, 22, 0.2); color: #fdba74; border: 1px solid rgba(249, 115, 22, 0.4); }
.tag-vt { background: rgba(234, 179, 8, 0.2); color: #fde047; border: 1px solid rgba(234, 179, 8, 0.4); }
.tag-genero { background: rgba(236, 72, 153, 0.2); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.4); }
.tag-numero { background: rgba(244, 63, 94, 0.2); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.4); }
.tag-tam { background: rgba(14, 165, 233, 0.2); color: #7dd3fc; border: 1px solid rgba(14, 165, 233, 0.4); }
.tag-np { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.4); }
.tag-participio { background: rgba(20, 184, 166, 0.2); color: #5eead4; border: 1px solid rgba(20, 184, 166, 0.4); }
.tag-enclitico { background: rgba(100, 116, 139, 0.25); color: #cbd5e1; border: 1px solid rgba(100, 116, 139, 0.4); }

/* Indicador de Rango de Alumno / Gamificación */
.rank-badge {
  background: linear-gradient(90deg, #ec4899, #8b5cf6, #3b82f6);
  background-size: 200% 200%;
  animation: gradient-flow 3s ease infinite;
}

@keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Floating score popup */
.floating-score {
  position: fixed;
  font-family: monospace;
  font-weight: 900;
  font-size: 2.2rem;
  color: #34d399;
  text-shadow: 0 0 15px rgba(52, 211, 153, 0.8), 0 0 30px rgba(16, 185, 129, 0.5);
  pointer-events: none;
  z-index: 10000;
  animation: float-up-fade 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes float-up-fade {
  0% { opacity: 0; transform: translateY(20px) scale(0.6); }
  25% { opacity: 1; transform: translateY(-10px) scale(1.15); }
  75% { opacity: 1; transform: translateY(-50px) scale(1); }
  100% { opacity: 0; transform: translateY(-90px) scale(0.8); }
}

/* Confetti overlay */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* Animaciones */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes pop {
  0% { transform: scale(0.9); opacity: 0; }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.pop-in {
  animation: pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Barra de progreso arcade */
.timer-bar-fill {
  transition: width 1s linear, background-color 0.5s ease;
}

/* Scrollbar estilizado */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.7);
}
