/* Modo maestro — puntero + anillo de foco (offline, sin CDN) */
#maestro-puntero {
  position: fixed;
  left: 0;
  top: 0;
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
  z-index: 100000;
  opacity: 0;
  transform: translate(-12px, -8px) scale(0.85);
  transition: opacity 0.25s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}
#maestro-puntero.is-visible {
  opacity: 1;
  transform: translate(-12px, -8px) scale(1);
}
#maestro-puntero svg {
  display: block;
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.35));
}

.maestro-focus {
  outline: 3px solid #C4A15A !important;
  outline-offset: 6px;
  border-radius: 8px;
  box-shadow: 0 0 0 6px rgba(196, 161, 90, 0.28);
  transition: outline-color 0.2s ease, box-shadow 0.2s ease;
}

#maestro-barra {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 100001;
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  max-width: min(340px, calc(100vw - 24px));
  padding: 0.65rem 0.75rem;
  background: #0E0E0C;
  color: #f8fafc;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.35);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
  line-height: 1.35;
}
#maestro-barra.is-on {
  display: flex;
}
#maestro-barra .maestro-barra-titulo {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: #C4A15A;
  margin: 0;
}
#maestro-barra .maestro-paso-texto {
  margin: 0;
  color: #e2e8f0;
  max-height: 4.8em;
  overflow: auto;
}
#maestro-barra .maestro-barra-botones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
#maestro-barra button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  background: #C4A15A;
  color: #1A160E;
}
#maestro-barra button.secondary {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
}
#maestro-barra button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
#maestro-barra .maestro-estado {
  margin: 0;
  font-size: 0.72rem;
  color: #94a3b8;
}

@media (prefers-reduced-motion: reduce) {
  #maestro-puntero {
    transition: opacity 0.15s linear;
  }
}

/* Chip de rol de voz en la barra */
#maestro-barra .maestro-barra-titulo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
#maestro-barra .maestro-voz-chip {
  display: inline-block;
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #334155;
  color: #e2e8f0;
  vertical-align: middle;
}
#maestro-barra .maestro-voz-chip[hidden] {
  display: none !important;
}
#maestro-barra .maestro-voz-narrador { background: #1e3a8a; color: #bfdbfe; }
#maestro-barra .maestro-voz-chico { background: #075985; color: #bae6fd; }
#maestro-barra .maestro-voz-chica { background: #9d174d; color: #fbcfe8; }
#maestro-barra .maestro-voz-mayor { background: #4c1d95; color: #ddd6fe; }
#maestro-barra .maestro-voz-perro { background: #9a3412; color: #fed7aa; }
#maestro-barra .maestro-voz-timbre { background: #065f46; color: #a7f3d0; }


/* Atajo «Modo maestro» — colores explícitos (cream + Android force-dark) */
.pie-maestro {
  display: block;
  margin: 0.75rem 0 0.35rem;
  padding: 0;
  line-height: 1.2;
}

.leccion-barra .atajo-maestro,
.leccion-pie .atajo-maestro,
a.atajo-maestro,
#maestro-atajo-fijo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 2.25rem;
  padding: 0.45rem 0.85rem;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: #1A160E !important;
  background: #C4A15A !important;
  border: 1px solid #b08d45 !important;
  border-radius: 10px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  -webkit-text-fill-color: #1A160E;
  forced-color-adjust: none;
}

.leccion-pie .atajo-maestro {
  display: inline-flex;
}

.leccion-barra .atajo-maestro:hover,
.leccion-pie .atajo-maestro:hover,
a.atajo-maestro:hover,
#maestro-atajo-fijo:hover {
  background: #b08d45 !important;
  border-color: #9a7a3a !important;
  color: #1A160E !important;
}

.leccion-barra .atajo-maestro.is-activo,
.leccion-pie .atajo-maestro.is-activo,
a.atajo-maestro.is-activo,
#maestro-atajo-fijo.is-activo {
  color: #1A160E !important;
  background: #d4b56e !important;
  border-color: #C4A15A !important;
  box-shadow: 0 0 0 2px rgba(196, 161, 90, 0.35);
}

/* Fallback fijo si no hay .leccion-pie */
#maestro-atajo-fijo {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 99999;
  margin: 0;
}

@media (max-width: 560px) {
  .leccion-barra .atajo-maestro {
    flex: 1 1 auto;
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
  }
  .pie-maestro {
    margin-top: 0.85rem;
  }
}

/* Atajo junto al progreso: visible above the lesson body, never footer-only. */
.leccion-progreso {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}
.leccion-progreso .progreso-texto {
  flex: 0 0 auto;
}
.leccion-progreso .progreso-pista {
  flex: 1 1 100%;
  min-width: 5rem;
}
.leccion-progreso .atajo-maestro,
.leccion-barra .atajo-maestro {
  flex: 0 1 auto;
  min-height: 2rem;
  max-width: 100%;
  padding: 0.32rem 0.65rem;
  color: #1A160E !important;
  background: #C4A15A !important;
  border-color: #b08d45 !important;
  line-height: 1.15;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .leccion-progreso {
    min-width: 0;
    max-width: 100%;
  }
  .leccion-progreso .atajo-maestro {
    flex: 0 1 auto;
    white-space: normal;
  }
}

/* lv-maestro-controles — carbón + ámbar */
#maestro-barra {
  background: #0E0E0C;
  color: #F3EFE4;
  border: 1px solid rgba(196, 161, 90, 0.55);
}
#maestro-barra .maestro-barra-titulo { color: #C4A15A; }
#maestro-barra .maestro-paso-texto { color: #F3EFE4; }
#maestro-barra button {
  background: #C4A15A;
  color: #1A160E;
}
#maestro-barra button.secondary {
  background: #1C1A16;
  color: #F3EFE4;
  border: 1px solid rgba(196, 161, 90, 0.45);
}
#maestro-barra .maestro-controles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: center;
}
#maestro-barra .maestro-controles label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: #C4A15A;
  font-weight: 700;
}
#maestro-barra select {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  color: #1A160E;
  background: #F3EFE4;
  border: 1px solid #C4A15A;
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
}
.maestro-focus {
  outline: 3px solid #C4A15A !important;
  box-shadow: 0 0 0 6px rgba(196, 161, 90, 0.28);
}
