/* ===== Compactación específica: Lista de participantes (Tutor) ===== */
/* NOTA: Media queries movidos a responsive.css */
#page-tutor #participantsList {
  padding: 6px !important;
  min-height: 0 !important;
  max-height: none !important; /* JS controla cuando >10 */
  overflow-y: visible !important;
}

#page-tutor #participantsList .participant-item {
  padding: 4px 6px !important;
  margin: 2px 0 !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid rgba(2,6,23,.06) !important;
  border-radius: 0 !important;
  gap: 8px !important;
}

#page-tutor #participantsList .participant-stats {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 2px 4px !important;
  margin: 0 !important;
  gap: 8px !important;
}

#page-tutor #participantsList .participant-status { font-size: 11px !important; padding: 2px 6px !important; }
#page-tutor #participantsList .participant-progress { width: 120px !important; }
#page-tutor #participantsList .participant-progress .progress { height: 6px !important; }
#page-tutor #participantsList .participant-actions button { padding: 3px 6px !important; font-size: 12px !important; }

/* Paleta clara por defecto: fresca y profesional */
/* Global box-sizing to prevent overflow on mobile */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
:root {
  --bg: #f7fafc;            /* very light */
  --panel: #ffffff;         /* white */
  --panel-2: #ffffff;       /* white */
  --text: #0f172a;          /* slate-900 */
  --muted: #475569;         /* slate-600 */
  --primary: #0ea5e9;       /* cyan-500 */
  --primary-600: #0284c7;   /* cyan-600 */
  --success: #16a34a;       /* green-600 */
  --danger: #dc2626;        /* red-600 */
  --ring: rgba(14,165,233,.25);
  --card-radius: 16px;
  --shadow: 0 12px 28px rgba(2,6,23,.08);
}

/* Previene espacios por overflow en móviles */
html, body { 
  overflow-x: hidden;
  height: 100%;
}

/* Layout base para sticky footer */
body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-bottom: 0;
  position: relative;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
}

body > .container {
  flex: 1 0 auto;
}

footer {
  flex-shrink: 0;
}

/* Forzar tema claro también cuando el sistema esté en oscuro */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #f7fafc;
    --panel: #ffffff;
    --panel-2: #ffffff;
    --text: #0f172a;
    --muted: #334155;
    --shadow: 0 12px 28px rgba(2,6,23,.08);
  }
}

/* Aumentar padding inferior solo cuando el teclado flotante esté visible */
body.has-vk-floating { padding-bottom: 180px; }

.container { width: 100%; max-width: 980px; padding: 32px 24px 24px; margin: 0 auto; align-self: center; flex: 1 0 auto; position: relative; }


.topbar {
  position: sticky; top: 0; z-index: 10;
  background: #ffffffcc;
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid rgba(2,6,23,.06);
  box-shadow: 0 2px 12px rgba(2,6,23,.04);
}
.topbar .inner { max-width: 980px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.brandmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.brandmark .dot { width: 10px; height: 10px; background: var(--primary); border-radius: 50%; box-shadow: 0 0 0 6px rgba(14,165,233,.12); }

h2 { font-size: 32px; margin: 0 0 8px; letter-spacing: .1px; color: var(--text); }
h2 span.brand { color: var(--primary); }
h3 { font-size: 20px; margin: 0 0 12px; color: var(--text); }
h4 { font-size: 16px; margin: 0 0 8px; color: var(--text); font-weight: 600; }
p  { color: var(--muted); margin: 0 0 12px; line-height: 1.6; }
.meta { margin: 8px 0 16px; color: #1f2937; font-weight: 500; }

.card {
  background: var(--panel);
  border: 1px solid rgba(2,6,23,.06);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 20px auto;
  text-align: left;
}
.card + .card { margin-top: 16px; }
.card > *:first-child { margin-top: 0; }
.card > *:last-child { margin-bottom: 0; }
.card.accent { border-top: 4px solid var(--primary); }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
label { color: #1f2937; font-size: 14px; }
.hint { font-size: 12px; color: #6b7280; margin-top: 6px; }

/* config-card moved to assets/styles/components/config-card.css */

/* Indicador de carga (spinner) ligero para mensajes en acciones */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(2,6,23,.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Badges moved to assets/styles/components/badges.css */

/* report-summary moved to assets/styles/components/reportes.css */
/* input/form styles moved to assets/styles/forms.css */

/* Estados de validación */
.input-error { border-color: var(--danger) !important; box-shadow: 0 0 0 4px rgba(220,38,38,.15) !important; }
.help-error { color: var(--danger); font-size: 12px; margin: 4px 0 0 0; display: none; }

.actions { margin: 16px 0 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions:first-child { margin-top: 0; }
/* Fuerza visibilidad del botón "Siguiente" al finalizar el ejercicio */
#btnToReport.force-visible {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
button { -webkit-tap-highlight-color: transparent; background: linear-gradient(180deg, var(--primary), var(--primary-600)); border: none; color: #fff; padding: 12px 16px; font-weight: 600; letter-spacing: .2px; border-radius: 12px; cursor: pointer; box-shadow: 0 8px 20px rgba(14,165,233,.28); transition: transform .08s ease, box-shadow .2s ease, filter .2s ease, opacity .2s; }
button:hover { filter: brightness(1.05); box-shadow: 0 12px 28px rgba(2,132,199,.36); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.btn-ghost { 
  background: #f8fafc; 
  color: var(--text); 
  border: 1px solid rgba(2,6,23,.12); 
  box-shadow: none;
  font-weight: 500;
  transition: all 0.2s ease;
}
.btn-ghost:hover { 
  color: var(--primary); 
  border-color: var(--primary);
  background: rgba(14,165,233,.05);
  transform: translateY(-1px);
}
.btn-ghost:active {
  transform: translateY(0);
}

/* Botón de peligro/alerta (para desbloquear pantallas) */
.btn-danger {
  background: linear-gradient(180deg, #ef4444, #dc2626) !important;
  color: #fff !important;
  border: 2px solid #b91c1c !important;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4), 0 0 0 0 rgba(239, 68, 68, 0.4) !important;
  animation: pulse-danger 2s ease-in-out infinite;
  font-weight: 700 !important;
  position: relative;
  overflow: hidden;
}

.btn-danger:hover {
  background: linear-gradient(180deg, #dc2626, #b91c1c) !important;
  box-shadow: 0 12px 32px rgba(220, 38, 38, 0.5), 0 0 0 4px rgba(239, 68, 68, 0.2) !important;
  filter: brightness(1.1) !important;
}

.btn-danger:active {
  transform: translateY(1px) !important;
}

.btn-danger::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 3s infinite;
}

@keyframes pulse-danger {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4), 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4), 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

@keyframes shimmer {
  0% { left: -100%; }
  50%, 100% { left: 200%; }
}

/* Animaciones para spotlight del botón de desbloqueo */
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulseSpotlight {
  0%, 100% {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5),
                0 0 60px 20px rgba(239, 68, 68, 0.6),
                inset 0 0 0 3px rgba(239, 68, 68, 0.8);
  }
  50% {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5),
                0 0 80px 30px rgba(239, 68, 68, 0.8),
                inset 0 0 0 3px rgba(239, 68, 68, 1);
  }
}

/* Botón de nivel seleccionado */
.btn-selected {
  background: linear-gradient(180deg, #10b981, #059669); /* verdes */
  box-shadow: 0 8px 20px rgba(16,185,129,.28);
}

#juego .status { margin-top: 10px; }
#resultado.correcto { color: var(--success); font-weight: 600; background: rgba(22,163,74,.10); border: 1px solid rgba(22,163,74,.25); padding: 10px 12px; border-radius: 10px; }
#resultado.incorrecto { color: var(--danger); font-weight: 600; background: rgba(220,38,38,.08); border: 1px solid rgba(220,38,38,.25); padding: 10px 12px; border-radius: 10px; }

.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 780px) { .grid { grid-template-columns: 1fr 1fr; } }

/* Páginas (pasos) */
.page { display: none; }
.page.active { display: block; }

/* Barra de avance en juego */
.avance-row { display:flex; align-items:center; gap:12px; margin: 16px 0 20px; }
.progress { position: relative; flex: 1; height: 12px; background: #eef2f7; border-radius: 999px; overflow: hidden; border: 1px solid rgba(2,6,23,.08); }
.progress-fill { position: absolute; left:0; top:0; bottom:0; width:0; background: linear-gradient(90deg, #22c55e, #16a34a); transition: width .3s ease; }
.progress-text { font-size: 14px; color: #1f2937; font-weight: 600; min-width: 52px; text-align: right; }

/* Formulario responsive */
.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.form-field {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.form-field label {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 2px;
}

.form-field input {
  width: 100%;
  box-sizing: border-box;
}

.form-field + .form-field { margin-top: 16px; }

/* --- Responsive unificado --- */
@media (max-width: 768px) {
  .container { padding: 20px 14px 40px; }
  .topbar .inner { padding: 10px 14px; gap: 8px; flex-wrap: wrap; }
  h2 { font-size: 24px; }
  .card { padding: 16px; }

  /* Asegurar márgenes laterales cómodos en móviles */
  body { align-items: stretch; }
  .container { padding-left: 16px; padding-right: 16px; }
  .card { margin-left: 12px; margin-right: 12px; }
  footer > div { padding-left: 12px; padding-right: 12px; }

  /* Formularios y filas responsive */
  .row, .form-row {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch;
  }
  
  .form-field {
    min-width: 0;
  }

  /* Inputs y botones responsive */
  input[type="text"], input[type="number"], select, .row input[type="text"], .row button { 
    width: 100% !important; 
    flex: none !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  #page-game #respuesta {
    height: 44px;
    max-height: 56px;
    font-size: 18px;
    padding: 10px 14px;
  }

  /* Acciones y botones */
  .actions { gap: 8px; }
  .actions button { width: 100%; }

  /* Progreso */
  .avance-row { flex-wrap: wrap; }
  .progress-text { text-align: left; }
}

/* Modal personalizado - Diseño mejorado */
.modal {
  position: fixed;
  z-index: 10010;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px) saturate(120%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(8px) saturate(120%);
  }
}

.modal-content {
  position: relative;
  background: linear-gradient(to bottom, #ffffff 0%, #fafbfc 100%);
  margin: 0;
  padding: 0;
  border-radius: 20px;
  box-shadow: 
    0 24px 48px rgba(0, 0, 0, 0.2),
    0 12px 24px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  width: 90%;
  max-width: 500px;
  animation: modalSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid rgba(2,6,23,.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to bottom, rgba(255,255,255,0.8), transparent);
}

.modal-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  color: var(--muted);
  font-size: 24px;
  font-weight: 400;
  cursor: pointer;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
}

.modal-close:hover {
  color: var(--text);
  background-color: rgba(2,6,23,.08);
  transform: scale(1.1);
}

.modal-close:active {
  transform: scale(0.95);
}

.modal-body {
  padding: 24px 28px 28px;
  max-height: 70vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.3);
}

.modal-body p {
  margin: 0 0 16px 0;
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 20px 28px;
  border-top: 1px solid rgba(2,6,23,.04);
  background: linear-gradient(to top, rgba(255,255,255,0.8), transparent);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  border: none;
  color: #fff;
  padding: 13px 24px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.3px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 
    0 4px 12px rgba(14,165,233,.25),
    0 2px 4px rgba(14,165,233,.15);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 20px rgba(14,165,233,.35),
    0 4px 8px rgba(14,165,233,.2);
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 8px rgba(14,165,233,.3),
    0 1px 3px rgba(14,165,233,.2);
}

/* Modal responsive */
@media (max-width: 640px) {
  .modal-content {
    margin: 15% auto;
    width: 95%;
    max-width: 95vw;
  }
  
  .modal-header {
    padding: 16px 18px 14px;
  }
  
  .modal-body {
    padding: 16px 18px 18px;
  }
  
  .modal-actions {
    flex-direction: column;
    padding: 12px 18px;
  }
  
  .modal-actions button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .modal-content {
    margin: 10% auto;
    width: 96%;
  }
  
  .modal-header h3 {
    font-size: 16px;
  }
  
  .modal-body p {
    font-size: 14px;
  }
}

/* ================= Selección de Modo y Roles ================= */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0;
}

.mode-card {
  background: var(--panel);
  border: 2px solid rgba(2,6,23,.08);
  border-radius: var(--card-radius);
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(2,6,23,.06);
}

.mode-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(14,165,233,.15);
  transform: translateY(-2px);
}

.mode-card:active {
  transform: translateY(0);
}

.mode-icon {
  font-size: 52px;
  margin-bottom: 16px;
  line-height: 1;
}

.mode-card h4 {
  margin: 12px 0 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}

.mode-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .mode-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .mode-card {
    padding: 24px 20px;
  }
  
  .mode-icon {
    font-size: 48px;
  }
  
  .mode-card h4 {
    font-size: 17px;
  }
  
  .mode-card p {
    font-size: 13px;
  }
}

/* Estilos para interfaces de tutor y participante */
.status-panel {
  background: #f8fafc;
  border: 1px solid rgba(2,6,23,.08);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.session-card {
  background: #e0f2fe;
  border: 1px solid #0ea5e9;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.session-details p {
  margin: 4px 0;
}

@media (max-width: 520px) {
  .status-panel {
    padding: 12px;
    margin: 12px 0;
  }
  
  .session-card {
    padding: 12px;
    margin: 12px 0;
  }
  
  .session-card h4 {
    font-size: 16px;
  }
  
  .session-details p {
    font-size: 14px;
  }
}

.session-id {
  font-family: monospace;
  background: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #ddd;
  font-weight: bold;
  color: var(--primary);
}

.participants-panel {
  margin: 20px 0;
}

.participants-list {
  background: #f8fafc;
  border: 1px solid rgba(2,6,23,.08);
  border-radius: 8px;
  padding: 12px;
  min-height: 80px;
  max-height: 200px;
  overflow-y: auto;
}

.participant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid rgba(2,6,23,.06);
  border-radius: 6px;
  margin: 4px 0;
}

.participant-name {
  font-weight: 500;
  color: var(--text);
}

/* ================= Warning Banner ================= */
.warning-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: var(--card-radius);
  padding: 20px 24px;
  margin: 0 0 20px;
}

.warning-content {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.warning-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.warning-title {
  margin: 0 0 8px;
  color: #92400e;
  font-size: 18px;
  font-weight: 700;
}

.warning-text {
  margin: 0;
  color: #78350f;
  line-height: 1.6;
}

/* ================= Participante ================= */
.participant-input {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin: 20px 0;
}

.participant-input input {
  flex: 1;
  min-width: 0;
}

.participant-input button {
  flex-shrink: 0;
  min-width: 120px;
}

.participant-feedback {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 500;
}

.participant-progress {
  margin: 20px 0;
}

.participant-info {
  background: #f8fafc;
  border: 1px solid rgba(2,6,23,.06);
  border-radius: 10px;
  padding: 16px;
  margin: 16px 0;
}

.participant-info p {
  margin: 8px 0;
  line-height: 1.5;
}

.connection-panel,
.exercise-panel {
  margin: 16px 0;
}

@media (max-width: 520px) {
  .participant-info {
    padding: 12px;
    margin: 12px 0;
  }
  
  .participant-info p {
    font-size: 14px;
    margin: 6px 0;
  }
  
  .connection-panel,
  .exercise-panel {
    margin: 12px 0;
  }
}

/* Realce sutil del resultado al comprobar */
.result-flash {
  animation: result-pop 800ms ease-out, result-bg 1200ms ease-out;
}
@keyframes result-pop {
  0% { transform: scale(1); }
  15% { transform: scale(1.025); }
  100% { transform: scale(1); }
}
@keyframes result-bg {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.0); background-color: transparent; }
  20% { box-shadow: 0 8px 24px rgba(2,6,23,0.10); background-color: rgba(16,185,129,0.10); }
  100% { box-shadow: none; background-color: transparent; }
}

/* Variantes por estado */
.correcto.result-flash { animation: result-pop 800ms ease-out, result-bg-green 1200ms ease-out; }
.incorrecto.result-flash { animation: result-pop 800ms ease-out, result-bg-red 1200ms ease-out; }

@keyframes result-bg-green {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.00); background-color: transparent; }
  20% { box-shadow: 0 8px 24px rgba(16,185,129,0.18); background-color: rgba(16,185,129,0.12); }
  100% { box-shadow: none; background-color: transparent; }
}
@keyframes result-bg-red {
  0% { box-shadow: 0 0 0 0 rgba(220,38,38,0.00); background-color: transparent; }
  20% { box-shadow: 0 8px 24px rgba(220,38,38,0.18); background-color: rgba(220,38,38,0.10); }
  100% { box-shadow: none; background-color: transparent; }
}

.participant-status {
  font-size: 12px;
  color: var(--success);
}

.no-participants {
  color: var(--muted);
  text-align: center;
  font-style: italic;
  margin: 20px 0;
}

.tutor-controls {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  flex-wrap: wrap;
}
.tutor-controls button {
  width: auto;           /* que no ocupen toda la fila en desktop */
  flex: 0 0 auto;
}

/* Alinear botones de la barra de reproducción del tutor en forma horizontal */
#tutorPlayback .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#tutorPlayback .actions button {
  width: auto !important;   /* evitar que ocupen 100% en desktop */
  flex: 0 0 auto;
  min-width: 150px;
}
@media (max-width: 768px) {
  #tutorPlayback .actions button {
    min-width: calc(50% - 8px); /* en móviles, dos por fila de forma agradable */
    flex: 1 1 auto;
  }
}

.connection-panel {
  margin: 20px 0;
}

.participant-input {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
}

.participant-input input {
  flex: 1;
  font-size: 16px;
  padding: 12px 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.participant-feedback {
  background: #f8fafc;
  border: 1px solid rgba(2,6,23,.08);
  border-radius: 8px;
  padding: 12px;
  margin: 16px 0;
  min-height: 40px;
}

.exercise-panel {
  margin: 20px 0;
}

.participant-info p {
  margin: 4px 0;
}

/* Estilos para configuración del tutor */
.config-summary {
  background: #f0f9ff;
  border: 1px solid #0ea5e9;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.config-summary h4 {
  margin: 0 0 12px 0;
  color: var(--primary);
}

.config-summary p {
  margin: 4px 0;
  font-size: 14px;
}

@media (max-width: 520px) {
  .config-summary {
    padding: 12px;
    margin: 12px 0;
  }
  
  .config-summary h4 {
    font-size: 15px;
  }
  
  .config-summary p {
    font-size: 13px;
  }
  
  .config-summary button {
    width: 100%;
    margin-top: 8px;
  }
}

.participant-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}

.participant-stats {
  background: #f8fafc;
  border: 1px solid rgba(2,6,23,.08);
  border-radius: 8px;
  padding: 16px;
  margin: 12px 0;
}
.participant-stats p {
  margin: 6px 0;
}

/* Botones de nivel: 2x2 en móvil (unificado para individual y tutor) */
@media (max-width: 768px) {
  /* Todos los botones de nivel usando clase común */
  .actions .btn-nivel {
    flex: 1 1 calc(50% - 5px) !important;
    min-width: 0 !important;
    padding: 14px 10px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
  }
  
  /* Botones ghost (volver, refrescar) en su propia línea */
  .actions .btn-ghost {
    flex: 1 1 100% !important;
  }
}

@media (max-width: 520px) {
  .actions .btn-nivel {
    flex: 1 1 calc(50% - 4px) !important;
    padding: 12px 8px !important;
    font-size: 13px !important;
  }
}

/* Página de reporte: botones en horizontal en móvil */
@media (max-width: 768px) {
  #page-report .actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  
  #page-report .actions button {
    flex: 1 1 calc(50% - 5px) !important;
    min-width: 0 !important;
    padding: 14px 10px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 520px) {
  #page-report .actions {
    gap: 8px !important;
  }
  
  #page-report .actions button {
    flex: 1 1 calc(50% - 4px) !important;
    padding: 12px 8px !important;
    font-size: 13px !important;
  }
}

/* Modo y roles: ajustar SOLO en móviles */
@media (max-width: 768px) {
  .mode-grid { grid-template-columns: 1fr; gap: 16px; }
  .mode-card { padding: 20px 16px; }
  .mode-icon { font-size: 40px; }
  .tutor-controls { flex-direction: column; }
  .tutor-controls button { width: 100%; }
  .participant-input {
    flex-direction: column;
    align-items: stretch;
  }
  
  .participant-input input {
    width: 100%;
    margin-bottom: 8px;
  }
  
  .config-summary {
    padding: 12px;
  }
}

/* Footer */
footer {
  position: static;
  width: 100%;
  background: #ffffff;
  border-top: 1px solid #e0e0e0;
  padding: 12px 20px 12px 20px;
  color: #666;
  font-size: 11px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
}

/* --- Reusable warning banner --- */
.warning-banner {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.warning-banner .warning-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.warning-banner .warning-icon {
  font-size: 24px;
  color: #856404;
  line-height: 1;
}

.warning-banner .warning-title {
  margin: 0 0 8px 0;
  color: #856404;
  font-size: 16px;
  font-weight: 700;
}

.warning-banner .warning-text {
  margin: 0;
  color: #856404;
  font-size: 14px;
  line-height: 1.4;
}

/* Ocultar aviso informativo (banner amarillo) en todas las páginas */
.warning-banner { display: none !important; }

/* --- Virtual Keyboard Container --- */
#virtual-keyboard-container {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: #f3f4f6; /* gris claro */
  border-top: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 -6px 20px rgba(0,0,0,0.08);
  padding: 8px env(safe-area-inset-right) calc(8px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
}

/* Inline keyboard container inside the page */
.vk-inline-container {
  background: transparent;   /* fondo limpio */
  border: none;              /* sin bordes alrededor del teclado */
  border-radius: 0;
  box-shadow: none;          /* sin sombra externa */
  padding: 0;
  margin: 6px 0 0;           /* sin margen inferior */
}

/* Estado oculto: colapsar completamente cualquier espacio */
.vk-inline-container.hidden {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Hide inline keyboard on desktop/tablet-large; show on small screens */
@media (min-width: 1024px) {
  .vk-inline-container { display: none !important; }
}

/* Ajustes de tema de simple-keyboard para integrarlo con el estilo */
.virtual-keyboard-theme.hg-theme-default {
  background: transparent;
  box-shadow: none;
}

.virtual-keyboard-theme .hg-button {
  border-radius: 10px;
  background: #ffffff;
  border: none; /* sin bordes en las teclas */
  font-size: 18px;          /* aumentar tamaño de letra */
  line-height: 1.2;         /* legibilidad */
  padding: 12px 10px;       /* más área táctil */
}

.virtual-keyboard-theme .hg-button:hover {
  filter: brightness(1.02);
}

.hg-button-space { min-width: 30vw; }
.hg-button-bksp { min-width: 64px; }

@media (max-width: 768px) {
  #virtual-keyboard-container { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  /* En pantallas pequeñas, hacer las teclas un poco más grandes */
  .virtual-keyboard-theme .hg-button {
    font-size: 20px;
    padding: 14px 12px;
  }
}

/* Tablets/landscape medianas: leve incremento */
@media (min-width: 769px) and (max-width: 1023px) {
  .virtual-keyboard-theme .hg-button {
    font-size: 19px;
    padding: 12px 12px;
  }
}

/* --- Visual input mirror with fake caret (for mobile VK) --- */
.vk-mirror {
  display: none;
  width: 100%;
  background: #fff;
  border: 1px solid rgba(2,6,23,.12);
  border-radius: 12px; /* igual que input */
  padding: 10px 12px;  /* ligeramente menor para reducir altura */
  font: inherit;
  color: inherit;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(2,6,23,.04); /* igual que input */
  height: 44px;           /* altura similar a input estándar */
  max-height: 44px;
  overflow: hidden;       /* evita crecer verticalmente */
  display: flex;          /* centrar verticalmente el contenido */
  align-items: center;
}
.vk-mirror:focus-within, .vk-mirror.vk-active {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring); /* igual que input:focus */
}
.vk-mirror .vk-mirror-text {
  white-space: nowrap;      /* una sola línea */
  overflow: hidden;
  text-overflow: ellipsis;  /* puntos suspensivos si se excede */
}
.vk-mirror .vk-caret {
  display: inline-block;
  width: 2px; height: 1.1em;
  margin-left: 1px;
  background: #111827; /* slate-900 */
  animation: vkBlink 1s steps(2, start) infinite;
  vertical-align: text-bottom;
}
@keyframes vkBlink { to { visibility: hidden; } }

/* ================= Virtual Keyboard: Responsive Rules ================= */

/* Placeholder visual en el espejo cuando está vacío */
.vk-mirror.empty .vk-mirror-text {
  color: #64748b; /* igual que input::placeholder */
}

/* Desktop: ocultar espejos siempre */
@media (min-width: 1024px) {
  #vkMirror, #vkMirrorParticipant { display: none !important; }
}

/* Móvil/Tablet: mostrar espejos y ocultar inputs reales */
@media (max-width: 1023px) {
  /* Mostrar espejos */
  .vk-mirror { display: block; }
  
  /* Ocultar inputs reales y mostrar espejos en su lugar */
  #page-game #respuesta { display: none !important; }
  #page-game #vkMirror { display: block !important; }
  #page-participant #participantAnswer { display: none !important; }
  #page-participant #vkMirrorParticipant { display: block !important; }
  
  /* Llevar teclado inline al borde de la página (full-bleed) */
  .vk-inline-container { margin-left: -16px; margin-right: -16px; }
}

/* Refuerzo global: cuando vk-mode está activo, ocultar inputs reales en cualquier resolución */
body.vk-mode #page-game #respuesta,
body.vk-mode #page-participant #participantAnswer { 
  display: none !important; 
}
body.vk-mode #page-game #vkMirror,
body.vk-mode #page-participant #vkMirrorParticipant { 
  display: block !important; 
}

/* Ocultar cualquier botón fantasma 'Volver' dentro de la página del participante */
#page-participant .actions .btn-ghost { display: none !important; }

/* Quitar bordes/sombras del wrapper de Simple Keyboard (más limpio) */
.vk-inline-container .simple-keyboard {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;      /* sin margen inferior */
}

/* Reducir separación entre filas de teclas y eliminar espacio final */
.vk-inline-container .simple-keyboard .hg-row { margin-bottom: 4px; }
.vk-inline-container .simple-keyboard .hg-row:last-child { margin-bottom: 0; }

/* ================= Layout: Tutor ================= */
/* Estilo base de panel de estado reutilizable */
.status-panel {
  background: #f1f5f9; /* slate-100 */
  border: 1px solid rgba(2,6,23,.08);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0 12px;
}

/* Resumen de configuración (azul suave) */
#page-tutor .config-summary {
  background: #f0f7ff;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 8px 0 12px;
}
#page-tutor .config-summary h4 { margin: 0 0 8px; }

/* Franja verde de servidor activo */
#page-tutor #tutorStatus {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

/* Tarjeta de sesión */
#page-tutor .session-card {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 10px;
}
#page-tutor .session-card h4 { margin: 0 0 8px; }
#page-tutor .session-details p { margin: 2px 0; }

/* Contenedores y controles */
#page-tutor #sessionInfo { margin: 16px 0 20px; }
#page-tutor .tutor-controls { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin: 16px 0 !important; }
#page-tutor #tutorPlayback { margin: 20px 0 !important; padding: 16px; background: #fafbfc; border-radius: 12px; border: 1px solid rgba(2,6,23,.06); }

/* Participantes */
#page-tutor .participants-panel { margin-top: 24px; }
#page-tutor .participants-panel h4 { margin: 0 0 12px; font-size: 16px; }
#page-tutor .participants-list { margin-top: 12px; padding: 12px; background: #fafbfc; border-radius: 10px; border: 1px solid rgba(2,6,23,.04); }
#page-tutor .no-participants { color: var(--muted); font-style: italic; margin: 8px 0; }

/* Afinado de márgenes dentro de la tarjeta principal del tutor */
#page-tutor .card > *:first-child { margin-top: 0; }
#page-tutor .card > *:last-child { margin-bottom: 0; }

/* Responsive: compactar controles del tutor */
@media (max-width: 768px) {
  #page-tutor .tutor-controls button,
  #page-tutor .tutor-controls select,
  #page-tutor .tutor-controls label { flex: 1 1 auto; min-width: 120px; }
  #page-tutor .tutor-controls { gap: 6px; }
  #page-tutor .config-summary,
  #page-tutor .session-card { padding: 14px 16px; }
}

/* ================= Páginas de Configuración ================= */
#page-config .card,
#page-tutor-config .card {
  margin-bottom: 20px;
}

#page-config label,
#page-tutor-config label {
  display: block;
  margin-bottom: 8px;
}

#page-config .hint,
#page-tutor-config .hint {
  margin-top: 8px;
  line-height: 1.5;
}

/* Espaciado de checkboxes */
#page-config label input[type="checkbox"],
#page-tutor-config label input[type="checkbox"] {
  margin-right: 8px;
}

/* Secciones de configuración */
#page-config > *:not(.page),
#page-tutor-config > *:not(.page) {
  margin-bottom: 16px;
}
/* tutorial responsive moved to components/tutorial.css */
