/* WortSpark - Estilos Principales y Animaciones EdTech */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --primary: #18181b;
  --primary-hover: #27272a;
  --accent-gold: #f59e0b;
  --accent-crimson: #dc2626;
  --der-color: #2563eb;
  --die-color: #e11d48;
  --das-color: #059669;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

/* Evitar zoom accidental en doble toque en botones táctiles de tablet */
button, input, select, .memory-card, .german-key {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Ocultar scrollbars nativos en barras de navegación horizontales */
.scrollbar-none,
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-none::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ========================================================
   TARJETAS 3D (FLASHCARDS) - ESTRUCTURA ROBUSTA ANTI-DEFORMACIÓN
   ======================================================== */
.flashcard-box {
  width: 100%;
  max-width: 520px;
  height: 350px;
  min-height: 350px;
  margin: 0 auto;
  perspective: 1200px;
  -webkit-perspective: 1200px;
  cursor: pointer;
  user-select: none;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 1.75rem;
}

.flashcard-inner.is-flipped {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 1.75rem;
  padding: 2rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  box-shadow: 0 14px 28px rgba(0,0,0,0.08), 0 10px 10px rgba(0,0,0,0.04);
}

.flashcard-front {
  background-color: #ffffff;
  border: 2.5px solid #e7e5e4;
}

.dark .flashcard-front {
  background-color: #18181b;
  border-color: #3f3f46;
}

.flashcard-back {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2.5px solid #f59e0b;
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.dark .flashcard-back {
  background: linear-gradient(135deg, #18181b 0%, #27272a 100%);
  border-color: #d97706;
}

/* ========================================================
   TARJETAS DE VOCABULARIO EN GRID - ALTURA UNIFORME Y ELEGANTE
   ======================================================== */
.vocab-card {
  min-height: 230px;
  border-radius: 1.25rem;
  background-color: #ffffff;
  border: 1.5px solid #e7e5e4;
  padding: 1.25rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.dark .vocab-card {
  background-color: #18181b;
  border-color: #27272a;
}

.vocab-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.08);
}

/* Barra superior de acento de género gramatical (nunca deforma esquinas) */
.gender-bar-der {
  border-top: 5px solid #2563eb !important;
}

.gender-bar-die {
  border-top: 5px solid #e11d48 !important;
}

.gender-bar-das {
  border-top: 5px solid #059669 !important;
}

.gender-bar-default {
  border-top: 5px solid #64748b !important;
}

/* ========================================================
   TARJETAS DEL JUEGO MEMORY MATCH
   ======================================================== */
.memory-card-box {
  min-height: 110px;
  height: 110px;
  cursor: pointer;
  user-select: none;
  border-radius: 1rem;
  box-sizing: border-box;
}

/* Efectos visuales de visor de cámara y escaneo */
.camera-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-frame {
  width: 82%;
  max-width: 520px;
  height: 62%;
  max-height: 360px;
  border: 2px dashed rgba(255, 255, 255, 0.75);
  border-radius: 1.5rem;
  position: relative;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.50);
}

.scanner-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: #f59e0b;
  border-width: 5px;
}

.scanner-corner.tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.scanner-corner.tr { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.scanner-corner.bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.scanner-corner.br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }

/* Línea de escaneo láser animada */
.scan-laser {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #fbbf24, #dc2626, #fbbf24, transparent);
  box-shadow: 0 0 16px #f59e0b;
  animation: laserScan 2.4s ease-in-out infinite;
}

@keyframes laserScan {
  0% { top: 5%; opacity: 0.2; }
  50% { top: 92%; opacity: 0.95; }
  100% { top: 5%; opacity: 0.2; }
}

/* Indicador de pestaña activa */
.tab-active {
  background-color: #18181b !important;
  color: #ffffff !important;
  border-bottom: 3px solid #fbbf24 !important;
  box-shadow: 0 4px 14px 0 rgba(24, 24, 27, 0.25);
}

/* Teclado de diacríticos alemanes */
.german-key {
  transition: all 0.15s ease;
  user-select: none;
  min-width: 44px;
  min-height: 44px;
}
.german-key:active {
  transform: scale(0.92);
}

/* Animaciones suaves */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Barra de progreso de auto-captura */
.progress-ring__circle {
  transition: stroke-dashoffset 0.1s linear;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* ========================================================
   TEMAS DINÁMICOS DE PERFIL (PALETA ALEMANA MODERNA)
   ======================================================== */
body.theme-gigi {
  --primary: #18181b;
  --primary-hover: #27272a;
  --theme-header-gradient: linear-gradient(135deg, #18181b 0%, #991b1b 55%, #d97706 100%);
  --theme-accent-bg: #fffbeb;
  --theme-accent-text: #92400e;
  --theme-badge-border: #fde68a;
}

body.theme-gory {
  --primary: #18181b;
  --primary-hover: #27272a;
  --theme-header-gradient: linear-gradient(135deg, #18181b 0%, #3f3f46 55%, #d97706 100%);
  --theme-accent-bg: #fffbeb;
  --theme-accent-text: #92400e;
  --theme-badge-border: #fde68a;
}

body.theme-gory .tab-active {
  background-color: #18181b !important;
  border-bottom: 3px solid #fbbf24 !important;
  box-shadow: 0 4px 14px 0 rgba(24, 24, 27, 0.28);
}

body.theme-gigi .tab-active {
  background-color: #18181b !important;
  border-bottom: 3px solid #fbbf24 !important;
  box-shadow: 0 4px 14px 0 rgba(24, 24, 27, 0.28);
}

/* ========================================================
   LIENZO DIGITAL DE ESCRITURA TÁCTIL (NOTEBOOK PAPER)
   ======================================================== */
.writing-canvas-container {
  position: relative;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
  border: 2.5px solid #cbd5e1;
}

.dark .writing-canvas-container {
  border-color: #334155;
}

#handwriting-touch-canvas {
  display: block;
  width: 100%;
  height: 280px;
  background-color: #ffffff;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 38px,
    #e2e8f0 38px,
    #e2e8f0 40px
  );
  cursor: crosshair;
  touch-action: none;
}

.dark #handwriting-touch-canvas {
  background-color: #0f172a;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 38px,
    #1e293b 38px,
    #1e293b 40px
  );
}

/* ========================================================
   MICRÓFONO PULSANTE - TUTOR HERR SCHMIDT
   ======================================================== */
.mic-pulsing-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  border-radius: 9999px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 10px 25px rgba(24, 24, 27, 0.28);
}

.mic-pulsing-btn.is-recording {
  animation: micPulse 1.4s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  background-color: #ef4444 !important;
}

@keyframes micPulse {
  0% {
    transform: scale(0.96);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    transform: scale(1.08);
    box-shadow: 0 0 0 22px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.96);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* ========================================================
   FUEGUITO DE RACHA ANIMADO
   ======================================================== */
.streak-flame {
  display: inline-block;
  animation: flameWiggle 1.8s ease-in-out infinite;
  transform-origin: bottom center;
}

@keyframes flameWiggle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.12) rotate(-5deg); }
  50% { transform: scale(0.98) rotate(3deg); }
  75% { transform: scale(1.15) rotate(-3deg); }
}

/* ========================================================
   MEDALLAS Y TROFEOS (ACHIEVEMENTS)
   ======================================================== */
.trophy-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.trophy-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.1);
}

.trophy-card.is-locked {
  filter: grayscale(1);
  opacity: 0.55;
}

/* ========================================================
   TUTORIAL EN PANTALLA (SPOTLIGHT / COACH-MARKS)
   ======================================================== */
.ws-tour-dim-full {
  position: fixed;
  inset: 0;
  z-index: 258;
  background: rgba(9, 9, 11, 0.72);
  transition: opacity 0.2s ease;
}

.ws-tour-shield {
  position: fixed;
  z-index: 259;
  background: transparent;
}

.ws-tour-spotlight {
  position: fixed;
  z-index: 260;
  pointer-events: none;
  border-radius: 16px;
  border: 3px solid #f59e0b;
  box-shadow: 0 0 0 9999px rgba(9, 9, 11, 0.72), 0 0 0 6px rgba(245, 158, 11, 0.35);
  transition: top 0.22s ease, left 0.22s ease, width 0.22s ease, height 0.22s ease, opacity 0.2s ease;
  animation: wsTourRing 1.9s ease-in-out infinite;
}

@keyframes wsTourRing {
  0%, 100% {
    box-shadow: 0 0 0 9999px rgba(9, 9, 11, 0.72), 0 0 0 6px rgba(245, 158, 11, 0.42);
  }
  50% {
    box-shadow: 0 0 0 9999px rgba(9, 9, 11, 0.72), 0 0 0 11px rgba(245, 158, 11, 0.14);
  }
}

.ws-tour-popover {
  position: fixed;
  z-index: 270;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  border-radius: 1.25rem;
  background: #ffffff;
  color: #18181b;
  border: 2px solid #f59e0b;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.45);
  padding: 1rem 1.125rem;
}

.dark .ws-tour-popover {
  background: #18181b;
  color: #fafaf9;
  border-color: #d97706;
}

.ws-tour-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-top: 2px solid #f59e0b;
  border-left: 2px solid #f59e0b;
  transform: rotate(45deg);
}

.dark .ws-tour-arrow {
  background: #18181b;
  border-color: #d97706;
}

.ws-tour-arrow.arrow-top {
  top: -7px;
}

.ws-tour-arrow.arrow-bottom {
  bottom: -7px;
  transform: rotate(225deg);
}
