:root {
  --marca: #141a2e;
  --marca-2: #222a45;
  --acento: #3b5bdb;
  --acento-suave: #e8edff;
  --exito: #1f9d55;
  --fondo: #f6f7fb;
  --superficie: #ffffff;
  --superficie-2: #f0f2f8;
  --borde: #e2e5ef;
  --texto: #161b2e;
  --texto-2: #5a6178;
  --texto-3: #8a90a6;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --radio: 12px;
  --lateral: 390px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --marca: #0f1530; --marca-2: #1b2550; --acento: #7c95ff; --acento-suave: #1f2a55; --exito: #3ccf7f;
    --fondo: #0b0e1a; --superficie: #131828; --superficie-2: #1a2034; --borde: #262d45;
    --texto: #e9ecf5; --texto-2: #a5acc4; --texto-3: #6f7690;
    --sombra: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --marca: #0f1530; --marca-2: #1b2550; --acento: #7c95ff; --acento-suave: #1f2a55; --exito: #3ccf7f;
  --fondo: #0b0e1a; --superficie: #131828; --superficie-2: #1a2034; --borde: #262d45;
  --texto: #e9ecf5; --texto-2: #a5acc4; --texto-3: #6f7690;
  --sombra: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fondo); color: var(--texto); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* barra superior */
.barra {
  position: sticky; top: 0; z-index: 20; height: 64px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--marca); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
.barra-marca { display: flex; align-items: center; gap: 12px; min-width: 0; }
.barra-marca img { border-radius: 9px; }
.barra-titulo { font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-sub { font-size: 12.5px; color: rgba(255,255,255,.7); }
.barra-acciones { display: flex; align-items: center; gap: 10px; }
.progreso-global { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: rgba(255,255,255,.9); white-space: nowrap; }
.anillo { width: 30px; height: 30px; transform: rotate(-90deg); }
.anillo circle { fill: none; stroke-width: 3.5; }
.anillo-fondo { stroke: rgba(255,255,255,.18); }
.anillo-valor { stroke: #7ee2a8; stroke-linecap: round; stroke-dasharray: 97.4; stroke-dashoffset: 97.4; transition: stroke-dashoffset .5s ease; }
.icono-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06); color: #fff; display: grid; place-items: center;
}
.icono-btn:hover { background: rgba(255,255,255,.14); }

/* disposición */
.disposicion { display: grid; grid-template-columns: minmax(0, 1fr) var(--lateral); align-items: start; }
.principal { min-width: 0; }
.reproductor { position: relative; background: #000; aspect-ratio: 16 / 9; max-height: calc(100vh - 64px - 64px); width: 100%; }
.reproductor video { width: 100%; height: 100%; display: block; background: #000; }
video::cue { font-family: Inter, system-ui, sans-serif; font-size: .9em; background: rgba(0,0,0,.72); color: #fff; line-height: 1.35; }

.siguiente { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 11, 24, .78); backdrop-filter: blur(3px); }
.siguiente[hidden] { display: none; }
.siguiente-caja { text-align: center; color: #fff; padding: 24px; max-width: 420px; }
.siguiente-etiqueta { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.7); }
.siguiente-titulo { font-size: 22px; font-weight: 700; margin: 6px 0 4px; }
.siguiente-cuenta { font-size: 14px; color: rgba(255,255,255,.75); margin-bottom: 18px; }
.siguiente-botones { display: flex; gap: 10px; justify-content: center; }

.herramientas {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 20px; background: var(--superficie); border-bottom: 1px solid var(--borde);
}
.herramientas-centro { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn:disabled { opacity: .4; cursor: default; }
.btn-primario { background: var(--acento); color: #fff; }
.btn-primario:hover { filter: brightness(1.08); }
.btn-claro { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.2); }
.btn-plano { background: transparent; color: var(--texto-2); }
.btn-plano:hover:not(:disabled) { background: var(--superficie-2); color: var(--texto); }
.btn-borde { background: var(--superficie); border-color: var(--borde); color: var(--texto); }
.btn-borde:hover { border-color: var(--acento); }
.btn-borde.hecha { background: color-mix(in srgb, var(--exito) 12%, transparent); border-color: color-mix(in srgb, var(--exito) 40%, transparent); color: var(--exito); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--borde); background: var(--superficie); color: var(--texto-2); font-size: 13px; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--acento-suave); color: var(--acento); border-color: transparent; }
.chip-select select { border: 0; background: transparent; font-weight: 600; font-size: 13px; color: inherit; outline: none; cursor: pointer; }
.chip-select select option { color: #000; }

/* detalle */
.detalle { padding: 22px 20px 48px; max-width: 980px; }
.detalle-cabecera { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.detalle-seccion { font-size: 12.5px; font-weight: 600; color: var(--acento); text-transform: uppercase; letter-spacing: .06em; }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.02em; margin: 4px 0 0; }
.pestanas { display: flex; gap: 4px; margin: 20px 0 0; border-bottom: 1px solid var(--borde); }
.pestana {
  background: none; border: 0; padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--texto-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.pestana[aria-selected="true"] { color: var(--texto); border-bottom-color: var(--acento); }
.panel { padding-top: 18px; }
.descripcion { font-size: 16px; margin: 0 0 16px; color: var(--texto); }
.datos-leccion { display: flex; flex-wrap: wrap; gap: 18px; color: var(--texto-2); font-size: 13.5px; margin-bottom: 22px; }
.datos-leccion span { display: inline-flex; align-items: center; gap: 6px; }
.atajos { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; color: var(--texto-2);
  padding: 14px 16px; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); }
.atajos-titulo { font-weight: 600; color: var(--texto); width: 100%; }
kbd { font-family: inherit; font-size: 12px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--borde); border-bottom-width: 2px; background: var(--superficie-2); margin-right: 3px; }
.ayuda { color: var(--texto-3); font-size: 13px; margin: 0 0 10px; }
.transcripcion { list-style: none; margin: 0; padding: 0; position: relative; max-height: 440px; overflow-y: auto; }
.transcripcion li {
  display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--texto-2);
}
.transcripcion li:hover { background: var(--superficie-2); }
.transcripcion li.activa { background: var(--acento-suave); color: var(--texto); }
.transcripcion time { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--acento); font-weight: 600; padding-top: 2px; }

/* lateral */
.lateral {
  position: sticky; top: 64px; height: calc(100vh - 64px); display: flex; flex-direction: column;
  background: var(--superficie); border-left: 1px solid var(--borde);
}
.lateral-cabecera { padding: 16px 16px 12px; border-bottom: 1px solid var(--borde); }
.lateral-cabecera h2 { font-size: 16px; margin: 0 0 12px; letter-spacing: -.01em; }
.buscador { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--borde); border-radius: 10px; background: var(--fondo); color: var(--texto-3); }
.buscador:focus-within { border-color: var(--acento); }
.buscador input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 14px; color: var(--texto); }
.temario { overflow-y: auto; flex: 1; }
.seccion { border-bottom: 1px solid var(--borde); }
.seccion-cabecera {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 14px 16px;
  background: var(--superficie-2); border: 0;
}
.seccion-cabecera .flecha { transition: transform .2s ease; color: var(--texto-2); }
.seccion.cerrada .flecha { transform: rotate(-90deg); }
.seccion.cerrada .lecciones { display: none; }
.seccion-nombre { font-weight: 700; font-size: 14px; }
.seccion-meta { font-size: 12px; color: var(--texto-3); margin-top: 1px; }
.lecciones { list-style: none; margin: 0; padding: 4px 0; }
.leccion {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 10px 16px; cursor: pointer; position: relative;
}
.leccion:hover { background: var(--superficie-2); }
.leccion.actual { background: var(--acento-suave); }
.leccion.actual::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--acento); }
.marca {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--texto-3); background: transparent;
  display: grid; place-items: center; margin-top: 1px; padding: 0; color: #fff;
}
.marca svg { width: 13px; height: 13px; stroke-width: 3; opacity: 0; }
.marca.hecha { background: var(--exito); border-color: var(--exito); }
.marca.hecha svg { opacity: 1; }
.leccion-titulo { font-size: 14px; font-weight: 500; line-height: 1.4; }
.leccion.actual .leccion-titulo { font-weight: 600; }
.leccion-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--texto-3); margin-top: 4px; }
.leccion-meta svg { width: 13px; height: 13px; }
.leccion-barra { height: 3px; border-radius: 3px; background: var(--borde); margin-top: 6px; overflow: hidden; }
.leccion-barra i { display: block; height: 100%; background: var(--acento); }
.leccion-mini { display: none; }
.sin-resultados { padding: 24px 16px; color: var(--texto-3); font-size: 14px; text-align: center; }
.lateral-pie { padding: 12px 16px; border-top: 1px solid var(--borde); }
.enlace { background: none; border: 0; padding: 0; color: var(--texto-3); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.enlace:hover { color: var(--texto); }

.solo-movil { display: none; }

.aviso {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--texto); color: var(--superficie); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: var(--sombra);
}

@media (max-width: 1100px) { :root { --lateral: 340px; } }
@media (max-width: 860px) {
  .disposicion { display: block; }
  .lateral { display: none; }
  .solo-movil { display: revert; }
  .panel.solo-movil[hidden] { display: none; }
  #panel-contenido .lateral { display: flex; position: static; height: auto; border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; }
  #panel-contenido .temario { overflow: visible; }
  .reproductor { max-height: none; position: sticky; top: 56px; z-index: 10; }
  .barra { height: 56px; }
  .herramientas { flex-wrap: nowrap; }
  .herramientas-centro { flex-wrap: nowrap; gap: 6px; }
  .chip .txt { display: none; }
  .chip { padding: 0 10px; }
  .atajos { display: none; }
  .barra { padding: 0 16px; }
  .barra-sub { display: none; }
  .herramientas { padding: 8px 16px; }
  .btn-plano .txt { display: none; }
  .detalle { padding: 18px 16px 40px; }
  .detalle-cabecera { flex-direction: column; }
  h1 { font-size: 20px; }
}
@media (max-width: 420px) {
  .progreso-global span { display: none; }
  .barra-titulo { font-size: 15px; }
}
