/* ==========================================================================
   ACTIVIDAD ELE: ¿QUIÉN ERES? - ESTILOS VISUALES
   Diseño pedagógico, limpio, de alta accesibilidad y 100% responsivo para celulares
   ========================================================================== */

:root {
  --primary-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display-font: 'Outfit', 'Plus Jakarta Sans', sans-serif;

  /* Paleta Alumno A (Azul vibrante / Zafiro) */
  --color-a-primary: #1d4ed8;
  --color-a-dark: #1e40af;
  --color-a-light: #eff6ff;
  --color-a-border: #93c5fd;
  --color-a-badge: #2563eb;

  /* Paleta Alumno B (Esmeralda / Verde azulado) */
  --color-b-primary: #047857;
  --color-b-dark: #065f46;
  --color-b-light: #ecfdf5;
  --color-b-border: #6ee7b7;
  --color-b-badge: #059669;

  /* Colores neutros de UI */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

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

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--primary-font);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header principal y Selector de Rol
   ========================================================================== */
.main-header {
  background: #ffffff;
  border-bottom: 2px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.header-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  box-sizing: border-box;
}

.badge-ele {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
}

.main-title {
  font-family: var(--display-font);
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}

.subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.role-selector-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #f1f5f9;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-full);
  box-sizing: border-box;
}

.role-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: #334155;
  margin-left: 0.4rem;
}

.btn-group-roles {
  display: flex;
  gap: 0.4rem;
}

.btn-role {
  font-family: var(--primary-font);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #475569;
}

.btn-role:hover {
  background: #e2e8f0;
}

.btn-role-a.active {
  background: var(--color-a-primary);
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(29, 78, 216, 0.35);
}

.btn-role-b.active {
  background: var(--color-b-primary);
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(4, 120, 87, 0.35);
}

/* ==========================================================================
   Barra de control de Rondas
   ========================================================================== */
.round-control-nav {
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  padding: 0.6rem 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

.round-nav-inner {
  max-width: 1380px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.round-indicator {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.round-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
}

.round-theme {
  font-size: 0.85rem;
  color: #64748b;
  background: #f1f5f9;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.round-pills {
  display: flex;
  gap: 0.4rem;
}

.pill-round-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: #f8fafc;
  font-size: 0.88rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pill-round-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.pill-round-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  transform: scale(1.08);
}

.round-actions {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  border: 1px solid var(--border-light);
  background: #ffffff;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-btn:hover {
  background: #f1f5f9;
}

.nav-btn.primary {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.nav-btn.primary:hover {
  background: #334155;
}

/* ==========================================================================
   Contenedor Principal de Compartimentos (Alumno A y B)
   ========================================================================== */
.main-content {
  max-width: 1380px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  width: 100%;
  box-sizing: border-box;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Visibilidad de los compartimentos según el rol */
body.mode-role-a #compartmentB {
  display: none !important;
}

body.mode-role-b #compartmentA {
  display: none !important;
}

/* Estructura del compartimento */
.student-compartment {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

.compartment-a {
  border-color: var(--color-a-border);
}

.compartment-b {
  border-color: var(--color-b-border);
}

.compartment-header {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  box-sizing: border-box;
}

.header-a {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-bottom: 2px solid #bfdbfe;
}

.header-b {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-bottom: 2px solid #a7f3d0;
}

.compartment-badge {
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  color: #ffffff;
  letter-spacing: 0.5px;
}

.header-a .compartment-badge {
  background: var(--color-a-badge);
}

.header-b .compartment-badge {
  background: var(--color-b-badge);
}

.compartment-title {
  font-family: var(--display-font);
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.role-hint {
  font-size: 0.82rem;
  color: #475569;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-weight: 500;
}

/* Grid dentro del compartimento: Mi personaje vs Tu compañero */
.compartment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

/* ==========================================================================
   Tarjetas de Personaje
   ========================================================================== */
.character-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: #ffffff;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  box-shadow: var(--shadow-sm);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.my-character {
  background: #fafafa;
  border-color: #cbd5e1;
}

.partner-character {
  background: #ffffff;
  border-color: #cbd5e1;
}

.card-status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  width: fit-content;
}

.self-badge {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.partner-badge {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.character-media {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
}

.char-photo {
  width: 170px;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  background: #e2e8f0;
  max-width: 100%;
}

.char-generation {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  text-align: center;
}

.partner-mystery-badge {
  background: #f1f5f9;
  color: #475569;
  border: 1px dashed #cbd5e1;
}

/* Bloque de datos confidenciales de mi personaje */
.character-data-box {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

.data-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9rem;
  border-bottom: 1px dashed #f1f5f9;
  padding-bottom: 0.35rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.data-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.data-label {
  font-weight: 600;
  color: #64748b;
  flex-shrink: 0;
}

.data-value {
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.data-value.highlight {
  color: #1e3a8a;
  background: #eff6ff;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.origin-item .data-value {
  font-size: 0.82rem;
  color: #475569;
  font-weight: 600;
}

.char-name-note {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #92400e;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  line-height: 1.35;
  width: 100%;
  box-sizing: border-box;
}

.comp-star-note {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: #92400e;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  line-height: 1.35;
  font-style: normal;
  display: block;
}

/* Sugerencias y estructura de respuestas orales */
.speech-scaffold {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.83rem;
  width: 100%;
  box-sizing: border-box;
}

.scaffold-header {
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.4rem;
}

.speech-tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.speech-tips li {
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.speech-text {
  flex: 1;
  text-align: left;
  word-break: break-word;
}

.scaffold-note {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: #0369a1;
  background: #f0f9ff;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid #0284c7;
}

.btn-tts, .btn-tts-mini {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-full);
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-tts:hover, .btn-tts-mini:hover {
  background: #e2e8f0;
  transform: scale(1.1);
}

/* ==========================================================================
   Flujo de preguntas al compañero y Tarjeta de Auto-Comparación Pedagógica
   ========================================================================== */
.partner-instruction {
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.4;
}

.question-discovery-flow {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.flow-step {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #0f172a;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.step-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.step-question {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  word-break: break-word;
}

.input-wrapper {
  display: flex;
  gap: 0.4rem;
  width: 100%;
}

.answer-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.86rem;
  font-family: var(--primary-font);
  transition: all 0.2s;
  background: #ffffff;
  box-sizing: border-box;
}

.answer-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-check {
  border: none;
  background: #0f172a;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-check:hover {
  background: #334155;
}

.feedback-reminder {
  font-size: 0.8rem;
  color: #b45309;
  background: #fef3c7;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-weight: 500;
}

/* Tarjeta de Comparación Pedagógica */
.comparison-card {
  margin-top: 0.35rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #0284c7;
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.25s ease-out;
  width: 100%;
  box-sizing: border-box;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.comp-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.comp-label {
  font-weight: 700;
  color: #0369a1;
}

.comp-synced-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: #15803d;
  background: #dcfce7;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.comp-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: #f8fafc;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.comp-model-box, .comp-user-box {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.comp-tag-name {
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  min-width: 82px;
  flex-shrink: 0;
}

.comp-model-text {
  color: #0f172a;
  word-break: break-word;
}

.comp-user-text {
  color: #334155;
  word-break: break-word;
}

.comp-footer-note {
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.35;
  font-style: italic;
}

.card-footer-action {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.btn-auto-save {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: #1e293b;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.btn-auto-save:hover {
  background: #e2e8f0;
}

/* ==========================================================================
   Sección Cuadro de Registro (Actividad 15)
   ========================================================================== */
.record-table-section {
  background: #ffffff;
  border-top: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  padding: 2.25rem 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

.section-container {
  max-width: 1380px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.table-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.table-title-area {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.exercise-number {
  font-family: var(--display-font);
  font-size: 1.6rem;
  font-weight: 800;
  color: #0284c7;
  line-height: 1.1;
}

.table-heading {
  font-family: var(--display-font);
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
}

.table-subnote {
  font-size: 0.84rem;
  color: #64748b;
  margin-top: 0.2rem;
}

.mobile-scroll-hint {
  display: none;
  font-size: 0.76rem;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px dashed #bae6fd;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.6rem;
  text-align: center;
  font-weight: 600;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-secondary {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-danger-outline {
  border: 1px solid #fecaca;
  background: #fff5f5;
  color: #b91c1c;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger-outline:hover {
  background: #fee2e2;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 2px solid #bae6fd;
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.ele-activity-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  text-align: left;
}

.ele-activity-table thead tr {
  background: #e0f2fe;
  border-bottom: 2px solid #bae6fd;
}

.ele-activity-table th {
  padding: 0.85rem 1rem;
  font-family: var(--display-font);
  font-size: 0.95rem;
  font-weight: 800;
  color: #0369a1;
  border-right: 1px solid #bae6fd;
  white-space: nowrap;
}

.ele-activity-table th:last-child {
  border-right: none;
}

.ele-activity-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  font-size: 0.88rem;
  vertical-align: middle;
}

.ele-activity-table td:last-child {
  border-right: none;
}

.ele-activity-table tbody tr:last-child td {
  border-bottom: none;
}

.round-badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #0f172a;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
}

.partner-meta-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.partner-micro-avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  flex-shrink: 0;
}

.partner-meta-texts {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.partner-role-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  width: fit-content;
  white-space: nowrap;
}

.role-a {
  background: #eff6ff;
  color: #1e40af;
}

.role-b {
  background: #ecfdf5;
  color: #065f46;
}

.partner-mystery-tag {
  font-size: 0.74rem;
  color: #64748b;
  font-style: italic;
  white-space: nowrap;
}

.table-cell-input {
  width: 100%;
  min-width: 120px;
  border: 1px solid transparent;
  background: transparent;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: var(--primary-font);
  font-size: 0.88rem;
  color: #0f172a;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.table-cell-input:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.table-cell-input:focus {
  background: #ffffff;
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.table-cell-input.auto-updated {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.badge-status {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-status.complete {
  background: #dcfce7;
  color: #15803d;
}

.badge-status.pending {
  background: #fef3c7;
  color: #b45309;
}

/* ==========================================================================
   Sección Herramientas para Comunicarnos (Diseño fiel al libro)
   ========================================================================== */
.communication-tools-section {
  background: #f8fafc;
  padding: 2rem 1.5rem 3.5rem;
  width: 100%;
  box-sizing: border-box;
}

.tools-container {
  max-width: 1380px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.tools-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #334155;
  color: #ffffff;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  margin-bottom: -15px;
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow-sm);
}

.pill-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #38bdf8;
}

.pill-text {
  font-family: var(--display-font);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.tools-box {
  background: #ffffff;
  border: 2px solid #64748b;
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  box-shadow: var(--shadow-sm);
  width: 100%;
  box-sizing: border-box;
}

.tool-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.tool-column-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.4rem;
  gap: 0.5rem;
}

.dialogue-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: #f8fafc;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
}

.dialogue-line {
  font-size: 0.88rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  word-break: break-word;
}

.speaker-a {
  font-weight: 800;
  color: #d97706;
  flex-shrink: 0;
}

.speaker-b {
  font-weight: 800;
  color: #ca8a04;
  flex-shrink: 0;
}

.phrase {
  color: #334155;
  font-weight: 500;
}

/* ==========================================================================
   RESPONSIVIDAD MÓVIL PROFUNDA (Smartphones & Pantallas pequeñas)
   Solución integral para que nada aparezca cortado ni desencuadrado
   ========================================================================== */
@media (max-width: 860px) {
  .header-container {
    padding: 0.75rem 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    text-align: center;
  }

  .brand-section {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .main-title {
    font-size: 1.25rem;
  }

  .subtitle {
    font-size: 0.82rem;
  }

  .role-selector-bar {
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
  }

  .btn-group-roles {
    width: 100%;
    display: flex;
    gap: 0.4rem;
  }

  .btn-role {
    flex: 1;
    justify-content: center;
    padding: 0.55rem 0.5rem;
    font-size: 0.84rem;
  }

  /* Barra de control de rondas */
  .round-control-nav {
    padding: 0.5rem 0.75rem;
  }

  .round-nav-inner {
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
  }

  .round-indicator {
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
  }

  .round-pills {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .pill-round-btn {
    width: 32px;
    height: 32px;
    font-size: 0.82rem;
  }

  .round-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
  }

  .round-actions .nav-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.4rem;
    font-size: 0.8rem;
  }

  /* Contenedor principal */
  .main-content {
    margin: 0.75rem auto;
    padding: 0 0.5rem;
    gap: 1.25rem;
  }

  .student-compartment {
    border-radius: var(--radius-md);
  }

  .compartment-header {
    padding: 0.75rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .compartment-title {
    font-size: 1.15rem;
  }

  .role-hint {
    margin-left: 0;
    width: 100%;
    font-size: 0.78rem;
  }

  .compartment-grid {
    grid-template-columns: 1fr !important;
    padding: 0.75rem;
    gap: 1rem;
  }

  .character-card {
    padding: 0.85rem;
    box-sizing: border-box;
    overflow: hidden;
  }

  .char-photo {
    width: 150px;
    height: 180px;
  }

  /* Datos del personaje */
  .character-data-box {
    padding: 0.65rem 0.75rem;
  }

  .data-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .data-value {
    word-break: break-word;
    font-size: 0.86rem;
  }

  /* Andamiaje */
  .speech-scaffold {
    padding: 0.65rem 0.75rem;
  }

  .speech-tips li {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
  }

  .speech-text {
    flex: 1 1 80%;
    font-size: 0.82rem;
  }

  /* Flujo de preguntas del compañero */
  .flow-step {
    padding: 0.65rem;
    gap: 0.5rem;
  }

  .step-num {
    width: 22px;
    height: 22px;
    font-size: 0.74rem;
  }

  .step-question {
    font-size: 0.84rem;
  }

  /* Los inputs y botones se colocan en columna para aprovechar el 100% de la pantalla */
  .input-wrapper {
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
  }

  .answer-input {
    width: 100%;
    min-width: 0;
    font-size: 0.86rem;
    padding: 0.55rem 0.65rem;
  }

  .btn-check {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.84rem;
    text-align: center;
    white-space: normal;
  }

  /* Tarjeta de comparación pedagógica */
  .comparison-card {
    padding: 0.65rem;
  }

  .comp-header {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .comp-synced-badge {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }

  .comp-model-box, .comp-user-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }

  .comp-tag-name {
    min-width: auto;
    font-size: 0.72rem;
  }

  .comp-model-text, .comp-user-text {
    word-break: break-word;
    font-size: 0.84rem;
  }

  /* Tabla de registro */
  .record-table-section {
    padding: 1.5rem 0.5rem;
  }

  .table-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .table-heading {
    font-size: 1.15rem;
  }

  .table-actions {
    width: 100%;
    flex-direction: column;
    gap: 0.4rem;
  }

  .table-actions button {
    width: 100%;
    text-align: center;
  }

  .mobile-scroll-hint {
    display: block;
  }

  .table-responsive {
    border-radius: var(--radius-sm);
  }

  .ele-activity-table {
    min-width: 580px; /* Ancho seguro con scroll horizontal fluido en móvil */
  }

  /* Herramientas de comunicación */
  .communication-tools-section {
    padding: 1.5rem 0.5rem 3rem;
  }

  .tools-header-badge {
    padding: 0.35rem 0.9rem;
  }

  .pill-text {
    font-size: 0.84rem;
  }

  .tools-box {
    grid-template-columns: 1fr;
    padding: 1.5rem 0.85rem 1rem;
    gap: 1.25rem;
  }
}

/* ==========================================================================
   Modo Impresión / Exportación limpia
   ========================================================================== */
@media print {
  .main-header,
  .round-control-nav,
  .role-selector-bar,
  .table-actions,
  .btn-check,
  .btn-auto-save,
  .btn-tts,
  .btn-tts-mini,
  .mobile-scroll-hint {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #000000;
  }

  .main-content {
    display: none !important;
  }

  .record-table-section {
    border: none;
    padding: 0;
  }

  .ele-activity-table {
    border: 1px solid #000;
  }

  .ele-activity-table th,
  .ele-activity-table td {
    border: 1px solid #000;
    color: #000;
  }
}
