/*
 * Cuadernos Karel
 * Concepto: un aula al estilo de Google Classroom (salones con banner de color, novedades,
 * trabajo de clase, personas y calificaciones) alrededor del cuaderno de Karel: el mundo de Karel
 * (calles, avenidas, paredes y trompos) sigue siendo la ilustración principal. Fondo blanco,
 * azul de acento, tarjetas con borde fino y modo oscuro con los mismos tokens.
 */
:root {
  color-scheme: light;
  --papel: #ffffff;
  --hoja: #ffffff;
  --hoja-2: #f1f3f4;
  --hoja-3: #f8f9fa;
  --tinta: #202124;
  --tinta-2: #3c4043;
  --tinta-3: #5f6368;
  --reja: #e0e0e0;
  --reja-2: #dadce0;
  --marca: #fdd663;
  --marca-tinta: #3c2a00;
  --marca-suave: #e8f0fe;
  --azul: #1a73e8;
  --azul-hover: #1765cc;
  --azul-suave: #e8f0fe;
  --azul-tinta: #1967d2;
  --verde: #188038;
  --verde-suave: #e6f4ea;
  --rojo: #d93025;
  --rojo-suave: #fce8e6;
  --ambar: #b06000;
  --ambar-suave: #fef7e0;
  --morado: #8430ce;
  --morado-suave: #f3e8fd;
  --sobre-acento: #ffffff;
  --sombra: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  --sombra-2: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
  --velo: rgba(32, 33, 36, 0.6);

  --nivel-primaria: var(--verde);
  --nivel-secundaria: var(--azul);
  --nivel-bachillerato: var(--morado);

  /* Colores de los banners de los salones (texto blanco encima). */
  --b-azul: #1967d2;
  --b-verde: #137333;
  --b-morado: #8430ce;
  --b-rojo: #c5221f;
  --b-naranja: #b95000;
  --b-turquesa: #00747c;
  --b-rosa: #c2185b;
  --b-gris: #5f6368;

  --k-fondo: #ffffff;
  --k-reja: #dfe1e5;
  --k-borde: #9aa0a6;
  --k-eje: #70757a;
  --k-muro: #d93025;
  /* Colores que se pueden elegir para Karel (cuerpo, contorno y visor del robot). */
  --kc-azul: #1a73e8;
  --kc-azul-osc: #0b3d91;
  --kc-azul-claro: #e8f0fe;
  --kc-morado: #8430ce;
  --kc-morado-osc: #4a148c;
  --kc-morado-claro: #f3e8fd;
  --kc-rosa: #d01884;
  --kc-rosa-osc: #7a0a4c;
  --kc-rosa-claro: #fde7f3;
  --kc-turquesa: #00838f;
  --kc-turquesa-osc: #004d56;
  --kc-turquesa-claro: #e0f7fa;
  --kc-grafito: #5f6368;
  --kc-grafito-osc: #202124;
  --kc-grafito-claro: #f1f3f4;
  --k-karel: var(--kc-azul);
  --k-karel-osc: var(--kc-azul-osc);
  --k-karel-claro: var(--kc-azul-claro);
  --k-robot-luz: #f9ab00;
  --k-robot-mochila: #e37400;
  --k-trompo: #e6f4ea;
  --k-trompo-borde: #188038;
  --k-trompo-n: #0d652d;
  --k-rastro: rgba(26, 115, 232, 0.18);
  --k-meta: rgba(253, 214, 99, 0.5);
  --k-fuera: #eceef1;
  --k-margen: #f8f9fa;
  --k-margen-sel: #d2e3fc;
  --k-margen-sel-txt: #174ea6;
  --k-seleccion: rgba(26, 115, 232, 0.13);
  --k-seleccion-borde: #1a73e8;
  --k-evaluar: rgba(251, 188, 4, 0.28);
  --grafica-serie: #1a73e8;
  --grafica-eje: #dadce0;

  --t-kw: #a142f4;
  --t-ins: #1967d2;
  --t-sen: #00796b;
  --t-fnum: #b06000;
  --t-num: #b06000;
  --t-fn: #c5221f;
  --t-com: #70757a;
  --t-id: #202124;
  --t-str: #188038;
  --t-pp: #c2185b;
  --t-ty: #00796b;

  --f-display: "Google Sans", "Product Sans", "DM Sans", Roboto, system-ui, sans-serif;
  --f-texto: Roboto, "Google Sans Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-codigo: "JetBrains Mono", "Roboto Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radio: 8px;
  --radio-chico: 6px;
  --riel: 300px;
  --lectura: 46rem;
  --barra-alto: 64px;
}

/* El tema sigue al sistema hasta que se elige con el botón de la barra (data-theme en <html>); sin JavaScript también se sigue al sistema. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papel: #202124;
    --hoja: #292a2d;
    --hoja-2: #35363a;
    --hoja-3: #2d2e31;
    --tinta: #e8eaed;
    --tinta-2: #bdc1c6;
    --tinta-3: #9aa0a6;
    --reja: #3c4043;
    --reja-2: #5f6368;
    --marca: #fdd663;
    --marca-tinta: #2b2200;
    --marca-suave: #2d3b52;
    --azul: #8ab4f8;
    --azul-hover: #aecbfa;
    --azul-suave: #2d3b52;
    --azul-tinta: #aecbfa;
    --verde: #81c995;
    --verde-suave: #1f3a29;
    --rojo: #f28b82;
    --rojo-suave: #44211f;
    --ambar: #fdd663;
    --ambar-suave: #3d3418;
    --morado: #d7aefb;
    --morado-suave: #362647;
    --sobre-acento: #202124;
    --sombra: 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --sombra-2: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
    --velo: rgba(0, 0, 0, 0.6);
    --k-fondo: #202124;
    --k-reja: #3c4043;
    --k-borde: #70757a;
    --k-eje: #9aa0a6;
    --k-muro: #f28b82;
    --kc-azul: #8ab4f8;
    --kc-azul-osc: #0d2a5c;
    --kc-morado: #d7aefb;
    --kc-morado-osc: #3b1466;
    --kc-rosa: #ff8bcb;
    --kc-rosa-osc: #5c0a37;
    --kc-turquesa: #78d9ec;
    --kc-turquesa-osc: #00363d;
    --kc-grafito: #bdc1c6;
    --kc-grafito-osc: #17181a;
    --k-robot-luz: #fdd663;
    --k-robot-mochila: #fcad70;
    --k-trompo: #1f3a29;
    --k-trompo-borde: #81c995;
    --k-trompo-n: #ceead6;
    --k-rastro: rgba(138, 180, 248, 0.26);
    --k-meta: rgba(253, 214, 99, 0.3);
    --k-fuera: #17181a;
    --k-margen: #292a2d;
    --k-margen-sel: #2d3b52;
    --k-margen-sel-txt: #aecbfa;
    --k-seleccion: rgba(138, 180, 248, 0.2);
    --k-seleccion-borde: #8ab4f8;
    --k-evaluar: rgba(253, 214, 99, 0.2);
    --grafica-serie: #8ab4f8;
    --grafica-eje: #5f6368;
    --t-kw: #d7aefb;
    --t-ins: #8ab4f8;
    --t-sen: #78d9ec;
    --t-fnum: #fcad70;
    --t-num: #fcad70;
    --t-fn: #f28b82;
    --t-com: #9aa0a6;
    --t-id: #e8eaed;
    --t-str: #81c995;
    --t-pp: #ff8bcb;
    --t-ty: #78d9ec;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --papel: #202124;
  --hoja: #292a2d;
  --hoja-2: #35363a;
  --hoja-3: #2d2e31;
  --tinta: #e8eaed;
  --tinta-2: #bdc1c6;
  --tinta-3: #9aa0a6;
  --reja: #3c4043;
  --reja-2: #5f6368;
  --marca: #fdd663;
  --marca-tinta: #2b2200;
  --marca-suave: #2d3b52;
  --azul: #8ab4f8;
  --azul-hover: #aecbfa;
  --azul-suave: #2d3b52;
  --azul-tinta: #aecbfa;
  --verde: #81c995;
  --verde-suave: #1f3a29;
  --rojo: #f28b82;
  --rojo-suave: #44211f;
  --ambar: #fdd663;
  --ambar-suave: #3d3418;
  --morado: #d7aefb;
  --morado-suave: #362647;
  --sobre-acento: #202124;
  --sombra: 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --sombra-2: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
  --velo: rgba(0, 0, 0, 0.6);
  --k-fondo: #202124;
  --k-reja: #3c4043;
  --k-borde: #70757a;
  --k-eje: #9aa0a6;
  --k-muro: #f28b82;
  --kc-azul: #8ab4f8;
  --kc-azul-osc: #0d2a5c;
  --kc-morado: #d7aefb;
  --kc-morado-osc: #3b1466;
  --kc-rosa: #ff8bcb;
  --kc-rosa-osc: #5c0a37;
  --kc-turquesa: #78d9ec;
  --kc-turquesa-osc: #00363d;
  --kc-grafito: #bdc1c6;
  --kc-grafito-osc: #17181a;
  --k-robot-luz: #fdd663;
  --k-robot-mochila: #fcad70;
  --k-trompo: #1f3a29;
  --k-trompo-borde: #81c995;
  --k-trompo-n: #ceead6;
  --k-rastro: rgba(138, 180, 248, 0.26);
  --k-meta: rgba(253, 214, 99, 0.3);
  --k-fuera: #17181a;
  --k-margen: #292a2d;
  --k-margen-sel: #2d3b52;
  --k-margen-sel-txt: #aecbfa;
  --k-seleccion: rgba(138, 180, 248, 0.2);
  --k-seleccion-borde: #8ab4f8;
  --k-evaluar: rgba(253, 214, 99, 0.2);
  --grafica-serie: #8ab4f8;
  --grafica-eje: #5f6368;
  --t-kw: #d7aefb;
  --t-ins: #8ab4f8;
  --t-sen: #78d9ec;
  --t-fnum: #fcad70;
  --t-num: #fcad70;
  --t-fn: #f28b82;
  --t-com: #9aa0a6;
  --t-id: #e8eaed;
  --t-str: #81c995;
  --t-pp: #ff8bcb;
  --t-ty: #78d9ec;
  color-scheme: dark;
}

/* Color de Karel que se eligió en «Apariencia de Karel» (data-karel-color en <html>); sin elección, azul. */
:root[data-karel-color="morado"] { --k-karel: var(--kc-morado); --k-karel-osc: var(--kc-morado-osc); --k-karel-claro: var(--kc-morado-claro); }
:root[data-karel-color="rosa"] { --k-karel: var(--kc-rosa); --k-karel-osc: var(--kc-rosa-osc); --k-karel-claro: var(--kc-rosa-claro); }
:root[data-karel-color="turquesa"] { --k-karel: var(--kc-turquesa); --k-karel-osc: var(--kc-turquesa-osc); --k-karel-claro: var(--kc-turquesa-claro); }
:root[data-karel-color="grafito"] { --k-karel: var(--kc-grafito); --k-karel-osc: var(--kc-grafito-osc); --k-karel-claro: var(--kc-grafito-claro); }

/* ------------------------------------------------------------------ */
/* Base                                                               */
/* ------------------------------------------------------------------ */

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--f-texto);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  text-wrap: balance;
  margin: 0;
}

p { margin: 0; }

a { color: var(--azul); text-underline-offset: 0.18em; }
a:hover { color: var(--azul-hover); }

code, kbd, pre, textarea.ed-in { font-family: var(--f-codigo); }

:not(pre) > code {
  font-size: 0.88em;
  background: var(--hoja-2);
  border: 1px solid var(--reja);
  border-radius: 5px;
  padding: 0.05em 0.35em;
  white-space: nowrap;
}

strong, b { font-weight: 600; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; border-radius: 4px; }

.oculto-visual {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ */
/* Botones, chips y campos                                            */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 36px;
  padding: 0.4rem 1.1rem;
  border: 1px solid var(--reja-2);
  border-radius: 999px;
  background: var(--hoja);
  color: var(--azul-tinta);
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--azul-suave); border-color: var(--reja-2); color: var(--azul-tinta); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-pri { background: var(--azul); border-color: var(--azul); color: var(--sobre-acento); }
.btn-pri:hover { background: var(--azul-hover); border-color: var(--azul-hover); color: var(--sobre-acento); box-shadow: var(--sombra); }
.btn-ok { background: var(--verde); border-color: var(--verde); color: var(--sobre-acento); }
.btn-ok:hover { background: var(--verde); border-color: var(--verde); color: var(--sobre-acento); filter: brightness(1.08); }
.btn-alto { background: var(--rojo); border-color: var(--rojo); color: var(--sobre-acento); }
.btn-alto:hover { background: var(--rojo); border-color: var(--rojo); color: var(--sobre-acento); }
.btn-chico { min-height: 32px; padding: 0.25rem 0.85rem; font-size: 0.84rem; }

.enlace {
  border: 0;
  background: none;
  padding: 0;
  color: var(--azul);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
  font-size: 0.9rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--reja-2);
  background: var(--hoja);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--tinta-2);
}
.chip-nivel { border-color: transparent; color: var(--sobre-acento); }
.chip-primaria { background: var(--nivel-primaria); }
.chip-secundaria { background: var(--nivel-secundaria); }
.chip-bachillerato { background: var(--nivel-bachillerato); }
.chip-plat { font-family: var(--f-codigo); font-size: 0.72rem; letter-spacing: 0.02em; }
.chip-ok { background: var(--verde-suave); border-color: transparent; color: var(--verde); }
.chip-marca { background: var(--marca); border-color: transparent; color: var(--marca-tinta); }

.campo { display: grid; gap: 0.35rem; }
.campo label { font-weight: 500; font-size: 0.92rem; }
.campo input, .campo select, .campo textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--reja-2);
  border-radius: var(--radio-chico);
  background: var(--hoja);
}
.campo textarea { min-height: 140px; resize: vertical; font-family: var(--f-texto); }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 3px solid var(--azul-suave); border-color: var(--azul); }
.campo .ayuda { font-size: 0.82rem; color: var(--tinta-3); }

.ceja {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--tinta-3);
}

.marcado {
  background: linear-gradient(transparent 52%, var(--marca) 52%, var(--marca) 90%, transparent 90%);
  color: inherit;
  padding: 0 0.08em;
}

/* ------------------------------------------------------------------ */
/* Pantalla de acceso                                                 */
/* ------------------------------------------------------------------ */

.acceso {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding-block: 2.5rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background-color: var(--papel);
  background-image:
    linear-gradient(var(--reja) 1px, transparent 1px),
    linear-gradient(90deg, var(--reja) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}

.acceso-tarjeta {
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  background: var(--hoja);
  border: 1px solid var(--reja-2);
  border-radius: 16px;
  box-shadow: var(--sombra);
  overflow: hidden;
}

.acceso-portada {
  padding: 2.2rem 2.2rem 1.8rem;
  background: var(--hoja-2);
  border-right: 1px solid var(--reja);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 0;
}

.marca-app { display: flex; align-items: center; gap: 0.6rem; font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; }
.marca-app svg { flex: none; }
.marca-app .marca-sub { font-family: var(--f-texto); font-weight: 400; color: var(--tinta-3); font-size: 0.85rem; }

.acceso-portada h1 { font-size: clamp(2rem, 4.2vw, 2.9rem); font-weight: 800; letter-spacing: -0.025em; }
.acceso-portada .acceso-lema { color: var(--tinta-2); max-width: 32rem; }
.acceso-mundo { margin-top: auto; }
.acceso-mundo svg { width: 100%; height: auto; max-width: 420px; display: block; }
.acceso-mundo figcaption { font-size: 0.8rem; color: var(--tinta-3); margin-top: 0.4rem; font-family: var(--f-codigo); }

.acceso-form { padding: 2.2rem; display: grid; gap: 1.1rem; align-content: center; min-width: 0; }
.acceso-form h2 { font-size: 1.45rem; }
.acceso-form p.acceso-instr { color: var(--tinta-2); font-size: 0.95rem; }
.acceso-form .campo input[name="codigo"] { font-family: var(--f-codigo); letter-spacing: 0.12em; text-transform: uppercase; font-size: 1.1rem; }
.acceso-error { background: var(--rojo-suave); color: var(--rojo); border-radius: var(--radio-chico); padding: 0.6rem 0.8rem; font-size: 0.92rem; }
.acceso-nota { font-size: 0.82rem; color: var(--tinta-3); border-top: 1px dashed var(--reja-2); padding-top: 0.9rem; }

/* Selector de cuadernos (coordinación) */
.selector { display: grid; gap: 1.2rem; }
.selector-tabla { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; }
.selector-celda { display: grid; gap: 0.5rem; padding: 1rem; border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); }
.selector-celda h3 { font-size: 1.1rem; }
.selector-celda .chip { justify-self: start; }
.selector-celda .btn { width: 100%; }

/* ------------------------------------------------------------------ */
/* Estructura del cuaderno                                            */
/* ------------------------------------------------------------------ */

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--hoja);
}

.barra {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 60px;
  padding-block: 0.5rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--hoja);
  border-bottom: 1px solid var(--reja);
}
.barra .marca-app { white-space: nowrap; }
.barra-cuaderno { display: flex; align-items: center; gap: 0.5rem; min-width: 0; flex-wrap: wrap; }
.barra-espacio { flex: 1; }
.barra-usuario { display: flex; align-items: center; gap: 0.6rem; min-width: 0; flex: none; }
.barra-nombre { font-size: 0.88rem; color: var(--tinta-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 14rem; }
.barra-menu { display: none; }

.vista-toggle { display: inline-flex; border: 1px solid var(--reja-2); border-radius: 999px; padding: 2px; background: var(--hoja-2); }
.vista-toggle button { border: 0; background: none; padding: 0.2rem 0.7rem; border-radius: 999px; font-size: 0.8rem; cursor: pointer; color: var(--tinta-2); }
.vista-toggle button[aria-pressed="true"] { background: var(--hoja); color: var(--tinta); box-shadow: 0 1px 2px rgba(0,0,0,0.12); font-weight: 600; }

.cuerpo {
  display: grid;
  grid-template-columns: var(--riel) minmax(0, 1fr);
  min-height: calc(100vh - 60px);
}

.riel {
  position: sticky;
  top: calc(60px + env(safe-area-inset-top, 0px));
  align-self: start;
  height: calc(100vh - 60px - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  padding: 1.1rem 0.75rem 2rem max(0.75rem, env(safe-area-inset-left, 0px));
  border-right: 1px solid var(--reja);
  background: var(--hoja);
}

.riel-inicio {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 0; border-radius: var(--radio-chico);
  background: none; cursor: pointer; text-align: left;
  font-weight: 500;
}
.riel-inicio:hover { background: var(--hoja-2); }
.riel-inicio[aria-current="page"] { background: var(--marca-suave); }

.riel-progreso { margin: 0.6rem 0.65rem 1rem; display: grid; gap: 0.35rem; }
.riel-progreso-txt { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--tinta-3); }
.riel-leyenda { font-size: 0.74rem; color: var(--tinta-3); display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.riel-leyenda .riel-puntos { margin-right: 0.15rem; }
.barra-avance { height: 6px; border-radius: 99px; background: var(--hoja-2); overflow: hidden; border: 1px solid var(--reja); }
.barra-avance span { display: block; height: 100%; background: var(--verde); border-radius: 99px; }

.riel-bloque { margin-top: 0.15rem; }
.riel-bloque h2 { margin: 0; padding: 0; font: inherit; }
.riel-bloque .riel-lista { margin: 0.1rem 0 0.5rem; }
.riel-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }

.riel-tema {
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 0;
  border-radius: var(--radio-chico);
  background: none;
  cursor: pointer;
  text-align: left;
  font-size: 0.92rem;
  line-height: 1.3;
}
.riel-tema:hover { background: var(--hoja-2); }
.riel-tema[aria-current="page"] { background: var(--marca-suave); }
.riel-tema[aria-current="page"] .riel-t { font-weight: 600; }
.riel-tema:disabled { cursor: default; opacity: 0.55; }
.riel-tema:disabled:hover { background: none; }
.riel-n { font-family: var(--f-codigo); font-size: 0.74rem; color: var(--tinta-3); }
.riel-t { min-width: 0; }
.riel-t code { white-space: normal; }
.riel-extra { font-size: 0.74rem; color: var(--tinta-3); font-family: var(--f-codigo); white-space: nowrap; }
.riel-check { width: 18px; height: 18px; color: var(--verde); }
.riel-puntos { display: inline-flex; gap: 3px; }
.riel-puntos i { width: 7px; height: 7px; border-radius: 50%; background: var(--reja-2); }
.riel-puntos i.si { background: var(--verde); }

.principal {
  min-width: 0;
  padding-block: 2rem 4rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.contenedor { max-width: 72rem; margin: 0 auto; padding: 0 clamp(0px, 2vw, 1.5rem); }
.lectura { max-width: var(--lectura); }

.velo { display: none; }

@media (max-width: 960px) {
  .cuerpo { grid-template-columns: minmax(0, 1fr); }
  .riel {
    position: fixed;
    z-index: 40;
    top: 0;
    left: 0;
    bottom: 0;
    height: auto;
    width: min(86vw, 330px);
    padding-top: calc(1rem + env(safe-area-inset-top, 0px));
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: var(--sombra);
  }
  .riel.abierto { transform: none; }
  .velo.visible { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 14, 24, 0.45); }
  .barra-menu { display: inline-flex; }
  .barra-nombre { display: none; }
}

@media (max-width: 640px) {
  .barra { gap: 0.5rem; }
  .barra .marca-app .marca-texto { display: none; }
  .principal { padding-block: 1.25rem 3rem; }
  .acceso-tarjeta { grid-template-columns: minmax(0, 1fr); }
  .acceso-portada { border-right: 0; border-bottom: 1px solid var(--reja); padding: 1.5rem; }
  .acceso-form { padding: 1.5rem; }
  .selector-tabla { grid-template-columns: minmax(0, 1fr); }
}

/* Menú del riel: secciones con íconos y temas que se pliegan */
.icono { width: 1.15rem; height: 1.15rem; flex: none; }
.riel-menu { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.riel-item {
  display: grid;
  grid-template-columns: 1.2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: var(--radio-chico);
  background: none;
  cursor: pointer;
  text-align: left;
  font-weight: 500;
  font-size: 0.94rem;
  color: var(--tinta-2);
}
.riel-item .icono { color: var(--tinta-3); }
.riel-item:hover { background: var(--hoja-2); color: var(--tinta); }
.riel-item[aria-current="page"] { background: var(--marca-suave); color: var(--tinta); }
.riel-item[aria-current="page"] .icono { color: var(--tinta); }
.riel-insignia { min-width: 1.5rem; padding: 0 0.4rem; border-radius: 99px; background: var(--hoja-2); border: 1px solid var(--reja); font-family: var(--f-codigo); font-size: 0.72rem; line-height: 1.5; text-align: center; color: var(--tinta-3); }
.riel-insignia.viva { background: var(--rojo); border-color: transparent; color: var(--sobre-acento); font-weight: 600; }
.riel-titulo { margin: 0; padding: 1.1rem 0.65rem 0.3rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--tinta-3); }
.riel-bloque-cab {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.4rem 0.65rem;
  border: 0;
  border-radius: var(--radio-chico);
  background: none;
  cursor: pointer;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tinta-2);
}
.riel-bloque-cab:hover { background: var(--hoja-2); color: var(--tinta); }
.riel-bloque-cab .icono { width: 0.95rem; height: 0.95rem; margin-left: auto; color: var(--tinta-3); transition: transform 0.15s; }
.riel-bloque-cab[aria-expanded="false"] .icono { transform: rotate(-90deg); }
.riel-bloque-n { font-family: var(--f-codigo); font-weight: 500; font-size: 0.72rem; color: var(--tinta-3); }
/* Encabezado de cada curso en el menú (Karel, C/C++): sus temas y sus problemas van debajo. */
.riel-curso {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 0.6rem; align-items: center;
  margin: 0.9rem 0.35rem 0.35rem; padding: 0.5rem 0.6rem; border-radius: var(--radio);
  background: var(--hoja-2); border-left: 3px solid var(--curso, var(--azul));
}
.riel-curso.curso-karel { --curso: var(--azul); }
.riel-curso.curso-cpp { --curso: var(--morado); }
.riel-curso-marca {
  grid-row: 1 / 3; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--hoja); color: var(--curso, var(--azul)); box-shadow: inset 0 0 0 1px var(--reja-2);
}
.riel-curso-marca .icono { width: 20px; height: 20px; }
.marca-curso-txt { font-family: var(--f-codigo); font-weight: 700; font-size: 0.72rem; letter-spacing: -0.02em; }
.riel-curso-t { font-family: var(--f-display); font-weight: 600; font-size: 0.98rem; color: var(--tinta); line-height: 1.2; }
.riel-curso-sub { font-size: 0.72rem; color: var(--tinta-3); line-height: 1.2; }
.riel-propio {
  display: inline-block; margin-left: 0.35rem; padding: 0 0.35rem; border-radius: 999px; vertical-align: 0.08em;
  font-family: var(--f-texto); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.02em; color: var(--azul-tinta); background: var(--azul-suave);
}
.riel-agregar { color: var(--azul-tinta); margin-top: 0.4rem; }
.riel-agregar .icono { color: var(--azul-tinta); }
/* Etiqueta del curso en las cejas de los temas, la ruta y la planeación. */
.ceja-curso { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; letter-spacing: 0.06em; color: var(--azul-tinta); background: var(--azul-suave); }
.ceja-curso.curso-cpp { color: var(--morado); background: var(--morado-suave); }

/* Botón de modo claro / oscuro y migas de pan */
.tema-boton { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border: 1px solid var(--reja-2); border-radius: 999px; background: var(--hoja); color: var(--tinta-2); cursor: pointer; }
.tema-boton:hover { background: var(--hoja-2); color: var(--tinta); }
.tema-boton .icono { width: 18px; height: 18px; }
.acceso-tema { position: fixed; z-index: 5; top: calc(14px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); }
.barra-menu .icono { width: 1rem; height: 1rem; }
@media (max-width: 640px) {
  .barra-menu-t { display: none; }
  .barra-menu { padding-inline: 0.5rem; }
  .tema-boton { width: 32px; height: 32px; }
  .barra .vista-toggle button { padding-inline: 0.5rem; }
}
.migas { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0 0 1rem; font-size: 0.86rem; color: var(--tinta-3); }
.migas button { border: 0; background: none; padding: 0; color: var(--azul); cursor: pointer; font-size: inherit; text-decoration: underline; text-underline-offset: 0.18em; }
.migas span[aria-current] { color: var(--tinta-2); }

/* ------------------------------------------------------------------ */
/* Cabecera de tema y pestañas                                        */
/* ------------------------------------------------------------------ */

.tema-cab { display: grid; gap: 0.55rem; margin-bottom: 1.4rem; }
.tema-cab h1 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; }
.tema-cab h1 code { font-family: var(--f-codigo); font-size: 0.82em; background: none; border: 0; padding: 0; white-space: normal; }
.tema-lema { color: var(--tinta-2); font-size: 1.05rem; max-width: var(--lectura); }
.tema-horas { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; font-size: 0.88rem; color: var(--tinta-2); }
.tema-propio { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0; }
.chip-propio { background: var(--azul-suave); border-color: transparent; color: var(--azul-tinta); }
.tema-acciones { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tema-acciones .btn .icono { width: 16px; height: 16px; margin-right: 0.3rem; vertical-align: -0.2em; }
.tema-compartir { border-top: 0; padding-top: 0; }

.pestanas {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--reja-2);
  margin-bottom: 1.6rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.pestanas::-webkit-scrollbar { display: none; }
.pestana {
  position: relative;
  border: 0;
  background: none;
  padding: 0.7rem 0.95rem 0.75rem;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--tinta-3);
  cursor: pointer;
  white-space: nowrap;
}
.pestana:hover { color: var(--tinta); }
.pestana[aria-selected="true"] { color: var(--tinta); }
.pestana[aria-selected="true"] span {
  background: linear-gradient(transparent 55%, var(--marca) 55%, var(--marca) 92%, transparent 92%);
  padding: 0 0.12em;
}
.pestana-maestro { margin-left: auto; }
.pestana .cuenta { font-family: var(--f-codigo); font-size: 0.72rem; color: var(--tinta-3); margin-left: 0.3rem; }
@media (max-width: 520px) {
  .pestana { padding-inline: 0.7rem; font-size: 0.98rem; }
  .pestana .cuenta { display: none; }
}

.tema-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.2rem; border-top: 1px dashed var(--reja-2); flex-wrap: wrap; }
.tema-nav .btn { max-width: 100%; }
.tema-nav .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ */
/* Contenido de lectura (Aprende)                                     */
/* ------------------------------------------------------------------ */

.leccion { display: grid; gap: 1.05rem; }
.leccion > * { min-width: 0; }
.leccion h3 { font-size: 1.32rem; margin-top: 1.1rem; }
.leccion h3:first-child { margin-top: 0; }
.leccion h4 { font-size: 1.05rem; margin-top: 0.4rem; }
.leccion p, .leccion ul, .leccion ol { max-width: var(--lectura); }
.leccion ul, .leccion ol { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.35rem; }

.k-codigo {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--hoja);
  border: 1px solid var(--reja-2);
  border-radius: var(--radio-chico);
  font-size: 0.88rem;
  line-height: 1.6;
  overflow-x: auto;
  max-width: var(--lectura);
  tab-size: 4;
}
.k-codigo-pie { font-size: 0.82rem; color: var(--tinta-3); margin-top: -0.6rem; }
.comparar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; max-width: var(--lectura); }
.comparar figure { margin: 0; display: grid; gap: 0.35rem; min-width: 0; align-content: start; }
@media (max-width: 420px) { .comparar { grid-template-columns: minmax(0, 1fr); } }

.t-kw { color: var(--t-kw); font-weight: 600; }
.t-ins { color: var(--t-ins); font-weight: 600; }
.t-sen { color: var(--t-sen); }
.t-fnum { color: var(--t-fnum); }
.t-num { color: var(--t-num); }
.t-fn { color: var(--t-fn); }
.t-com { color: var(--t-com); font-style: italic; }
.t-id { color: var(--t-id); }
.t-str { color: var(--t-str); }
.t-pp { color: var(--t-pp); font-weight: 600; }
.t-ty { color: var(--t-ty); font-weight: 600; }

.tabla-envoltura { overflow-x: auto; max-width: 100%; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); }
.tabla { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.tabla th, .tabla td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--reja); vertical-align: top; }
.tabla th { font-weight: 600; background: var(--hoja-2); font-size: 0.84rem; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla td.num, .tabla th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla .resaltada { background: var(--marca-suave); }
.tabla .v-si { color: var(--verde); font-weight: 600; }
.tabla .v-no { color: var(--rojo); font-weight: 600; }

.nota {
  display: grid;
  gap: 0.3rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radio-chico);
  border: 1px solid transparent;
  max-width: var(--lectura);
  font-size: 0.95rem;
}
.nota-t { font-weight: 600; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; }
.nota-tip { background: var(--azul-suave); }
.nota-tip .nota-t { color: var(--azul); }
.nota-ojo { background: var(--ambar-suave); }
.nota-ojo .nota-t { color: var(--ambar); }
.nota-sabias { background: var(--verde-suave); }
.nota-sabias .nota-t { color: var(--verde); }
.nota-cpp { background: var(--hoja-2); border-color: var(--reja-2); }
.nota-cpp .nota-t { color: var(--tinta-2); }
.nota-maestro { background: var(--morado-suave); }
.nota-maestro .nota-t { color: var(--morado); }

.esencial {
  max-width: var(--lectura);
  padding: 1rem 1.15rem;
  border: 2px dashed var(--reja-2);
  border-radius: var(--radio);
  background: var(--hoja);
}
.esencial h4 { font-size: 1rem; margin-bottom: 0.5rem; }
.esencial ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.3rem; }

.mundos { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.mundo-fig { margin: 0; display: grid; gap: 0.35rem; justify-items: start; min-width: 0; max-width: 100%; }
.mundo-fig svg { max-width: 100%; height: auto; display: block; }
.mundo-fig figcaption { font-size: 0.8rem; color: var(--tinta-3); }
.mundo-flecha { align-self: center; color: var(--tinta-3); font-size: 1.4rem; }

/* Dibujo del mundo */
.k-mundo { font-family: var(--f-codigo); }
.k-fondo { fill: var(--k-fondo); }
.k-reja { stroke: var(--k-reja); stroke-width: 1; fill: none; shape-rendering: crispEdges; }
.k-borde { fill: none; stroke: var(--k-borde); stroke-width: 2; }
.k-eje { fill: var(--k-eje); font-size: 10px; }
.k-muro { stroke: var(--k-muro); stroke-width: 4; stroke-linecap: round; fill: none; }
.k-flecha path { fill: var(--k-karel); }
/* Karel se dibuja como flecha y como robot; se ve el que se eligió en «Apariencia de Karel» (data-karel en <html>). */
.k-robot { display: none; }
:root[data-karel="robot"] .k-flecha:not(.k-fija) { display: none; }
:root[data-karel="robot"] .k-robot, .k-robot.k-fija { display: inline; }
.k-r-k { fill: var(--k-karel-osc); }
.k-r-b { fill: var(--k-karel); }
.k-r-c { fill: var(--k-karel-claro); }
.k-r-a { fill: var(--k-robot-luz); }
.k-r-m { fill: var(--k-robot-mochila); }
.k-trompo { fill: var(--k-trompo); stroke: var(--k-trompo-borde); stroke-width: 1.4; }
.k-trompo-n { fill: var(--k-trompo-n); font-weight: 700; }
.k-rastro { fill: none; stroke: var(--k-rastro); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.k-meta { fill: var(--k-meta); }
.k-insignia-halo { fill: var(--k-fondo); }

/* Ejemplo interactivo dentro de la lección */
.demo { border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); overflow: hidden; }
.demo-cab { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: baseline; justify-content: space-between; padding: 0.8rem 1rem; border-bottom: 1px solid var(--reja); background: var(--hoja-2); }
.demo-cab h4 { font-size: 1rem; }
.demo-cab .ceja { color: var(--azul); }
.demo-txt { padding: 0.8rem 1rem 0; color: var(--tinta-2); font-size: 0.95rem; max-width: var(--lectura); }

/* ------------------------------------------------------------------ */
/* Simulador                                                          */
/* ------------------------------------------------------------------ */

.sim {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1rem;
  padding: 1rem;
}
.sim-panel-mundo, .sim-panel-codigo { min-width: 0; display: grid; gap: 0.7rem; align-content: start; }
.sim-vista { display: flex; justify-content: center; align-items: center; padding: 0.6rem; background: var(--hoja-2); border-radius: var(--radio-chico); border: 1px solid var(--reja); min-height: 160px; overflow: hidden; }
.sim-vista svg { max-width: 100%; height: auto; display: block; }
.sim-datos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; margin: 0; }
.sim-datos div { background: var(--hoja-2); border: 1px solid var(--reja); border-radius: var(--radio-chico); padding: 0.35rem 0.5rem; min-width: 0; }
.sim-datos dt { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tinta-3); }
.sim-datos dd { margin: 0; font-family: var(--f-codigo); font-size: 0.86rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-casos { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.sim-casos-t { font-size: 0.78rem; color: var(--tinta-3); margin-right: 0.2rem; }
.sim-caso { min-width: 32px; min-height: 32px; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); cursor: pointer; font-family: var(--f-codigo); font-size: 0.85rem; }
.sim-caso[aria-pressed="true"] { background: var(--marca); border-color: var(--marca); color: var(--marca-tinta); font-weight: 600; }

.sim-herr { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.sim-herr-b {
  border: 1px solid transparent;
  background: var(--azul-suave);
  color: var(--azul);
  border-radius: 5px;
  padding: 0.2rem 0.5rem;
  min-height: 30px;
  font-family: var(--f-codigo);
  font-size: 0.78rem;
  cursor: pointer;
}
.sim-herr-b:hover { border-color: var(--azul); }

.sim-controles { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.sim-vel { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--tinta-3); margin-left: auto; }
.sim-vel select { border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); padding: 0.3rem 0.4rem; font-size: 0.85rem; }

.sim-msj { border-radius: var(--radio-chico); padding: 0.6rem 0.8rem; background: var(--hoja-2); border: 1px solid var(--reja); font-size: 0.9rem; display: grid; gap: 0.15rem; }
.sim-msj-t { font-size: 0.68rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--tinta-3); }
.sim-msj[data-tipo="error"] { background: var(--rojo-suave); border-color: transparent; color: var(--rojo); }
.sim-msj[data-tipo="ok"] { background: var(--verde-suave); border-color: transparent; color: var(--verde); }
.sim-msj[data-tipo="aviso"] { background: var(--ambar-suave); border-color: transparent; color: var(--ambar); }
.sim-msj[data-tipo="error"] .sim-msj-t, .sim-msj[data-tipo="ok"] .sim-msj-t, .sim-msj[data-tipo="aviso"] .sim-msj-t { color: inherit; opacity: 0.8; }
.sim-pie { display: flex; justify-content: flex-end; }

@media (max-width: 760px) {
  .sim { grid-template-columns: minmax(0, 1fr); padding: 0.75rem; }
  .sim-datos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sim-vel { margin-left: 0; }
}

/* Editor */
.ed {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  border: 1px solid var(--reja-2);
  border-radius: var(--radio-chico);
  background: var(--hoja);
  overflow: hidden;
  height: 300px;
  font-size: 14px;
}
.ed-num {
  margin: 0;
  padding: 10px 8px 10px 10px;
  font-family: var(--f-codigo);
  line-height: 22px;
  color: var(--tinta-3);
  background: var(--hoja-2);
  border-right: 1px solid var(--reja);
  text-align: right;
  white-space: pre;
  overflow: hidden;
  user-select: none;
  font-variant-numeric: tabular-nums;
  min-width: 2.6em;
}
.ed-area { position: relative; min-width: 0; }
.ed-hl, .ed-in {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  font-family: var(--f-codigo);
  font-size: 14px;
  line-height: 22px;
  white-space: pre;
  overflow: auto;
  tab-size: 4;
  letter-spacing: 0;
}
.ed-hl { pointer-events: none; color: var(--tinta); scrollbar-width: none; }
.ed-hl::-webkit-scrollbar { display: none; }
.ed-in { background: transparent; color: transparent; caret-color: var(--tinta); resize: none; outline: none; width: 100%; height: 100%; }
.ed-in::selection { background: rgba(35, 80, 200, 0.25); color: transparent; }
.ed:focus-within { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-suave); }
.ed-marca { position: absolute; left: 0; right: 0; top: 0; height: 22px; pointer-events: none; }
.ed-marca-activa { background: var(--marca-suave); border-left: 3px solid var(--marca); }
.ed-marca-error { background: var(--rojo-suave); border-left: 3px solid var(--rojo); }

/* ------------------------------------------------------------------ */
/* Practica                                                           */
/* ------------------------------------------------------------------ */

.seccion { display: grid; gap: 0.9rem; margin-bottom: 2.4rem; }
.seccion > * { min-width: 0; }
.seccion-cab { display: grid; gap: 0.3rem; }
.seccion-cab h2 { font-size: 1.35rem; }
.seccion-cab p { color: var(--tinta-2); max-width: var(--lectura); }

.asignado {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 1.5rem;
  align-items: center;
  padding: 1.2rem 1.3rem;
  border-radius: var(--radio);
  border: 1px solid var(--reja-2);
  background: var(--hoja);
  box-shadow: var(--sombra);
}
.asignado-info { display: grid; gap: 0.35rem; min-width: 0; }
.asignado-info h3 { font-size: 1.3rem; overflow-wrap: anywhere; }
.asignado-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.asignado-acciones { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
.asignado-nota { grid-column: 1 / -1; font-size: 0.84rem; color: var(--tinta-3); border-top: 1px dashed var(--reja-2); padding-top: 0.75rem; }
@media (max-width: 640px) {
  .asignado { grid-template-columns: minmax(0, 1fr); }
  .asignado-acciones { justify-content: flex-start; }
}

.lista-problemas { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.problema {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--reja-2);
  border-radius: var(--radio-chico);
  background: var(--hoja);
  text-decoration: none;
  color: var(--tinta);
}
a.problema:hover { border-color: var(--azul); color: var(--tinta); }
.problema-n { font-family: var(--f-codigo); font-size: 0.78rem; color: var(--tinta-3); }
.problema-t { display: grid; gap: 0.1rem; min-width: 0; }
.problema-t strong { font-weight: 500; overflow-wrap: anywhere; }
.problema-t span { font-size: 0.8rem; color: var(--tinta-3); }
.problema-ir { color: var(--azul); font-size: 0.86rem; white-space: nowrap; }

.reto { border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); overflow: hidden; }
.reto-cab { display: grid; gap: 0.6rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--reja); background: var(--hoja-2); }
.reto-titulo { display: flex; gap: 0.6rem; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.reto-titulo h3 { font-size: 1.12rem; }
.reto-enunciado { max-width: var(--lectura); color: var(--tinta-2); }
.reto-enunciado p + p { margin-top: 0.4rem; }
.reto-mundos { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.reto-extra { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; padding: 0 1.1rem 1rem; }
.reto-extra details { max-width: 100%; }
.reto-extra summary { cursor: pointer; color: var(--azul); font-size: 0.9rem; }
.reto-extra .k-codigo { margin-top: 0.5rem; }

.herramienta { border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); padding: 1.1rem; display: grid; gap: 0.9rem; }
.herramienta .fila { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; }

.reto { scroll-margin-top: calc(76px + env(safe-area-inset-top, 0px)); }
.reto-enunciado ul { margin: 0.4rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.2rem; }
.reto-revisa { font-size: 0.84rem; color: var(--tinta-3); }
.reto-acciones { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-left: auto; }
.riel-inicio .riel-extra { margin-left: auto; }

/* ------------------------------------------------------------------ */
/* Problemas del maestro                                              */
/* ------------------------------------------------------------------ */

.mp-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.mp-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--reja-2);
  border-radius: var(--radio);
  background: var(--hoja);
}
.mp-info { display: grid; gap: 0.35rem; min-width: 0; }
.mp-info h3 { font-size: 1.05rem; overflow-wrap: anywhere; }
.mp-acciones { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.mp-panel { grid-column: 1 / -1; display: grid; gap: 0.8rem; padding-top: 0.8rem; border-top: 1px dashed var(--reja-2); min-width: 0; }
.mp-panel .fila { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.campo textarea.mp-codigo { min-height: 4.6rem; font-family: var(--f-codigo); font-size: 0.76rem; line-height: 1.45; word-break: break-all; }
@media (max-width: 720px) {
  .mp-item { grid-template-columns: minmax(0, 1fr); }
  .mp-acciones { justify-content: flex-start; }
}

/* Editor de problemas */
.editor-problema { display: grid; gap: 1.6rem; }
.editor-problema > * { min-width: 0; }
.editor-problema .seccion { margin-bottom: 0; }
.ep-fila { display: flex; flex-wrap: wrap; gap: 0.6rem 0.8rem; align-items: flex-end; }
.ep-fila > .campo { flex: 1 1 10rem; min-width: 0; }
.ep-fila > .ep-titulo { flex: 3 1 18rem; }
.ep-fila > .ep-num { flex: 0 0 6.5rem; }
.ep-etiqueta { font-weight: 500; font-size: 0.92rem; }
.editor-problema .ayuda { font-size: 0.82rem; color: var(--tinta-3); }
.ep-grupo { border: 1px solid var(--reja); border-radius: var(--radio-chico); padding: 0.55rem 0.9rem 0.8rem; margin: 0; min-width: 0; }
.ep-grupo legend { font-weight: 500; font-size: 0.92rem; padding: 0 0.3rem; }
.ep-checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.3rem; }
.ep-sangria { margin-top: 0.55rem; padding-left: 1.7rem; }
.ep-check { display: inline-flex; gap: 0.45rem; align-items: center; font-size: 0.92rem; cursor: pointer; min-height: 32px; }
.ep-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--azul); flex: none; }

.ep-casos { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; justify-content: space-between; }
.ep-casos-acciones { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ep-cuerpo { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(15rem, 1fr); gap: 1rem; align-items: start; }
.ep-col-lienzo, .ep-col-datos { display: grid; gap: 0.7rem; min-width: 0; align-content: start; }
.ep-herr { display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: center; }
.ep-herr .vista-toggle button, .ep-bloque .vista-toggle button { padding: 0.3rem 0.8rem; font-size: 0.86rem; min-height: 32px; }
.ep-bloque .vista-toggle { flex-wrap: wrap; justify-self: start; }
.ep-lienzo {
  display: flex;
  justify-content: center;
  padding: 0.6rem;
  background: var(--hoja-2);
  border: 1px solid var(--reja);
  border-radius: var(--radio-chico);
  overflow: auto;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.ep-lienzo[data-herr="paredes"] { cursor: crosshair; }
.ep-lienzo svg { display: block; max-width: 100%; height: auto; }
.ep-guia { fill: none; stroke: var(--azul); stroke-width: 2; stroke-dasharray: 4 3; pointer-events: none; }
.ep-guia-muro { stroke: var(--k-muro); stroke-width: 6; stroke-dasharray: none; stroke-linecap: round; opacity: 0.45; }
.ep-bloque { display: grid; gap: 0.65rem; padding: 0.8rem 0.9rem; border: 1px solid var(--reja); border-radius: var(--radio-chico); background: var(--hoja); }
.ep-bloque-t { font-size: 1rem; }
.ep-lados { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem; }
.ep-lado { min-height: 34px; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); cursor: pointer; font-size: 0.82rem; padding: 0 0.2rem; }
.ep-lado:hover { border-color: var(--tinta-3); }
.ep-lado[aria-pressed="true"] { background: var(--rojo-suave); border-color: var(--k-muro); color: var(--rojo); font-weight: 600; }
.ep-lado:disabled { cursor: default; opacity: 0.55; }
.ep-bloque .btn { justify-self: start; }
@media (max-width: 860px) { .ep-cuerpo { grid-template-columns: minmax(0, 1fr); } }

.ep-prueba { display: grid; gap: 0.6rem; }
.ep-prueba:empty { display: none; }
.ep-ok { background: var(--verde-suave); color: var(--verde); border-radius: var(--radio-chico); padding: 0.6rem 0.8rem; font-size: 0.92rem; }
.ep-resultados { display: grid; gap: 0.6rem; }
.ep-res { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.8rem; align-items: start; padding: 0.6rem 0.8rem; border: 1px solid var(--reja); border-radius: var(--radio-chico); background: var(--hoja); }
.ep-res strong { font-family: var(--f-display); }
.ep-res p { font-size: 0.9rem; color: var(--tinta-2); }
.ep-res .mundo-fig svg { max-width: 220px; }
.ep-res-mal { border-color: var(--rojo); background: var(--rojo-suave); }
.ep-res-mal p { color: var(--rojo); }
@media (max-width: 520px) { .ep-res { grid-template-columns: minmax(0, 1fr); } }
.ep-codigo { display: grid; gap: 0.35rem; min-width: 0; }
.ep-plantilla summary { cursor: pointer; color: var(--azul); font-size: 0.92rem; }
.ep-plantilla[open] summary { margin-bottom: 0.6rem; }
.ep-plantilla .ayuda { display: block; margin-bottom: 0.5rem; font-size: 0.82rem; color: var(--tinta-3); }
.ep-guardar {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: grid;
  gap: 0.5rem;
  padding: 0.8rem 0 calc(0.8rem + env(safe-area-inset-bottom, 0px));
  background: var(--papel);
  border-top: 1px solid var(--reja-2);
}
.ep-errores { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.2rem; }
@media (max-width: 720px) { .ep-guardar { position: static; } }

/* ------------------------------------------------------------------ */
/* Quiz                                                               */
/* ------------------------------------------------------------------ */

.quiz { display: grid; gap: 1rem; max-width: 52rem; }
.quiz-estado { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; justify-content: space-between; padding: 0.9rem 1.1rem; border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); }
.quiz-estado .quiz-cuenta { font-family: var(--f-codigo); font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.quiz-resultado { padding: 1rem 1.15rem; border-radius: var(--radio); display: grid; gap: 0.35rem; }
.quiz-resultado.aprobado { background: var(--verde-suave); color: var(--verde); }
.quiz-resultado.reprobado { background: var(--ambar-suave); color: var(--ambar); }
.quiz-resultado strong { font-family: var(--f-display); font-size: 1.25rem; }

.pregunta { border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); padding: 1rem 1.1rem; display: grid; gap: 0.75rem; }
.pregunta > * { min-width: 0; }
.pregunta-cab { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 0.5rem; align-items: baseline; }
.pregunta-n { font-family: var(--f-codigo); font-size: 0.82rem; color: var(--tinta-3); }
.pregunta-q { font-weight: 450; }
.opciones { display: grid; gap: 0.4rem; }
.opcion { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; padding: 0.55rem 0.75rem; border: 1px solid var(--reja); border-radius: var(--radio-chico); cursor: pointer; }
.opcion:hover { border-color: var(--reja-2); background: var(--hoja-2); }
.opcion input { width: 18px; height: 18px; accent-color: var(--azul); margin: 0; }
.opcion.correcta { border-color: var(--verde); background: var(--verde-suave); }
.opcion.incorrecta { border-color: var(--rojo); background: var(--rojo-suave); }
.opcion .opcion-marca { font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.opcion.correcta .opcion-marca { color: var(--verde); }
.opcion.incorrecta .opcion-marca { color: var(--rojo); }
.opcion.bloqueada { cursor: default; }
.explicacion { font-size: 0.92rem; color: var(--tinta-2); border-top: 1px dashed var(--reja-2); padding-top: 0.6rem; }
.quiz-acciones { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

.formulario {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem 1.2rem;
  align-items: center;
  padding: 1.1rem 1.2rem;
  border: 2px solid var(--marca);
  border-radius: var(--radio);
  background: var(--marca-suave);
}
.formulario h3 { font-size: 1.1rem; }
.formulario p { color: var(--tinta-2); font-size: 0.92rem; }
.formulario.pendiente { border-style: dashed; border-color: var(--reja-2); background: var(--hoja); }
@media (max-width: 640px) { .formulario { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------------ */
/* Guía del maestro y planeación                                      */
/* ------------------------------------------------------------------ */

.guia { display: grid; gap: 1.6rem; }
.guia > * { min-width: 0; }
.guia-resumen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem; }
.dato { border: 1px solid var(--reja-2); border-radius: var(--radio); padding: 0.8rem 1rem; background: var(--hoja); display: grid; gap: 0.15rem; }
.dato .dato-v { font-family: var(--f-display); font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dato .dato-t { font-size: 0.82rem; color: var(--tinta-3); }
.dato.actual { border-color: var(--marca); background: var(--marca-suave); }
@media (max-width: 640px) { .guia-resumen { grid-template-columns: minmax(0, 1fr); } }

.sesion { border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); overflow: hidden; }
.sesion-cab { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.4rem 1rem; padding: 0.8rem 1rem; background: var(--hoja-2); border-bottom: 1px solid var(--reja); }
.sesion-cab h4 { font-size: 1.02rem; }
.sesion-cab span { font-size: 0.84rem; color: var(--tinta-3); font-family: var(--f-codigo); }
.linea-tiempo { display: flex; height: 12px; margin: 0.9rem 1rem 0.2rem; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--hoja-2); }
.linea-tiempo span { display: block; height: 100%; }
.seg-inicio { background: var(--marca); }
.seg-explica { background: var(--azul); }
.seg-practica { background: var(--verde); }
.seg-quiz { background: var(--morado); }
.seg-cierre { background: var(--tinta-3); }
.momentos { list-style: none; margin: 0; padding: 0.4rem 1rem 1rem; display: grid; gap: 0.55rem; }
.momento { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: 0.6rem; font-size: 0.94rem; }
.momento-min { font-family: var(--f-codigo); font-size: 0.8rem; color: var(--tinta-3); padding-top: 0.15rem; display: flex; gap: 0.4rem; align-items: baseline; }
.momento-min i { width: 9px; height: 9px; border-radius: 2px; flex: none; display: inline-block; }
.momento-t strong { font-weight: 600; }
.leyenda { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.8rem; color: var(--tinta-3); }
.leyenda span { display: inline-flex; align-items: center; gap: 0.35rem; }
.leyenda i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.lista-guia { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.45rem; max-width: var(--lectura); }

.calendario { display: grid; gap: 0.6rem; }
.semana { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0.8rem; padding: 0.6rem 0.8rem; border: 1px solid var(--reja); border-radius: var(--radio-chico); background: var(--hoja); }
.semana-t { font-size: 0.84rem; color: var(--tinta-2); }
.semana-t strong { display: block; color: var(--tinta); font-family: var(--f-display); }
.semana-temas { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
@media (max-width: 640px) { .semana { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------------ */
/* Inicio                                                             */
/* ------------------------------------------------------------------ */

.inicio { display: grid; gap: 2rem; }
.inicio > * { min-width: 0; }
.inicio-cab { display: grid; gap: 0.6rem; }
.inicio-cab h1 { font-size: clamp(1.9rem, 3.8vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; }
.inicio-cab p { color: var(--tinta-2); max-width: var(--lectura); font-size: 1.05rem; }
.resumen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem; }
@media (max-width: 640px) { .resumen { grid-template-columns: minmax(0, 1fr); } }

.ruta { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.ruta-curso { margin: 0.4rem 0 0.2rem; font-size: 0.76rem; font-weight: 600; text-transform: uppercase; color: var(--tinta-3); }
.tabla .fila-curso th { background: var(--hoja-3); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; }
.ruta li { position: relative; padding-left: 2.6rem; }
.ruta li::before { content: ""; position: absolute; left: 0.95rem; top: 0; bottom: 0; width: 2px; background: var(--reja-2); }
.ruta li:first-child::before { top: 1.3rem; }
.ruta li:last-child::before { bottom: calc(100% - 1.3rem); }
.ruta-punto { position: absolute; left: 0.45rem; top: 0.85rem; width: 1.05rem; height: 1.05rem; border-radius: 4px; background: var(--hoja); border: 2px solid var(--reja-2); }
.ruta li.hecho .ruta-punto { background: var(--verde); border-color: var(--verde); }
.ruta li.actual .ruta-punto { background: var(--marca); border-color: var(--marca); }
.ruta-btn { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; width: 100%; padding: 0.55rem 0.7rem; border: 0; border-radius: var(--radio-chico); background: none; cursor: pointer; text-align: left; }
.ruta-btn:hover { background: var(--hoja); }
.ruta-btn strong { font-weight: 500; }
.ruta-btn small { display: block; color: var(--tinta-3); font-size: 0.8rem; }
.ruta-estado { display: flex; gap: 0.3rem; flex-wrap: wrap; justify-content: flex-end; }

.pasos-uso { counter-reset: paso; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.7rem; }
.pasos-uso li { counter-increment: paso; border: 1px solid var(--reja-2); border-radius: var(--radio); padding: 0.9rem 1rem; background: var(--hoja); display: grid; gap: 0.3rem; align-content: start; }
.pasos-uso li::before { content: counter(paso); font-family: var(--f-display); font-weight: 800; font-size: 1.5rem; color: var(--azul); line-height: 1; }
.pasos-uso strong { font-family: var(--f-display); }
.pasos-uso span { font-size: 0.88rem; color: var(--tinta-2); }
@media (max-width: 900px) { .pasos-uso { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .pasos-uso { grid-template-columns: minmax(0, 1fr); } }

.cobertura td.cero { color: var(--rojo); font-weight: 600; }

.aviso-modo { font-size: 0.8rem; color: var(--tinta-3); }

.cargando { min-height: 60vh; display: grid; place-items: center; color: var(--tinta-3); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 60;
  background: var(--tinta);
  color: var(--papel);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: var(--sombra);
  max-width: calc(100vw - 32px);
}

/* ------------------------------------------------------------------ */
/* Panel de clases, alumnos y competencias (versión con servidor)     */
/* ------------------------------------------------------------------ */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.7rem; }
.kpi { display: grid; gap: 0.1rem; align-content: start; padding: 0.85rem 1rem; border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); }
.kpi-t { font-size: 0.84rem; color: var(--tinta-2); }
.kpi-v { font-family: var(--f-texto); font-size: 1.7rem; font-weight: 600; line-height: 1.25; color: var(--tinta); }
.kpi-n { font-size: 0.78rem; color: var(--tinta-3); }

.vacio { padding: 1.1rem 1.2rem; border: 1px dashed var(--reja-2); border-radius: var(--radio); background: var(--hoja); color: var(--tinta-2); max-width: var(--lectura); }

.aviso-vivo { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; justify-content: space-between; padding: 0.8rem 1rem; border-radius: var(--radio); border: 1px solid transparent; background: var(--rojo-suave); color: var(--tinta); }
.aviso-vivo.proxima { background: var(--azul-suave); }
.aviso-vivo .reloj { font-weight: 500; }

.reloj { display: inline-flex; align-items: center; gap: 0.3rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.reloj .icono { width: 1rem; height: 1rem; }

.clases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.8rem; }
.clase { display: grid; gap: 0.6rem; align-content: start; padding: 1rem 1.05rem; border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); }
.clase .btn { justify-self: start; }
.clase.inactiva { background: var(--hoja-2); }
.clase-cab { display: flex; gap: 0.5rem; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.clase-cab h3 { font-size: 1.1rem; overflow-wrap: anywhere; }
.clase-codigo { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.84rem; color: var(--tinta-3); }
.clase-codigo code { font-size: 0.95rem; letter-spacing: 0.08em; color: var(--tinta); }
.clase-codigo.grande code { font-size: 1.2rem; padding: 0.15em 0.5em; }
.clase-datos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem 0.8rem; margin: 0; }
.clase-datos dt { font-size: 0.74rem; color: var(--tinta-3); }
.clase-datos dd { margin: 0; font-weight: 500; }
.clase-nueva { border-style: dashed; }
.clase-nueva form { display: grid; gap: 0.7rem; }

.tabla .orden { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: inherit; cursor: pointer; text-align: inherit; }
.tabla .orden:hover { color: var(--azul); }
.tabla th[aria-sort="ascending"] .orden::after { content: " ↑"; }
.tabla th[aria-sort="descending"] .orden::after { content: " ↓"; }

/* Barras horizontales: una sola serie, barra delgada con la punta redondeada y el valor al final. */
.barras { display: grid; gap: 0.35rem; max-width: 52rem; }
.barra-fila { display: grid; grid-template-columns: minmax(8rem, 15rem) minmax(0, 1fr); gap: 0.75rem; align-items: center; font-size: 0.88rem; }
.barra-tema { color: var(--tinta-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-tema code { white-space: nowrap; }
.barra-carril { position: relative; height: 26px; display: flex; align-items: center; border-left: 1px solid var(--grafica-eje); }
.barra-dato { display: block; height: 14px; min-width: 0; background: var(--grafica-serie); border-radius: 0 4px 4px 0; cursor: default; }
.barra-dato:hover, .barra-dato:focus-visible { filter: brightness(1.12); outline-offset: 3px; }
.barra-valor { margin-left: 0.5rem; font-size: 0.82rem; color: var(--tinta-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) { .barra-fila { grid-template-columns: minmax(0, 7rem) minmax(0, 1fr); } }

/* Matriz alumnos × temas: el estado va en texto y símbolo, el color solo acompaña. */
.leyenda-matriz { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.82rem; color: var(--tinta-2); }
.leyenda-matriz li { display: inline-flex; align-items: center; gap: 0.4rem; }
.muestra { width: 0.9rem; height: 0.9rem; border-radius: 3px; border: 1px solid var(--reja-2); display: inline-block; }
.matriz th[scope="row"] { font-weight: 500; white-space: nowrap; background: var(--hoja); }
.matriz abbr { text-decoration: none; }
.matriz th, .matriz td { padding: 0.45rem 0.35rem; }
.matriz th:first-child { padding-left: 0.8rem; }
.matriz .celda { text-align: center; white-space: nowrap; font-size: 0.76rem; font-variant-numeric: tabular-nums; min-width: 2.75rem; border-left: 2px solid var(--hoja); color: var(--tinta); }
.matriz .celda:focus-visible { outline-offset: -3px; }
.m-ok { background: var(--verde-suave); }
.m-casi { background: var(--ambar-suave); }
.m-leido { background: var(--azul-suave); }
.m-nada { background: var(--hoja); }
.estado-tema { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 99px; font-size: 0.8rem; }
.estado-tema.m-nada { color: var(--tinta-3); border: 1px solid var(--reja); }

.tip { position: fixed; z-index: 70; display: grid; gap: 0.1rem; max-width: 18rem; padding: 0.45rem 0.65rem; border-radius: var(--radio-chico); background: var(--tinta); color: var(--papel); font-size: 0.8rem; box-shadow: var(--sombra); pointer-events: none; }
.tip strong { font-size: 0.92rem; }
.tip span { opacity: 0.85; }

/* Competencias */
.competencias { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.competencia { display: grid; gap: 0.45rem; padding: 0.95rem 1.05rem; border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); }
.competencia-cab { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
.competencia-cab h3 { font-size: 1.1rem; overflow-wrap: anywhere; }
.competencia-fecha { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; font-size: 0.9rem; color: var(--tinta-2); }
.estado-en_curso { background: var(--rojo); border-color: transparent; color: var(--sobre-acento); }
.estado-proxima { background: var(--azul-suave); border-color: transparent; color: var(--azul); }
.estado-terminada { background: var(--hoja-2); }
.ficha { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.6rem; margin: 0; }
.ficha div { padding: 0.6rem 0.8rem; border: 1px solid var(--reja); border-radius: var(--radio-chico); background: var(--hoja); }
.ficha dt { font-size: 0.76rem; color: var(--tinta-3); }
.ficha dd { margin: 0; font-size: 0.92rem; }
.editor-competencia { display: grid; gap: 1.6rem; }
.editor-competencia > * { min-width: 0; }
.editor-competencia .seccion { margin-bottom: 0; }
.cp-problemas { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.cp-problema { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; padding: 0.6rem 0.85rem; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); }
.cp-puntos { display: inline-flex; align-items: center; gap: 0.4rem; margin-left: auto; font-size: 0.84rem; color: var(--tinta-2); }
.cp-puntos input { width: 5.5rem; min-height: 36px; padding: 0.3rem 0.5rem; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); }
.cp-puntos input:disabled { opacity: 0.5; }
.cp-lista { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.cp-pestanas { margin-bottom: 0.8rem; }
.cp-mejor { font-size: 0.88rem; color: var(--tinta-2); }
.tabla-posiciones tr.yo td { background: var(--marca-suave); }
.envios-t { font-size: 1.05rem; margin-top: 0.6rem; }

/* ================================================================== */
/* Aula: la app al estilo de Google Classroom                         */
/* ================================================================== */

/* ---------------- Barra superior ---------------- */
.barra {
  min-height: var(--barra-alto);
  gap: 0.5rem;
  padding-block: 0.4rem;
  border-bottom: 1px solid var(--reja);
  box-shadow: none;
}
.barra .marca-app { gap: 0.55rem; text-decoration: none; color: var(--tinta-2); border: 0; background: none; cursor: pointer; padding: 0.25rem 0.4rem; border-radius: var(--radio-chico); }
.barra .marca-app:hover .marca-texto { text-decoration: underline; text-underline-offset: 0.2em; }
.marca-texto { font-family: var(--f-display); font-weight: 400; font-size: 1.375rem; color: var(--tinta-2); letter-spacing: 0; }
.marca-app svg rect { fill: var(--verde); stroke: none; }
.marca-app svg path { fill: #fff; }
.barra-menu { display: inline-flex; }
.barra-menu-t { display: none; }
.icono-boton {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 50%;
  background: none; color: var(--tinta-3);
  cursor: pointer;
}
.icono-boton:hover { background: var(--hoja-2); color: var(--tinta); }
.icono-boton .icono { width: 24px; height: 24px; }
.barra .btn.barra-menu { border: 0; border-radius: 50%; width: 44px; height: 44px; padding: 0; color: var(--tinta-3); background: none; }
.barra .btn.barra-menu:hover { background: var(--hoja-2); }
.barra .btn.barra-menu .icono { width: 24px; height: 24px; }

.barra-migas { display: flex; align-items: center; gap: 0.35rem; min-width: 0; font-family: var(--f-display); color: var(--tinta-2); }
.barra-migas .sep { color: var(--tinta-3); font-size: 1.3rem; line-height: 1; }
.barra-migas button { border: 0; background: none; padding: 0.2rem 0.3rem; cursor: pointer; text-align: left; min-width: 0; border-radius: var(--radio-chico); color: inherit; }
.barra-migas button:hover strong { text-decoration: underline; text-underline-offset: 0.2em; }
.barra-migas strong { display: block; font-weight: 500; font-size: 1.1rem; color: var(--tinta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22rem; }
.barra-migas small { display: block; font-size: 0.78rem; color: var(--tinta-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22rem; line-height: 1.2; }

.barra-pestanas { display: flex; align-self: stretch; align-items: stretch; gap: 0.25rem; margin: -0.4rem auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.barra-pestanas:not([hidden]) + .barra-espacio { display: none; }
.barra-pestanas::-webkit-scrollbar { display: none; }
.barra-pestana {
  position: relative; display: flex; align-items: center;
  padding: 0 1.4rem; border: 0; background: none; cursor: pointer;
  font-family: var(--f-display); font-weight: 500; font-size: 0.9rem; color: var(--tinta-2);
  white-space: nowrap;
}
.barra-pestana:hover { background: var(--hoja-2); color: var(--tinta); }
.barra-pestana[aria-current="page"] { color: var(--azul-tinta); }
.barra-pestana[aria-current="page"]::after { content: ""; position: absolute; left: 0.6rem; right: 0.6rem; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--azul-tinta); }
.barra-usuario { gap: 0.25rem; }
.barra .tema-boton { width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--tinta-3); }
.barra .tema-boton:hover { background: var(--hoja-2); color: var(--tinta); }
.barra .tema-boton .icono { width: 22px; height: 22px; }
.barra .vista-toggle { margin-right: 0.25rem; }

.avatar {
  --av: var(--b-azul);
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--av); color: #fff;
  font-family: var(--f-display); font-weight: 500; font-size: 0.95rem; line-height: 1;
  border: 0; text-transform: uppercase; user-select: none;
}
button.avatar { cursor: pointer; }
.avatar-chico { width: 28px; height: 28px; font-size: 0.8rem; }
.avatar-grande { width: 40px; height: 40px; font-size: 1.05rem; }
.barra .avatar { width: 34px; height: 34px; margin-left: 0.25rem; box-shadow: 0 0 0 4px transparent; transition: box-shadow 0.15s; }
.barra .avatar:hover { box-shadow: 0 0 0 4px var(--hoja-2); }
.c-azul { --av: var(--b-azul); --banner: var(--b-azul); }
.c-verde { --av: var(--b-verde); --banner: var(--b-verde); }
.c-morado { --av: var(--b-morado); --banner: var(--b-morado); }
.c-rojo { --av: var(--b-rojo); --banner: var(--b-rojo); }
.c-naranja { --av: var(--b-naranja); --banner: var(--b-naranja); }
.c-turquesa { --av: var(--b-turquesa); --banner: var(--b-turquesa); }
.c-rosa { --av: var(--b-rosa); --banner: var(--b-rosa); }
.c-gris { --av: var(--b-gris); --banner: var(--b-gris); }

/* Menús emergentes (crear o unirse, cuenta) */
.menu-emergente {
  position: fixed; z-index: 60;
  min-width: 220px; max-width: min(92vw, 340px);
  padding: 0.5rem 0; margin: 0;
  background: var(--hoja); color: var(--tinta);
  border: 1px solid var(--reja); border-radius: var(--radio);
  box-shadow: var(--sombra-2);
  list-style: none;
}
.menu-emergente button, .menu-emergente a {
  display: flex; align-items: center; gap: 0.8rem; width: 100%;
  padding: 0.7rem 1.2rem; border: 0; background: none; cursor: pointer;
  font-size: 0.92rem; text-align: left; color: var(--tinta); text-decoration: none;
}
.menu-emergente button:hover, .menu-emergente a:hover { background: var(--hoja-2); }
.menu-emergente .icono { color: var(--tinta-3); }
.menu-cuenta { padding: 1rem 0 0.5rem; text-align: center; min-width: 280px; }
.menu-cuenta .avatar { width: 64px; height: 64px; font-size: 1.6rem; margin: 0 auto 0.6rem; }
.menu-cuenta .menu-nombre { font-family: var(--f-display); font-size: 1.05rem; font-weight: 500; padding: 0 1rem; }
.menu-cuenta .menu-rol { color: var(--tinta-3); font-size: 0.86rem; padding: 0 1rem 0.9rem; border-bottom: 1px solid var(--reja); margin-bottom: 0.4rem; }

/* ---------------- Menú lateral ---------------- */
.cuerpo { min-height: calc(100vh - var(--barra-alto)); }
.riel {
  top: calc(var(--barra-alto) + env(safe-area-inset-top, 0px));
  height: calc(100vh - var(--barra-alto) - env(safe-area-inset-top, 0px));
  padding: 0.5rem 0.75rem 2rem 0;
  border-right: 1px solid var(--reja);
}
.riel-menu { gap: 0; }
.riel-item, .riel-tema, .riel-clase {
  border-radius: 0 999px 999px 0;
  padding-left: 1.5rem;
}
.riel-item { min-height: 48px; font-family: var(--f-display); font-weight: 500; font-size: 0.9rem; color: var(--tinta); grid-template-columns: 1.5rem minmax(0, 1fr) auto; gap: 1.1rem; }
.riel-item .icono { width: 22px; height: 22px; color: var(--tinta-3); }
.riel-item:hover, .riel-tema:hover, .riel-clase:hover { background: var(--hoja-2); }
.riel-item[aria-current="page"], .riel-tema[aria-current="page"], .riel-clase[aria-current="page"] { background: var(--azul-suave); color: var(--azul-tinta); }
.riel-item[aria-current="page"] .icono { color: var(--azul-tinta); }
.riel-tema[aria-current="page"] .riel-t { font-weight: 500; }
.riel-separador { height: 1px; background: var(--reja); margin: 0.5rem 0 0.5rem 0; }
.riel-seccion { margin: 0; }
.riel-seccion-cab {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  min-height: 44px; padding: 0 1rem 0 1.5rem; border: 0; border-radius: 0 999px 999px 0;
  background: none; cursor: pointer; text-align: left;
  font-family: var(--f-display); font-weight: 500; font-size: 0.9rem; color: var(--tinta);
}
.riel-seccion-cab:hover { background: var(--hoja-2); }
.riel-seccion-cab .icono { width: 22px; height: 22px; color: var(--tinta-3); }
.riel-seccion-cab .flecha { margin-left: auto; transition: transform 0.15s; width: 18px; height: 18px; }
.riel-seccion-cab[aria-expanded="false"] .flecha { transform: rotate(-90deg); }
.riel-clase {
  display: grid; grid-template-columns: 2rem minmax(0, 1fr); align-items: center; gap: 0.9rem;
  width: 100%; min-height: 52px; padding-top: 0.35rem; padding-bottom: 0.35rem; border: 0; background: none; cursor: pointer; text-align: left;
}
.riel-clase .avatar { width: 32px; height: 32px; font-size: 0.95rem; }
.riel-clase span:last-child { min-width: 0; }
.riel-clase strong { display: block; font-weight: 500; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.riel-clase small { display: block; font-size: 0.76rem; color: var(--tinta-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.riel-titulo { margin: 0.4rem 0 0.2rem 1.5rem; font-family: var(--f-display); font-weight: 500; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: none; color: var(--tinta-3); }
.riel-progreso { margin: 0.4rem 0.4rem 0.7rem 1.5rem; }
.riel-bloque-cab { padding-left: 1.5rem; border-radius: 0 999px 999px 0; }
.riel-tema { padding-left: 1.5rem; }
.riel-puntos i.si { background: var(--verde); }
.riel-insignia { background: var(--hoja-2); color: var(--tinta-2); }

@media (max-width: 1100px) {
  .cuerpo { grid-template-columns: minmax(0, 1fr); }
  .riel {
    position: fixed; z-index: 40; top: 0; left: 0; bottom: 0; height: auto;
    width: min(86vw, 320px);
    padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    transform: translateX(-102%); transition: transform 0.2s ease;
    box-shadow: var(--sombra-2);
  }
  .riel.abierto { transform: none; }
  .velo.visible { display: block; position: fixed; inset: 0; z-index: 35; background: var(--velo); }
  .barra-nombre { display: none; }
}
@media (min-width: 1101px) {
  .cuerpo.sin-riel { grid-template-columns: minmax(0, 1fr); }
  .cuerpo.sin-riel .riel { display: none; }
}

/* ---------------- Contenido general ---------------- */
.principal { padding-block: 1.5rem 4rem; }
.aula-pagina { display: grid; gap: 1.5rem; }
.aula-cab { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.aula-cab h1 { font-size: 1.75rem; font-weight: 400; color: var(--tinta); }
.aula-cab p { color: var(--tinta-3); }
.aula-vacio {
  display: grid; justify-items: center; gap: 0.9rem; text-align: center;
  padding: 3rem 1rem; color: var(--tinta-2);
}
.aula-vacio svg { width: min(240px, 60vw); height: auto; }
.aula-vacio h2 { font-size: 1.25rem; font-weight: 400; color: var(--tinta); }
.aula-vacio p { max-width: 34rem; }
.boton-texto {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.9rem; border: 0; border-radius: 999px; background: none;
  color: var(--azul-tinta); font-family: var(--f-display); font-weight: 500; font-size: 0.875rem; cursor: pointer; text-decoration: none;
}
.boton-texto:hover { background: var(--azul-suave); }
.boton-texto .icono { width: 20px; height: 20px; }
.boton-crear {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-height: 48px; padding: 0 1.4rem 0 1rem; border: 0; border-radius: 999px;
  background: var(--azul-tinta); color: var(--sobre-acento);
  font-family: var(--f-display); font-weight: 500; font-size: 0.95rem; cursor: pointer;
  box-shadow: var(--sombra);
}
.boton-crear:hover { box-shadow: var(--sombra-2); filter: brightness(1.05); }
.boton-crear .icono { width: 22px; height: 22px; }

/* ---------------- Tarjetas de salón (inicio) ---------------- */
.aulas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 1.5rem; }
.aula {
  position: relative; display: flex; flex-direction: column;
  min-height: 292px; border: 1px solid var(--reja-2); border-radius: var(--radio);
  background: var(--hoja); overflow: hidden; transition: box-shadow 0.2s;
}
.aula:hover { box-shadow: var(--sombra-2); }
.aula-banner {
  position: relative; height: 100px; padding: 1rem 4.5rem 0.75rem 1rem; color: #fff;
  background-color: var(--banner, var(--b-azul));
  background-image: var(--patron-aula);
  background-repeat: no-repeat; background-position: right -8px center; background-size: auto 120%;
}
.aula-banner h3 { font-size: 1.35rem; font-weight: 400; line-height: 1.25; }
.aula-banner h3 button { border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.aula-banner h3 button:hover { text-decoration: underline; text-underline-offset: 0.15em; }
.aula-banner h3 button::after { content: ""; position: absolute; inset: 0; }
.aula-banner p { font-size: 0.86rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.95; }
.aula-menu { position: absolute; top: 0.4rem; right: 0.4rem; z-index: 2; color: #fff; }
.aula-menu:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.aula-avatar { position: absolute; right: 1rem; top: 62px; z-index: 1; width: 75px; height: 75px; font-size: 2rem; box-shadow: 0 0 0 3px var(--hoja); }
.aula-cuerpo { flex: 1; display: grid; align-content: start; gap: 0.35rem; padding: 1rem 6rem 0.75rem 1rem; font-size: 0.86rem; color: var(--tinta-2); min-height: 120px; }
.aula-cuerpo .aula-dato { color: var(--tinta-3); }
.aula-cuerpo ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; position: relative; z-index: 2; }
.aula-cuerpo li button { border: 0; background: none; padding: 0; color: var(--tinta-2); cursor: pointer; text-align: left; font-size: 0.84rem; }
.aula-cuerpo li button:hover { text-decoration: underline; color: var(--tinta); }
.aula-cuerpo li small { color: var(--tinta-3); display: block; font-size: 0.76rem; }
.aula-alerta { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--azul-tinta); font-weight: 500; }
.aula-pie { position: relative; z-index: 2; display: flex; justify-content: flex-end; gap: 0.25rem; padding: 0.3rem 0.6rem; border-top: 1px solid var(--reja); }
.aula-pie .icono-boton { width: 40px; height: 40px; }
.aula-pie .icono-boton .icono { width: 22px; height: 22px; }
.aula.archivada .aula-banner { filter: grayscale(0.75); }
.aula.inactiva .aula-banner::before { content: "Código desactivado"; position: absolute; left: 1rem; bottom: 0.5rem; font-size: 0.72rem; background: rgba(0, 0, 0, 0.35); padding: 0.05rem 0.5rem; border-radius: 999px; }

/* El patrón de los banners: una esquina del mundo de Karel. */
:root {
  --patron-aula: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 120'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.22' stroke-width='1.5'%3E%3Cpath d='M20 0v120M60 0v120M100 0v120M140 0v120M0 20h160M0 60h160M0 100h160'/%3E%3C/g%3E%3Cpath d='M98 6v28' stroke='%23fff' stroke-opacity='.5' stroke-width='5' stroke-linecap='round'/%3E%3Ccircle cx='140' cy='60' r='11' fill='%23fff' fill-opacity='.28'/%3E%3Ccircle cx='60' cy='100' r='11' fill='%23fff' fill-opacity='.2'/%3E%3Cpath d='M60 46l12 26-12-6-12 6z' fill='%23fff' fill-opacity='.55'/%3E%3C/svg%3E");
  --patron-salon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 240'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.18' stroke-width='2'%3E%3Cpath d='M40 0v240M100 0v240M160 0v240M220 0v240M280 0v240M340 0v240M0 30h400M0 90h400M0 150h400M0 210h400'/%3E%3C/g%3E%3Cpath d='M190 60h60M250 60v60' stroke='%23fff' stroke-opacity='.55' stroke-width='7' stroke-linecap='round'/%3E%3Ccircle cx='340' cy='90' r='16' fill='%23fff' fill-opacity='.3'/%3E%3Ccircle cx='280' cy='210' r='16' fill='%23fff' fill-opacity='.22'/%3E%3Ccircle cx='340' cy='150' r='16' fill='%23fff' fill-opacity='.18'/%3E%3Cpath d='M220 130l18 38-18-9-18 9z' fill='%23fff' fill-opacity='.7'/%3E%3Cpath d='M100 210h60' stroke='%23fff' stroke-opacity='.25' stroke-width='3' stroke-dasharray='6 8'/%3E%3C/svg%3E");
}

/* ---------------- Página del salón ---------------- */
.salon { display: grid; gap: 1.5rem; max-width: 62rem; margin: 0 auto; }
.salon-banner {
  position: relative; min-height: 240px; border-radius: var(--radio); padding: 1.5rem; color: #fff;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 0.25rem;
  background-color: var(--banner, var(--b-azul)); background-image: var(--patron-salon);
  background-repeat: no-repeat; background-position: right center; background-size: auto 100%;
  overflow: hidden;
}
.salon-banner h1 { font-size: clamp(1.8rem, 4vw, 2.25rem); font-weight: 500; line-height: 1.2; max-width: 36rem; }
.salon-banner p { font-size: 1.1rem; max-width: 36rem; }
.salon-banner .salon-ajustes { position: absolute; top: 0.75rem; right: 0.75rem; background: rgba(255, 255, 255, 0.95); color: var(--b-gris); border-radius: 999px; min-height: 36px; padding: 0 0.9rem; border: 0; display: inline-flex; align-items: center; gap: 0.45rem; font-family: var(--f-display); font-weight: 500; font-size: 0.85rem; cursor: pointer; }
.salon-banner .salon-ajustes:hover { background: #fff; color: #202124; }
.salon-banner .salon-ajustes .icono { width: 18px; height: 18px; }
.salon-columnas { display: grid; grid-template-columns: 12.5rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.salon-lado { display: grid; gap: 1rem; }
.caja { border: 1px solid var(--reja-2); border-radius: var(--radio); padding: 1rem; background: var(--hoja); }
.caja h2, .caja h3 { font-size: 0.95rem; font-weight: 500; margin-bottom: 0.6rem; }
.caja p { font-size: 0.86rem; color: var(--tinta-2); }
.caja-codigo .codigo { display: flex; align-items: center; justify-content: space-between; gap: 0.25rem; font-family: var(--f-display); font-size: 1.45rem; color: var(--azul-tinta); letter-spacing: 0.03em; }
.caja-codigo .codigo .icono-boton { width: 36px; height: 36px; color: var(--azul-tinta); }
.caja .boton-texto { margin: 0.6rem -0.9rem -0.4rem auto; display: flex; width: max-content; }
.proximas { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.proximas li { font-size: 0.84rem; }
.proximas small { display: block; color: var(--tinta-3); }
.proximas button { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: var(--tinta); font-size: 0.86rem; }
.proximas button:hover { text-decoration: underline; }

/* Novedades: anunciar y publicaciones */
.feed { display: grid; gap: 1rem; min-width: 0; }
.anunciar { border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); box-shadow: none; }
.anunciar-cerrado { display: flex; align-items: center; gap: 1rem; width: 100%; padding: 1rem 1.25rem; border: 0; background: none; cursor: pointer; text-align: left; color: var(--tinta-3); font-size: 0.9rem; border-radius: var(--radio); }
.anunciar-cerrado:hover { color: var(--azul-tinta); }
.anunciar form { display: grid; gap: 0.8rem; padding: 1.1rem 1.25rem; }
.anunciar textarea { width: 100%; min-height: 110px; padding: 0.9rem 1rem; border: 0; border-bottom: 2px solid var(--reja-2); background: var(--hoja-2); border-radius: var(--radio-chico) var(--radio-chico) 0 0; resize: vertical; font-family: var(--f-texto); }
.anunciar textarea:focus { outline: none; border-bottom-color: var(--azul); }
.anunciar .fila-fin { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.anunciar .para { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; font-size: 0.86rem; color: var(--tinta-2); }
.anunciar .para select { border: 1px solid var(--reja-2); border-radius: var(--radio-chico); padding: 0.35rem 0.5rem; background: var(--hoja); }

.post { border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); overflow: hidden; }
.post-cab { display: flex; align-items: center; gap: 0.9rem; padding: 0.9rem 0.6rem 0.4rem 1.25rem; }
.post-cab > div { min-width: 0; flex: 1; }
.post-cab strong { display: block; font-weight: 500; font-size: 0.9rem; }
.post-cab small { color: var(--tinta-3); font-size: 0.78rem; }
.post-texto { padding: 0.3rem 1.25rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.92rem; }
.post-tarea { display: flex; align-items: center; gap: 1rem; width: 100%; padding: 1rem 1.25rem; border: 0; background: none; text-align: left; cursor: pointer; color: var(--tinta); }
.post-tarea:hover { background: var(--hoja-3); }
.post-tarea > span:nth-child(2) { min-width: 0; flex: 1; }
.post-tarea strong { display: block; font-weight: 400; font-size: 0.92rem; }
.post-tarea small { color: var(--tinta-3); font-size: 0.78rem; }
.icono-tarea { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--azul-tinta); color: #fff; }
.icono-tarea .icono { width: 22px; height: 22px; }
.icono-tarea.icono-material { background: var(--b-gris); }
.icono-tarea.icono-pregunta { background: var(--b-turquesa); }
.icono-tarea.apagado { background: var(--hoja-2); color: var(--tinta-3); }
.icono-aviso { background: var(--b-verde); }

.comentarios { border-top: 1px solid var(--reja); padding: 0.6rem 1.25rem 0.9rem; display: grid; gap: 0.7rem; }
.comentarios-titulo { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.84rem; font-weight: 500; color: var(--tinta-2); }
.comentarios-titulo .icono { width: 18px; height: 18px; }
.comentario { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 0.75rem; align-items: start; }
.comentario .avatar { width: 32px; height: 32px; font-size: 0.85rem; }
.comentario strong { font-weight: 500; font-size: 0.84rem; margin-right: 0.35rem; }
.comentario small { color: var(--tinta-3); font-size: 0.74rem; }
.comentario p { font-size: 0.88rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.comentario .icono-boton { width: 32px; height: 32px; }
.comentario .icono-boton .icono { width: 18px; height: 18px; }
.comentar { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; }
.comentar input { width: 100%; min-height: 38px; padding: 0.4rem 1rem; border: 1px solid var(--reja-2); border-radius: 999px; background: var(--hoja); }
.comentar input:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 1px var(--azul); }
.comentar .icono-boton { width: 38px; height: 38px; color: var(--azul-tinta); }
.comentar .icono-boton:disabled { color: var(--tinta-3); opacity: 0.5; cursor: default; }

/* Trabajo de clase */
.trabajo-cab { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.trabajo-filtros { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.trabajo-filtros select { min-height: 36px; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); padding: 0 0.6rem; background: var(--hoja); font-size: 0.86rem; }
.unidad { display: grid; gap: 0; }
.unidad-titulo { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.4rem 0 0.7rem; margin-bottom: 0.25rem; border-bottom: 1px solid var(--azul-tinta); color: var(--azul-tinta); }
.unidad-titulo h2 { font-size: 1.75rem; font-weight: 400; color: var(--azul-tinta); }
.unidad-titulo span { color: var(--tinta-3); font-size: 0.82rem; }
.trabajo-lista { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.trabajo-item { border-bottom: 1px solid var(--reja); }
.trabajo-item details > summary { list-style: none; }
.trabajo-item details > summary::-webkit-details-marker { display: none; }
.trabajo-fila { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 0.75rem; cursor: pointer; border-radius: var(--radio-chico); }
.trabajo-fila:hover { background: var(--hoja-3); }
details[open] > .trabajo-fila { background: var(--hoja-3); border-radius: var(--radio-chico) var(--radio-chico) 0 0; }
.trabajo-fila > span:nth-child(2) { flex: 1; min-width: 0; }
.trabajo-fila strong { display: block; font-weight: 500; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; }
.trabajo-fila small { display: block; color: var(--tinta-3); font-size: 0.78rem; }
.trabajo-fila .fecha { color: var(--tinta-3); font-size: 0.8rem; white-space: nowrap; text-align: right; }
.trabajo-detalle { display: grid; gap: 0.8rem; padding: 0.4rem 0.75rem 1rem 4.25rem; background: var(--hoja-3); border-radius: 0 0 var(--radio-chico) var(--radio-chico); font-size: 0.88rem; }
.trabajo-detalle .instrucciones { white-space: pre-wrap; color: var(--tinta-2); overflow-wrap: anywhere; }
.trabajo-detalle .conteos { display: flex; gap: 2rem; }
.conteos { display: flex; gap: 2rem; flex-wrap: wrap; }
.conteos div, .conteos > span { display: grid; }
.conteos strong { font-family: var(--f-display); font-size: 1.9rem; font-weight: 400; line-height: 1.1; }
.conteos span { color: var(--tinta-3); font-size: 0.8rem; }
.trabajo-detalle .fila-fin { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; border-top: 1px solid var(--reja); padding-top: 0.6rem; }

/* Estados de una entrega */
.estado { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; font-weight: 500; white-space: nowrap; }
.estado-asignada { color: var(--tinta-3); }
.estado-faltante { color: var(--rojo); }
.estado-entregada { color: var(--verde); }
.estado-tarde { color: var(--ambar); }
.estado-devuelta { color: var(--azul-tinta); }
.chip.chip-borrador { background: var(--hoja-2); border-color: transparent; color: var(--tinta-2); }
.chip.chip-programada { background: var(--ambar-suave); border-color: transparent; color: var(--ambar); }

/* Recurso adjunto (tarjeta como los archivos adjuntos de Classroom) */
.adjunto { display: flex; align-items: stretch; border: 1px solid var(--reja-2); border-radius: var(--radio); overflow: hidden; background: var(--hoja); text-align: left; cursor: pointer; width: 100%; max-width: 30rem; padding: 0; color: var(--tinta); text-decoration: none; }
.adjunto:hover { border-color: var(--tinta-3); }
.adjunto-icono { display: grid; place-items: center; width: 6.5rem; flex: none; background: var(--azul-suave); color: var(--azul-tinta); border-right: 1px solid var(--reja-2); }
.adjunto-icono svg { width: 76px; height: auto; }
.adjunto-icono .icono { width: 30px; height: 30px; }
.adjunto-texto { padding: 0.75rem 1rem; display: grid; align-content: center; min-width: 0; gap: 0.1rem; }
.adjunto-texto strong { font-weight: 500; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adjunto-texto small { color: var(--tinta-3); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Detalle de una tarea */
.tarea-vista { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 2rem; align-items: start; max-width: 62rem; margin: 0 auto; }
.tarea-vista.sin-lado { grid-template-columns: minmax(0, 1fr); max-width: 50rem; }
.tarea-principal { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 1rem; }
.tarea-principal > div { min-width: 0; display: grid; gap: 0.75rem; }
.tarea-titulo h1 { font-size: 2rem; font-weight: 400; color: var(--azul-tinta); line-height: 1.2; overflow-wrap: anywhere; }
.tarea-titulo p { color: var(--tinta-3); font-size: 0.86rem; }
.tarea-meta { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--azul-tinta); font-size: 0.88rem; font-weight: 500; flex-wrap: wrap; }
.tarea-instrucciones { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.94rem; }
.tarea-seccion { border-top: 1px solid var(--reja); padding-top: 0.9rem; display: grid; gap: 0.7rem; }
.tu-trabajo { border: 1px solid var(--reja-2); border-radius: var(--radio); padding: 1.25rem; display: grid; gap: 0.9rem; box-shadow: var(--sombra); background: var(--hoja); }
.tu-trabajo-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.tu-trabajo-cab h2 { font-size: 1.25rem; font-weight: 400; }
.tu-trabajo textarea { width: 100%; min-height: 110px; padding: 0.7rem 0.8rem; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); resize: vertical; }
.tu-trabajo textarea:focus { outline: 2px solid var(--azul); border-color: transparent; }
.tu-trabajo .btn { width: 100%; }
.tu-trabajo .nota-calif { font-family: var(--f-display); font-size: 1.6rem; color: var(--tinta); }
.respuesta-enviada { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--hoja-2); border-radius: var(--radio-chico); padding: 0.6rem 0.8rem; font-size: 0.88rem; max-height: 14rem; overflow: auto; }
.privados { border: 1px solid var(--reja-2); border-radius: var(--radio); padding: 1rem 1.25rem; display: grid; gap: 0.75rem; }
.privados h2 { display: flex; align-items: center; gap: 0.45rem; font-size: 0.95rem; font-weight: 500; }
.privados .icono { width: 20px; height: 20px; color: var(--tinta-3); }

/* Trabajos de los alumnos (maestro) */
.trabajos { display: grid; grid-template-columns: 18rem minmax(0, 1fr); border: 1px solid var(--reja-2); border-radius: var(--radio); overflow: hidden; min-height: 24rem; }
.trabajos-lista { border-right: 1px solid var(--reja-2); overflow-y: auto; max-height: 70vh; }
.trabajos-lista h3 { font-size: 0.78rem; font-weight: 500; color: var(--tinta-3); padding: 0.8rem 1rem 0.3rem; letter-spacing: 0.03em; }
.trabajos-lista button { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 0.7rem; width: 100%; padding: 0.55rem 1rem; border: 0; background: none; text-align: left; cursor: pointer; color: var(--tinta); }
.trabajos-lista button:hover { background: var(--hoja-2); }
.trabajos-lista button[aria-current="true"] { background: var(--azul-suave); }
.trabajos-lista button span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; }
.trabajos-lista .calif { font-size: 0.82rem; color: var(--tinta-2); white-space: nowrap; }
.trabajos-lista .calif.borrador { font-style: italic; color: var(--tinta-3); }
.trabajo-alumno { padding: 1.25rem 1.5rem; display: grid; gap: 1rem; align-content: start; min-width: 0; }
.trabajo-alumno-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.trabajo-alumno-cab h3 { font-size: 1.35rem; font-weight: 400; }
.calificar { display: grid; grid-template-columns: auto auto 1fr; gap: 0.6rem; align-items: center; }
.calificar input[type="number"] { width: 6.5rem; min-height: 40px; padding: 0.3rem 0.6rem; border: 0; border-bottom: 2px solid var(--reja-2); background: var(--hoja-2); border-radius: var(--radio-chico) var(--radio-chico) 0 0; font-size: 1.1rem; text-align: right; }
.calificar input[type="number"]:focus { outline: none; border-bottom-color: var(--azul); }
.trabajo-alumno textarea { width: 100%; min-height: 80px; padding: 0.6rem 0.8rem; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); resize: vertical; }
.pestanas-tarea { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--reja-2); margin-bottom: 1.25rem; }
.pestanas-tarea button { position: relative; padding: 0.8rem 1.2rem; border: 0; background: none; cursor: pointer; font-family: var(--f-display); font-weight: 500; font-size: 0.9rem; color: var(--tinta-2); }
.pestanas-tarea button:hover { background: var(--hoja-2); }
.pestanas-tarea button[aria-selected="true"] { color: var(--azul-tinta); }
.pestanas-tarea button[aria-selected="true"]::after { content: ""; position: absolute; left: 0.5rem; right: 0.5rem; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--azul-tinta); }

/* Personas */
.personas { display: grid; gap: 2.5rem; max-width: 48rem; margin: 0 auto; }
.personas-cab { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--azul-tinta); }
.personas-cab h2 { font-size: 2rem; font-weight: 400; color: var(--azul-tinta); }
.personas-cab span { color: var(--azul-tinta); font-size: 0.88rem; font-weight: 500; }
.personas-cab .icono-boton { color: var(--azul-tinta); }
.personas ul { list-style: none; margin: 0; padding: 0; }
.persona { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--reja); font-size: 0.92rem; }
.persona > span:nth-child(2) { flex: 1; min-width: 0; }
.persona small { display: block; color: var(--tinta-3); font-size: 0.78rem; }
.persona .icono-boton { width: 36px; height: 36px; }
.persona .icono-boton .icono { width: 20px; height: 20px; }

/* Calificaciones */
.notas-envoltura { overflow: auto; border: 1px solid var(--reja-2); border-radius: var(--radio); max-height: 75vh; }
.notas { border-collapse: separate; border-spacing: 0; font-size: 0.86rem; min-width: 100%; }
.notas th, .notas td { border-bottom: 1px solid var(--reja); border-right: 1px solid var(--reja); padding: 0; background: var(--hoja); }
.notas thead th { position: sticky; top: 0; z-index: 2; vertical-align: bottom; text-align: left; font-weight: 400; min-width: 8.5rem; max-width: 10rem; padding: 0.6rem 0.75rem; }
.notas thead th small { display: block; color: var(--tinta-3); font-size: 0.74rem; }
.notas thead th button { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: var(--azul-tinta); font: inherit; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.notas thead th .de { display: block; border-top: 1px solid var(--reja); margin-top: 0.4rem; padding-top: 0.3rem; color: var(--tinta-3); font-size: 0.74rem; }
.notas th:first-child { position: sticky; left: 0; z-index: 1; min-width: 14rem; text-align: left; font-weight: 400; padding: 0.55rem 0.9rem; }
.notas thead th:first-child { z-index: 3; vertical-align: bottom; }
.notas tbody th { display: table-cell; }
.notas tbody th .persona-mini { display: flex; align-items: center; gap: 0.6rem; }
.notas td { text-align: left; min-width: 8.5rem; }
.notas td .celda-nota { display: grid; gap: 0.05rem; padding: 0.45rem 0.75rem; }
.notas td input { width: 4.2rem; border: 0; border-bottom: 1px solid transparent; background: transparent; padding: 0.1rem 0.2rem; font-size: 0.92rem; text-align: right; border-radius: 3px 3px 0 0; }
.notas td input:hover { border-bottom-color: var(--reja-2); background: var(--hoja-2); }
.notas td input:focus { outline: none; border-bottom: 2px solid var(--azul); background: var(--hoja-2); }
.notas td .de-puntos { color: var(--tinta-3); font-size: 0.8rem; }
.notas td.borrador input { font-style: italic; color: var(--tinta-2); }
.notas td .estado { font-size: 0.74rem; }
.notas tr.promedios th, .notas tr.promedios td { background: var(--hoja-3); font-weight: 500; }
.notas .promedio { padding: 0.55rem 0.75rem; }

/* Pendientes y por revisar */
.pendientes { display: grid; gap: 1.25rem; max-width: 52rem; margin: 0 auto; }
.pendientes-grupo { border: 1px solid var(--reja-2); border-radius: var(--radio); overflow: hidden; }
.pendientes-grupo > summary { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; cursor: pointer; list-style: none; font-family: var(--f-display); font-weight: 500; }
.pendientes-grupo > summary::-webkit-details-marker { display: none; }
.pendientes-grupo > summary span { color: var(--tinta-3); font-size: 0.86rem; font-weight: 400; }
.pendientes-grupo ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--reja); }
.pendiente { display: flex; align-items: center; gap: 1rem; width: 100%; padding: 0.8rem 1.25rem; border: 0; border-bottom: 1px solid var(--reja); background: none; cursor: pointer; text-align: left; color: var(--tinta); }
.pendiente:hover { background: var(--hoja-3); }
.pendientes-grupo li:last-child .pendiente { border-bottom: 0; }
.pendiente > span:nth-child(2) { flex: 1; min-width: 0; }
.pendiente strong { display: block; font-weight: 500; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pendiente small { display: block; color: var(--tinta-3); font-size: 0.78rem; }
.pendiente .lado { text-align: right; font-size: 0.8rem; color: var(--tinta-3); white-space: nowrap; }
.pendiente .conteos { gap: 1.25rem; }
.pendiente .conteos strong { font-size: 1.4rem; }

/* Calendario */
.calendario-cab { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.calendario-cab h2 { font-size: 1.1rem; font-weight: 400; margin-inline: 0.5rem; }
.semana-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--reja-2); border-radius: var(--radio); overflow: hidden; }
.dia { min-height: 12rem; border-right: 1px solid var(--reja); padding: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.dia:last-child { border-right: 0; }
.dia-cab { display: grid; justify-items: center; gap: 0.1rem; padding-bottom: 0.4rem; color: var(--tinta-3); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.dia-cab b { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; font-family: var(--f-display); font-weight: 400; font-size: 1.4rem; color: var(--tinta); text-transform: none; letter-spacing: 0; }
.dia.hoy .dia-cab { color: var(--azul-tinta); }
.dia.hoy .dia-cab b { background: var(--azul-tinta); color: var(--sobre-acento); }
.evento { display: block; width: 100%; border: 0; border-radius: var(--radio-chico); padding: 0.35rem 0.5rem; background: var(--banner, var(--b-azul)); color: #fff; text-align: left; cursor: pointer; font-size: 0.76rem; line-height: 1.3; overflow: hidden; }
.evento strong { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evento small { opacity: 0.92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.evento.hecho { opacity: 0.6; }
@media (max-width: 760px) {
  .semana-grid { grid-template-columns: minmax(0, 1fr); }
  .dia { min-height: 0; border-right: 0; border-bottom: 1px solid var(--reja); flex-direction: row; flex-wrap: wrap; align-items: center; }
  .dia-cab { grid-auto-flow: column; gap: 0.5rem; padding: 0; min-width: 5.5rem; justify-items: start; }
  .dia-cab b { width: 2rem; height: 2rem; font-size: 1.05rem; }
  .evento { width: auto; flex: 1 1 12rem; }
}

/* ---------------- Diálogos ---------------- */
dialog.dialogo {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  padding: 0; border: 0; border-radius: 12px;
  background: var(--hoja); color: var(--tinta);
  box-shadow: var(--sombra-2);
}
dialog.dialogo::backdrop { background: var(--velo); }
.dialogo form, .dialogo .dialogo-cuerpo { display: grid; gap: 1.1rem; padding: 1.5rem; }
.dialogo h2 { font-size: 1.4rem; font-weight: 400; }
.dialogo .dialogo-texto { color: var(--tinta-2); font-size: 0.9rem; }
.dialogo .acciones { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.3rem; }
.dialogo .error { background: var(--rojo-suave); color: var(--rojo); border-radius: var(--radio-chico); padding: 0.55rem 0.8rem; font-size: 0.88rem; }
.dialogo .aviso-ok { background: var(--verde-suave); color: var(--verde); border-radius: var(--radio-chico); padding: 0.55rem 0.8rem; font-size: 0.88rem; }
/* ---------------- Editor de temas ---------------- */
.editor-tema { display: grid; gap: 1.6rem; }
.te-cursos { justify-self: start; }
.te-cursos button { font-size: 0.88rem; padding: 0.3rem 0.95rem; }
.te-niveles { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; }
.te-nivel { display: inline-flex; align-items: center; gap: 0.5rem; }
.te-nivel input[type="number"], .te-num input { width: 6rem; min-height: 36px; padding: 0.35rem 0.5rem; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); color: var(--tinta); font: inherit; }
.te-nivel input[type="number"]:disabled { opacity: 0.5; }
.te-num { max-width: 24rem; }
.campo textarea.te-texto-largo { min-height: 18rem; font-family: var(--f-codigo); font-size: 0.86rem; line-height: 1.55; }
.campo textarea.te-texto-medio { min-height: 9rem; font-family: var(--f-codigo); font-size: 0.86rem; line-height: 1.55; }
.te-leccion-vista { border: 1px dashed var(--reja-2); border-radius: var(--radio); padding: 1rem 1.1rem; background: var(--papel); }
.te-ejemplo { display: grid; gap: 0.8rem; padding: 1rem; border: 1px solid var(--reja); border-radius: var(--radio); background: var(--hoja-3); }
.te-ejemplo-cab { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.te-ejemplo-cab h3 { font-size: 1.02rem; font-weight: 600; }
.te-ejemplo-cab .fila { display: flex; gap: 0.4rem; }
.te-ejemplo-cuerpo { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.te-ejemplo-mundo, .te-ejemplo-codigo { display: grid; gap: 0.5rem; min-width: 0; }
.te-ejemplo-mundo .mundo-fig { margin: 0; overflow: auto; }
.te-ejemplo-mundo .fila { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.te-ejemplo-mundo .btn .icono { width: 16px; height: 16px; margin-right: 0.3rem; vertical-align: -0.2em; }
.te-pegar { display: grid; gap: 0.4rem; }
.te-pegar textarea { width: 100%; min-height: 4.5rem; padding: 0.5rem; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); color: var(--tinta); font-family: var(--f-codigo); font-size: 0.76rem; }
.te-codigo .ed { min-height: 12rem; }
.te-pregunta { display: grid; gap: 0.7rem; margin: 0; padding: 0.8rem 1rem 1rem; border: 1px solid var(--reja); border-radius: var(--radio); min-width: 0; }
.te-pregunta legend { font-weight: 600; font-size: 0.92rem; padding: 0 0.3rem; }
.campo textarea[rows="2"], .campo textarea[rows="3"] { min-height: 3.6rem; }
.te-opciones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem 0.8rem; }
.te-correcta input { border-color: var(--verde); box-shadow: inset 3px 0 0 var(--verde); }
.te-correcta label::before { content: "✓ "; color: var(--verde); }
.te-previa { border-top: 2px dashed var(--reja-2); padding-top: 1.2rem; }
@media (max-width: 760px) {
  .te-ejemplo-cuerpo { grid-template-columns: minmax(0, 1fr); }
  .te-opciones { grid-template-columns: minmax(0, 1fr); }
}

/* Apariencia de Karel (flecha o robot y su color). */
.ap-grupo { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 0.55rem; }
.ap-grupo legend, .ap-titulo { font-weight: 500; font-size: 0.92rem; padding: 0; margin-bottom: 0.1rem; }
.ap-formas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.ap-forma {
  display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0.8rem; min-height: 72px;
  border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); color: var(--tinta);
  font: inherit; font-size: 0.95rem; text-align: left; cursor: pointer;
}
.ap-forma:hover { background: var(--hoja-3); }
.ap-forma[aria-pressed="true"] { border-color: var(--azul); box-shadow: inset 0 0 0 1px var(--azul); background: var(--azul-suave); font-weight: 600; }
.ap-forma svg { flex: none; border-radius: 6px; }
.ap-colores { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.ap-color {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 36px; padding: 0.25rem 0.75rem 0.25rem 0.4rem;
  border: 1px solid var(--reja-2); border-radius: 999px; background: var(--hoja); color: var(--tinta); font: inherit; font-size: 0.88rem; cursor: pointer;
}
.ap-color i { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18); }
.ap-color:hover { background: var(--hoja-3); }
.ap-color[aria-pressed="true"] { border-color: var(--azul); box-shadow: inset 0 0 0 1px var(--azul); background: var(--azul-suave); font-weight: 600; }
.ap-lados { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.ap-lados figure { margin: 0; display: grid; justify-items: center; gap: 0.25rem; font-size: 0.8rem; color: var(--tinta-3); }
.ap-nota { margin: 0; }
@media (max-width: 480px) {
  .ap-formas { grid-template-columns: 1fr; }
}
.relleno { display: grid; gap: 0.3rem; position: relative; }
.relleno label { font-size: 0.78rem; color: var(--tinta-3); padding-left: 0.9rem; }
.relleno input, .relleno select, .relleno textarea {
  width: 100%; min-height: 52px; padding: 0.85rem 0.9rem 0.6rem;
  border: 0; border-bottom: 1px solid var(--tinta-3); border-radius: var(--radio-chico) var(--radio-chico) 0 0;
  background: var(--hoja-2); color: var(--tinta); font-size: 1rem;
}
.relleno textarea { min-height: 120px; resize: vertical; font-family: var(--f-texto); line-height: 1.45; }
.relleno input:focus, .relleno select:focus, .relleno textarea:focus { outline: none; border-bottom: 2px solid var(--azul-tinta); }
.relleno .ayuda { font-size: 0.76rem; color: var(--tinta-3); padding-left: 0.9rem; }
.relleno-codigo input { font-family: var(--f-codigo); letter-spacing: 0.15em; text-transform: uppercase; font-size: 1.15rem; }
.dos-columnas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.colores { display: flex; gap: 0.5rem; flex-wrap: wrap; border: 0; padding: 0; margin: 0; }
.colores legend { font-size: 0.78rem; color: var(--tinta-3); margin-bottom: 0.4rem; padding: 0; }
.colores label { position: relative; cursor: pointer; }
.colores input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.colores span { display: block; width: 36px; height: 36px; border-radius: 50%; background: var(--banner); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6); }
.colores input:checked + span { box-shadow: 0 0 0 3px var(--hoja), 0 0 0 5px var(--azul-tinta); }
.colores input:focus-visible + span { outline: 3px solid var(--azul); outline-offset: 3px; }
.lista-salones { display: grid; gap: 0.2rem; max-height: 14rem; overflow: auto; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); padding: 0.4rem; }
.lista-salones label { display: flex; align-items: center; gap: 0.7rem; padding: 0.35rem 0.5rem; border-radius: var(--radio-chico); cursor: pointer; font-size: 0.9rem; }
.lista-salones label:hover { background: var(--hoja-2); }
.lista-salones input { width: 18px; height: 18px; accent-color: var(--azul-tinta); }

/* Diálogo de pantalla completa para crear trabajo (como el de Classroom) */
dialog.dialogo.completo { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; border-radius: 0; }
.completo-barra { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 1rem; border-bottom: 1px solid var(--reja); background: var(--hoja); }
.completo-barra h2 { flex: 1; font-size: 1.3rem; font-weight: 400; display: flex; align-items: center; gap: 0.8rem; }
.completo-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; min-height: calc(100vh - 66px); }
.completo-cuerpo > section { padding: 1.5rem; display: grid; gap: 1.1rem; align-content: start; }
.completo-principal { background: var(--hoja-3); }
.completo-principal .tarjeta-campos { background: var(--hoja); border: 1px solid var(--reja-2); border-radius: var(--radio); padding: 1.25rem; display: grid; gap: 1.1rem; }
.completo-lado { border-left: 1px solid var(--reja); }
.completo-lado h3 { font-size: 0.86rem; font-weight: 500; color: var(--tinta-2); margin-bottom: -0.6rem; }
.recurso-tipos { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.recurso-tipos label { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.4rem 0.85rem; border: 1px solid var(--reja-2); border-radius: 999px; cursor: pointer; font-size: 0.86rem; }
.recurso-tipos input { accent-color: var(--azul-tinta); }
.recurso-tipos label:has(input:checked) { background: var(--azul-suave); border-color: var(--azul-tinta); color: var(--azul-tinta); }

/* ---------------- Pantalla de acceso (tarjeta como la de inicio de sesión) ---------------- */
.acceso { background: var(--hoja-3); background-image: none; }
.acceso-tarjeta { border-radius: 28px; border: 0; box-shadow: none; background: var(--hoja); width: min(100%, 1040px); }
.acceso-portada { background: var(--hoja); border-right: 0; padding: 2.5rem 2.5rem 2rem; }
.acceso-portada h1 { font-weight: 400; font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: 0; }
.acceso-form { padding: 2.5rem; }
.acceso-form h2 { font-weight: 400; }
.acceso-form .btn-pri { justify-self: end; min-width: 8rem; }
.acceso-nota { border-top: 0; padding-top: 0; }
[data-theme="dark"] .acceso, [data-theme="dark"] .acceso-tarjeta, [data-theme="dark"] .acceso-portada { background: var(--papel); }
[data-theme="dark"] .acceso-tarjeta { background: var(--hoja); }
[data-theme="dark"] .acceso-portada { background: var(--hoja); }

/* ---------------- Ajustes a piezas existentes ---------------- */
.pestana { font-weight: 500; font-size: 0.95rem; }
.pestana[aria-selected="true"] { color: var(--azul-tinta); }
.pestana[aria-selected="true"] span { background: none; padding: 0; }
.pestana[aria-selected="true"]::after { content: ""; position: absolute; left: 0.5rem; right: 0.5rem; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--azul-tinta); }
.tema-cab h1 { font-weight: 400; letter-spacing: 0; }
.inicio-cab h1 { font-weight: 400; }
.seccion-cab h2 { font-weight: 400; }
.chip-nivel { color: #fff; }
.toast { background: #323232; color: #fff; border-radius: 4px; box-shadow: var(--sombra-2); }
.tema-asignar { display: flex; gap: 0.5rem; flex-wrap: wrap; }

@media (max-width: 900px) {
  .salon-columnas { grid-template-columns: minmax(0, 1fr); }
  .salon-lado { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
  .tarea-vista { grid-template-columns: minmax(0, 1fr); }
  .trabajos { grid-template-columns: minmax(0, 1fr); }
  .trabajos-lista { border-right: 0; border-bottom: 1px solid var(--reja-2); max-height: 16rem; }
  .completo-cuerpo { grid-template-columns: minmax(0, 1fr); }
  .completo-lado { border-left: 0; border-top: 1px solid var(--reja); }
}
@media (max-width: 760px) {
  .barra-pestanas { position: fixed; left: 0; right: 0; top: calc(var(--barra-alto) + env(safe-area-inset-top, 0px)); height: 48px; margin: 0; background: var(--hoja); border-bottom: 1px solid var(--reja); z-index: 19; justify-content: flex-start; }
  .barra-pestana { padding: 0 1rem; }
  .con-pestanas .principal { padding-top: calc(48px + 1.25rem); }
  .barra-migas small { display: none; }
  .barra-migas strong { max-width: 9rem; font-size: 1rem; }
  .barra .marca-texto { display: none; }
  .salon-banner { min-height: 160px; padding: 1rem; }
  .trabajo-detalle { padding-left: 0.75rem; }
  .dos-columnas { grid-template-columns: minmax(0, 1fr); }
  .aula-cuerpo { padding-right: 1rem; }
}
@media (max-width: 520px) {
  .barra .vista-toggle { display: none; }
  .barra-migas .sep { display: none; }
}

/* Ajustes tras revisar en el navegador */
.dialogo.completo form { padding: 0; gap: 0; display: block; }
.caja-codigo .codigo { font-size: 1.3rem; white-space: nowrap; letter-spacing: 0.02em; }
.caja-codigo .codigo span { overflow: hidden; text-overflow: ellipsis; }
.notas-envoltura { width: fit-content; max-width: 100%; }
.notas { min-width: 0; width: max-content; }
.notas th small { display: block; color: var(--tinta-3); font-size: 0.74rem; font-weight: 400; }
select[data-aula-filtro], .herramienta select, .herramienta input {
  min-height: 36px; border: 1px solid var(--reja-2); border-radius: var(--radio-chico);
  padding: 0 0.6rem; background: var(--hoja); color: var(--tinta); font-size: 0.88rem;
}

.chip.chip-entorno { background: var(--ambar-suave); border-color: transparent; color: var(--ambar); font-weight: 600; letter-spacing: 0.02em; }
.inicio-cab h1 { letter-spacing: 0; font-size: clamp(1.8rem, 3.4vw, 2.35rem); }

/* Dentro de un salón la barra lleva migas y pestañas: se compacta para que quepan. */
.con-pestanas .barra-pestana { padding: 0 1rem; }
@media (max-width: 1500px) {
  .con-pestanas .barra .marca-texto { display: none; }
}
@media (max-width: 1200px) and (min-width: 761px) {
  .con-pestanas .barra .vista-toggle { display: none; }
  .con-pestanas .barra-migas small { display: none; }
  .con-pestanas .barra-pestana { padding: 0 0.75rem; }
}

/* ------------------------------------------------------------------ */
/* Simulador libre, al estilo de ReKarel (assets/simulador-libre.js)  */
/* ------------------------------------------------------------------ */

.principal.principal-lab { padding-block: 0.75rem; }
.principal-lab .contenedor { max-width: none; padding: 0; }

.lab {
  --lab-alto: calc(100vh - var(--barra-alto) - 1.5rem);
  container: lab / inline-size;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  height: max(560px, var(--lab-alto));
}
@supports (height: 100dvh) {
  .lab { --lab-alto: calc(100dvh - var(--barra-alto) - 1.5rem); }
}

.lab-barra {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.75rem;
  padding: 0.4rem 0.6rem;
  background: var(--hoja); border: 1px solid var(--reja); border-radius: var(--radio);
}
.lab-grupo { display: flex; align-items: center; gap: 0.2rem; flex-wrap: wrap; min-width: 0; }
.lab-ejec { padding-left: 0.7rem; border-left: 1px solid var(--reja); }
.lab-ajustes { margin-left: auto; gap: 0.9rem; }

.lab-b {
  display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 36px; padding: 0.3rem 0.7rem;
  border: 1px solid transparent; border-radius: 999px;
  background: none; color: var(--tinta-2); cursor: pointer;
  font: 500 0.86rem var(--f-display); white-space: nowrap;
}
.lab-b:hover { background: var(--hoja-2); color: var(--tinta); }
.lab-b:disabled { opacity: 0.45; cursor: not-allowed; }
.lab-b:disabled:hover { background: none; color: var(--tinta-2); }
.lab-b .icono { width: 20px; height: 20px; flex: none; }
.lab-pri { background: var(--azul); color: var(--sobre-acento); padding-inline: 0.9rem 1rem; }
.lab-pri:hover { background: var(--azul-hover); color: var(--sobre-acento); }
.lab-pri.lab-alto, .lab-pri.lab-alto:hover { background: var(--rojo); color: var(--sobre-acento); }
.lab-desplegar { border-color: var(--reja-2); }
.lab-desplegar .icono:last-child { width: 16px; height: 16px; margin-left: -0.1rem; color: var(--tinta-3); }

.lab-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none;
  border: 0; border-radius: 50%; background: none; color: var(--tinta-3); cursor: pointer;
}
.lab-ico:hover { background: var(--hoja-2); color: var(--tinta); }
.lab-ico[aria-pressed="true"] { background: var(--azul-suave); color: var(--azul-tinta); }
.lab-ico .icono { width: 20px; height: 20px; }

.lab-campo { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; color: var(--tinta-3); }
.lab-campo label { font: 500 0.84rem var(--f-display); color: var(--tinta-2); margin-right: 0.1rem; }
.lab-campo input {
  width: 4.6rem; min-height: 32px; padding: 0.2rem 0.45rem;
  border: 1px solid var(--reja-2); border-radius: var(--radio-chico);
  background: var(--hoja); color: var(--tinta); font: 0.9rem var(--f-codigo); text-align: right;
}
.lab-campo input:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 2px var(--azul-suave); }
.lab-campo input:disabled { background: var(--hoja-2); }
.lab-mini {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 0.3rem;
  border: 1px solid var(--reja-2); border-radius: var(--radio-chico);
  background: var(--hoja); color: var(--tinta-2); cursor: pointer; font: 600 1rem var(--f-codigo);
}
.lab-mini .icono { width: 16px; height: 16px; }
.lab-mini:hover { border-color: var(--azul); color: var(--azul-tinta); }
.lab-mini[aria-pressed="true"] { background: var(--azul); border-color: var(--azul); color: var(--sobre-acento); }

.lab-pestanas { display: none; }

.lab-cuerpo {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.35fr); gap: 0.6rem;
}
.lab-codigo, .lab-mundo {
  min-width: 0; min-height: 0; display: grid;
  background: var(--hoja); border: 1px solid var(--reja); border-radius: var(--radio); overflow: hidden;
}
.lab-codigo { grid-template-rows: auto minmax(0, 1fr) minmax(150px, 34%); }
.lab-mundo { grid-template-rows: auto minmax(0, 1fr) auto; position: relative; container: mundo / inline-size; }

.lab-codigo-cab { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--reja); min-width: 0; }
.lab-lenguaje { font-family: var(--f-codigo); font-size: 0.74rem; border-color: transparent; }
.lab-lenguaje[data-lenguaje="java"] { background: var(--azul-suave); color: var(--azul-tinta); }
.lab-lenguaje[data-lenguaje="pascal"] { background: var(--morado-suave); color: var(--morado); }
.lab-nota { font-size: 0.76rem; color: var(--tinta-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.lab-editor { min-height: 0; display: grid; }
.lab-editor .ed { height: 100%; border: 0; border-radius: 0; }
.lab-editor .ed:focus-within { box-shadow: inset 0 0 0 2px var(--azul-suave); }
.ed-lab .ed-num { padding-left: 20px; cursor: pointer; white-space: normal; }
.ed-lab .ed-num span { display: block; position: relative; height: 22px; }
.ed-lab .ed-num span:hover { color: var(--tinta); }
.ed-lab .ed-num span:hover::before { content: ''; position: absolute; left: -15px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--reja-2); }
.ed-lab .ed-num .ed-punto { color: var(--rojo); font-weight: 700; }
.ed-lab .ed-num .ed-punto::before, .ed-lab .ed-num .ed-punto:hover::before { content: ''; position: absolute; left: -15px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--rojo); }
.ed-marca-punto { background: var(--rojo-suave); border-left: 3px solid var(--rojo); }

.lab-consola { display: grid; grid-template-rows: auto minmax(0, 1fr); border-top: 1px solid var(--reja); min-height: 0; }
.lab-consola-cab { display: flex; align-items: center; gap: 0.1rem; padding: 0 0.3rem; border-bottom: 1px solid var(--reja); background: var(--hoja-3); }
.lab-consola-cab [role="tab"] {
  position: relative; display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 38px; padding: 0 0.7rem; border: 0; background: none; color: var(--tinta-3); cursor: pointer;
  font: 500 0.84rem var(--f-display);
}
.lab-consola-cab [role="tab"]:hover { color: var(--tinta); }
.lab-consola-cab [role="tab"][aria-selected="true"] { color: var(--azul-tinta); }
.lab-consola-cab [role="tab"][aria-selected="true"]::after { content: ''; position: absolute; left: 0.45rem; right: 0.45rem; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--azul-tinta); }
.lab-cuenta { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rojo); color: var(--sobre-acento); font-size: 0.7rem; display: inline-flex; align-items: center; justify-content: center; }
.lab-cuenta[hidden] { display: none; }
.lab-espacio { flex: 1; }
.lab-consola-cuerpo { min-height: 0; overflow: auto; }
.lab-mensajes { list-style: none; margin: 0; padding: 0.25rem 0; font-size: 0.86rem; max-height: 100%; overflow: auto; }
.lab-consola-cuerpo > [data-tab-panel] { height: 100%; overflow: auto; }
.lab-msj { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.6rem; padding: 0.3rem 0.8rem; border-left: 3px solid transparent; line-height: 1.4; }
.lab-msj-hora { font: 0.72rem var(--f-codigo); color: var(--tinta-3); padding-top: 0.12rem; }
.lab-msj-texto { overflow-wrap: anywhere; }
.lab-msj-ok { border-left-color: var(--verde); }
.lab-msj-aviso { border-left-color: var(--ambar); }
.lab-msj-error { border-left-color: var(--rojo); background: var(--rojo-suave); color: var(--rojo); }
.lab-msj .enlace { font-size: 0.82rem; margin-left: 0.2rem; }
.lab-pila ol { list-style: none; margin: 0; padding: 0; }
.lab-pila li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.35rem 0.8rem; border-bottom: 1px solid var(--reja); font-size: 0.86rem; }
.lab-pila li:first-child { background: var(--azul-suave); }
.lab-pila code { font-family: var(--f-codigo); overflow-wrap: anywhere; }
.lab-pila small { color: var(--tinta-3); white-space: nowrap; }
.lab-datos { margin: 0; padding: 0.6rem 0.8rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.4rem; align-content: start; }
.lab-datos div { background: var(--hoja-2); border-radius: var(--radio-chico); padding: 0.4rem 0.6rem; min-width: 0; }
.lab-datos dt { font-size: 0.72rem; color: var(--tinta-3); }
.lab-datos dd { margin: 0; font: 600 1rem var(--f-codigo); font-variant-numeric: tabular-nums; }
.lab-vacio { padding: 0.8rem; color: var(--tinta-3); font-size: 0.86rem; }

.lab-mundo-barra { display: flex; align-items: center; flex-wrap: wrap; gap: 0.2rem; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--reja); }
.lab-sep { width: 1px; height: 22px; background: var(--reja); margin: 0 0.25rem; flex: none; }
.lab-lienzo { position: relative; min-height: 0; overflow: hidden; background: var(--k-fuera); }
.lab-lienzo canvas { position: absolute; inset: 0; display: block; touch-action: none; cursor: cell; outline: none; }
.lab-lienzo canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--azul); }
.lab-estado { display: flex; flex-wrap: wrap; gap: 0.25rem 1.2rem; padding: 0.4rem 0.75rem; border-top: 1px solid var(--reja); font: 0.8rem var(--f-codigo); color: var(--tinta-2); }
.lab-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }

/* Menús del simulador */
.menu-lab { max-height: calc(100vh - 16px); overflow-y: auto; padding: 0.35rem 0; min-width: 250px; max-width: min(92vw, 360px); }
.menu-lab button { padding: 0.5rem 1rem; gap: 0.75rem; font-size: 0.9rem; }
.menu-lab button:disabled { opacity: 0.45; cursor: default; }
.menu-lab button:focus-visible { background: var(--hoja-2); outline: none; }
.menu-lab .icono { width: 18px; height: 18px; flex: none; }
.menu-lab kbd { margin-left: auto; padding: 0 0.35rem; font: 0.74rem var(--f-codigo); color: var(--tinta-3); border: 1px solid var(--reja-2); border-radius: 4px; }
.menu-lab .menu-titulo { padding: 0.5rem 1rem 0.2rem; font: 600 0.72rem var(--f-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--tinta-3); }
.menu-lab .menu-sep { height: 1px; background: var(--reja); margin: 0.35rem 0; }
.menu-lab .menu-marca { margin-left: auto; color: var(--azul-tinta); }

/* Diálogos del simulador */
dialog.dialogo-lab:has(.dialogo-ancho) { width: min(760px, calc(100vw - 32px)); }
.dialogo-lab code { font-family: var(--f-codigo); font-size: 0.85em; }
.lab-texto { width: 100%; min-height: 200px; font: 0.82rem/1.45 var(--f-codigo) !important; white-space: pre; overflow: auto; }
.lab-xml { min-height: 260px; max-height: 50vh; padding: 0.7rem; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja-3); color: var(--tinta); resize: vertical; }
.lab-segmentos { display: inline-flex; width: max-content; padding: 2px; border: 1px solid var(--reja-2); border-radius: 999px; background: var(--hoja-2); }
.lab-segmentos button { padding: 0.3rem 0.9rem; border: 0; border-radius: 999px; background: none; color: var(--tinta-2); cursor: pointer; font: 500 0.86rem var(--f-codigo); }
.lab-segmentos button[aria-selected="true"] { background: var(--hoja); color: var(--tinta); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.lab-check { display: flex; align-items: center; gap: 0.55rem; font-size: 0.9rem; cursor: pointer; }
.lab-check input { width: 18px; height: 18px; flex: none; accent-color: var(--azul-tinta); }
.lab-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 1rem; margin: 0; padding: 0.8rem 1rem 1rem; border: 1px solid var(--reja); border-radius: var(--radio); }
.lab-campos legend { padding: 0 0.4rem; font: 500 0.86rem var(--f-display); color: var(--tinta-2); }
.lab-campos-num { gap: 0.8rem 1rem; }
.lab-ayuda-t { font: 500 1rem var(--f-display); margin-top: 0.3rem; }
.lab-atajos { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.lab-atajos td { padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--reja); vertical-align: top; }
.lab-atajos td:first-child { width: 12rem; white-space: nowrap; }
.dialogo-lab kbd { padding: 0.05rem 0.4rem; font: 0.78rem var(--f-codigo); background: var(--hoja-2); border: 1px solid var(--reja-2); border-bottom-width: 2px; border-radius: 4px; }

/* Según el ancho del simulador (con el menú lateral abierto o cerrado), los botones muestran solo el ícono. */
@container lab (max-width: 1260px) {
  .lab-ejec .lab-b:not(.lab-pri) span { display: none; }
  .lab-ejec .lab-b:not(.lab-pri) { padding-inline: 0.5rem; }
}
@container lab (max-width: 1120px) {
  .lab-barra { gap: 0.4rem 0.5rem; }
  .lab-ajustes { gap: 0.6rem; }
  .lab-campo input { width: 3.8rem; }
  .lab-unidad { display: none; }
}
@container mundo (max-width: 780px) {
  .lab-mundo-barra .lab-desplegar span { display: none; }
  .lab-mundo-barra .lab-desplegar { padding-inline: 0.55rem 0.45rem; }
}
@container mundo (max-width: 470px) {
  .lab-mundo-barra { gap: 0.1rem; padding-inline: 0.3rem; }
  .lab-mundo-barra .lab-ico { width: 32px; height: 32px; }
  .lab-mundo-barra .lab-sep { margin: 0 0.1rem; }
}
@media (max-width: 900px) {
  .lab { height: auto; }
  .lab-pestanas { display: flex; gap: 0.4rem; }
  .lab-pestanas button {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    min-height: 40px; border: 1px solid var(--reja-2); border-radius: 999px;
    background: var(--hoja); color: var(--tinta-2); cursor: pointer; font: 500 0.9rem var(--f-display);
  }
  .lab-pestanas button[aria-selected="true"] { background: var(--azul-suave); border-color: transparent; color: var(--azul-tinta); }
  .lab-pestanas .icono { width: 18px; height: 18px; }
  .lab-cuerpo { grid-template-columns: minmax(0, 1fr); }
  .lab-cuerpo[data-panel="codigo"] .lab-mundo, .lab-cuerpo[data-panel="mundo"] .lab-codigo { display: none; }
  .lab-codigo, .lab-mundo { height: max(440px, calc(100vh - var(--barra-alto) - 13rem)); }
  .lab-ajustes { margin-left: 0; }
  .lab-ejec { padding-left: 0; border-left: 0; }
}
@supports (height: 100dvh) {
  @media (max-width: 900px) {
    .lab-codigo, .lab-mundo { height: max(440px, calc(100dvh - var(--barra-alto) - 13rem)); }
  }
}
@media (max-width: 560px) {
  .lab-barra { padding: 0.4rem; gap: 0.35rem 0.5rem; }
  .lab-grupo { gap: 0.1rem; }
  .lab-ejec { order: -1; width: 100%; justify-content: space-between; }
  .lab-ejec .lab-b:not(.lab-pri) { padding-inline: 0.45rem; }
  .lab-ajustes { gap: 0.6rem; flex-wrap: nowrap; }
  .lab-campo { gap: 0.2rem; }
  .lab-campo input { width: 3.4rem; padding-inline: 0.3rem; }
  .lab-campo .lab-mini { min-width: 28px; height: 30px; }
  .lab-unidad { display: none; }
  .lab-nota { display: none; }
  .lab-campos { grid-template-columns: minmax(0, 1fr); }
  .lab-atajos td:first-child { width: auto; white-space: normal; }
}
@media (max-width: 420px) {
  .barra-simulador { display: none; }
}

/* ------------------------------------------------------------------ */
/* C y C++: compilador, problemas y juez (assets/cpp.js)               */
/* ------------------------------------------------------------------ */

.principal.principal-cpp .contenedor { max-width: 96rem; }

/* Veredictos con las siglas de omegaUp */
.cpp-v { gap: 0.3rem; border-color: transparent; }
.cpp-v b { font-family: var(--f-codigo); font-size: 0.74rem; letter-spacing: 0.02em; }
.cpp-v-ok { background: var(--verde-suave); color: var(--verde); }
.cpp-v-parcial { background: var(--ambar-suave); color: var(--ambar); }
.cpp-v-mal { background: var(--rojo-suave); color: var(--rojo); }
.cpp-v-juez, .cpp-v-omitido { background: var(--hoja-2); color: var(--tinta-2); }
.cpp-v-pendiente { background: var(--azul-suave); color: var(--azul-tinta); }

.cpp-pre {
  margin: 0; padding: 0.6rem 0.75rem; min-height: 2.4rem; max-height: 22rem; overflow: auto;
  font: 0.86rem/1.5 var(--f-codigo); white-space: pre; tab-size: 4;
  background: var(--hoja-3); border: 1px solid var(--reja); border-radius: var(--radio-chico); color: var(--tinta);
}
.cpp-pre[data-vacia]:empty::before { content: attr(data-vacia); color: var(--tinta-3); font-family: var(--f-texto); font-style: italic; }
.cpp-pre-error { background: var(--rojo-suave); border-color: transparent; color: var(--tinta); white-space: pre-wrap; word-break: break-word; }
.cpp-pre-mal { border-color: var(--rojo); }
.cpp-pre-chico { max-height: 7rem; font-size: 0.78rem; }
.cpp-estado { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; }
.cpp-medida { display: inline-flex; align-items: center; gap: 0.25rem; font: 0.82rem var(--f-codigo); color: var(--tinta-3); white-space: nowrap; }
.cpp-medida .icono { width: 15px; height: 15px; }
.cpp-detalle { color: var(--tinta-2); font-size: 0.92rem; }
.cpp-sub { display: block; margin: 0.2rem 0 0; font: 600 0.8rem var(--f-display); color: var(--tinta-3); text-transform: uppercase; letter-spacing: 0.05em; }
.cpp-mensajes summary { cursor: pointer; font-size: 0.86rem; color: var(--tinta-2); padding: 0.2rem 0; }
.cpp-mensajes[open] summary { margin-bottom: 0.4rem; }
.cpp-espera { display: flex; align-items: center; gap: 0.6rem; color: var(--tinta-2); font-size: 0.92rem; }
.cpp-girando { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--reja-2); border-top-color: var(--azul); animation: cpp-girar 0.8s linear infinite; flex: none; }
@keyframes cpp-girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cpp-girando { animation-duration: 3s; } }

.cpp-select {
  min-height: 34px; padding: 0.2rem 0.5rem; border: 1px solid var(--reja-2); border-radius: var(--radio-chico);
  background: var(--hoja); color: var(--tinta); font: 500 0.86rem var(--f-display);
}
.cpp-select:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 2px var(--azul-suave); }
.cpp-menu button { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
.cpp-menu small { color: var(--tinta-3); font-size: 0.8rem; }

/* Compilador en línea */
.cpp-juez { font: 0.8rem var(--f-codigo); color: var(--tinta-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 18rem; }
.cpp-juez.listo::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--verde); margin-right: 0.4rem; vertical-align: 1px; }
.cpp-juez.caido { color: var(--rojo); }
.cpp-cuerpo { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); gap: 0.6rem; }
.cpp-codigo { grid-template-rows: auto minmax(0, 1fr); }
.cpp-io { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(120px, 0.8fr) minmax(0, 1.4fr); gap: 0.6rem; }
.cpp-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--hoja); border: 1px solid var(--reja); border-radius: var(--radio); overflow: hidden; }
.cpp-panel-cab { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.4rem 0.3rem 0.75rem; border-bottom: 1px solid var(--reja); min-width: 0; }
.cpp-panel-cab h2 { font: 600 0.92rem var(--f-display); }
.cpp-panel-cab .ayuda { flex: 1; font-size: 0.78rem; color: var(--tinta-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cpp-entrada textarea {
  width: 100%; height: 100%; resize: none; border: 0; padding: 0.6rem 0.75rem;
  background: var(--hoja); color: var(--tinta); font: 0.88rem/1.5 var(--f-codigo); tab-size: 4;
}
.cpp-entrada textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--azul-suave); }
.cpp-resultado { overflow: auto; padding: 0.75rem; display: grid; gap: 0.6rem; align-content: start; }
.cpp-resultado .vacio { max-width: none; }
.ed-cpp .ed-hl, .ed-cpp .ed-in { tab-size: 4; }
@media (max-width: 860px) {
  .cpp-lab { height: auto; }
  .cpp-cuerpo { grid-template-columns: minmax(0, 1fr); }
  .cpp-codigo { height: 60vh; min-height: 320px; }
  .cpp-io { grid-template-rows: auto auto; }
  .cpp-entrada textarea { min-height: 8rem; }
  .cpp-resultado { max-height: none; }
}

/* Lista de problemas */
.cpp-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; max-width: 60rem; }
.cpp-item {
  display: flex; align-items: center; gap: 0.8rem; width: 100%; padding: 0.8rem 1rem; text-align: left; cursor: pointer;
  border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); color: var(--tinta); font: inherit;
}
.cpp-item:hover { border-color: var(--azul); box-shadow: var(--sombra); }
.cpp-item-t { flex: 1; min-width: 0; display: grid; gap: 0.15rem; }
.cpp-item-t small { color: var(--tinta-3); font-size: 0.84rem; }
.cpp-sub-fila { font-size: 0.8rem; color: var(--tinta-3); margin-top: 0.15rem; }
.cpp-acciones { white-space: nowrap; }
.cpp-acciones .btn + .btn { margin-left: 0.3rem; }

/* Un problema: enunciado a la izquierda, solución a la derecha */
.cpp-problema { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.cpp-enunciado { min-width: 0; display: grid; gap: 0.9rem; align-content: start; }
.cpp-cab { display: grid; gap: 0.55rem; }
.cpp-cab h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; }
.cpp-titulo-comp { font-size: 1.5rem; }
.cpp-fichas { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cpp-fichas .chip .icono { width: 14px; height: 14px; }
.cpp-mi-estado { font-size: 0.92rem; color: var(--tinta-2); }
.cpp-h { font-size: 1.15rem; margin-top: 0.4rem; }
.cpp-texto { display: grid; gap: 0.7rem; }
.cpp-texto .k-codigo { max-width: none; }
.cpp-ejemplo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.cpp-ejemplo > div { min-width: 0; display: grid; gap: 0.25rem; align-content: start; }
.cpp-ejemplo-cab { display: flex; align-items: center; justify-content: space-between; }
.cpp-ejemplo-cab h3 { font: 600 0.84rem var(--f-display); color: var(--tinta-2); }
.cpp-ejemplo-cab .lab-ico { width: 30px; height: 30px; }
.cpp-califica { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.7rem 0.9rem; border-radius: var(--radio-chico); background: var(--azul-suave); color: var(--tinta-2); font-size: 0.88rem; }
.cpp-califica .icono { flex: none; color: var(--azul-tinta); margin-top: 0.05rem; }

.cpp-solucion {
  position: sticky; top: calc(var(--barra-alto) + 0.75rem); min-width: 0;
  display: grid; gap: 0.5rem; padding: 0.6rem; background: var(--hoja); border: 1px solid var(--reja); border-radius: var(--radio);
  max-height: calc(100vh - var(--barra-alto) - 1.5rem); grid-template-rows: auto minmax(260px, 1fr) auto auto; overflow: hidden;
}
.cpp-sol-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.cpp-sol-editor { min-height: 260px; display: grid; }
.cpp-sol-editor .ed { height: 100%; min-height: 260px; }
.cpp-sol-pestanas { margin: 0; }
.cpp-sol-pestanas .pestana { font-size: 0.9rem; padding: 0.45rem 0.75rem; }
.cpp-sol-panel { overflow: auto; max-height: 40vh; display: grid; gap: 0.6rem; align-content: start; padding: 0.1rem 0.1rem 0.4rem; }
.cpp-sol-panel .vacio { max-width: none; font-size: 0.9rem; }
.cpp-propia { width: 100%; min-height: 6rem; padding: 0.5rem 0.65rem; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); color: var(--tinta); font: 0.86rem/1.5 var(--f-codigo); resize: vertical; }
.cpp-propia:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 2px var(--azul-suave); }
.cpp-caso { border: 1px solid var(--reja); border-radius: var(--radio-chico); padding: 0.4rem 0.6rem; background: var(--hoja); }
.cpp-caso > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; cursor: pointer; font-size: 0.9rem; }
.cpp-caso[open] > summary { margin-bottom: 0.5rem; }
.cpp-caso h4 { font: 600 0.8rem var(--f-display); color: var(--tinta-3); margin: 0.4rem 0 0.2rem; }
.cpp-comparar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.cpp-comparar > div { min-width: 0; }
.cpp-envio-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; padding: 0.7rem 0.9rem; border-radius: var(--radio-chico); border-left: 4px solid var(--reja-2); background: var(--hoja-3); }
.cpp-envio-ok { border-left-color: var(--verde); background: var(--verde-suave); }
.cpp-envio-parcial { border-left-color: var(--ambar); background: var(--ambar-suave); }
.cpp-envio-mal { border-left-color: var(--rojo); background: var(--rojo-suave); }
.cpp-puntos { font-family: var(--f-display); font-size: 1.05rem; }
.cpp-casos td, .cpp-envios td { vertical-align: middle; }
.cpp-casos small { color: var(--tinta-3); }
.cpp-en-competencia { margin-top: 0.5rem; }
@media (max-width: 1100px) {
  .cpp-problema { grid-template-columns: minmax(0, 1fr); }
  .cpp-solucion { position: static; max-height: none; grid-template-rows: auto auto auto auto; }
  .cpp-sol-editor { height: 55vh; min-height: 300px; }
  .cpp-sol-panel { max-height: none; }
}
@media (max-width: 560px) {
  .cpp-ejemplo, .cpp-comparar { grid-template-columns: minmax(0, 1fr); }
}

/* Envío en un diálogo */
dialog.cpp-dialogo { width: min(860px, calc(100vw - 32px)); }
.cpp-dialogo-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.cpp-dialogo-cab .ceja { margin: 0; }
.cpp-codigo-ver { max-width: none; max-height: 24rem; overflow: auto; }

/* Editor de problemas (maestros) */
.cpp-editor { display: grid; gap: 1.6rem; }
.cpp-casos-acciones { margin: 0; }
.cpp-casos-lista { display: grid; gap: 0.7rem; }
.cpp-caso-ed { border: 1px solid var(--reja-2); border-radius: var(--radio); background: var(--hoja); padding: 0.6rem 0.75rem 0.75rem; display: grid; gap: 0.5rem; }
.cpp-caso-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; }
.cpp-caso-cab .ep-check { font-size: 0.88rem; }
.cpp-caso-puntos { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.86rem; color: var(--tinta-2); }
.cpp-caso-puntos input { width: 5.2rem; min-height: 32px; padding: 0.2rem 0.45rem; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja); color: var(--tinta); font: 0.86rem var(--f-codigo); }
.cpp-caso-cuerpo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.cpp-caso-lado { min-width: 0; display: grid; gap: 0.25rem; align-content: start; }
.cpp-caso-texto { width: 100%; min-height: 6.5rem; padding: 0.5rem 0.6rem; border: 1px solid var(--reja-2); border-radius: var(--radio-chico); background: var(--hoja-3); color: var(--tinta); font: 0.84rem/1.45 var(--f-codigo); resize: vertical; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.cpp-caso-texto:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 2px var(--azul-suave); background: var(--hoja); }
.cpp-grande { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; font-size: 0.86rem; color: var(--tinta-2); }
.cpp-grande label.btn { cursor: pointer; }
.cpp-arriba { transform: rotate(90deg); }
.cpp-editor-codigo .ed { height: 340px; }
.cpp-editor-chico .ed { height: 200px; }
@media (max-width: 720px) { .cpp-caso-cuerpo { grid-template-columns: minmax(0, 1fr); } }
