/* Laboratorios · REDISEÑO v1.89
 * Se carga después de app.css y theme.css. Qué cambia:
 *   1. Cabecera en una sola fila; lo secundario (clase, cuenta, web) va en «Más». En el móvil, barra inferior.
 *   2. Inicio: los cursos arriba y «Sigue donde lo dejaste».
 *   3. Un color por área (Matemáticas azul, Lengua rojo, Inglés morado, Medio verde…): el mismo que ya tenía la pantalla de jugar.
 *   4. Niveles: un botón «Jugar» y un menú «⋯» con Ficha, Mi trimestre y sesión.
 *   5. Jugar: sin cabecera de la app, título en una línea y más sitio para los ejercicios.
 *   6. Un solo botón flotante (🧰) que abre accesibilidad, semáforo y ruleta.
 * El modo PDI (.is-pdi / .is-pfs) no se toca.
 */

/* ---------- color por área ---------- */
[data-area] { --area: #138a72; --area-t: #e9f6f2; }
[data-area="matematicas"] { --area: #1a6aa1; --area-t: #e8f2fb; }
[data-area="lengua"] { --area: #c0392b; --area-t: #fdecea; }
[data-area="ingles"] { --area: #6d3fc0; --area-t: #f1ebfb; }
[data-area="cono"] { --area: #2f8f46; --area-t: #eaf6ed; }
[data-area="artistica"] { --area: #d14d8b; --area-t: #fcebf3; }
[data-area="efisica"] { --area: #e07a1f; --area-t: #fdf1e5; }
[data-area="tutoria"] { --area: #b8860b; --area-t: #fbf4e0; }
[data-area="temporada"] { --area: #a8551a; --area-t: #fbeee2; }

/* ---------- 1 · cabecera ---------- */
.oec-nav { flex-wrap: nowrap; gap: 14px; padding-top: 8px; padding-bottom: 8px; }
.oec-embed .oec-nav { flex-wrap: nowrap; justify-content: flex-start; }
.oec-nav .oec-brand { margin-right: 4px; flex: none; }
.oec-nav .oec-grades { flex: none; }
.oec-nav .oec-menu { flex: 1 1 auto; min-width: 0; margin-right: auto; overflow-x: auto; scrollbar-width: none; }
.oec-nav .oec-menu::-webkit-scrollbar { display: none; }
.oec-nav nav.oec-menu a { padding: 8px 12px; white-space: nowrap; font-size: 15px; }
.oec-nav .oec-opinion { flex: none; display: inline-flex !important; align-items: center; gap: 4px; padding: 7px 12px; border-width: 2px; border-radius: 999px; font-size: 14px; }
.oec-mas { position: relative; flex: none; }
.oec-mas > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; max-width: 200px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; }
.oec-mas > summary::-webkit-details-marker { display: none; }
.oec-mas > summary:hover, .oec-mas[open] > summary { border-color: var(--teal); background: var(--mint); }
.oec-mas__t { overflow: hidden; text-overflow: ellipsis; }
.oec-mas__p { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: min(320px, 92vw); display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px; background: #fff; border: 2px solid var(--line); box-shadow: 0 16px 40px rgba(20, 52, 58, .18); }
.oec-mas__p .oec-classsel { display: grid; gap: 6px; font-size: 13px; }
.oec-mas__p .oec-classsel select { max-width: none; width: 100%; min-height: 44px; }
.oec-mas__u { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.oec-mas__u:empty { display: none; }
.oec-mas__p > * { order: 3; } .oec-mas__p > .oec-classsel { order: 1; } .oec-mas__p > .oec-mas__menu { order: 2; } .oec-mas__p > .oec-ext { order: 5; }
.oec-mas__p .oec-ext, .oec-mas__p .oec-labs { display: inline-block !important; align-self: flex-start; }
.oec-nav nav.oec-mas__menu { display: none; }
@media (max-width: 1240px) { .oec-nav .oec-opinion__t { display: none; } .oec-nav .oec-brand small { display: none; } }
.oec-nav nav.oec-tabbar { display: none; }

@media (max-width: 899px) {
  :root { --tabh: 60px; }
  /* sin desenfoque: con él, la barra inferior y el panel «Más» se colocarían respecto a la cabecera y no a la pantalla */
  .oec-nav { gap: 8px; padding-left: 12px; padding-right: 12px; -webkit-backdrop-filter: none; backdrop-filter: none; background: #fff; }
  .oec-nav .oec-brand > span:last-child { display: none; }
  .oec-nav .oec-grades { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .oec-nav .oec-grades::-webkit-scrollbar { display: none; }
  .oec-nav nav.oec-menu, .oec-nav > .oec-opinion { display: none !important; }
  .oec-mas { position: static; }
  .oec-mas > summary { display: none; }
  .oec-mas__p { position: fixed; left: 10px; right: 10px; top: auto; bottom: calc(var(--tabh) + 10px + env(safe-area-inset-bottom, 0px)); width: auto; max-height: 70vh; overflow: auto; }
  html.oec-autoh .oec-mas__p { position: absolute; bottom: auto; top: clamp(0px, calc(var(--vt, 0px) + var(--vh1, 1vh) * 100 - var(--vo, 0px) - var(--tabh) - 10px), calc(100% - var(--tabh) - 10px)); transform: translateY(-100%); }
  .oec-nav nav.oec-mas__menu { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .oec-nav nav.oec-mas__menu a { display: flex; align-items: center; min-height: 46px; padding: 0 14px; border-radius: 12px; background: var(--brand-xl); border: 1px solid var(--line); }
  .oec-nav nav.oec-tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: calc(var(--tabh) + env(safe-area-inset-bottom, 0px)); padding: 0 4px env(safe-area-inset-bottom, 0px); background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(20, 52, 58, .08); }
  html.oec-autoh .oec-nav nav.oec-tabbar { position: absolute; bottom: auto; top: clamp(0px, calc(var(--vt, 0px) + var(--vh1, 1vh) * 100 - var(--vo, 0px) - var(--tabh)), calc(100% - var(--tabh))); }
  .oec-nav nav.oec-tabbar a, .oec-tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; border: 0; border-radius: 12px; background: none; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 700; text-decoration: none; cursor: pointer; }
  .oec-tabbar span { font-size: 21px; line-height: 1.15; }
  .oec-nav nav.oec-tabbar a.is-on { background: none; color: var(--teal-d); box-shadow: inset 0 3px 0 var(--teal); border-radius: 0; }
  .oec-nav nav.oec-tabbar a:hover { background: none; }
  body { padding-bottom: calc(var(--tabh) + 8px); }
  body.is-playing, body.pzm-body, body.dz-kid { padding-bottom: 0; }
  body.is-playing .oec-tabbar, body.pzm-body .oec-tabbar, body.dz-kid .oec-tabbar { display: none !important; }
}

/* ---------- 2 · inicio ---------- */
.oec-start { padding: 6px 0 0; max-width: 760px; }
.oec-start h1 { font-size: clamp(26px, 3.2vw, 36px); }
.oec-start p { font-size: 16px; margin-top: 6px; }
.oec-gtiles { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 16px 0 20px; }
.oec-gtile { min-height: 0; padding: 16px 16px 14px; border-radius: 20px; gap: 2px; }
.oec-gtile::before { right: -30px; top: -30px; width: 96px; height: 96px; }
.oec-gtile__n { font-size: 46px; }
.oec-gtile b { font-size: 17px; }
.oec-gtile__d { font-size: 13px; line-height: 1.3; }
.oec-gtile__cy { font-size: 12px; padding: 3px 10px; }
@media (max-width: 1100px) { .oec-gtiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .oec-gtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .oec-gtile { padding: 12px; } .oec-gtile__n { font-size: 38px; } .oec-gtile__cy { display: none; } }

.oec-rec { margin: 0 0 20px; }
.oec-rec h2 { font-size: 19px; margin-bottom: 10px; }
.oec-rec__l { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.oec-rec__a { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; border-radius: 16px; background: #fff; border: 2px solid var(--line); border-left: 6px solid var(--area); text-decoration: none; color: var(--ink); }
.oec-rec__a:hover { border-color: var(--area); background: var(--area-t); }
.oec-rec__i { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; background: var(--area-t); }
.oec-rec__a b { display: block; font-size: 16px; line-height: 1.2; } .oec-rec__a small { color: var(--muted); font-weight: 600; }

/* «Crea tu clase»: una franja, no un cartel */
.oec-clsnew { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 14px 18px; border-radius: 18px; border-width: 1px; box-shadow: none; }
.oec-clsnew__t { flex: 1 1 320px; }
.oec-clsnew__t h2 { font-size: 18px; }
.oec-clsnew__t p { margin: 0; font-size: 14px; }
.oec-clsnew__l { display: none; }
.oec-clsnew .oec-row { margin: 0; flex: none; }
.oec-clsnew .oec-btn--big { min-height: 44px; font-size: 15px; padding: 0 18px; }
.oec-nov2 { margin-top: 14px; }

/* ---------- 3 · curso y laboratorio ---------- */
.oec-ghead__n, .oec-coursehead .oec-course__n { width: 64px; height: 64px; border-radius: 18px; font-size: 30px; box-shadow: 0 4px 0 rgba(0, 0, 0, .16); }
.oec-ghead h1, .oec-coursehead h1 { font-size: clamp(24px, 3vw, 32px); }
.oec-ghead p, .oec-coursehead p { font-size: 14.5px; }
.oec-ghead__a { gap: 8px; }
.oec-ghead__a .oec-btn { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 999px; }
.oec-ghead__a .oec-btn--ghost { box-shadow: inset 0 0 0 1.5px var(--line); background: #fff; }
.oec-area { margin-top: 26px; }
.oec-area__h { align-items: center; padding-left: 12px; border-left: 6px solid var(--area); }
.oec-area__h h2 { font-size: 22px; color: var(--area); filter: brightness(.82); }
.oec-area__h > span { font-size: 14px; }
.oec-labcard { min-height: 0; padding: 14px 16px; border-radius: 18px; border-left: 6px solid var(--area); box-shadow: 0 3px 0 #e3eeeb; }
.oec-labcard:hover { border-color: var(--area); background: var(--area-t); }
.oec-labcard__i { width: 48px; height: 48px; border-radius: 14px; font-size: 26px; background: var(--area-t); border: 0; }
.oec-labcard__b b { font-size: 17px; }
.oec-labcard__m { color: var(--area); filter: brightness(.82); font-size: 13.5px; }
.oec-main[data-area] .oec-labtabs a.is-on { background: var(--area); border-color: var(--area); }
.oec-main[data-area] .oec-labtabs a:hover { border-color: var(--area); }
.oec-main[data-area] .oec-level__n { background: var(--area); }
.oec-main[data-area] .oec-coursehead { padding: 14px 16px; border-radius: 20px; background: linear-gradient(90deg, var(--area-t), transparent 70%); }
.oec-labtabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
.oec-labtabs a { flex: none; min-height: 40px; font-size: 14.5px; }

/* ---------- 4 · niveles ---------- */
.oec-levels { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.oec-level { position: relative; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px 12px; padding: 12px 14px; border-radius: 18px; box-shadow: 0 3px 0 #e3eeeb; }
.oec-level:has(details[open]) { z-index: 6; }
.oec-level__n { width: 44px; height: 44px; border-radius: 13px; font-size: 19px; }
.oec-level h3 { font-size: 16px; line-height: 1.25; }
.oec-level__a { grid-column: auto; align-self: center; gap: 6px; }
.oec-level__a .oec-btn { flex: none; min-height: 44px; padding: 0 20px; }
.oec-lvmore { position: relative; }
.oec-lvmore > summary { list-style: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-size: 24px; font-weight: 800; line-height: 1; color: var(--muted); cursor: pointer; box-shadow: inset 0 0 0 1.5px var(--line); background: #fff; }
.oec-lvmore > summary::-webkit-details-marker { display: none; }
.oec-lvmore > summary:hover, .oec-lvmore[open] > summary { background: var(--mint); color: var(--teal-d); }
.oec-lvmore__p { position: absolute; right: 0; top: calc(100% + 6px); z-index: 7; width: max-content; max-width: min(300px, 80vw); display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 16px; background: #fff; border: 2px solid var(--line); box-shadow: 0 14px 34px rgba(20, 52, 58, .2); }
.oec-level__a .oec-lvmore__p .oec-btn { flex: none; justify-content: flex-start; width: 100%; min-height: 44px; padding: 0 14px; font-size: 15px; font-weight: 700; box-shadow: none; border-radius: 10px; white-space: nowrap; color: var(--ink); background: none; }
.oec-level__a .oec-lvmore__p .oec-btn:hover { background: var(--mint); }
.oec-level__a .oec-lvmore__p .oec-btn.is-on { background: var(--mint); box-shadow: none; color: var(--teal-d); }
.oec-fav i, .oec-addsess i { font-style: normal; }
.oec-fav span, .oec-addsess span { display: none; }
.oec-lvmore__p .oec-fav span, .oec-lvmore__p .oec-addsess span { display: inline; }
.oec-level.is-fav::after { content: "★"; position: absolute; top: -9px; right: 12px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; background: #fff6d6; color: #a26a00; box-shadow: inset 0 0 0 2px #e0a43a; }
.oec-level.is-insess { border-color: var(--teal); }
@media (max-width: 520px) { .oec-level { grid-template-columns: 40px minmax(0, 1fr); } .oec-level__a { grid-column: 1 / -1; } .oec-level__a > .oec-btn { flex: 1; } .oec-level__n { width: 40px; height: 40px; } }

/* ---------- 5 · jugar (fuera del modo PDI) ---------- */
body.is-playing .oec-nav { display: none; }
body.is-playing .oec-main { padding-top: 8px; }
.oec-play:not(.is-pdi):not(.is-pfs) { padding: clamp(10px, 1.4vw, 18px); border-radius: 24px; border-top-width: 6px; }
.oec-play:not(.is-pdi) .oec-play__top { margin-bottom: 8px; gap: 8px; }
.oec-play:not(.is-pdi) .oec-play__top .oec-btn { min-height: 40px; padding: 0 14px; font-size: 14.5px; }
.oec-play:not(.is-pdi) .oec-play__title { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; }
.oec-play:not(.is-pdi) .oec-play__title h2 { margin: 0; font-size: clamp(18px, 2vw, 24px); }
.oec-play:not(.is-pdi) .oec-board { gap: 8px; padding: clamp(8px, 1.2vw, 14px); border-radius: 20px; }
.oec-play:not(.is-pdi) .oec-stats span { padding: 4px 12px; font-size: 14px; }
.oec-play:not(.is-pdi) .av-pista { height: 34px; }
.oec-play:not(.is-pdi) .av-va { font-size: 24px; } .oec-play:not(.is-pdi) .av-meta { font-size: 26px; }
.oec-play:not(.is-pdi) .oec-grid { gap: 10px; }
.oec-play:not(.is-pdi) .oec-card { min-height: 92px; padding: 22px 10px 12px; border-radius: 18px; }
.oec-play[data-area]:not(.is-pdi) .oec-card.is-selected, .oec-play[data-area]:not(.is-pdi) .oec-card.is-sel { border-color: var(--area); box-shadow: 0 5px 0 color-mix(in srgb, var(--area) 35%, #fff); }
.oec-play:not(.is-pdi) .oec-side { gap: 10px; padding: 12px; border-radius: 18px; }
.oec-play[data-area]:not(.is-pdi) .oec-side { background: var(--area-t); border-color: color-mix(in srgb, var(--area) 22%, #fff); }
.oec-play:not(.is-pdi) .oec-keypad button { min-height: 54px; }
.oec-play[data-area] .oec-keypad .k-ok { background: var(--area); box-shadow: 0 4px 0 color-mix(in srgb, var(--area) 70%, #000); }

/* ---------- 6 · un solo botón flotante ---------- */
:root { --dockb: 14px; }
@media (max-width: 899px) { :root { --dockb: calc(var(--tabh) + 12px); } body.is-playing, body.pzm-body, body.dz-kid { --dockb: 14px; } }
.oec-dock { position: fixed; left: 14px; bottom: var(--dockb); z-index: 60; width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--teal); background: #fff; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.oec-dock:hover, body.fabs-open .oec-dock { background: var(--mint); }
html.oec-autoh .oec-dock { position: absolute; bottom: auto; top: clamp(0px, calc(var(--vt, 0px) + var(--vh1, 1vh) * 100 - var(--vo, 0px) - 48px - var(--dockb)), calc(100% - 48px - var(--dockb))); }
body.pzm-body .oec-dock, body.dz-kid .oec-dock { display: none; }

/* accesibilidad: cerrada, solo «leer en voz alta» (si toca), encima del botón; abierta, en fila */
body .acc-fab { left: 14px; bottom: calc(var(--dockb) + 58px); }
body.fabs-open .acc-fab { left: 72px; bottom: var(--dockb); }
body:not(.fabs-open) .acc-fab #accBtn { display: none; }
html.oec-autoh body .acc-fab { position: absolute; bottom: auto; transform: translateY(-100%); top: clamp(106px, calc(var(--vt, 0px) + var(--vh1, 1vh) * 100 - var(--vo, 0px) - var(--dockb) - 58px), calc(100% - var(--dockb) - 58px)); }
html.oec-autoh body.fabs-open .acc-fab { top: clamp(48px, calc(var(--vt, 0px) + var(--vh1, 1vh) * 100 - var(--vo, 0px) - var(--dockb)), calc(100% - var(--dockb))); }

/* semáforo y ruleta: escondidos hasta abrir, salvo si están en marcha */
body .rd-fab:not(.is-pdi) { left: 130px; bottom: var(--dockb); }
body .rl-fab:not(.is-pdi) { left: 188px; bottom: var(--dockb); }
body:not(.fabs-open) .rd-fab:not(.is-pdi):not(.is-on), body:not(.fabs-open) .rl-fab:not(.is-pdi):not(.is-on) { display: none; }
html.oec-autoh body .rd-fab:not(.is-pdi), html.oec-autoh body .rl-fab:not(.is-pdi) { position: absolute; bottom: auto; top: clamp(0px, calc(var(--vt, 0px) + var(--vh1, 1vh) * 100 - var(--vo, 0px) - 48px - var(--dockb)), calc(100% - 48px - var(--dockb))); }
body .rd-mini:not(.is-pdi), body .rl-mini:not(.is-pdi) { bottom: calc(var(--dockb) + 60px); }
html.oec-autoh body .rd-mini:not(.is-pdi), html.oec-autoh body .rl-mini:not(.is-pdi) { bottom: auto; top: clamp(0px, calc(var(--vt, 0px) + var(--vh1, 1vh) * 100 - var(--vo, 0px) - 60px - var(--dockb)), calc(100% - 60px - var(--dockb))); }

/* ayuda: al lado del botón; se aparta cuando se abren los demás */
body .oec-ayuda, body.oec-minis .oec-ayuda { left: 72px; bottom: var(--dockb); }
body.fabs-open .oec-ayuda { display: none; }
html.oec-autoh body .oec-ayuda { bottom: auto; top: clamp(0px, calc(var(--vt, 0px) + var(--vh1, 1vh) * 100 - var(--vo, 0px) - 56px - var(--dockb)), calc(100% - 56px - var(--dockb))); }

/* «Tu opinión» flotante: en ordenador ya está en la cabecera */
.oec-fab { display: none; }
@media (max-width: 899px) {
  .oec-fab { display: block; right: 12px; bottom: var(--dockb); padding: 0; width: 48px; height: 48px; font-size: 0; }
  .oec-fab::before { content: "👍"; font-size: 22px; }
  html.oec-autoh .oec-fab { top: clamp(0px, calc(var(--vt, 0px) + var(--vh1, 1vh) * 100 - var(--vo, 0px) - 48px - var(--dockb)), calc(100% - 48px - var(--dockb))); }
  body.is-playing .oec-fab { display: none; }
}

@media print { .oec-dock, .oec-tabbar, .oec-mas { display: none !important; } }
