/* ==========================================================================
   SISTEMA DE DISEÑO & VARIABLES
   ========================================================================== */
:root {
  /* Paleta de Colores Neo-Tokyo & Sakura (Diseño Premium) */
  --bg-dark: #0a0b10;
  --bg-deep: #050508;
  --panel-bg: rgba(18, 19, 30, 0.65);
  --panel-border: rgba(255, 255, 255, 0.08);
  
  --accent-sakura: #ff7597;      /* Rosa Cerezo */
  --accent-sakura-glow: rgba(255, 117, 151, 0.35);
  --accent-cyan: #00f0ff;        /* Cian Cyberpunk */
  --accent-cyan-glow: rgba(0, 240, 255, 0.35);
  --accent-purple: #8b5cf6;      /* Violeta Eléctrico */
  --accent-purple-glow: rgba(139, 92, 246, 0.3);
  
  --text-primary: #f8f9fc;
  --text-secondary: #a0aec0;
  --text-muted: #64748b;
  
  --state-success: #10b981;      /* Esmeralda */
  --state-success-glow: rgba(16, 185, 129, 0.25);
  --state-error: #ef4444;        /* Coral/Rojo */
  --state-error-glow: rgba(239, 68, 68, 0.25);
  
  --font-display: 'Outfit', sans-serif;
  --font-jp: 'Noto Sans JP', sans-serif;
  
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --glass-blur: blur(12px);
  --border-radius-lg: 20px;
  --border-radius-md: 12px;
  --transition-smooth: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================================================
   RESET & ESTILOS BASE
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-display);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Orbes de Fondo Dinámicos */
.glow-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.2;
  mix-blend-mode: screen;
  animation: floatOrb 12s infinite alternate ease-in-out;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-purple);
  top: -100px;
  right: -50px;
}

.orb-2 {
  width: 600px;
  height: 600px;
  background: var(--accent-sakura);
  bottom: -200px;
  left: -100px;
  animation-delay: -6s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.1); }
}
@keyframes floatSubtle {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.app-container {
  width: 95%;
  max-width: 1200px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  padding: 30px;
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-premium);
  z-index: 10;
  position: relative;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
  margin: 40px auto;
}

/* ==========================================================================
   HEADER DEL JUEGO
   ========================================================================== */
.game-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 25px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.badge-level {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-sakura));
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.game-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  flex-grow: 1;
  margin-left: 15px;
}

/* Estadísticas de Juego (Puntos y Racha) */
.stats-container {
  display: flex;
  gap: 12px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  text-align: center;
  min-width: 90px;
  transition: var(--transition-smooth);
}

.stat-box:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

#streak-box .stat-value {
  color: var(--accent-sakura);
}

/* Barra de Progreso */
.progress-bar-container {
  background: rgba(255, 255, 255, 0.05);
  height: 8px;
  border-radius: 10px;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.game-instruction {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.game-instruction strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ==========================================================================
   TABLERO DE JUEGO & LAYOUT GRID
   ========================================================================== */
.game-board {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 30px;
}

@media (max-width: 768px) {
  .game-board {
    grid-template-columns: 1fr;
  }
  .app-container {
    padding: 24px;
  }
}

.container-title {
  font-size: 1rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  margin-bottom: 20px;
  font-weight: 600;
}

.grid-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ==========================================================================
   ZONA DE DESTINOS (DROP ZONES)
   ========================================================================== */
.drop-zone {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-md);
  padding: 12px 20px;
  min-height: 80px;
  justify-content: space-between;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.drop-zone.drag-over {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.1);
}

.zone-label {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.zone-slot {
  width: 140px;
  height: 56px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition-smooth);
}

/* Estados de Emparejamiento Correcto/Incorrecto */
.drop-zone.matched {
  border-color: var(--state-success);
  border-style: solid;
  background: rgba(16, 185, 129, 0.06);
  box-shadow: 0 0 15px var(--state-success-glow);
}

.drop-zone.matched .zone-label {
  color: var(--state-success);
}

.drop-zone.matched .zone-slot {
  border-color: var(--state-success);
  background: rgba(16, 185, 129, 0.15);
}

.zone-slot .jp-char {
  background: linear-gradient(135deg, #ffffff, var(--state-success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.drop-zone.error-shake {
  animation: shake 0.4s ease-in-out;
  border-color: var(--state-error);
  background: rgba(239, 68, 68, 0.08);
}

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

/* ==========================================================================
   ELEMENTOS ARRASTRABLES (DRAG ITEMS)
   ========================================================================== */
.draggables-container {
  display: flex;
  flex-direction: column;
}

.draggables-wrapper {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 24px;
  border-radius: var(--border-radius-md);
  min-height: 250px;
  align-content: start;
}

@media (max-width: 768px) {
  .draggables-wrapper {
    grid-template-columns: repeat(5, 1fr);
    min-height: auto;
    padding: 16px;
  }
}

.drag-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-md);
  height: 64px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: grab;
  user-select: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              border-color 0.25s, box-shadow 0.25s;
  position: relative;
  touch-action: none; /* Crucial para usar Pointer Events en móviles sin scroll conflict */
}

.drag-item:hover {
  border-color: var(--accent-sakura);
  transform: translateY(-3px);
  box-shadow: 0 8px 16px var(--accent-sakura-glow);
}

.drag-item:active {
  cursor: grabbing;
}

/* Clase añadida durante el arrastre nativo */
.drag-item.dragging {
  opacity: 0.4;
  border-color: var(--accent-purple);
  transform: scale(0.95);
}

.jp-char {
  font-family: var(--font-jp);
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff, var(--accent-sakura));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Estilo del elemento cuando ya está colocado y bloqueado */
.drag-item.placed {
  cursor: default;
  pointer-events: none;
  border-color: var(--state-success);
  background: rgba(16, 185, 129, 0.1);
  box-shadow: none;
  transform: none !important;
}

.drag-item.placed .jp-char {
  background: linear-gradient(135deg, #ffffff, var(--state-success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Elemento fantasma / clon para el arrastre PointerEvent en móvil */
.drag-item.ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  opacity: 0.85;
  border-color: var(--accent-cyan);
  box-shadow: 0 10px 25px var(--accent-cyan-glow);
  transform: scale(1.05);
}

/* ==========================================================================
   BOTONES Y ELEMENTOS DE CONTROL
   ========================================================================== */
.game-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 14px 28px;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-sakura));
  color: white;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.6);
  filter: brightness(1.1);
}

/* Feedback Flotante (Toast de Acierto rápido) */
.feedback-toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(15px);
  z-index: 1000;
  background: rgba(16, 185, 129, 0.95);
  border: 1px solid rgba(16, 185, 129, 0.3);
  backdrop-filter: blur(8px);
  color: white;
  padding: 14px 28px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  pointer-events: none;
}

.feedback-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   MODAL DE VICTORIA (MODAL OVERLAY & CONTENT)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 5, 8, 0.85);
  backdrop-filter: blur(15px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: rgba(18, 19, 30, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 50px 40px;
  border-radius: var(--border-radius-lg);
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), 0 0 80px rgba(139, 92, 246, 0.15);
  transform: scale(0.9) translateY(30px);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.show .modal-content {
  transform: scale(1) translateY(0);
}

.victory-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: bounce 2s infinite alternate ease-in-out;
}

@keyframes bounce {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-15px) scale(1.05); }
}

.modal-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ffffff, var(--accent-sakura));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-desc {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 30px;
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 35px;
}

.m-stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-md);
  padding: 14px;
}

.m-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.m-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.m-stat:last-child .m-val {
  color: var(--accent-sakura);
}

/* ==========================================================================
   SIDEBAR DE MISIONES / NIVELES INTERACTIVO
   ========================================================================== */
.game-main-area {
  display: flex;
  flex-direction: column;
  gap: 30px;
  min-width: 0;
}

.levels-sidebar {
  background: rgba(10, 11, 16, 0.45);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 80vh;
  overflow-y: auto;
  backdrop-filter: var(--glass-blur);
}

.levels-sidebar::-webkit-scrollbar {
  width: 6px;
}
.levels-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.levels-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}
.levels-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 15px;
}

.sidebar-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-close-sidebar {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-smooth);
}

.btn-close-sidebar:hover {
  color: var(--accent-sakura);
  transform: scale(1.1);
}

.levels-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Tarjeta de Nivel Individual */
.level-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.level-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateX(4px);
}

.level-item.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.08), rgba(139, 92, 246, 0.08));
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

.level-num {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition-smooth);
}

.level-item.active .level-num {
  color: #000;
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

.level-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.level-item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition-smooth);
}

.level-item.active .level-item-title {
  color: var(--text-primary);
}

.level-chars {
  font-family: var(--font-jp);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
  transition: var(--transition-smooth);
}

.level-item.active .level-chars {
  color: var(--accent-sakura);
}

.level-status-icon {
  font-size: 0.85rem;
  font-weight: 900;
  color: transparent;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.level-status-icon.completed {
  color: var(--state-success);
  text-shadow: 0 0 6px var(--state-success-glow);
}

/* Botón flotante móvil */
.btn-sidebar-toggle {
  display: none;
  background: rgba(18, 19, 30, 0.85);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: var(--border-radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 5px;
  box-shadow: var(--shadow-premium);
  transition: var(--transition-smooth);
}

.btn-sidebar-toggle:hover {
  background: rgba(18, 19, 30, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
}

.active-mission-tag {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #000;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
}

/* Backdrop */
.sidebar-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 8, 0.7);
  backdrop-filter: blur(5px);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  border-radius: var(--border-radius-lg);
  transition: var(--transition-smooth);
}

.sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   MEDIA QUERIES PARA ADAPTABILIDAD RESPONSIVA
   ========================================================================== */
@media (max-width: 992px) {
  .app-container {
    grid-template-columns: 1fr;
    padding: 24px;
    margin: 20px auto;
  }
  
  .btn-sidebar-toggle {
    display: flex;
  }
  
  .levels-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    max-height: 100vh;
    z-index: 200;
    background: rgba(10, 11, 16, 0.96);
    backdrop-filter: blur(25px);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.8);
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    padding: 30px 20px;
    transition: var(--transition-smooth);
  }
  
  .levels-sidebar.open {
    left: 0;
  }
  
  .btn-close-sidebar {
    display: block;
  }
}

/* ==========================================================================
   ESTILOS DE INTRODUCCIÓN EXPLICATIVA (TEORÍA)
   ========================================================================== */
.intro-card-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 10px 0;
}

/* ==========================================================================
   ESTILOS DE NIVEL 0 (INTRODUCCIÓN N5)
   ========================================================================== */
.intro-story-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 20px 0;
  min-height: 400px;
}

.intro-story-layout {
  display: flex;
  align-items: flex-end;
  gap: 30px;
  max-width: 800px;
  width: 100%;
  animation: fadeIn 0.5s ease-out;
}

.intro-mascot-area {
  flex-shrink: 0;
  width: 200px;
}

.intro-mascot-img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.4));
  animation: floatSubtle 4s infinite alternate ease-in-out;
}

.intro-dialog-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 15px;
}

.dialog-bubble {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px 20px 20px 0;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 20px rgba(139, 92, 246, 0.2);
  backdrop-filter: blur(10px);
  position: relative;
  width: 100%;
}

.dialog-bubble::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -20px;
  border-width: 0 20px 20px 0;
  border-style: solid;
  border-color: transparent rgba(30, 41, 59, 0.95) transparent transparent;
  filter: drop-shadow(-1px 1px 0px rgba(255, 255, 255, 0.15));
}

.dialog-bubble p {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0;
}

.dialog-bubble.fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

.btn-next-dialog {
  align-self: flex-end;
  font-size: 1.1rem;
  padding: 12px 25px;
  border-radius: 30px;
  background: linear-gradient(135deg, var(--accent-cyan), #00b0ff);
  box-shadow: 0 5px 15px rgba(0, 240, 255, 0.3);
  transition: all 0.3s ease;
}

.btn-next-dialog:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 240, 255, 0.5);
}

@media (max-width: 768px) {
  .intro-story-layout {
    flex-direction: column;
    align-items: center;
  }
  .intro-mascot-area {
    width: 150px;
    margin-bottom: -15px;
  }
  .dialog-bubble {
    border-radius: 20px;
  }
  .dialog-bubble::before {
    left: 50%;
    transform: translateX(-50%);
    bottom: 100%;
    border-width: 0 15px 15px 15px;
    border-color: transparent transparent rgba(30, 41, 59, 0.95) transparent;
  }
}


.intro-card {
  background: linear-gradient(135deg, rgba(18, 19, 30, 0.8) 0%, rgba(10, 11, 16, 0.8) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  max-width: 600px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(139, 92, 246, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
  animation: fadeIn 0.5s ease-out;
}

.intro-icon {
  font-size: 4rem;
  animation: floatSubtle 4s infinite alternate ease-in-out;
}

.intro-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.intro-subtitle {
  font-size: 1.1rem;
  color: var(--accent-sakura);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.intro-text {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
  text-align: justify;
}

.btn-start-practice {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #000;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 16px 36px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0, 240, 255, 0.35);
  transition: var(--transition-smooth);
}

.btn-start-practice:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0, 240, 255, 0.5);
  filter: brightness(1.1);
}

/* ==========================================================================
   ESTILOS DE DESAFÍO DE ESCRITURA / VOCABULARIO
   ========================================================================== */
.writing-challenge-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
  animation: fadeIn 0.4s ease-out;
}

/* Tarjeta del Vocablo */
.word-card-display {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-premium);
}

.word-emoji-box {
  font-size: 3.5rem;
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.word-text-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.word-meaning {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  background: linear-gradient(to right, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.word-romaji {
  font-size: 1.1rem;
  color: var(--accent-sakura);
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Slots de letras */
.writing-slots-container {
  background: rgba(0,0,0,0.12);
  border: 1px solid rgba(255,255,255,0.02);
  padding: 20px;
  border-radius: var(--border-radius-md);
  text-align: center;
}

.writing-slots {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 10px 0;
  min-height: 70px;
}

.writing-slot {
  width: 60px;
  height: 66px;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-md);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-jp);
  font-size: 1.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.01);
  color: var(--text-primary);
  transition: var(--transition-smooth);
}

.writing-slot.filled {
  border: 2px solid var(--accent-cyan);
  background: rgba(0, 240, 255, 0.04);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
  animation: popLetter 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.writing-slot.success {
  border-color: var(--state-success);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 15px var(--state-success-glow);
}

.writing-slot.error {
  border-color: var(--state-error);
  background: rgba(239, 68, 68, 0.08);
  box-shadow: 0 0 15px var(--state-error-glow);
  animation: shake 0.4s ease-in-out;
}

@keyframes popLetter {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* Controles de Deletreo */
.writing-controls {
  display: flex;
  gap: 16px;
}

.btn-mic-challenge {
  flex-grow: 1;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), rgba(139, 92, 246, 0.1));
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-mic-challenge:hover {
  background: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 20px var(--accent-cyan-glow);
}

.btn-mic-challenge.recording {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--state-error);
  color: #ff8888;
  animation: pulseRecording 1.5s infinite;
}

@keyframes pulseRecording {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.btn-clear-spelling {
  font-weight: 600;
  border-color: rgba(239, 68, 68, 0.2);
  color: #ff9999;
  background: rgba(239, 68, 68, 0.05);
}

.btn-clear-spelling:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ff6666;
  border-color: rgba(239, 68, 68, 0.35);
}

/* Indicador de Estado de Voz */
.voice-status-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 18px;
  border-radius: var(--border-radius-md);
  margin-top: 14px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
  width: 100%;
  justify-content: center;
  backdrop-filter: var(--glass-blur);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.02);
}

.voice-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 6px var(--text-muted);
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.voice-status-container.recording {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.03);
  color: #ff9999;
}

.voice-status-container.recording .voice-status-dot {
  background: var(--state-error);
  box-shadow: 0 0 10px var(--state-error);
  animation: pulse-dot 1.5s infinite;
}

.voice-status-container.processing {
  border-color: rgba(0, 240, 255, 0.25);
  background: rgba(0, 240, 255, 0.03);
  color: #cceeff;
}

.voice-status-container.processing .voice-status-dot {
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  animation: pulse-dot 1s infinite;
}

.voice-status-container.success {
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.03);
  color: #a7f3d0;
}

.voice-status-container.success .voice-status-dot {
  background: var(--state-success);
  box-shadow: 0 0 10px var(--state-success);
}

.voice-status-container.error {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.03);
  color: #fca5a5;
}

.voice-status-container.error .voice-status-dot {
  background: var(--state-error);
  box-shadow: 0 0 10px var(--state-error);
}

@keyframes pulse-dot {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.voice-warning-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
  line-height: 1.4;
  opacity: 0.8;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
}

/* Pool de Letras */
.writing-pool-container {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 24px;
  border-radius: var(--border-radius-md);
  text-align: center;
}

.writing-tiles-pool {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 15px;
}

.writing-tile {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-md);
  width: 56px;
  height: 56px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-jp);
  font-size: 1.6rem;
  font-weight: 700;
  transition: var(--transition-smooth);
}

.writing-tile:hover {
  border-color: var(--accent-sakura);
  transform: translateY(-3px);
  box-shadow: 0 8px 16px var(--accent-sakura-glow);
}

.writing-tile:active {
  transform: scale(0.95);
}

.writing-tile.used {
  opacity: 0.25;
  pointer-events: none;
  border-color: rgba(255,255,255,0.05);
  box-shadow: none;
  transform: none;
}

/* ==========================================================================
   DISEÑO ESPECIAL PARA LOS ITEMS DE VOCABULARIO EN EL SIDEBAR
   ========================================================================== */
.level-item.activity {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(255, 117, 151, 0.02) 100%);
  border-color: rgba(139, 92, 246, 0.15);
}

.level-item.activity:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(255, 117, 151, 0.04) 100%);
  border-color: rgba(139, 92, 246, 0.3);
}

.level-item.activity.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(255, 117, 151, 0.12) 100%);
  border-color: var(--accent-sakura);
  box-shadow: 0 0 15px rgba(255, 117, 151, 0.2);
}

.level-item.activity .level-num {
  border-color: rgba(139, 92, 246, 0.2);
  color: var(--accent-sakura);
  background: rgba(139, 92, 246, 0.06);
}

.level-item.activity.active .level-num {
  color: #000;
  background: var(--accent-sakura);
  border-color: var(--accent-sakura);
  box-shadow: 0 0 8px var(--accent-sakura);
}

.level-item.activity .level-item-title {
  color: #bfaaff;
}

.level-item.activity.active .level-item-title {
  color: var(--text-primary);
}

/* Animación general de fundido */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
}

/* Espectro de Audio en Botón Micrófono */
.mic-visualizer {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
  margin-left: 12px;
}

.visualizer-bar {
  width: 3px;
  height: 14px;
  background-color: #00f0ff;
  border-radius: 3px;
  transform-origin: bottom;
  transform: scaleY(0.2);
  transition: transform 0.05s ease;
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.5);
}

.btn-mic-challenge.recording .mic-visualizer {
  display: inline-flex !important;
}

/* ==========================================================================
   ESTILOS DE TRIVIA / SELECCIÓN MÚLTIPLE (choice)
   ========================================================================== */
.choice-challenge-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
  animation: fadeIn 0.4s ease-out;
}

.memory-challenge-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
  animation: fadeIn 0.4s ease-out;
}

.choice-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 25px;
}

@media (max-width: 576px) {
  .choice-options-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.btn-choice-option {
  font-family: var(--font-jp), sans-serif;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--border-radius-md);
  padding: 22px 30px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 75px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
  backdrop-filter: var(--glass-blur);
}

.btn-choice-option:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  box-shadow: 0 8px 25px rgba(0, 240, 255, 0.18);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.btn-choice-option:active {
  transform: scale(0.98);
}

.btn-choice-option.correct {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(16, 185, 129, 0.08) 100%) !important;
  border-color: var(--state-success) !important;
  color: #a7f3d0 !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.35) !important;
  animation: successPulse 0.4s ease-out;
}

.btn-choice-option.incorrect {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0.08) 100%) !important;
  border-color: var(--state-error) !important;
  color: #fca5a5 !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.35) !important;
  animation: choiceShake 0.4s ease-in-out;
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

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

/* ==========================================================================
   ESTILOS DE JUEGO DE MEMORIA (memory)
   ========================================================================== */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 600px;
  margin: 25px auto;
  perspective: 1000px;
}

@media (max-width: 576px) {
  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}

.memory-card {
  aspect-ratio: 3 / 4;
  height: auto;
  cursor: pointer;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.2), box-shadow 0.3s;
  border-radius: var(--border-radius-md);
}

.memory-card:active {
  transform: scale(0.95);
}

.memory-card.flipped {
  transform: rotateY(180deg);
}

.memory-card.matched {
  transform: rotateY(180deg) scale(0.98);
  pointer-events: none;
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--border-radius-md);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-back {
  background: linear-gradient(135deg, #181926 0%, #0a0b10 100%);
  border: 2px solid rgba(0, 240, 255, 0.25);
  /* Kitsune sticker happy background */
  background-image: url('../kitsune/sticker_happy.png');
  background-size: 70% auto;
  background-position: center;
  background-repeat: no-repeat;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.memory-card:hover .card-back {
  border-color: var(--accent-cyan);
  box-shadow: inset 0 0 15px rgba(0, 240, 255, 0.25), 0 0 20px rgba(0, 240, 255, 0.2);
  background-image: url('../kitsune/sticker_excited.png'); /* switch zorro to excited state on hover! */
  background-size: 75% auto;
}

.card-front {
  background: linear-gradient(135deg, rgba(25, 27, 41, 0.95) 0%, rgba(13, 14, 20, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transform: rotateY(180deg);
  font-size: 1.4rem;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  word-break: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-front.jp-text {
  font-family: var(--font-jp);
  font-size: 2.6rem;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.memory-card.matched .card-front {
  border-color: var(--state-success) !important;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0.05) 100%) !important;
  color: #a7f3d0 !important;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.28) !important;
}

/* ==========================================================================
   MÓDULO DE HISTORIA EVOLUTIVA & KANJI ORIGIN
   ========================================================================== */
.history-challenge-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.4s ease;
}

.history-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.history-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.history-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.history-tab-btn.active {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-sakura));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.history-tab-btn.completed {
  border-color: var(--state-success);
  position: relative;
}

.history-tab-btn.completed::after {
  content: '✓';
  position: absolute;
  top: -4px;
  right: -2px;
  background: var(--state-success);
  color: white;
  font-size: 0.65rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.evolution-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-lg);
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: var(--transition-smooth);
}

.evolution-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
}

.evolution-char-sound {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
}

.evolution-title {
  font-size: 1.4rem;
  font-weight: 700;
}

.evolution-title span {
  font-family: var(--font-jp);
  color: var(--accent-sakura);
}

.evolution-display {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(0, 0, 0, 0.2);
  padding: 20px;
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.evolution-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  flex: 1;
}

.evolution-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.evolution-char {
  font-size: 3rem;
  font-weight: 700;
  font-family: var(--font-jp);
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

#stage-kanji .evolution-char {
  background: linear-gradient(135deg, #fff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#stage-cursive .evolution-char {
  font-family: 'Georgia', 'KaiTi', 'YuMincho', serif;
  font-style: italic;
  font-weight: normal;
  opacity: 0.8;
  background: linear-gradient(135deg, var(--accent-purple), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#stage-kana .evolution-char {
  background: linear-gradient(135deg, #fff, var(--accent-sakura));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 15px rgba(255, 117, 151, 0.2);
}

.evolution-meaning {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.evolution-arrow {
  font-size: 1.5rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* Morph Slider y Caja de Vista Previa */
.morph-slider-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 20px;
  border-radius: var(--border-radius-md);
}

.slider-instruction {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 15px;
}

.slider-wrapper span {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.evolution-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
  transition: background 0.3s;
}

.evolution-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-sakura));
  border-radius: 5px;
}

.evolution-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent-sakura);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 117, 151, 0.8);
  margin-top: -7px;
  transition: transform 0.1s;
}

.evolution-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.morph-preview-box {
  width: 120px;
  height: 120px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  margin: 15px auto 0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.morph-preview-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 80%);
  z-index: 1;
  pointer-events: none;
}

.morph-layer {
  position: absolute;
  font-size: 4rem;
  font-weight: 700;
  font-family: var(--font-jp);
  transition: opacity 0.1s ease;
  user-select: none;
}

.layer-kanji {
  color: rgba(255, 255, 255, 0.9);
}

.layer-cursive {
  font-family: 'Georgia', 'KaiTi', 'YuMincho', serif;
  font-style: italic;
  font-weight: normal;
  color: var(--accent-purple);
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.layer-kana {
  color: var(--accent-sakura);
  text-shadow: 0 0 15px rgba(255, 117, 151, 0.6);
}

.evolution-description {
  font-size: 0.98rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Cuestionario Histórico */
.hq-target-kana-display {
  font-family: var(--font-jp);
  font-size: 6.5rem;
  font-weight: 800;
  text-align: center;
  margin: 20px auto;
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
  color: #fff;
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  animation: floatSubtle 4s infinite alternate ease-in-out;
}

/* ==========================================================================
   LABORATORIO DAKUON (MESA DE MEZCLAS MECÁNICA)
   ========================================================================== */
.dakuon-lab-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
  animation: fadeIn 0.4s ease;
}

.dakuon-lab-panel {
  background: linear-gradient(135deg, rgba(20, 21, 33, 0.8) 0%, rgba(10, 11, 16, 0.9) 100%);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-lg);
  padding: 25px;
  box-shadow: var(--shadow-premium), 0 0 30px rgba(0, 240, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.dakuon-lab-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple), var(--accent-sakura));
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.panel-status-led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #555;
  box-shadow: 0 0 2px #000;
  transition: var(--transition-smooth);
}

.panel-status-led.on {
  background-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan), 0 0 20px var(--accent-cyan);
}

.panel-title-text {
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-primary);
}

.panel-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 25px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .panel-layout {
    grid-template-columns: 1fr;
  }
}

/* Pantalla del Tubo CRT / Visualizador de Carácter */
.panel-display-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-md);
  padding: 20px;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.tube-display {
  display: flex;
  position: relative;
  width: 120px;
  height: 120px;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
}

.tube-char {
  font-family: var(--font-jp);
  font-size: 5rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
  transition: var(--transition-smooth);
}

.tube-char.voiced {
  color: var(--accent-cyan);
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.5), 0 0 40px rgba(0, 240, 255, 0.3);
}

.tube-dakuten {
  font-family: var(--font-jp);
  font-size: 4rem;
  font-weight: 800;
  position: absolute;
  top: 5px;
  right: -5px;
  color: var(--accent-cyan);
  opacity: 0;
  transform: scale(0.5) translate(-10px, 10px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tube-dakuten.visible {
  opacity: 1;
  transform: scale(1) translate(0, 0);
  text-shadow: 0 0 15px var(--accent-cyan), 0 0 30px var(--accent-cyan);
}

.vibrate-effect {
  animation: vibrateLetter 0.15s infinite alternate ease-in-out;
}

@keyframes vibrateLetter {
  0% { transform: translate(-2px, -1px) rotate(-1deg); }
  100% { transform: translate(2px, 1px) rotate(1deg); }
}

.tube-display-sub {
  text-align: center;
}

.sound-romaji-label {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.vocal-state-tag {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Controles de Mesa de Mezclas */
.panel-controls-section {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 20px;
}

.control-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.control-label.font-title {
  font-weight: 700;
  color: var(--text-secondary);
}

.mixing-slider-container {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 15px;
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Switch Mecánico Digital */
.switch-mechanical {
  position: relative;
  display: inline-block;
  width: 80px;
  height: 40px;
  margin: 5px 0;
}

.switch-mechanical input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 40px;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 28px;
  width: 28px;
  left: 4px;
  bottom: 4px;
  background-color: #718096;
  transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1.25);
  border-radius: 50%;
  box-shadow: 0 4px 6px rgba(0,0,0,0.4);
}

.switch-mechanical input:checked + .switch-slider {
  border-color: var(--accent-cyan);
  background-color: rgba(0, 240, 255, 0.08);
}

.switch-mechanical input:checked + .switch-slider:before {
  transform: translateX(40px);
  background-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan), 0 0 20px var(--accent-cyan);
}

.switch-status-label {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.switch-status-label.active {
  color: var(--accent-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

/* Osciloscopio */
.oscilloscope-container {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 12px;
  border-radius: var(--border-radius-md);
}

.oscilloscope-screen {
  height: 60px;
  background-color: #04080a;
  border: 2px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 15px rgba(0, 240, 255, 0.1);
}

.oscilloscope-screen::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(0, 240, 255, 0.04) 1px, transparent 1px),
              linear-gradient(90deg, rgba(0, 240, 255, 0.04) 1px, transparent 1px);
  background-size: 8px 8px;
  top: 0;
  left: 0;
  pointer-events: none;
}

.oscilloscope-wave {
  position: absolute;
  left: 0;
  width: 200%;
  height: 100%;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="60" viewBox="0 0 200 60"><path d="M 0 30 Q 25 30 50 30 T 100 30 T 150 30 T 200 30" fill="none" stroke="%2300f0ff" stroke-width="1.5" opacity="0.3"/></svg>');
  background-repeat: repeat-x;
  background-position: center;
  top: 0;
  transform: translate3d(0, 0, 0);
  transition: background-image 0.3s;
}

.oscilloscope-wave.active {
  animation: moveWave 1s infinite linear;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="60" viewBox="0 0 200 60"><path d="M 0 30 Q 12.5 10 25 30 T 50 30 T 75 30 T 100 30 T 112.5 10 125 30 T 150 30 T 175 30 T 200 30" fill="none" stroke="%2300f0ff" stroke-width="2" /></svg>');
}

@keyframes moveWave {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-100px, 0, 0); }
}

.panel-explanation {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 15px;
}

/* Rompecabezas Dakuten */
.dakuten-puzzle-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-lg);
  padding: 25px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.puzzle-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-sakura);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.puzzle-instruction {
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
  max-width: 550px;
}

.puzzle-word-display {
  display: flex;
  gap: 20px;
  margin: 15px 0;
}

.puzzle-letter-slot {
  position: relative;
  width: 90px;
  height: 90px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-md);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-jp);
  font-size: 3rem;
  font-weight: 700;
  transition: var(--transition-smooth);
}

.puzzle-letter-slot .puzzle-char-base {
  background: linear-gradient(135deg, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dakuten-drop-slot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 32px;
  height: 32px;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.4rem;
  color: transparent;
  transition: var(--transition-smooth);
}

.dakuten-drop-slot.drag-over {
  border-color: var(--accent-sakura);
  background: rgba(255, 117, 151, 0.1);
}

.dakuten-drop-slot.filled {
  border-style: solid;
  border-color: var(--accent-sakura);
  color: var(--accent-sakura);
  text-shadow: 0 0 8px var(--accent-sakura);
  background: rgba(255, 117, 151, 0.05);
}

.puzzle-letter-slot.solved {
  border-color: var(--state-success);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.puzzle-letter-slot.solved .puzzle-char-base {
  background: linear-gradient(135deg, #ffffff, var(--state-success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.puzzle-letter-slot.solved .dakuten-drop-slot {
  border-color: var(--state-success);
  color: var(--state-success);
  text-shadow: 0 0 8px var(--state-success);
}

.puzzle-draggable-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(255,255,255,0.08);
  padding: 15px 25px;
  border-radius: var(--border-radius-md);
  margin-top: 5px;
}

.draggable-dakuten {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-jp);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-primary);
  cursor: grab;
  user-select: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  touch-action: none;
}

.draggable-dakuten:hover {
  transform: translateY(-2px);
  border-color: var(--accent-sakura);
  box-shadow: 0 6px 14px var(--accent-sakura-glow);
}

.draggable-dakuten:active {
  cursor: grabbing;
}



/* Card Quiz */
.card-quiz-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: center;
  width: 100%;
}
.card-deck-area {
  position: relative;
  width: 180px;
  height: 240px;
  perspective: 1000px;
}
.kanji-card {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(30,32,45,0.9), rgba(18,20,32,0.95));
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 15px 35px rgba(0,0,0,0.6), inset 0 0 20px rgba(255,255,255,0.05);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 6.5rem;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text-primary);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1), opacity 0.4s ease;
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: center 120%;
}
.kanji-card.swipe-right {
  transform: translateX(180px) rotate(25deg);
  opacity: 0;
}
.kanji-card.swipe-left {
  transform: translateX(-180px) rotate(-25deg);
  opacity: 0;
}
.kanji-card.enter {
  animation: cardEnter 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}
@keyframes cardEnter {
  0% { transform: translateY(-40px) scale(0.85); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.card-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  width: 100%;
  max-width: 550px;
}


/* =========================================
   TARJETAS FLASH (KANJI MOVIMIENTO)
========================================= */
.card-quiz-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

.card-deck-area {
  perspective: 1000px;
  width: 250px;
  height: 350px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.kanji-card {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 15px 35px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s;
  position: relative;
  overflow: hidden;
}

.kanji-card::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.1), transparent);
  transform: skewX(-20deg);
  animation: cardShine 3s infinite;
}

@keyframes cardShine {
  0% { left: -100%; }
  20% { left: 200%; }
  100% { left: 200%; }
}

.card-kanji {
  font-size: 8rem;
  color: #fff;
  font-family: 'Noto Sans JP', sans-serif;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.kanji-card.enter {
  animation: cardEnter 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.kanji-card.swipe-right {
  transform: translateX(150%) rotate(20deg);
  opacity: 0;
}

@keyframes cardEnter {
  0% { transform: translateY(50px) scale(0.8); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.card-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  width: 100%;
  max-width: 500px;
}

.card-options-grid .choice-option {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: 12px;
  color: #e2e8f0;
  font-size: 1.1rem;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.card-options-grid .choice-option:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.card-options-grid .choice-option.correct {
  background: rgba(46, 213, 115, 0.2);
  border-color: #2ed573;
  color: #2ed573;
}

.card-options-grid .choice-option.wrong {
  background: rgba(255, 71, 87, 0.2);
  border-color: #ff4757;
  color: #ff4757;
}

.choice-feedback {
  min-height: 24px;
  font-size: 1.2rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
}
.choice-feedback.show { opacity: 1; }
.choice-feedback.success { color: #2ed573; }
.choice-feedback.error { color: #ff4757; }
