:root {
  --bg: #f6f3ec;
  --surface: #fffefb;
  --surface-2: #f1ede3;
  --border: #e3ddcf;
  --text: #1c1b2e;
  --muted: #6a6878;
  --accent: #4338ca;
  --accent-2: #8b5cf6;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--surface));
  --ok: #0f8a55;
  --ok-soft: #dff3e8;
  --bad: #c9372c;
  --bad-soft: #fbe6e2;
  --warn: #a8660b;
  --warn-soft: #fcefd2;
  --omit: #8b8898;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 4px 14px rgba(40, 30, 10, .05);
  --shadow-lg: 0 2px 4px rgba(40, 30, 10, .06), 0 14px 32px rgba(40, 30, 10, .10);
  --radius: 16px;
  --eje-ondas: #2b7de9;
  --eje-mecanica: #e8743b;
  --eje-energia: #2e9e6a;
  --eje-electricidad: #9b5de5;
  --display: "Bricolage Grotesque", Inter, system-ui, sans-serif;
  color-scheme: light;
}
:root[data-asig="Química"] { --accent: #d69c00; --accent-2: #ffd43b; }
:root[data-asig="Biología"] { --accent: #0b8a62; --accent-2: #19b5a5; }
:root[data-asig="Ciencias Naturales"] { --accent: #3d8b1f; --accent-2: #e3c21a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11101b; --surface: #1a1927; --surface-2: #232236; --border: #302f47; --text: #ece9f6; --muted: #9d9ab3;
    --accent: #8f8cff; --accent-2: #c08bff; --ok: #3fcf8e; --ok-soft: #12332a; --bad: #ff7d72; --bad-soft: #3b1f21;
    --warn: #f0b95a; --warn-soft: #3a2e17; --omit: #7a7790; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.25);
    --shadow-lg: 0 14px 34px rgba(0,0,0,.45); color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-asig="Química"] { --accent: #f5c518; --accent-2: #ffe066; }
  :root:not([data-theme="light"])[data-asig="Biología"] { --accent: #3dd6a0; --accent-2: #4fd8e0; }
  :root:not([data-theme="light"])[data-asig="Ciencias Naturales"] { --accent: #8fd14f; --accent-2: #f5dc4a; }
}
:root[data-theme="dark"] {
  --bg: #11101b; --surface: #1a1927; --surface-2: #232236; --border: #302f47; --text: #ece9f6; --muted: #9d9ab3;
  --accent: #8f8cff; --accent-2: #c08bff; --ok: #3fcf8e; --ok-soft: #12332a; --bad: #ff7d72; --bad-soft: #3b1f21;
  --warn: #f0b95a; --warn-soft: #3a2e17; --omit: #7a7790; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.25);
  --shadow-lg: 0 14px 34px rgba(0,0,0,.45); color-scheme: dark;
}
:root[data-theme="dark"][data-asig="Química"] { --accent: #f5c518; --accent-2: #ffe066; }
:root[data-theme="dark"][data-asig="Biología"] { --accent: #3dd6a0; --accent-2: #4fd8e0; }
:root[data-theme="dark"][data-asig="Ciencias Naturales"] { --accent: #8fd14f; --accent-2: #f5dc4a; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- layout */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .in { max-width: var(--ancho-pagina, 1100px); margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 15px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a.on, .nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.user { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.user img { width: 30px; height: 30px; border-radius: 50%; }
main { max-width: var(--ancho-pagina, 1100px); margin: 0 auto; padding: 22px 16px 60px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.stack > * + * { margin-top: 14px; }

/* ---------- controles */
button, .btn { font: inherit; cursor: pointer; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { border-color: transparent; background: transparent; }
button:disabled { opacity: .5; cursor: default; }
button.danger { color: var(--bad); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chip { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.chip.eje-Ondas { color: var(--eje-ondas); border-color: currentColor; }
.chip.eje-Mecánica { color: var(--eje-mecanica); border-color: currentColor; }
.chip.eje-Energía { color: var(--eje-energia); border-color: currentColor; }
.chip.eje-Electricidad { color: var(--eje-electricidad); border-color: currentColor; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a.on { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ---------- login */
.login { max-width: 430px; margin: 9vh auto; text-align: center; }
.login .card { padding: 32px 26px; }
.login .logo-big { width: 56px; height: 56px; border-radius: 14px; background: var(--accent); color: #fff; font-size: 30px; display: grid; place-items: center; margin: 0 auto 14px; font-weight: 700; }
#gbtn { display: flex; justify-content: center; margin: 18px 0 8px; min-height: 44px; }

/* ---------- tarjetas de guía */
.guide { display: flex; flex-direction: column; gap: 8px; }
.guide .code { font-size: .78rem; font-weight: 700; color: var(--accent); letter-spacing: .04em; }
.guide h3 { margin: 0; }
.guide .foot { margin-top: auto; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding-top: 6px; }
.guide .foot .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { font-size: .78rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.prog { background: var(--warn-soft); color: var(--warn); }

/* ---------- resolución */
.quiz { display: grid; grid-template-columns: 1fr 250px; gap: 18px; align-items: start; }
.quiz-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.quiz-head h2 { margin: 0; font-size: 1.05rem; }
.timers { display: flex; gap: 10px; font-variant-numeric: tabular-nums; }
.timer { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 4px 10px; font-size: .85rem; }
.timer b { font-size: 1rem; }
.qcard { padding: 22px; }
.qnum { font-size: .8rem; color: var(--muted); font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.stem p { margin: 0 0 .7em; }
.stem img, .opt-body img, .just img { max-width: 100%; height: auto; }
.stem p.fig, .just p.fig { text-align: center; }
.stem img { cursor: zoom-in; border-radius: 6px; }
.tbl { overflow-x: auto; margin: .4em 0 .8em; }
.tbl table { border-collapse: collapse; font-size: .92rem; }
.tbl td, .tbl th { border: 1px solid var(--border); padding: 4px 9px; vertical-align: top; }
.tbl td p, .tbl th p { margin: 0; }
math { font-size: 1.08em; }
.options { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 11px; background: var(--surface); width: 100%; font-weight: 400; }
.opt:hover { border-color: var(--accent); }
.opt .letter { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--border); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.opt .opt-body { padding-top: 3px; min-width: 0; }
.opt .opt-body p { margin: 0; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.sel .letter { background: var(--accent); border-color: var(--accent); color: #fff; }
.opt.empty .opt-body { color: var(--muted); font-style: italic; }
.qnav { display: flex; gap: 10px; margin-top: 20px; align-items: center; flex-wrap: wrap; }
.mark-btn.on { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.side { position: sticky; top: 70px; }
.navgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.navgrid button { padding: 0; height: 36px; justify-content: center; font-size: .85rem; font-weight: 600; position: relative; }
.navgrid button.ans { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.navgrid button.cur { outline: 2px solid var(--text); outline-offset: 1px; }
.navgrid button.mk::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .75rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--border); vertical-align: -1px; margin-right: 4px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 9px; overflow: hidden; margin: 10px 0; }
.progress > div { height: 100%; background: var(--accent); }

/* ---------- informe */
.score { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.kpi { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.kpi .v { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: .78rem; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar { display: grid; grid-template-columns: minmax(110px, 36%) 1fr 104px; gap: 10px; align-items: center; font-size: .88rem; }
.bar .name { overflow: hidden; text-overflow: ellipsis; }
.bar .track { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 6px; }
.bar .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); line-height: 1.3; }
.bar .val .t { display: block; font-size: .72rem; }
.bar .val b { color: var(--text); }
.lvl-hi { background: var(--ok); } .lvl-mid { background: var(--warn); } .lvl-lo { background: var(--bad); }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.areas { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; }
.area-eje { margin-bottom: 8px; }
.nw { white-space: nowrap; }
.tchart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding: 8px 0 0; border-bottom: 1px solid var(--border); position: relative; }
.tchart .tb { flex: 1; min-width: 4px; border-radius: 3px 3px 0 0; position: relative; cursor: pointer; }
.tchart .tb.ok { background: var(--ok); } .tchart .tb.bad { background: var(--bad); } .tchart .tb.om { background: var(--omit); }
.tchart .tb .avg { position: absolute; left: -1px; right: -1px; height: 2px; background: var(--text); opacity: .6; }
.tlabels { display: flex; gap: 3px; font-size: .65rem; color: var(--muted); }
.tlabels span { flex: 1; text-align: center; min-width: 4px; overflow: hidden; }
.rtable { width: 100%; border-collapse: collapse; font-size: .88rem; }
.rtable th, .rtable td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.rtable th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.rtable tr.click { cursor: pointer; }
.rtable td.grip { cursor: grab; color: var(--muted); font-size: 1.2rem; width: 24px; padding: 0 2px; text-align: center; user-select: none; }
.rtable tr.dragging { opacity: .45; }
.rtable tr.click:hover td { background: var(--surface-2); }
.res { font-weight: 700; }
.res.ok { color: var(--ok); } .res.bad { color: var(--bad); } .res.om { color: var(--omit); }
.review { border-left: 4px solid var(--border); }
.review.ok { border-left-color: var(--ok); } .review.bad { border-left-color: var(--bad); } .review.om { border-left-color: var(--omit); }
.ropt { display: flex; gap: 10px; padding: 7px 10px; border-radius: 9px; border: 1px solid transparent; align-items: flex-start; }
.ropt .letter { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border); display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.ropt .opt-body p { margin: 0; }
.ropt.right { background: var(--ok-soft); border-color: var(--ok); }
.ropt.right .letter { background: var(--ok); border-color: var(--ok); color: #fff; }
.ropt.wrong { background: var(--bad-soft); border-color: var(--bad); }
.ropt.wrong .letter { background: var(--bad); border-color: var(--bad); color: #fff; }
.just { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; margin-top: 12px; font-size: .93rem; }
.just p { margin: 0 0 .5em; }
.just p:last-child { margin: 0; }

/* ---------- formularios del profesor */
.qedit { display: grid; grid-template-columns: 50px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.qedit .meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.qedit .meta label { font-size: .75rem; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.qedit details summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.switch { position: relative; width: 38px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 22px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(16px); }
.drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { border: 1.5px solid var(--border); border-radius: 99px; padding: 5px 12px; cursor: pointer; user-select: none; font-size: .88rem; background: var(--surface); }
.pill.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pill small { color: var(--muted); font-weight: 400; }

.meta-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.meta-form label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
.meta-form input, .meta-form select { color: var(--text); }
.asigsel { font-weight: 600; border-radius: 99px; padding: 5px 10px; }
.pill input { margin: 0 4px 0 0; vertical-align: -1px; }
.viewbar { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--warn); padding: 8px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: .88rem; font-weight: 500; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 100; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; }
.modal-bg { position: fixed; inset: 0; background: rgba(10, 15, 25, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 22px; max-width: 460px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
/* La imagen se ajusta al ANCHO y, si es más alta que la pantalla (una hoja carta escaneada), el fondo hace scroll:
   así se puede leer toda. margin:auto la centra cuando cabe y no la recorta cuando no. */
.zoom-bg { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; overflow: auto; overscroll-behavior: contain; z-index: 60; cursor: zoom-out; padding: 16px; }
.zoom-bg img { flex: none; margin: auto; max-width: 100%; height: auto; background: #fff; border-radius: 6px; }

@media (max-width: 860px) {
  .quiz { grid-template-columns: 1fr; }
  .side { position: static; order: -1; }
  .navgrid { grid-template-columns: repeat(10, 1fr); }
  .cols2, .areas { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 110px 1fr 80px; }
}
@media (max-width: 560px) {
  .navgrid { grid-template-columns: repeat(6, 1fr); }
  .qcard { padding: 16px; }
  .topbar .in { flex-wrap: wrap; }
  .user .uname { display: none; }
  .bar { grid-template-columns: 1fr 70px; }
  .bar .track { grid-column: 1 / -1; grid-row: 2; }
}
@media print {
  .topbar, .noprint, .tabs { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  .review { break-inside: avoid; }
}
.convert { margin-top: 16px; padding: 14px 16px; border-radius: 10px; background: var(--accent-soft); font-size: .9rem; }
.modal:has(textarea) { max-width: 760px; }
.qedit details > summary .pvo { display: none; }
.qedit details[open] > summary .pv { display: none; }
.qedit details[open] > summary .pvo { display: inline; }
.modal:has(.imp) { max-width: 640px; max-height: 88vh; overflow-y: auto; }
.imp { padding: 10px 0; border-top: 1px solid var(--border); }
.impwarn { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: .86rem; }
.impwarn b { color: inherit; }
.duplist { margin: 6px 0 0 18px; padding: 0; max-height: 150px; overflow: auto; color: var(--text); }

/* ================= tema "cuaderno de laboratorio" ================= */
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
body {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 8%, transparent) 1px, transparent 0);
  background-size: 22px 22px;
  background-attachment: fixed;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3, .brand, .kpi .v, .timer b { font-family: var(--display); letter-spacing: -.015em; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-weight: 700; }

/* barra superior */
.topbar { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(12px) saturate(1.4); -webkit-backdrop-filter: blur(12px) saturate(1.4); border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent); }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .9; }
.brand { font-size: 1.08rem; font-weight: 800; }
.brand .logo { width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 38%, transparent); }
.brand .logo svg { width: 22px; height: 22px; }
/* Nombre en dos líneas para que ocupe poco ancho: «ACTIVIDADES» chico arriba, «Departamento de Ciencias» abajo. */
.brand-txt { display: flex; flex-direction: column; line-height: 1.08; white-space: nowrap; }
.brand-txt small, .login-pre { font-family: Inter, system-ui, sans-serif; font-size: .62rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); }
.login-pre { display: block; font-size: .72rem; margin-bottom: 4px; }
.nav a { border-radius: 99px; padding: 7px 14px; transition: background .15s, color .15s; }
.nav a.on { background: var(--accent); color: #fff; }
.nav a:hover:not(.on) { background: var(--accent-soft); color: var(--accent); }
.asigsel { border: 1.5px solid color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); color: var(--accent); padding: 6px 12px; }
.user img { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

/* botones y controles */
button, .btn { border-radius: 11px; padding: 9px 16px; transition: transform .12s, box-shadow .15s, border-color .15s, background .15s; }
button:hover:not(:disabled), .btn:hover { border-color: var(--accent); transform: translateY(-1px); }
button.primary, .btn.primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 62%, var(--accent-2))); border-color: transparent; color: #fff; font-weight: 600; box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 35%, transparent); }
button.primary:hover:not(:disabled) { filter: none; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 42%, transparent); border-color: transparent; }
button.ghost:hover { background: var(--surface-2); border-color: transparent; transform: none; }
input, select, textarea { border-radius: 10px; border-width: 1.5px; background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.pill { border-radius: 99px; padding: 6px 14px; transition: all .15s; }
.pill:hover { border-color: var(--accent); }
.pill.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tabs { gap: 2px; border-bottom-width: 2px; }
.tabs a { padding: 9px 16px; border-bottom-width: 3px; margin-bottom: -2px; font-weight: 600; border-radius: 8px 8px 0 0; }
.tabs a:hover { background: var(--accent-soft); text-decoration: none; }
.chip { font-weight: 600; background: var(--surface); }

/* tarjetas */
.card { border-radius: var(--radius); box-shadow: var(--shadow); }
.guide { position: relative; overflow: hidden; padding: 20px 20px 18px; gap: 10px; transition: transform .18s, box-shadow .18s, border-color .18s; }
.guide::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.guide:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.guide .code { font: 700 .72rem ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; background: var(--accent-soft); color: var(--accent); padding: 3px 9px; border-radius: 7px; }
.guide h3 { font-size: 1.08rem; line-height: 1.3; }
.badge { border-radius: 99px; padding: 3px 10px; }
.progress { height: 8px; border-radius: 99px; }
.progress > div { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; }
.grid { gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* portada de cada sección */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 28px 30px; margin-bottom: 22px; color: #fff; background: linear-gradient(120deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 55%, var(--accent-2)) 55%, var(--accent-2) 100%); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 30%, transparent); display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.hero::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.22) 1px, transparent 0); background-size: 18px 18px; -webkit-mask-image: linear-gradient(100deg, transparent 20%, #000 100%); mask-image: linear-gradient(100deg, transparent 20%, #000 100%); }
.hero .ghost-ico { position: absolute; right: -10px; bottom: -42px; font-size: 11rem; line-height: 1; opacity: .16; pointer-events: none; user-select: none; }
.hero .txt { position: relative; flex: 1 1 340px; min-width: 0; }
.hero h1 { color: #fff; margin: 0 0 6px; font-size: 2.1rem; }
.hero p { margin: 0; color: rgba(255,255,255,.88); max-width: 60ch; }
.hero .stats { position: relative; display: flex; gap: 10px; flex-wrap: wrap; }
.hero .stat { background: rgba(255,255,255,.17); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(4px); border-radius: 14px; padding: 9px 16px; min-width: 92px; text-align: center; }
.hero .stat b { display: block; font: 800 1.6rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.hero .stat span { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; opacity: .9; }

/* resolución */
.qcard { padding: 26px 28px; }
.qnum { text-transform: uppercase; letter-spacing: .06em; font-size: .74rem; }
.timer { border-radius: 99px; padding: 5px 14px; background: var(--surface); }
.opt { border-radius: 14px; padding: 12px 16px; transition: border-color .15s, background .15s, transform .12s, box-shadow .15s; }
.opt:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateX(3px); }
.opt .letter { width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); border-color: transparent; font-family: var(--display); }
.opt.sel { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); transform: none; }
.opt.sel .letter { background: var(--accent); }
.navgrid button { border-radius: 10px; }
.navgrid button.cur { outline-color: var(--accent); outline-width: 2.5px; }
.ropt { border-radius: 12px; }
.ropt .letter { border-radius: 9px; }

/* informe */
.kpi { border-radius: 16px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(var(--accent), var(--accent-2)); }
.kpi .v { font-size: 1.9rem; font-weight: 800; }
.bar .track { height: 14px; border-radius: 99px; }
.bar .fill { border-radius: 99px; }
.just { border-radius: 14px; border-left: 3px solid var(--accent); }
.rtable th { letter-spacing: .06em; }

/* acceso */
.login { margin: 7vh auto; max-width: 440px; }
.login .card { padding: 38px 30px 30px; border-radius: 24px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.login .card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.login .logo-big { width: 68px; height: 68px; border-radius: 20px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 40%, transparent); margin-bottom: 18px; }
.login .logo-big svg { width: 42px; height: 42px; }
.login h1 { font-size: 1.7rem; }

.modal { border-radius: 20px; }
.viewbar { font-weight: 600; }
#toast { border-radius: 99px; padding: 10px 20px; box-shadow: var(--shadow-lg); }
.drop { border-radius: 18px; border-width: 2px; }
.convert { border-radius: 14px; }

@media (max-width: 560px) {
  .hero { padding: 22px 20px; border-radius: 18px; }
  .hero h1 { font-size: 1.6rem; }
  .hero .ghost-ico { font-size: 7rem; }
  .qcard { padding: 18px; }
  h1 { font-size: 1.6rem; }
}
@media print {
  body { background-image: none; }
  .hero { background: none; color: #000; box-shadow: none; padding: 0; }
  .hero h1, .hero p { color: #000; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* contraste en modo oscuro */
:root { --on-accent: #fff; --hero-a: var(--accent); --hero-b: var(--accent-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --on-accent: #17131f; --hero-a: color-mix(in srgb, var(--accent) 55%, #11101b); --hero-b: color-mix(in srgb, var(--accent-2) 50%, #11101b); }
}
:root[data-theme="dark"] { --on-accent: #17131f; --hero-a: color-mix(in srgb, var(--accent) 55%, #11101b); --hero-b: color-mix(in srgb, var(--accent-2) 50%, #11101b); }
.nav a.on, button.primary, .btn.primary, .pill.on, .opt.sel .letter, .navgrid button.cur.ans { color: var(--on-accent); }
.hero { background: linear-gradient(120deg, var(--hero-a) 0%, color-mix(in srgb, var(--hero-a) 50%, var(--hero-b)) 55%, var(--hero-b) 100%); }

/* contadores de la portada que funcionan como filtro */
.hero button.stat { display: block; text-align: center; font: inherit; color: #fff; cursor: pointer; transition: background .15s, transform .12s, box-shadow .15s; }
.hero button.stat:hover { background: rgba(255,255,255,.28); border-color: rgba(255,255,255,.55); transform: translateY(-2px); }
.hero button.stat.on { background: rgba(255,255,255,.95); border-color: #fff; color: #1c1b2e; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.hero button.stat:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* selector de perfil (profesor / estudiante) bajo el nombre */
.rolsel { appearance: none; -webkit-appearance: none; background: transparent; border: 0; padding: 0; margin: 0; color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer; }
.rolsel:hover { color: var(--accent); }
.rolsel option { color: #222; background: #fff; }

/* botón modo claro / oscuro */
.themebtn { font-size: 1.05rem; line-height: 1; padding: 7px 10px; border-radius: 99px; cursor: pointer; }
#themefloat { position: fixed; right: 14px; bottom: 14px; z-index: 50; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
body:has(.topbar) #themefloat { display: none; }
@media print { #themefloat, #themebtn { display: none !important; } }

/* Importador: cursos obligatorios sin marcar */
#nivelbox.falta .pill { border-color: var(--bad); }
#nivelbox.falta #nivelayuda { color: var(--bad); font-weight: 600; }

/* Botones de curso y «Omitir repetidas»: sin la cajita del check; el botón marcado basta. */
.pill.nocheck { position: relative; }
.pill.nocheck input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.pill.nocheck:has(input:focus-visible), .nivtabs .pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Pestañas por curso en Panel → Guías */
.nivtabs .pill { cursor: pointer; }
.pill.on small { color: inherit; opacity: .8; }

/* Preguntas repetidas: solo una marca; el detalle (dónde está la otra copia) aparece al pasar el mouse. */
.rep { color: var(--warn); cursor: help; border-bottom: 1px dotted currentColor; white-space: nowrap; }
.rep.repq { font-size: 1.1rem; border-bottom: 0; }
.ciencia-op.actual { border-color: var(--accent); }

/* Barra superior en una sola línea (desde tablet hacia arriba): nada se parte en dos líneas; si falta espacio,
   primero se achica el selector de asignatura, luego se oculta el nombre del usuario y, al final, el menú se desplaza. */
@media (min-width: 561px) {
  .topbar .in { max-width: var(--ancho-pagina, 1280px); flex-wrap: nowrap; gap: 10px; }
  .brand, .themebtn, #logout { flex-shrink: 0; }
  .nav { flex-wrap: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 7px 12px; }
  .asigsel { min-width: 0; max-width: 220px; text-overflow: ellipsis; }
  .topbar .asigsel { flex-shrink: 8; min-width: 120px; }   /* cede espacio antes que el menú, sin volverse inservible */
  .user { flex-shrink: 0; }
  .user .uname { white-space: nowrap; line-height: 1.25; }
}
@media (min-width: 561px) and (max-width: 1100px) {
  .brand > span:last-child { display: none; }   /* queda solo el logo: el menú necesita el espacio */
}
@media (min-width: 561px) and (max-width: 1060px) {
  .user .uname { display: none; }
  .nav a { padding: 6px 9px; font-size: .92rem; }
}
@media (min-width: 561px) and (max-width: 900px) {
  .brand > span:last-child { display: none; }   /* queda solo el logo */
  .asigsel { max-width: 150px; }
  .nav a { padding: 6px 8px; }
}
/* Celular: arriba logo, asignatura y Salir; abajo el menú en una sola línea que se desliza. */
@media (max-width: 560px) {
  .topbar .in { gap: 8px 10px; padding: 8px 12px; }
  .brand > span:last-child { display: none; }
  .nav { order: 10; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 6px 10px; }
  .asigsel { min-width: 0; max-width: 140px; text-overflow: ellipsis; padding: 5px 8px; }
  .user { gap: 4px; }
  #logout { padding: 6px 8px; }
}
/* Sin espacio se oculta solo el nombre: el selector «Profesor ▾ / Estudiante ▾» sigue visible. */
@media (max-width: 1060px) {
  .topbar .user .uname { display: inline !important; }
  .topbar .user .uname > b, .topbar .user .uname > br, .topbar .user .uname > span { display: none; }
}

/* Química: el acento es amarillo, así que lo que va sobre él lleva texto oscuro (en modo claro y oscuro). */
:root[data-asig="Química"] :is(button.primary, .btn.primary, .nav a.on, .pill.on, .hero, .brand .logo, .login .logo-big, .opt.sel .letter) { color: #2a2100; }

/* Ciencias Naturales en modo oscuro: acento verde claro, así que lo que va sobre él lleva texto oscuro. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-asig="Ciencias Naturales"] :is(button.primary, .btn.primary, .nav a.on, .pill.on, .hero, .brand .logo, .login .logo-big, .opt.sel .letter) { color: #14230a; }
}
:root[data-theme="dark"][data-asig="Ciencias Naturales"] :is(button.primary, .btn.primary, .nav a.on, .pill.on, .hero, .brand .logo, .login .logo-big, .opt.sel .letter) { color: #14230a; }

/* Lista de guías agrupada por curso: secciones desplegables. */
/* Guías en carpetas colgantes: todas las pestañas en una fila y, debajo, el contenido de la elegida. */
.carpetas { --fb: color-mix(in srgb, var(--accent) 30%, var(--border)); --fbody: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.cf-tabs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px; padding: 0 14px; }
.cf-tab { --i: 0; display: flex; align-items: center; gap: 8px; position: relative; top: 1px; padding: 9px 16px 8px;
  border: 1px solid var(--fb); border-bottom: none; border-radius: 12px 12px 0 0; cursor: pointer;
  background: color-mix(in srgb, var(--accent) calc(12% + var(--i) * 4%), var(--surface)); color: var(--text);
  font-family: var(--display); font-weight: 700; font-size: 1rem; box-shadow: none; }
.cf-tab:hover { filter: brightness(1.04); }
.cf-tab.on { background: var(--fbody); padding-top: 12px; z-index: 1; color: var(--accent); }
.cf-tab.mia { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.cf-tab.mia.on { background: var(--fbody); color: var(--ok); }
.cf-tab .cg-n { font-family: Inter, system-ui, sans-serif; font-size: .78rem; font-weight: 600; color: var(--muted);
  background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 2px 8px; border-radius: 999px; }
.cf-body { border: 1px solid var(--fb); border-radius: 14px; background: var(--fbody); min-height: 60px; }
.cf-body .cgroup > .grid { padding: 18px 16px 16px; }

/* Tabla de profesores: los cursos en dos columnas para que las filas no queden tan altas. */
/* Panel → Profesores: cursos, asignaturas y botones en una sola columna (la tabla queda más holgada). */
.ptable .filter-group.cur, .ptable .filter-group.asigs { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.ptable td > label.pill { display: inline-block; margin-bottom: 4px; white-space: nowrap; }
.ptable .asigs .pill { white-space: nowrap; }
.ptable .pacts { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.ptable .pacts button { white-space: nowrap; }
.ptable .pill { padding: 3px 8px; font-size: .8rem; }
.ptable .cur .pill { white-space: nowrap; }
.ptable td, .ptable th { padding-left: 6px; padding-right: 6px; }

/* Tablas de guías y lotes (Panel → Guías/Importador): columnas más compactas para que quepan sin cortarse. */
.gtable th, .gtable td { padding-left: 7px; padding-right: 7px; }
.gtable th { letter-spacing: .02em; font-size: .72rem; }
.gtable td button, .gtable td .btn { padding-left: 10px; padding-right: 10px; }
/* Botones de cada guía: «Revisar» arriba y, debajo, actualizar y borrar uno al lado del otro (la columna queda angosta). */
.acts2 { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
.acts2 .btn { text-align: center; }
.acts2-sub { display: flex; gap: 5px; }
.acts2-sub button { flex: 1; padding-left: 6px; padding-right: 6px; }
@media (max-width: 960px) { .gtable th:nth-child(n+6):nth-child(-n+7), .gtable td:nth-child(n+6):nth-child(-n+7) { display: none; } }   /* tablet: sin «Entregas» ni «Logro medio» */

/* Puntaje PAES estimado: destacado junto a la nota. */
.kpi.paes .v { color: var(--accent); }

/* Editor rápido de preguntas. */
.modal.wide { max-width: 940px; max-height: 92vh; overflow: auto; padding: 18px 22px; }
.edtool { position: sticky; top: -18px; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px -4px 0; padding: 8px 4px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.edtool button { padding: 5px 10px; }
.edsep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.edfield { margin-top: 12px; }
.edfield > label { display: block; margin-bottom: 4px; font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.ed { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px; background: var(--bg); outline: none; line-height: 1.5; }
.ed:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.ed p { margin: .35em 0; }
.ed img { max-width: 100%; height: auto; cursor: pointer; border-radius: 4px; }
.ed img.sel { outline: 3px solid var(--accent); outline-offset: 2px; }
.qedit .qactions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.qedit .qactions button { white-space: nowrap; width: auto; }

/* Botón pequeño dentro de la fila de pestañas del panel (p. ej. «⬇ CSV»): no suma una segunda fila. */
.tabs a.tabtool { align-self: center; padding: 5px 10px; margin-bottom: 4px; border: 1px solid var(--border); border-radius: 8px;
  font-size: .85rem; font-weight: 600; white-space: nowrap; background: var(--surface); }
.tabs a.tabtool:hover { background: var(--accent-soft); }
.tabs .asigsel { align-self: center; margin-bottom: 4px; }
.tabs a[href="#/vista-alumno"] { white-space: nowrap; }
@media (max-width: 1000px) { .tabs a { padding-left: 10px; padding-right: 10px; } .tabs .asigsel { max-width: 130px; } }

/* Aviso de «Ver como profesor»: distinto al de «como alumno» para que no se olvide que se está en la vista de otra persona. */
.viewbar.suplantar { background: #3b1d6e; color: #fff; border-bottom-color: #2a1450; }
.viewbar.suplantar button { background: #fff; color: #3b1d6e; border-color: #fff; }
.login .viewbar.suplantar { position: fixed; top: 0; left: 0; right: 0; z-index: 40; }
.ptable .acts2-sub .small { white-space: nowrap; }

/* Ventana «Ver como colega». */
.colegas { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 12px 0 0; max-height: 52vh; overflow: auto; }
.colega-op { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 9px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.colega-op:hover { border-color: var(--accent); background: var(--accent-soft); }
.colega-op b { font-size: .95rem; }
.modal:has(.colegas) { max-width: 620px; }

/* «En línea» (solo administrador): botón en la barra y ventana con la lista de conectados. */
.onlinebtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px; font-size: .82rem; white-space: nowrap; }
.onlinebtn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.online-list { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto; }
.online-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.online-item:last-child { border-bottom: 0; }
.online-item img, .online-item .ava { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.online-item .ava { display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.online-item .oi-main { flex: 1; min-width: 0; }
.online-item .oi-side { text-align: right; flex: none; }
/* Historial de conexiones: un botón por día con una barra (alumnos en verde, profesores en el color de acento) */
.conex-dia { display: grid; grid-template-columns: minmax(150px, 1.2fr) 2fr auto; gap: 10px; align-items: center; width: 100%;
  padding: 9px 6px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); text-align: left;
  cursor: pointer; border-radius: 0; font: inherit; }
.conex-dia:hover { background: var(--surface-2); }
.conex-dia .cd-barra { display: flex; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.conex-dia .cd-al { background: var(--ok); }
.conex-dia .cd-pr { background: var(--accent); }
.conex-dia .cd-n { color: var(--muted); white-space: nowrap; }
@media (max-width: 560px) { .conex-dia { grid-template-columns: 1fr auto; } .conex-dia .cd-barra { grid-column: 1 / -1; order: 3; } }
@media (max-width: 1150px) { .onlinebtn { padding: 4px 8px; } .onlinebtn .lbl { display: none; } }

/* ---------- 🎮 En vivo (partidas estilo Kahoot) */
.vl-A { --vc: #e21b3c; } .vl-B { --vc: #1368ce; } .vl-C { --vc: #d89e00; } .vl-D { --vc: #26890c; }
.vl-E { --vc: #864cbf; } .vl-F { --vc: #0f8a8a; } .vl-X { --vc: #555; }
.vivo-crear .vc-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.vivo-crear .vc-row > b { width: 98px; flex: none; font-size: .88rem; }
.vivo-crear .vc-row select, .vivo-crear .vc-row input:not([type]) { flex: 1; min-width: 200px; max-width: 520px; }
.vivo-crear .vc-ayuda { margin: 0 0 4px 110px; }
.vivo-crear .pill input { display: none; }
button.big, .btn.big { font-size: 1.1rem; padding: 12px 26px; border-radius: 12px; }

/* proyector */
.vivo-host { min-height: 100vh; background: var(--bg); padding: 14px 22px 30px; font-size: 1.15rem; }
.vh-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: .95rem; }
.vlobby { text-align: center; max-width: 1000px; margin: 0 auto; }
.vl-inv { font-size: 1.4rem; margin: 18px 0 4px; }
.vcode { font: 800 clamp(64px, 14vw, 160px)/1 'Bricolage Grotesque', sans-serif; letter-spacing: .08em; color: var(--accent); margin: 6px 0 10px; }
.vnj { font-weight: 700; font-size: 1.2rem; margin-right: 10px; }
.vlista { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.vchip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 99px; padding: 6px 14px; font-weight: 600; cursor: default; }
.vchip.desc { text-decoration: line-through; opacity: .55; }
.vchip .vx { border: 0; background: none; padding: 0 2px; font-size: 1.1rem; line-height: 1; color: var(--muted); cursor: pointer; }
.veqs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; width: 100%; }
.veq { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.veq h4 { width: 100%; margin: 0 0 4px; }
.veq .vchip { cursor: pointer; }
.vbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; font-size: clamp(1.2rem, 1.5vw, 1.6rem); }
.vresp { font-weight: 600; }
.vgrid { display: grid; gap: 18px; }
.vgrid.con-rank { grid-template-columns: minmax(0, 1fr) 300px; }
.vq { zoom: var(--vz, 1); }   /* botones A− / A+ del proyector: todo crece o se achica en proporción */
.vzoom { display: inline-flex; gap: 0; }
.vzoom button { border-radius: 0; margin-left: -1px; min-width: 44px; }
.vzoom button:first-child { border-radius: 8px 0 0 8px; }
.vzoom button:last-child { border-radius: 0 8px 8px 0; }
.vq .stem { font-size: clamp(1.4rem, 2.1vw, 2.4rem); line-height: 1.4; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 22px; }
.vq .stem img { max-width: 100%; max-height: 42vh; height: auto; }
.vopts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.vopt { display: flex; align-items: center; gap: 14px; background: var(--vc); color: #fff; border-radius: 14px; padding: 16px 20px; font-size: clamp(1.3rem, 1.8vw, 2.1rem); line-height: 1.3; min-height: 72px; transition: opacity .2s; }
.vopts.n5 .vopt:last-child, .vopts.n3 .vopt:last-child { grid-column: 1 / -1; }   /* la E (o la C si hay 3) a todo el ancho */
.vopt img { max-height: 22vh; max-width: 100%; background: #fff; border-radius: 6px; }
.vopt .vlet { font-weight: 800; font-size: 1.1em; flex: none; }
.vopt-b { flex: 1; min-width: 0; }
.vopt.no { opacity: .3; }
.vopt.ok { outline: 4px solid var(--text); outline-offset: 2px; }
.vcount { font-weight: 800; font-size: 1.2em; flex: none; }
.vtimer { --p: 1; width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--accent) calc(var(--p) * 360deg), var(--border) 0); }
.vtimer::before { content: ''; grid-area: 1/1; width: 80%; height: 80%; border-radius: 50%; background: var(--surface); }
.vtimer .vt-n { grid-area: 1/1; font-weight: 800; font-size: 1.6rem; z-index: 1; }
.vtimer.poco { background: conic-gradient(var(--bad) calc(var(--p) * 360deg), var(--border) 0); }
.vtimer.chico { width: 52px; height: 52px; }
.vtimer.chico .vt-n { font-size: 1.2rem; }
.vside { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 16px; }
.vside h4 { margin: 6px 0; }
.vrank { list-style: none; margin: 0; padding: 0; }
.vrank li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.vrank li:last-child { border-bottom: 0; }
.vrank b { margin-left: auto; }
.vpos { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; }
.vdesc { margin-top: 16px; background: var(--bad-soft); border: 1px solid var(--bad); border-radius: 14px; padding: 10px 14px; font-size: .95rem; }
.vdesc > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
.vfin { text-align: center; }
.vganador { font-size: 1.4rem; margin: 6px 0 14px; }
/* Ranking oculto en la segunda mitad (individual y por equipos) */
.voculto { text-align: center; padding: 26px 12px; }
.voculto .vo-ico { font-size: 3.4rem; line-height: 1; }
.voculto h4 { margin: 10px 0 6px; font-size: 1.3rem; }
.voculto p { margin: 0; color: var(--muted); }
/* Ventana de resultados al terminar una partida (proyector): podio revelado 3° → 2° → 1° */
.vres { position: fixed; inset: 0; z-index: 9000; overflow: hidden auto; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 30px 16px; text-align: center; color: #fff;
  background: radial-gradient(ellipse at 50% 30%, #4c3fbf 0%, #23195e 55%, #120c33 100%); animation: vres-in .35s ease-out; }
@keyframes vres-in { from { opacity: 0; } to { opacity: 1; } }
.vres h1 { font: 800 clamp(2.4rem, 6vw, 4.2rem)/1 'Bricolage Grotesque', sans-serif; margin: 0; letter-spacing: -.02em; }
.vres-tit { margin: 8px 0 0; opacity: .75; font-size: 1.1rem; }
.vres-podio { display: flex; justify-content: center; align-items: flex-end; gap: clamp(8px, 2vw, 22px); margin: 34px 0 18px; width: 100%; max-width: 980px; }
.vres-p { flex: 1; max-width: 300px; display: flex; flex-direction: column; justify-content: flex-end; opacity: 0; transform: translateY(60px) scale(.9);
  transition: opacity .6s ease, transform .7s cubic-bezier(.2, 1.4, .4, 1); }
.vres-p.ver { opacity: 1; transform: none; }
.vres-p.vacio { visibility: hidden; }
.vres-n { font: 800 clamp(1.1rem, 2.6vw, 1.9rem)/1.15 'Bricolage Grotesque', sans-serif; margin-bottom: 6px; overflow-wrap: anywhere; }
.vres-v { opacity: .85; margin-bottom: 10px; font-size: clamp(.9rem, 1.8vw, 1.2rem); }
.vres-b { border-radius: 16px 16px 0 0; display: grid; place-items: center; font: 800 clamp(2.4rem, 6vw, 4rem)/1 'Bricolage Grotesque', sans-serif;
  box-shadow: 0 -6px 30px rgba(0, 0, 0, .25) inset; }
.vres-p1 .vres-b { height: clamp(150px, 30vh, 280px); background: linear-gradient(#f4c542, #c99211); }
.vres-p2 .vres-b { height: clamp(110px, 22vh, 210px); background: linear-gradient(#cfd6df, #8f99a6); }
.vres-p3 .vres-b { height: clamp(80px, 16vh, 150px); background: linear-gradient(#d99358, #a8642c); }
.vres-p1.ver .vres-n { color: #ffe07a; text-shadow: 0 0 24px rgba(255, 210, 80, .55); }
.vres-msg { font-size: clamp(1.2rem, 3vw, 1.8rem); font-weight: 700; min-height: 1.4em; margin: 6px 0 4px; }
.vres-sub { font-size: 1.15rem; opacity: .9; margin: 4px 0 0; }
.vres .row { margin-top: 22px; }
.vres button { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .35); }
.vres-conf { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s; }
.vres.fiesta .vres-conf { opacity: 1; }
.vres-conf span { position: absolute; top: -40px; font-size: 1.8rem; animation: vres-cae linear infinite; }
@keyframes vres-cae { to { transform: translateY(110vh) rotate(540deg); } }
.vres-conf i { position: absolute; top: -24px; width: 10px; height: 16px; border-radius: 2px; animation: vres-papel linear infinite; }
@keyframes vres-papel { 0% { transform: translateY(0) rotate(0) translateX(0); } 50% { transform: translateY(55vh) rotate(360deg) translateX(30px); }
  100% { transform: translateY(112vh) rotate(720deg) translateX(-20px); } }
.vres-mudo { position: absolute; top: 14px; right: 16px; z-index: 2; }
/* Cartel «¡GANADOR!»: reserva su lugar y aparece con un zoom y un brillo que late */
.vres-ganador { visibility: hidden; opacity: 0; transform: scale(.3) rotate(-6deg); margin: 18px 0 -8px; padding: 14px 34px 16px; border-radius: 22px;
  background: linear-gradient(135deg, #ffe07a, #f4b400 55%, #ff9f43); color: #3b2300; box-shadow: 0 10px 40px rgba(244, 180, 0, .45);
  transition: opacity .35s ease, transform .8s cubic-bezier(.18, 1.6, .4, 1); position: relative; z-index: 1; }
.vres-ganador.ver { visibility: visible; opacity: 1; transform: none; animation: vres-late 1.4s ease-in-out .9s infinite; }
@keyframes vres-late { 0%, 100% { box-shadow: 0 10px 40px rgba(244, 180, 0, .45); transform: scale(1); }
  50% { box-shadow: 0 10px 70px rgba(255, 215, 90, .9); transform: scale(1.04); } }
.vg-tit { font: 800 clamp(1.1rem, 2.6vw, 1.7rem)/1 'Bricolage Grotesque', sans-serif; letter-spacing: .08em; }
.vg-n { font: 800 clamp(1.8rem, 5vw, 3.4rem)/1.1 'Bricolage Grotesque', sans-serif; margin-top: 6px; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .vres-p, .vres-ganador { transition: none; } .vres-ganador.ver { animation: none; }
  .vres-conf span, .vres-conf i { animation: none; display: none; } }
.vpodio { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 20px 0 22px; }
.vp { width: 190px; }
.vp-n { font-weight: 700; font-size: 1.15rem; margin-bottom: 4px; }
.vp-pts { color: var(--muted); margin-bottom: 6px; }
.vp-b { border-radius: 14px 14px 0 0; color: #fff; font: 800 2.4rem/1 'Bricolage Grotesque', sans-serif; display: grid; place-items: center; }
.vp1 .vp-b { height: 190px; background: #d4a017; } .vp2 .vp-b { height: 140px; background: #9aa4b1; } .vp3 .vp-b { height: 100px; background: #b8733a; }
@media (max-width: 900px) { .vgrid.con-rank { grid-template-columns: 1fr; } .vopts { grid-template-columns: 1fr; } }

/* alumno */
.vjoin { max-width: 440px; margin: 30px auto; text-align: center; }
.vj-ico { font-size: 3rem; }
.vjoin form { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.vjoin input { width: 100%; min-width: 0; box-sizing: border-box; font-size: 1.8rem; text-align: center; letter-spacing: .15em; font-weight: 700; padding: 10px; }
.vjoin form button { justify-content: center; text-align: center; }
.vj-warn { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; text-align: left; }
.vivo-jugar { min-height: 100vh; min-height: 100dvh; background: var(--bg); display: flex; flex-direction: column; padding: 14px; }
.vj-msg { margin: auto; text-align: center; max-width: 460px; padding: 20px; }
.vivo-jugar .vj-repaso { width: 100%; max-width: 900px; margin: 0 auto 30px; }
.vj-hist { max-width: 640px; margin: 0 auto 30px; }
.vj-hist .vjh-fila { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--border); }
.vj-hist .vjh-fila:first-of-type { border-top: 0; }
.vj-hist .vjh-fila > div { flex: 1; min-width: 180px; }
.vj-big { font-size: 4rem; line-height: 1.1; margin-bottom: 6px; }
.vj-msg h2 { margin: 6px 0; }
.vj-si h2, .vj-gane { color: var(--ok); }
.vj-gane { font: 800 2.6rem/1 'Bricolage Grotesque', sans-serif; margin: 6px 0; }
.vj-no h2, .vj-desc h2 { color: var(--bad); }
.vj-desc { background: var(--bad-soft); border-radius: 20px; }
.vj-elegida { width: 110px; height: 110px; margin: 0 auto 10px; border-radius: 22px; background: var(--vc); color: #fff; display: grid; place-items: center; font: 800 3rem/1 'Bricolage Grotesque', sans-serif; }
.vj-q { flex: 1; display: flex; flex-direction: column; }
.vj-top { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.vj-mira { text-align: center; color: var(--muted); margin: 8px 0; }
/* Todas las alternativas iguales: rectángulos uno sobre otro (con 4 o 5, mismo alto cada uno). */
.vj-letras { flex: 1; display: grid; grid-template-columns: 1fr; grid-auto-rows: 1fr; gap: 10px; min-height: 60vh; }
.vj-l { background: var(--vc); color: #fff; border: 0; border-radius: 16px; font: 800 2.4rem/1 'Bricolage Grotesque', sans-serif; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 14px; box-shadow: 0 4px 0 rgba(0,0,0,.25); cursor: pointer; min-height: 0; }
.vj-l span { font-size: 1.5rem; opacity: .85; }
.vj-l:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.vj-pie { display: flex; justify-content: space-between; padding: 10px 4px 0; border-top: 1px solid var(--border); margin-top: 10px; font-weight: 600; }
body:has(.vivo-jugar) #themefloat, body:has(.vivo-host) #themefloat { display: none; }   /* en el juego no estorba */
.vj-lugar { margin-top: 14px; }
.vl-join { display: flex; align-items: center; justify-content: center; gap: 36px; flex-wrap: wrap; }
.vl-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vl-qr img { width: clamp(150px, 18vw, 230px); height: auto; background: #fff; border-radius: 14px; padding: 6px; box-shadow: var(--shadow); }

/* 📱 pregunta completa en el equipo del alumno */
.vj-full { gap: 10px; }
.vj-preg { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; font-size: 1.05rem; line-height: 1.45; }
.vj-preg .stem { position: relative; z-index: 1; }
.vj-preg img { max-width: 100%; height: auto; }
.vj-marca { position: absolute; inset: -40%; display: flex; flex-wrap: wrap; gap: 26px 40px; align-content: flex-start; transform: rotate(-24deg); pointer-events: none; z-index: 0; }
.vj-marca span { font-weight: 700; font-size: .95rem; color: var(--text); opacity: .07; white-space: nowrap; }
.nocopy, .nocopy * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.nocopy img { pointer-events: none; }
.vj-opts { display: flex; flex-direction: column; gap: 9px; }
.vj-opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--vc); color: #fff; border: 0; border-radius: 14px; padding: 12px 14px; font-size: 1rem; line-height: 1.35; box-shadow: 0 4px 0 rgba(0,0,0,.25); cursor: pointer; min-height: 56px; }
.vj-opt:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.vj-ol { font: 800 1.35rem/1 'Bricolage Grotesque', sans-serif; flex: none; }
.vj-ot { flex: 1; min-width: 0; }
.vj-ot img { max-width: 100%; max-height: 30vh; background: #fff; border-radius: 6px; }

/* 🃏 Desafío por equipos */
.vdes { max-width: 1200px; margin: 0 auto; }
.vdes-top { display: flex; align-items: center; gap: 12px; font-size: 1.3rem; margin: 6px 0 16px; }
.vdes-reloj { font: 800 clamp(2.2rem, 5vw, 4rem)/1 'Bricolage Grotesque', sans-serif; color: var(--accent); }
.vdes-reloj.poco { color: var(--bad); }
.vdes-eqs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.vdes-eq { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; }
.vdes-eqh { display: flex; justify-content: space-between; font-size: 1.3rem; margin-bottom: 8px; }
.vdes-bar { height: 16px; background: var(--border); border-radius: 99px; overflow: hidden; }
.vdes-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.vdes-mi { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: .9rem; }
.vdes-mi span { background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 2px 9px; }
.vdes-mi span.desc { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }
.vdes-ok { margin-top: 8px; color: var(--ok); font-weight: 700; }
.vdt { font-weight: 800; font-size: 1.15rem; color: var(--accent); }
/* Relojes de ancho fijo: cada dígito ocupa lo mismo, así no «bailan» al cambiar los números */
.vdes-reloj, .vdt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rl-d { display: inline-block; width: .64em; text-align: center; }
.rl-p { display: inline-block; width: .32em; text-align: center; }
.rl-ico { display: inline-block; margin-right: .2em; }
.vtimer .vt-n { font-variant-numeric: tabular-nums; min-width: 2ch; text-align: center; }
.vresp { font-variant-numeric: tabular-nums; min-width: 10.5em; text-align: right; }
.vnext-s { display: inline-block; min-width: 1.6em; padding: 1px 6px; margin-left: 4px; border-radius: 999px; background: rgba(255, 255, 255, .25);
  font-variant-numeric: tabular-nums; text-align: center; }
.vdt.poco { color: var(--bad); }
.vj-des { flex: 1; }
.vj-cartas { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.vj-carta { aspect-ratio: 3 / 4; border: 0; border-radius: 14px; background: linear-gradient(145deg, var(--accent), var(--accent-2)); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 4px 0 rgba(0,0,0,.2); cursor: pointer; padding: 4px; }
.vj-carta b { font: 800 1.9rem/1 'Bricolage Grotesque', sans-serif; }
.vj-carta span { font-size: .78rem; opacity: .9; text-align: center; line-height: 1.15; }
.vj-carta.hecha { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 2px var(--ok); }
.vj-cartas.fin .vj-carta { cursor: default; box-shadow: none; aspect-ratio: auto; padding: 10px 4px; }
.vj-carta.bien { background: var(--ok-soft); color: var(--ok); }
.vj-carta.mal { background: var(--bad-soft); color: var(--bad); }
.vj-vig { margin: 2px 0; padding: 8px 12px; background: var(--accent-soft); border-radius: 10px; font-size: .92rem; }
/* Intentos por tarjeta (máximo 2), candado mientras otro la responde y respuesta definitiva */
.vj-carta .vj-int { font-style: normal; font-size: .7rem; letter-spacing: 2px; opacity: .85; }
.vj-carta.bloq { background: repeating-linear-gradient(45deg, #9aa4b1, #9aa4b1 8px, #8a94a1 8px, #8a94a1 16px); color: #fff; cursor: not-allowed; box-shadow: none; }
.vj-carta.final { cursor: default; box-shadow: none; filter: saturate(.75); }
.vj-carta.final:not(.hecha) { background: var(--border); color: var(--muted); }
.vj-carta:disabled { opacity: 1; }
.vj-intento { margin: 4px 0 2px; padding: 6px 12px; border-radius: 10px; background: var(--surface-2, var(--accent-soft)); font-size: .9rem; }
.vj-intento.ultimo { background: var(--warn-soft, #fff3cd); color: var(--text); }
.vj-conf { width: 100%; justify-content: center; margin-top: 12px; position: sticky; bottom: 10px; }
.vj-conf:disabled { opacity: .55; }
.vj-opt.sel { outline: 4px solid var(--text); outline-offset: 2px; }
.vivo-crear #vneq { flex: none; min-width: 0; width: auto; }
/* A− / A+ del alumno: la pregunta y las alternativas crecen en proporción */
.vivo-jugar .vj-preg, .vivo-jugar .vj-opts, .vivo-jugar .vj-vig { zoom: var(--vjz, 1); }
.vzoom.chico button { min-width: 38px; padding: 4px 8px; }
.vj-top { gap: 8px; }
.vdet > td { background: var(--surface-2, var(--bg)); padding: 8px 10px 12px; }
.vdet-in { border-left: 3px solid var(--accent); padding-left: 10px; }
.vdet-in .rtable { font-size: .9rem; }
/* Desafío individual en el proyector: una tarjeta chica por alumno */
.vdes-eqs:has(.vdes-eq.chico) { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.vdes-eq.chico { padding: 10px 12px; }
.vdes-eq.chico .vdes-eqh { font-size: 1rem; }
.vdes-eq.chico .vdes-bar { height: 10px; }
.vdes-eq.chico .vdes-ok { margin-top: 4px; font-size: .9rem; }
.vdes-eq.desc { opacity: .5; }
.vdes-eqh { gap: 8px; }
.vdes-eq.chico .vdes-eqh b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vdes-eqh span { white-space: nowrap; flex: none; }
.vj-pie { gap: 10px; }
.vj-pie b { white-space: nowrap; flex: none; }
.vj-pie span { min-width: 0; }
.vteam { cursor: pointer; }
.vteam:hover > td { background: var(--accent-soft); }
.vteam.abierto > td { background: var(--accent-soft); }
.vteam-det > td { background: var(--surface-2, var(--bg)); padding: 8px 10px 12px; }
/* arrastrar alumnos entre equipos (proyector, antes de comenzar) */
.veq { transition: background .15s, box-shadow .15s; }
.veq.sobre { background: var(--accent-soft); box-shadow: inset 0 0 0 3px var(--accent); }
.vchip[draggable="true"] { cursor: grab; }
.vchip.arrastrado { opacity: .4; }

/* «Crear Actividad» (profesores): menú de tipos de actividad */
.tipos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 4px; }
.tipo.card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; text-align: left; color: var(--text); text-decoration: none; }
.tipo .ico { font-size: 2.2rem; line-height: 1; margin-bottom: 4px; }
.tipo b { font-size: 1.05rem; }
.tipo span:not(.ico):not(.chip) { color: var(--muted); font-size: .88rem; line-height: 1.4; }
a.tipo.card { cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; border-color: var(--accent); }
a.tipo.card:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.tipo.prox { opacity: .55; cursor: default; }
.tipo.prox .chip { margin-top: auto; }

/* ---------- Actividades interactivas (vienen de actividades-lab): todo bajo .act-scope para no chocar con la plataforma */
/* Zona de juego */
.act-scope .juego-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.act-scope .barra { height: 10px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; margin: 8px 0 14px; }
.act-scope .barra > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), #5ed39a); transition: width .3s; }
.act-scope .chips-info { display: flex; gap: 8px; flex-wrap: wrap; }
.act-scope .chip { font-size: .82rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.act-scope .chip.err { background: var(--bad-soft); color: var(--bad); }
.act-scope .consigna { font-size: 1.05rem; margin: 0 0 12px; }
.act-scope .fin { text-align: center; padding: 26px 18px; animation: pop .4s ease; }
.act-scope .fin .stars { font-size: 2.4rem; letter-spacing: 6px; }
.act-scope .fin h2 { font-size: 1.8rem; }
.act-scope .fin .row { justify-content: center; margin-top: 14px; }
.act-scope @keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.act-scope @keyframes sacudir { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.act-scope .shake { animation: sacudir .35s; }
/* Sopa de letras */
.act-scope .sopa { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; justify-content: center; }
.act-scope .sopa-grid { --cs: clamp(22px, calc((min(100vw, 620px) - 44px) / var(--n)), 46px); display: grid; grid-template-columns: repeat(var(--n), var(--cs)); gap: 2px;
  padding: 10px; background: var(--surface); border: 2px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); touch-action: none; user-select: none; -webkit-user-select: none; }
.act-scope .sopa-grid .cell { width: var(--cs); height: var(--cs); display: grid; place-items: center; font: 800 calc(var(--cs) * .5) var(--display); border-radius: 8px; cursor: pointer; color: var(--text); }
.act-scope .sopa-grid .cell.sel { background: #ffe08a; }
.act-scope .sopa-grid .cell.ini { background: #ffc233; outline: 3px solid var(--warn); }
.act-scope .sopa-grid .cell.mal { background: var(--bad-soft); }
.act-scope .sopa-grid .cell.found { color: #fff; }
.act-scope .f0 { background: #4f46e5; }
.act-scope .f1 { background: #1a9d5b; }
.act-scope .f2 { background: #e0752b; }
.act-scope .f3 { background: #c026d3; }
.act-scope .f4 { background: #0ea5c7; }
.act-scope .f5 { background: #d64545; }
.act-scope .f6 { background: #7c8b16; }
.act-scope .f7 { background: #5b6ee1; }
.act-scope .sopa-lista { min-width: 170px; max-width: 260px; flex: 1; }
.act-scope .sopa-lista ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.act-scope .sopa-lista li { padding: 6px 12px; border-radius: 10px; background: var(--surface); border: 1.5px solid var(--border); font-weight: 600; }
.act-scope .sopa-lista li.found { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); text-decoration: line-through; }
.act-scope .sopa-lista li.found.pista { text-decoration: none; }
/* Crucigrama */
.act-scope .cruci { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
.act-scope .cruci-grid { --cs: clamp(26px, calc((min(100vw, 640px) - 40px) / var(--cols)), 46px); display: grid; grid-template-columns: repeat(var(--cols), var(--cs)); gap: 2px; }
.act-scope .cx { width: var(--cs); height: var(--cs); position: relative; }
.act-scope .cx.vacia { background: transparent; }
.act-scope .cx input { width: 100%; height: 100%; padding: 0; text-align: center; text-transform: uppercase; font: 800 calc(var(--cs) * .52) var(--display); border: 2px solid #b8b2d6; border-radius: 6px; background: #fff; caret-color: transparent; }
.act-scope .cx input:focus { border-color: var(--accent); background: #fff8d9; }
.act-scope .cx.activa input { background: #eef0ff; }
.act-scope .cx.activa input:focus { background: #fff8d9; }
.act-scope .cx.ok input { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.act-scope .cx.mal input { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.act-scope .cx .num { position: absolute; top: 1px; left: 3px; font-size: calc(var(--cs) * .27); font-weight: 700; color: var(--muted); pointer-events: none; z-index: 1; }
.act-scope .cruci-pistas { flex: 1; min-width: 230px; max-width: 360px; }
.act-scope .cruci-pistas h3 { margin-top: 10px; }
.act-scope .cruci-pistas ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.act-scope .cruci-pistas li { padding: 6px 10px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font-size: .93rem; }
.act-scope .cruci-pistas li.activa { border-color: var(--accent); background: var(--accent-soft); }
.act-scope .cruci-pistas li.hecha { background: var(--ok-soft); border-color: var(--ok); }
.act-scope .cruci-pistas li b { color: var(--accent); margin-right: 4px; }
.act-scope .pista-activa { background: var(--accent-soft); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; min-height: 40px; font-weight: 600; }
/* Unir, ordenar, clasificar, completar */
.act-scope .unir { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 26px; max-width: 640px; margin: 0 auto; }
.act-scope .unir h3 { margin: 0; text-align: center; color: var(--muted); font-size: .95rem; }
.act-scope .col { display: grid; gap: 10px; align-content: start; }
.act-scope .item { padding: 13px 14px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); font-weight: 600; text-align: center; cursor: pointer; user-select: none;
  transition: transform .1s, background .15s, border-color .15s; display: flex; align-items: center; justify-content: center; min-height: 54px; }
.act-scope .item:hover { border-color: var(--accent); }
.act-scope .item.sel { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.03); box-shadow: 0 4px 14px rgba(79, 70, 229, .25); }
.act-scope .item.done { cursor: default; color: #fff; border-color: transparent; transform: none; box-shadow: none; }
.act-scope .item.bad { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.act-scope .item.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.act-scope .ordenar { max-width: 640px; margin: 0 auto; display: grid; gap: 16px; }
.act-scope .slots { display: grid; gap: 8px; }
.act-scope .slot { display: flex; gap: 10px; align-items: center; min-height: 56px; padding: 6px 8px; border-radius: 14px; border: 2px dashed var(--border); background: rgba(255,255,255,.55); }
.act-scope .slot > b { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }
.act-scope .slot .item { flex: 1; min-height: 44px; }
.act-scope .banco { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 54px; padding: 12px; border-radius: 16px; background: var(--accent-soft); }
.act-scope .banco .item { min-width: 120px; flex: 0 1 auto; }
.act-scope .clasif { display: grid; gap: 16px; max-width: 760px; margin: 0 auto; }
.act-scope .cajas { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.act-scope .caja { min-height: 140px; padding: 10px; border-radius: 16px; border: 2.5px dashed var(--accent); background: rgba(255,255,255,.6); cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.act-scope .caja:hover { background: var(--accent-soft); }
.act-scope .caja h3 { text-align: center; margin: 0; color: var(--accent); }
.act-scope .caja .item { min-height: 40px; padding: 8px; cursor: default; }
.act-scope .frases { display: grid; gap: 14px; max-width: 760px; margin: 0 auto; }
.act-scope .frase { font-size: 1.12rem; line-height: 2.1; padding: 10px 14px; background: var(--surface); border-radius: 14px; border: 1.5px solid var(--border); }
.act-scope .hueco { min-width: 110px; padding: 2px 12px; margin: 0 3px; border-radius: 10px; border: 2px dashed var(--accent); background: var(--accent-soft); color: var(--accent); font-size: 1rem; vertical-align: middle; min-height: 36px; }
.act-scope .hueco.sel { background: #ffe08a; border-color: var(--warn); }
.act-scope .hueco.ok { border: 2px solid var(--ok); background: var(--ok-soft); color: var(--ok); cursor: default; }
/* Zonas en una imagen */
.act-scope .zonas { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
.act-scope .zonas-img { position: relative; flex: 0 0 auto; width: min(100%, 560px, calc(68vh * var(--ar, 1))); line-height: 0; border-radius: 16px; overflow: hidden; border: 2px solid var(--border); box-shadow: var(--shadow); background: #fff; touch-action: manipulation; }
.act-scope .zonas-img img { display: block; width: 100%; height: auto; -webkit-user-drag: none; user-select: none; }
.act-scope .zonas-img svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.act-scope .zonas-img { cursor: pointer; }
.act-scope .zonas-img .zf { fill: transparent; stroke: none; }
.act-scope .zonas-img .zo { fill: none; stroke: none; }
.act-scope .zonas-img.contorno .zo { stroke: rgba(79, 70, 229, .85); stroke-dasharray: 1.4 1; vector-effect: non-scaling-stroke; stroke-width: 2px; }
.act-scope .zonas-img .zf.pintada { fill-opacity: .62; }
.act-scope .zlabel { position: absolute; transform: translate(-50%, -50%); background: #fff; color: var(--text); font: 700 .85rem/1.2 Inter, sans-serif; padding: 3px 8px; border-radius: 999px; border: 2px solid var(--ok); pointer-events: none; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.act-scope .zonas-lado { flex: 1; min-width: 200px; max-width: 320px; line-height: 1.5; }
.act-scope .toca { font: 800 1.5rem var(--display); background: var(--accent-soft); border-radius: 16px; padding: 14px 16px; text-align: center; }
.act-scope .toca small { display: block; font: 500 .9rem Inter, sans-serif; color: var(--muted); margin-top: 4px; }
.act-scope .zonas-lado .banco { padding: 10px; }
.act-scope .zonas-lado .banco .item { min-width: 0; padding: 8px 12px; }
.act-scope .paso { margin: 18px 0; }
.act-scope .paso > h3 { display: flex; gap: 10px; align-items: center; }
.act-scope .paso > h3 i { font-style: normal; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: .9rem; }
.act-scope .errores { background: var(--bad-soft); border: 1.5px solid var(--bad); color: #8f2323; border-radius: 14px; padding: 12px 16px; }
.act-scope .errores ul, .act-scope .avisos ul { margin: 6px 0 0; padding-left: 20px; }
.act-scope .avisos { background: var(--warn-soft); border: 1.5px solid #e5c066; color: #7a5200; border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; }
.act-scope .vista { border: 2px dashed var(--accent); border-radius: 20px; padding: 14px; background: rgba(255,255,255,.5); margin-top: 14px; }
.act-scope .vista > .etq { font-weight: 700; color: var(--accent); margin-bottom: 8px; }
/* Editor de zonas */
.act-scope .edz { display: grid; gap: 12px; }
.act-scope .edz-img { position: relative; width: min(100%, 720px, calc(62vh * var(--ar, 1))); line-height: 0; border: 2px solid var(--border); border-radius: 14px; overflow: hidden; cursor: crosshair; touch-action: manipulation; background: #fff; user-select: none; }
.act-scope .edz-vista { overflow: auto; max-height: 74vh; width: min(100%, 900px); border: 2px solid var(--border); border-radius: 14px; background: #ece9e0; }
.act-scope .edz-vista .edz-img { border: 0; border-radius: 0; max-width: none; flex: none; margin: 0 auto; }
.act-scope .edz-img img { display: block; width: 100%; height: auto; -webkit-user-drag: none; pointer-events: none; }
.act-scope .edz-img svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.act-scope .edz-img .zf { fill-opacity: .35; stroke: none; }
.act-scope .edz-img .zf.hl { fill-opacity: .6; }
.act-scope .edz-img .zo { fill: none; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.act-scope .edz-img .zo.ho { stroke-dasharray: 5 3; }
.act-scope .edz-vista.paneando, .act-scope .edz-vista.paneando * { cursor: grabbing !important; }
.act-scope .edz-img polyline { fill: none; stroke: #111; stroke-width: 2px; vector-effect: non-scaling-stroke; stroke-dasharray: 5 3; }
.act-scope .edz-img .pt { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; border: 3px solid #111; pointer-events: none; }
.act-scope .edz-img .pt.p0 { background: #ffd23f; width: 16px; height: 16px; margin: -8px 0 0 -8px; }
.act-scope .zlista { display: grid; gap: 8px; }
.act-scope .zfila { display: grid; grid-template-columns: 22px minmax(120px, 1fr) minmax(140px, 1.6fr) auto; gap: 8px; align-items: center; }
.act-scope .zfila .sw { width: 22px; height: 22px; border-radius: 6px; }
@media (max-width: 640px) {
.act-scope .zfila { grid-template-columns: 22px 1fr auto; }
.act-scope .zfila input:nth-of-type(2) { grid-column: 1 / -1; }
.act-scope .unir { gap: 10px; }
}
/* Parejas ya unidas: cada una con su color (tiene que ganarle al fondo de .item). */
.act-scope .item.done.f0 { background: #4f46e5; }
.act-scope .item.done.f1 { background: #1a9d5b; }
.act-scope .item.done.f2 { background: #e0752b; }
.act-scope .item.done.f3 { background: #c026d3; }
.act-scope .item.done.f4 { background: #0ea5c7; }
.act-scope .item.done.f5 { background: #d64545; }
.act-scope .item.done.f6 { background: #7c8b16; }
.act-scope .item.done.f7 { background: #5b6ee1; }

.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.act-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; color: var(--text); text-decoration: none; }
a.act-card.jugable { cursor: pointer; transition: transform .12s, box-shadow .12s; }
a.act-card.jugable:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(79, 70, 229, .18); text-decoration: none; }
.act-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: var(--accent-soft); }
.act-card h3 { margin: 6px 0 0; }
.act-pre { white-space: pre-wrap; font: 12.5px/1.5 ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 12px; border-radius: 12px; max-height: 55vh; overflow: auto; }
.act-scope textarea, .act-scope input[type=text] { width: 100%; font: inherit; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); }
.act-scope textarea { resize: vertical; }
.act-scope input[type=text]:focus, .act-scope textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.act-scope .paso label { display: block; font-size: .86rem; font-weight: 600; }
.act-scope .paso label.chk, .act-scope .paso label.btn { display: inline-flex; font-weight: 600; }

/* Ancho de la página en el computador: aprovecha pantallas grandes (1920 px) sin estirar demasiado las líneas de lectura. */
:root { --ancho-pagina: 1560px; }
.quiz { max-width: 1320px; margin-left: auto; margin-right: auto; }   /* resolver una guía: línea de lectura cómoda */

/* ---------- Programa del Diploma: desarrollos con foto, corrección con rúbrica y revisión del profesor */
.despanel { margin-top: 16px; padding: 16px; border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 14px; background: var(--accent-soft); }
.fotos { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.foto { margin: 0; width: 150px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.foto img { display: block; width: 100%; height: 190px; object-fit: cover; cursor: zoom-in; }
.foto figcaption { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: .75rem; padding: 3px 4px 3px 8px; color: var(--muted); }
.foto figcaption button { padding: 2px 6px; }
.foto.borrosa { border-color: var(--warn); }
.foto.borrosa figcaption { color: var(--warn); font-weight: 600; }
label.subir { cursor: pointer; }
.navgrid button.des::before { content: "✎"; position: absolute; left: 3px; top: 0; font-size: .6rem; opacity: .7; }
.deshojas { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.deshojas img.hoja { height: 170px; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; background: #fff; }
.deshojas.grande img.hoja { height: auto; width: 100%; max-height: 80vh; object-fit: contain; }
.pendnote { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 9px 12px; font-weight: 500; }
.corr { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.rubtable td { vertical-align: top; }
.rubtable tr.okrow td:nth-child(3) { color: var(--ok); font-weight: 700; }
.rubtable tr.partrow td:nth-child(3) { color: var(--warn); font-weight: 700; }
.rubtable tr.badrow td:nth-child(3) { color: var(--bad); font-weight: 700; }
.res.part, .res.pend { color: var(--warn); }
.review.part, .review.pend { border-left-color: var(--warn); }
.tchart .tb.part, .tchart .tb.pend { background: var(--warn); }
.promptbox { width: 100%; font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace; margin: 8px 0 6px; }
.pasos { padding-left: 20px; }
.pasos li { margin-bottom: 10px; }
.pasos ul { margin: 6px 0 0; padding-left: 18px; }
.pasos code, .modal code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: .86em; }
.modal:has(.pasos) { max-width: 720px; max-height: 90vh; overflow-y: auto; }
.desrev { align-items: start; }
@media (max-width: 560px) { .foto { width: calc(50% - 6px); } .foto img { height: 160px; } }
:root[data-asig="Química PD"] { --accent: #d69c00; --accent-2: #ffd43b; }
:root[data-asig="Biología PD"] { --accent: #0b8a62; --accent-2: #19b5a5; }
:root[data-asig="SAS PD"] { --accent: #2f7d4f; --accent-2: #4ea3c8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-asig="Química PD"] { --accent: #f5c518; --accent-2: #ffe066; }
  :root:not([data-theme="light"])[data-asig="Biología PD"] { --accent: #3dd6a0; --accent-2: #4fd8e0; }
  :root:not([data-theme="light"])[data-asig="SAS PD"] { --accent: #6fcf8f; --accent-2: #7cc8e8; }
}
:root[data-theme="dark"][data-asig="Química PD"] { --accent: #f5c518; --accent-2: #ffe066; }
:root[data-theme="dark"][data-asig="Biología PD"] { --accent: #3dd6a0; --accent-2: #4fd8e0; }
:root[data-theme="dark"][data-asig="SAS PD"] { --accent: #6fcf8f; --accent-2: #7cc8e8; }

/* ---------- hoja de desarrollo imprimible (PD): línea de datos + cuadro punteado con marcas en las esquinas */
.hoja-doc { position: relative; width: 190mm; height: 250mm; margin: 0 auto; background: #fff; color: #000; padding: 9mm 8mm; box-shadow: var(--shadow); font: 10pt Arial, sans-serif; }
.hoja-doc .hm { position: absolute; width: 7mm; height: 7mm; border: 0 solid #000; }
.hoja-doc .hm.tl { left: 0; top: 0; border-width: 0.5mm 0 0 0.5mm; } .hoja-doc .hm.tr { right: 0; top: 0; border-width: 0.5mm 0.5mm 0 0; }
.hoja-doc .hm.bl { left: 0; bottom: 0; border-width: 0 0 0.5mm 0.5mm; } .hoja-doc .hm.br { right: 0; bottom: 0; border-width: 0 0.5mm 0.5mm 0; }
.hhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 4mm; margin-bottom: 4mm; white-space: nowrap; }
.hbox { display: inline-block; width: 6.5mm; height: 8mm; border: 0.3mm solid #000; vertical-align: middle; text-align: center; font: 13pt/8mm Arial; margin-left: 0.6mm; }
.hbox.wide { width: 12mm; }
.hline { display: inline-block; border-bottom: 0.3mm solid #000; height: 5mm; vertical-align: bottom; }
.hframe { border: 0.4mm solid #000; height: 228mm; padding: 5mm 6mm; overflow: hidden; }
.hl { height: 8.2mm; background: radial-gradient(circle, #666 0.22mm, transparent 0.3mm) left bottom / 2.6mm 0.7mm repeat-x;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }   /* un punto cada ~2,6 mm */
@media print {
  @page { size: letter; margin: 8mm; }
  body { background: #fff; }
  header, .viewbar, .noprint { display: none !important; }
  main { max-width: none; padding: 0; margin: 0; }
  .hoja-doc { box-shadow: none; margin: 0; }
}

/* hoja: columna «Parte» a la izquierda del cuadro; datos que el alumno escribe arriba de su hoja */
.hframe { position: relative; padding-left: calc(6mm + 22mm); }
.hframe .hcol { position: absolute; left: 0; top: 0; bottom: 0; width: 22mm; border-right: 0.3mm solid #000; }
.hframe .hpar { position: absolute; left: 0; right: 0; top: 7mm; display: flex; flex-wrap: wrap; justify-content: center; gap: 1mm; }
.hframe .hpar.mitad { top: calc(50% + 2mm); }
.hframe .hpar .hbox { margin: 0; }
.hframe .hpar .hbox.ancha { width: 10mm; }
.hframe .hpar small { width: 100%; text-align: center; font: 6pt Arial; color: #666; }
.hframe .hcol span { display: block; text-align: center; font: bold 8pt Arial; padding-top: 1.5mm; color: #333; }
.hline { text-align: center; font: 12pt Arial; }
.hojadatos { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 8px 12px; margin: 0 0 10px;
  border: 1px dashed var(--border); border-radius: 10px; background: var(--surface); }
.hojadatos b { font-size: 1.05rem; color: var(--accent); }
