/* ==========================================================================
   BILIKIDS KIDS CLUB - UNIT 3: FAVORITE PEOPLE (7 A 10 AÑOS)
   Tema: Family, Best Friends, Personalities, Possessive Adjectives
   Nuevas Actividades: Árbol Genealógico Interactivo, Match & Link,
   Sentence Doctor (Caza-Errores), Talk Show Podcast Simulator
   ========================================================================== */

:root {
  --font-display: 'Fredoka', cursive, -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --unit3-primary: #ec4899;
  --unit3-primary-dark: #db2777;
  --unit3-secondary: #f59e0b;
  --unit3-accent: #8b5cf6;
  --unit3-success: #10b981;
  --unit3-danger: #ef4444;

  --card-bg: #ffffff;
  --border-subtle: #fce7f3;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --shadow-card: 0 10px 30px rgba(236, 72, 153, 0.08);
}

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

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, #fff1f2 0%, #fdf2f8 50%, #faf5ff 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navigation */
.unit-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #fbcfe8;
  padding: 10px 20px;
}

.unit-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.btn-back-map {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fdf2f8;
  color: #9d174d;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #fbcfe8;
  transition: all 0.2s;
}

.btn-back-map:hover {
  background: #fce7f3;
  transform: translateX(-2px);
}

.unit-title-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.unit-tag-pill {
  background: #fce7f3;
  color: #db2777;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.unit-name-head {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #0f172a;
}

.unit-score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fef3c7;
  color: #92400e;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #fde68a;
}

/* Tabs Bar */
.activity-tabs-bar {
  max-width: 1100px;
  margin: 18px auto 8px;
  padding: 0 20px;
  width: 100%;
}

.tabs-track {
  display: flex;
  gap: 8px;
  background: #ffffff;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid #fbcfe8;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.05);
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  min-width: 140px;
  border: none;
  background: transparent;
  padding: 10px 14px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.tab-btn:hover {
  background: #fff1f2;
  color: #db2777;
}

.tab-btn.active {
  background: linear-gradient(135deg, #ec4899, #db2777);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.35);
}

/* Main Workspace */
.unit-workspace {
  max-width: 1100px;
  margin: 12px auto 40px;
  padding: 0 20px;
  width: 100%;
}

.activity-view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.activity-view.active-view {
  display: block;
}

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

/* --------------------------------------------------------------------------
   NUEVA ACTIVIDAD 1: ÁRBOL GENEALÓGICO & DETECTIVE "WHO'S WHO"
   -------------------------------------------------------------------------- */
.family-tree-box {
  background: #ffffff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid #fbcfe8;
}

.tree-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.tree-clue-card {
  background: linear-gradient(135deg, #fdf2f8 0%, #fff1f2 100%);
  border: 2px solid #f472b6;
  border-radius: 18px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 6px 18px rgba(236, 72, 153, 0.1);
}

.clue-badge {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: #db2777;
  background: #ffffff;
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 4px;
}

.clue-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.clue-sub {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 2px;
}

/* Grid de Tarjetas de Detective Misteriosas con Efecto 3D Flip */
.family-tree-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 960px) {
  .family-tree-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .family-tree-grid { grid-template-columns: repeat(2, 1fr); }
}

.mystery-flip-card {
  perspective: 1000px;
  min-height: 280px;
}

.mystery-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  transform-style: preserve-3d;
  border-radius: 20px;
}

.mystery-flip-card.is-flipped .mystery-card-inner {
  transform: rotateY(180deg);
}

.mystery-card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 20px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

/* FRENTE OCULTO (ARCHIVADOR CONFIDENCIAL) */
.mystery-card-front {
  background: linear-gradient(145deg, #ffffff 0%, #fdf2f8 100%);
  border: 2px dashed #f472b6;
  cursor: pointer;
  transition: all 0.2s;
}

.mystery-card-front:hover {
  transform: translateY(-4px);
  border-style: solid;
  border-color: #ec4899;
  box-shadow: 0 10px 24px rgba(236, 72, 153, 0.16);
}

.case-file-badge {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: #db2777;
  background: #fce7f3;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-block;
}

.mystery-silhouette-avatar {
  font-size: 3.2rem;
  margin: 10px 0;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.08));
}

.mystery-question-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.mystery-tap-hint {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9d174d;
  background: #ffffff;
  border: 1px solid #fbcfe8;
  padding: 5px 10px;
  border-radius: 8px;
}

/* REVERSO REVELADO (DESCRIPCIÓN EN INGLÉS) */
.mystery-card-back {
  background: #ffffff;
  border: 2px solid #ec4899;
  transform: rotateY(180deg);
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.18);
}

.back-avatar {
  font-size: 2.3rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fdf2f8;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.back-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.back-desc-en {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.35;
  margin: 4px 0 2px;
  flex-grow: 1;
  display: flex;
  align-items: center;
}

.back-desc-es {
  font-size: 0.75rem;
  color: #64748b;
  font-style: italic;
  margin-bottom: 10px;
}

.back-actions {
  display: flex;
  gap: 6px;
  width: 100%;
}

.btn-flip-back {
  flex: 1;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-flip-back:hover {
  background: #e2e8f0;
}

.btn-solve-detective {
  flex: 2;
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  border-radius: 10px;
  padding: 7px 8px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-solve-detective:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.mystery-flip-card.correct-target .mystery-card-back {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25);
}

.mystery-flip-card.wrong-target .mystery-card-back {
  border-color: #ef4444;
  background: #fef2f2;
  animation: shakeBtn 0.3s;
}

/* --------------------------------------------------------------------------
   NUEVA ACTIVIDAD 2: MATCH & LINK (CONEXIONES Y POSESIVOS)
   -------------------------------------------------------------------------- */
.match-link-box {
  background: #ffffff;
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow-card);
  border: 1px solid #fbcfe8;
}

.match-columns-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 20px 0;
}

@media (max-width: 680px) {
  .match-columns-container { grid-template-columns: 1fr; }
}

.match-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.match-item-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e293b;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.match-item-card:hover {
  border-color: #ec4899;
  background: #ffffff;
  transform: translateX(3px);
}

.match-item-card.selected {
  border-color: #ec4899;
  background: #fdf2f8;
  color: #db2777;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.2);
}

.match-item-card.matched {
  border-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
  pointer-events: none;
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   NUEVA ACTIVIDAD 3: SENTENCE DOCTOR (CAZA-ERRORES GRAMATICAL)
   -------------------------------------------------------------------------- */
.doctor-container {
  background: #ffffff;
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow-card);
  border: 1px solid #fbcfe8;
  text-align: center;
}

.doctor-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.doctor-sentence-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 20px;
  margin-bottom: 24px;
}

.doctor-word-chip {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 12px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  color: #0f172a;
  cursor: pointer;
  transition: all 0.15s;
}

.doctor-word-chip:hover {
  border-color: #ec4899;
  background: #fdf2f8;
  transform: translateY(-2px);
}

.doctor-word-chip.wrong-spotted {
  border-color: #ef4444;
  background: #fee2e2;
  color: #dc2626;
  text-decoration: line-through;
}

.doctor-word-chip.fixed-chip {
  border-color: #10b981;
  background: #dcfce7;
  color: #15803d;
}

.doctor-correction-panel {
  display: none;
  background: #fff1f2;
  border: 2px solid #fbcfe8;
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}

.doctor-options-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.doctor-fix-btn {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 12px;
  border: 2px solid #f472b6;
  background: #ffffff;
  color: #db2777;
  cursor: pointer;
  transition: all 0.2s;
}

.doctor-fix-btn:hover {
  background: #db2777;
  color: #ffffff;
  transform: scale(1.04);
}

/* --------------------------------------------------------------------------
   NUEVA ACTIVIDAD 4: TALK SHOW PODCAST SIMULATOR
   -------------------------------------------------------------------------- */
.podcast-box {
  background: #ffffff;
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow-card);
  border: 1px solid #fbcfe8;
  text-align: center;
}

.podcast-stage {
  max-width: 680px;
  margin: 0 auto;
}

.podcast-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fee2e2;
  color: #dc2626;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc2626;
  animation: pulseDot 1s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

.podcast-host-card {
  background: linear-gradient(135deg, #fdf2f8 0%, #ffffff 100%);
  border: 2px solid #fbcfe8;
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.podcast-host-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fce7f3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.podcast-question-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: #0f172a;
  margin-bottom: 4px;
}

.podcast-question-es {
  font-size: 0.88rem;
  color: #64748b;
  font-style: italic;
}

.podcast-response-guide {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
  text-align: left;
}

.podcast-response-target {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 6px;
}

.btn-podcast-mic {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #ec4899, #db2777);
  color: #ffffff;
  font-size: 2.3rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.4);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-podcast-mic:hover {
  transform: scale(1.06);
  box-shadow: 0 12px 28px rgba(236, 72, 153, 0.5);
}

.btn-podcast-mic.recording {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  animation: pulseMic 1.2s infinite;
}

@keyframes pulseMic {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { transform: scale(1.08); box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
