/* ============================================================
   KAHOOT-INSPIRED RESPONSIVE THEME
   Evaluación de Pronunciación Oral - Oteima
   ============================================================ */

:root {
  --kahoot-purple: #46178f;
  --kahoot-dark-purple: #2f0d61;
  --kahoot-red: #e21b3c;
  --kahoot-red-hover: #c71230;
  --kahoot-blue: #1368ce;
  --kahoot-blue-hover: #0d52a7;
  --kahoot-yellow: #ffa602;
  --kahoot-yellow-hover: #e09200;
  --kahoot-green: #26890c;
  --kahoot-green-hover: #1f6f09;
  --kahoot-card-bg: #ffffff;
  --kahoot-text-dark: #292929;
  --kahoot-text-muted: #6b7280;
  --kahoot-border-radius: 18px;
  --kahoot-btn-radius: 14px;
  --kahoot-font: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--kahoot-font);
  background: radial-gradient(circle at 10% 20%, #46178f 0%, #2f0d61 90%);
  min-height: 100vh;
  color: var(--kahoot-text-dark);
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Formas geométricas flotantes decorativas estilo Kahoot */
.bg-shapes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0.15;
}

.shape {
  position: absolute;
  animation: floatShape 20s infinite ease-in-out alternate;
}

.shape-triangle {
  width: 0;
  height: 0;
  border-left: 35px solid transparent;
  border-right: 35px solid transparent;
  border-bottom: 60px solid #ffa602;
  top: 15%;
  left: 8%;
  animation-duration: 18s;
}

.shape-diamond {
  width: 50px;
  height: 50px;
  background-color: #1368ce;
  transform: rotate(45deg);
  top: 70%;
  left: 12%;
  animation-duration: 22s;
}

.shape-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #26890c;
  top: 25%;
  right: 10%;
  animation-duration: 16s;
}

.shape-square {
  width: 45px;
  height: 45px;
  background-color: #e21b3c;
  bottom: 15%;
  right: 15%;
  animation-duration: 25s;
}

@keyframes floatShape {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(180deg); }
  100% { transform: translateY(15px) rotate(360deg); }
}

/* Barra Superior / Header */
.kahoot-header {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: var(--kahoot-purple);
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
  padding: 6px 14px;
  border-radius: 10px;
  letter-spacing: 1px;
  box-shadow: 0 3px 0 var(--kahoot-dark-purple);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--kahoot-purple);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timer-badge {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  color: #92400e;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.timer-badge.pulsing {
  animation: pulseTimer 1s infinite alternate;
}

@keyframes pulseTimer {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

.sound-toggle-btn {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: var(--kahoot-text-dark);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
}

.sound-toggle-btn:hover {
  background: #e5e7eb;
}

/* Contenedor Principal */
.main-container {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 950px;
  margin: 24px auto;
  padding: 0 16px;
  flex: 1;
}

/* Tarjetas Estilo Kahoot */
.kahoot-card {
  background: var(--kahoot-card-bg);
  border-radius: var(--kahoot-border-radius);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
  padding: 30px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.kahoot-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(90deg, var(--kahoot-red), var(--kahoot-blue), var(--kahoot-yellow), var(--kahoot-green));
}

.card-header {
  text-align: center;
  margin-bottom: 24px;
}

.card-title {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--kahoot-purple);
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 1rem;
  color: var(--kahoot-text-muted);
  font-weight: 600;
}

/* Barra de progreso de las 4 partes */
.stepper-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  position: relative;
}

.stepper-progress-line {
  position: absolute;
  top: 50%;
  left: 5%;
  right: 5%;
  height: 6px;
  background: #e5e7eb;
  transform: translateY(-50%);
  z-index: 1;
  border-radius: 4px;
}

.stepper-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--kahoot-blue), var(--kahoot-green));
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

.step-node {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border: 3px solid #d1d5db;
  color: #6b7280;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.step-node.active {
  border-color: var(--kahoot-purple);
  background: var(--kahoot-purple);
  color: #fff;
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(70, 23, 143, 0.4);
}

.step-node.completed {
  border-color: var(--kahoot-green);
  background: var(--kahoot-green);
  color: #fff;
}

/* Part Intro Slide (Kahoot Big Slide) */
.part-intro-card {
  text-align: center;
  padding: 45px 30px;
}

.part-intro-pill {
  display: inline-block;
  background: var(--kahoot-yellow);
  color: #78350f;
  font-weight: 900;
  padding: 8px 20px;
  border-radius: 25px;
  font-size: 1rem;
  letter-spacing: 1.5px;
  margin-bottom: 16px;
}

.part-intro-title {
  font-size: 2.3rem;
  font-weight: 900;
  color: var(--kahoot-purple);
  margin-bottom: 12px;
}

.part-intro-instructions {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  max-width: 680px;
  margin: 24px auto 35px auto;
  font-size: 1.15rem;
  line-height: 1.7;
  color: #334155;
  text-align: left;
}

/* Pinned Sticky Instructions Bar during Questions */
.sticky-instruction-bar {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.sticky-instruction-info {
  font-size: 0.95rem;
  color: #475569;
  font-weight: 700;
}

.sticky-instruction-info strong {
  color: var(--kahoot-purple);
}

.question-counter-pill {
  background: var(--kahoot-blue);
  color: #ffffff;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Center Question Kahoot Card */
.kahoot-question-box {
  background: #ffffff;
  border: 3px solid #e2e8f0;
  border-radius: 20px;
  padding: 35px 24px;
  text-align: center;
  margin-bottom: 22px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  position: relative;
  transition: all 0.25s ease;
}

.kahoot-question-box.color-red { border-top: 8px solid var(--kahoot-red); }
.kahoot-question-box.color-blue { border-top: 8px solid var(--kahoot-blue); }
.kahoot-question-box.color-yellow { border-top: 8px solid var(--kahoot-yellow); }
.kahoot-question-box.color-green { border-top: 8px solid var(--kahoot-green); }

.question-title-badge {
  font-size: 0.85rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.kahoot-question-text {
  font-size: 2.6rem;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.3;
  margin: 10px 0;
  word-break: break-word;
}

.kahoot-question-sentence {
  font-size: 1.65rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.6;
}

.kahoot-question-sentence strong {
  color: var(--kahoot-purple);
  text-decoration: underline;
  text-underline-offset: 5px;
  font-weight: 900;
}

.kahoot-prompt-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 8px;
}

/* Cajas de Instrucciones */
.instruction-box {
  background: #f8fafc;
  border-left: 6px solid var(--kahoot-blue);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.instruction-box h4 {
  color: var(--kahoot-blue);
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.instruction-box p, .instruction-box ul {
  color: #374151;
  font-size: 0.98rem;
  line-height: 1.6;
}

.instruction-box ul {
  padding-left: 20px;
}

.instruction-box li {
  margin-bottom: 6px;
}

/* Grillas de Contenido del Examen */

/* Parte 1: Grilla de Palabras Aisladas (Kahoot badges) */
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.word-card {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: #1f2937;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.word-card .word-num {
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #9ca3af;
}

/* Colores alternados estilo Kahoot para palabras */
.word-card:nth-child(4n+1) { border-top: 5px solid var(--kahoot-red); }
.word-card:nth-child(4n+2) { border-top: 5px solid var(--kahoot-blue); }
.word-card:nth-child(4n+3) { border-top: 5px solid var(--kahoot-yellow); }
.word-card:nth-child(4n+4) { border-top: 5px solid var(--kahoot-green); }

/* Parte 2: Tarjetas de Oraciones */
.sentence-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

.sentence-card {
  background: #ffffff;
  border: 2px solid #f3f4f6;
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.03);
  font-size: 1.15rem;
  line-height: 1.5;
}

.sentence-card .num-badge {
  background: var(--kahoot-blue);
  color: #fff;
  font-weight: 800;
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.sentence-card strong {
  color: var(--kahoot-purple);
  text-decoration: underline;
  text-underline-offset: 4px;
  font-weight: 800;
}

/* Parte 3: Tarjeta de Párrafo de Lectura */
.passage-card {
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: 16px;
  padding: 24px;
  font-size: 1.25rem;
  line-height: 1.9;
  color: #1f2937;
  font-weight: 500;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  margin: 20px 0;
}

.passage-card strong {
  background: #fef08a;
  color: #854d0e;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 800;
}

/* Parte 4: Tarjetas de Verbos Guiados */
.verbs-prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.prompt-item {
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 3px 6px rgba(0,0,0,0.04);
}

.prompt-item .prompt-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: #166534;
}

.prompt-item .prompt-verb {
  font-size: 1.5rem;
  font-weight: 900;
  color: #15803d;
  margin-top: 4px;
}

/* ============================================================
   SECCIÓN DE GRABACIÓN DE AUDIO (KAHUT STYLE ANIMATED RECORDER)
   ============================================================ */
.recorder-section {
  background: #f9fafb;
  border: 2px dashed #cbd5e1;
  border-radius: 20px;
  padding: 24px 20px;
  margin-top: 28px;
  text-align: center;
  position: relative;
}

.recorder-status-banner {
  font-size: 1.1rem;
  font-weight: 800;
  color: #4b5563;
  margin-bottom: 16px;
}

.visualizer-wrapper {
  margin: 16px auto;
  max-width: 500px;
  height: 60px;
  background: #111827;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
  display: none;
}

.visualizer-wrapper.active {
  display: block;
}

#audioCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.rec-timer {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--kahoot-red);
  letter-spacing: 2px;
  margin: 10px 0;
  display: none;
}

.rec-timer.active {
  display: inline-block;
  animation: pulseTimer 1s infinite alternate;
}

/* Botones 3D Estilo Kahoot */
.btn-kahoot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 900;
  color: #ffffff;
  padding: 14px 28px;
  border-radius: var(--kahoot-btn-radius);
  border: none;
  cursor: pointer;
  outline: none;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.btn-kahoot:active {
  transform: translateY(4px);
}

/* Botón Rojo (Grabar) */
.btn-kahoot-red {
  background-color: var(--kahoot-red);
  box-shadow: 0 6px 0 var(--kahoot-red-hover), 0 10px 20px rgba(226, 27, 60, 0.4);
}
.btn-kahoot-red:hover {
  background-color: #f02447;
}
.btn-kahoot-red:active {
  box-shadow: 0 2px 0 var(--kahoot-red-hover);
}

/* Botón Azul */
.btn-kahoot-blue {
  background-color: var(--kahoot-blue);
  box-shadow: 0 6px 0 var(--kahoot-blue-hover), 0 10px 20px rgba(19, 104, 206, 0.4);
}
.btn-kahoot-blue:hover {
  background-color: #1977e8;
}
.btn-kahoot-blue:active {
  box-shadow: 0 2px 0 var(--kahoot-blue-hover);
}

/* Botón Verde (Guardar / Continuar) */
.btn-kahoot-green {
  background-color: var(--kahoot-green);
  box-shadow: 0 6px 0 var(--kahoot-green-hover), 0 10px 20px rgba(38, 137, 12, 0.4);
}
.btn-kahoot-green:hover {
  background-color: #2ea310;
}
.btn-kahoot-green:active {
  box-shadow: 0 2px 0 var(--kahoot-green-hover);
}

/* Botón Amarillo */
.btn-kahoot-yellow {
  background-color: var(--kahoot-yellow);
  color: #fff;
  box-shadow: 0 6px 0 var(--kahoot-yellow-hover), 0 10px 20px rgba(255, 166, 2, 0.4);
}
.btn-kahoot-yellow:hover {
  background-color: #ffb326;
}
.btn-kahoot-yellow:active {
  box-shadow: 0 2px 0 var(--kahoot-yellow-hover);
}

/* Animación pulsante para el botón de grabar */
.btn-record-pulse {
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 6px 0 var(--kahoot-red-hover), 0 0 0 0 rgba(226, 27, 60, 0.7);
  }
  70% {
    box-shadow: 0 6px 0 var(--kahoot-red-hover), 0 0 0 18px rgba(226, 27, 60, 0);
  }
  100% {
    box-shadow: 0 6px 0 var(--kahoot-red-hover), 0 0 0 0 rgba(226, 27, 60, 0);
  }
}

/* Reproductor de Audio grabado */
.audio-preview-container {
  display: none;
  margin: 20px 0;
  padding: 16px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.audio-preview-container.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

.audio-preview-container audio {
  width: 100%;
  max-width: 480px;
  outline: none;
  border-radius: 30px;
}

.recorder-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 18px;
}

/* Formulario de Registro de Estudiante */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-label {
  display: block;
  font-weight: 800;
  font-size: 1rem;
  color: var(--kahoot-purple);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 14px 18px;
  font-size: 1.1rem;
  font-family: inherit;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  transition: all 0.2s;
  background: #fafafa;
}

.form-control:focus {
  border-color: var(--kahoot-purple);
  background: #ffffff;
  outline: none;
  box-shadow: 0 0 0 4px rgba(70, 23, 143, 0.15);
}

.form-control:disabled, .form-control[readonly] {
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
}

/* Badges y Pills */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: #fef3c7; color: #b45309; }

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

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

/* Footer */
.kahoot-footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 18px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  font-weight: 600;
}

.kahoot-footer a {
  color: #ffffff;
  text-decoration: underline;
  font-weight: 800;
}

/* Media Queries para Responsividad */
@media (max-width: 768px) {
  .kahoot-card {
    padding: 20px 16px;
  }
  .card-title {
    font-size: 1.35rem;
  }
  .word-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sentence-card {
    font-size: 1rem;
    padding: 12px 14px;
  }
  .passage-card {
    font-size: 1.05rem;
    padding: 16px;
    line-height: 1.7;
  }
  .btn-kahoot {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
  }
  .recorder-actions {
    flex-direction: column;
  }
}
