/* Layout: barra superior con tres secciones + una página por sección, sin menú lateral.
   Look: minimalista — blanco y grises fríos, un solo acento verde azulado, Geist. */
:root {
  --paper: #fafafa;
  --surface: #ffffff;
  --sunk: #f2f3f4;
  --ink: #141619;
  --muted: #6b707a;
  --line: #e6e7ea;
  --accent: #0e6b62;
  --accent-ink: #ffffff;
  --hl: #d3ece7;
  --hl-ink: #0a3d38;
  --good: #1d7f4e;
  --bad: #c9372c;
  --board: #ffffff;
  --board-line: #d6dde6;

  --f-display: "Geist", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --f-body: "Geist", "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --f-num: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --shadow: 0 1px 2px rgb(20 22 25 / .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1012; --surface: #15181b; --sunk: #1d2125; --ink: #ebedf0; --muted: #9aa0a9;
    --line: #272b31; --accent: #4fbfae; --accent-ink: #0e1012; --hl: #1c4540; --hl-ink: #e6fbf7;
    --good: #4cc488; --bad: #ff7a6e; --board: #fbfcfd; --board-line: #d6dde6;
    --shadow: 0 1px 2px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1012; --surface: #15181b; --sunk: #1d2125; --ink: #ebedf0; --muted: #9aa0a9;
  --line: #272b31; --accent: #4fbfae; --accent-ink: #0e1012; --hl: #1c4540; --hl-ink: #e6fbf7;
  --good: #4cc488; --bad: #ff7a6e; --board: #fbfcfd; --board-line: #d6dde6;
  --shadow: 0 1px 2px rgb(0 0 0 / .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--f-body);
}
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; line-height: 1.1; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font: 800 18px/1 var(--f-display);
}
.brand b { font: 800 18px/1.1 var(--f-display); display: block; }
.brand small { color: var(--muted); font-size: 12.5px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 10px 4px; font-weight: 700; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer;
  text-align: left; font-size: 15px; color: var(--ink);
}
.nav-btn:hover { background: var(--sunk); }
.nav-btn[aria-current="page"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.sidebar-foot { margin-top: auto; font-size: 12.5px; color: var(--muted); padding: 0 10px; }

.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 40px; display: flex; flex-direction: column; gap: 20px; }
.view[hidden] { display: none !important; }
.view { display: flex; flex-direction: column; gap: 18px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.view-head h2 { font-size: clamp(26px, 3vw, 34px); font-weight: 800; }
.view-head p { margin: 4px 0 0; color: var(--muted); max-width: 62ch; }

.stage {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: clamp(16px, 2.5vw, 28px); min-width: 0;
}
.stage:fullscreen, .stage.presenting { border-radius: 0; overflow: auto; display: flex; flex-direction: column; justify-content: center; font-size: 120%; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stage:fullscreen .panel.setup, .stage.presenting .panel.setup { display: none; }
.stage:fullscreen .split, .stage.presenting .split { grid-template-columns: 1fr; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 9px 16px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 15px;
  transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--sunk); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.big { padding: 14px 28px; font-size: 18px; }
.btn.sm { padding: 6px 12px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.icon-btn { padding: 8px; border-radius: 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: var(--r-sm);
  padding: 9px 11px; font-size: 15px;
}
textarea { resize: vertical; line-height: 1.45; }
input[type="number"] { width: 5.5em; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14.5px; cursor: pointer; }
.hint { color: var(--muted); font-size: 13.5px; margin: 0; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.hl { background: linear-gradient(transparent 12%, var(--hl) 12%, var(--hl) 88%, transparent 88%); color: var(--hl-ink); padding: 0 .18em; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.pill { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.pill.good { color: var(--good); }
.pill.bad { color: var(--bad); }

/* ---------- Home ---------- */
.home-hero h2 { font-size: clamp(30px, 4.4vw, 52px); font-weight: 800; letter-spacing: -.02em; max-width: 18ch; }
.home-hero p { color: var(--muted); font-size: 17px; max-width: 60ch; margin: 10px 0 0; }
.home-group { display: flex; flex-direction: column; gap: 10px; }
.home-group h3 { font: 700 12px/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tool-card {
  display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px;
  transition: border-color .15s ease, transform .15s ease;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--sunk); color: var(--accent); }
.tool-card b { font: 700 17px/1.2 var(--f-display); }
.tool-card span { color: var(--muted); font-size: 14px; }
.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tip { background: var(--sunk); border-radius: var(--r-md); padding: 14px 16px; font-size: 14.5px; }
.tip b { display: block; font-family: var(--f-display); margin-bottom: 2px; }

/* ---------- Big result readouts ---------- */
.result { min-height: 2.6em; text-align: center; font: 800 clamp(22px, 3.2vw, 34px)/1.2 var(--f-display); }
.result-label { display: block; font: 700 12px/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }

/* Wheel */
.wheel-area { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.wheel-wrap { position: relative; width: min(100%, 460px); aspect-ratio: 1; max-width: 100%; }
.stage:fullscreen .wheel-wrap, .stage.presenting .wheel-wrap { width: min(70vh, 90vw); }
#wheel { width: 100%; height: 100%; display: block; }
.pointer { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0;
  border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 30px solid var(--ink); z-index: 2; filter: drop-shadow(0 2px 2px rgb(0 0 0 / .25)); }
.spin-btn { position: absolute; inset: 0; margin: auto; width: 23%; height: 23%; border-radius: 50%;
  border: 4px solid var(--surface); background: var(--ink); color: var(--surface); font: 800 clamp(13px, 2vw, 18px)/1 var(--f-display); cursor: pointer; box-shadow: 0 4px 14px rgb(0 0 0 / .25); }
.spin-btn:disabled { cursor: wait; }

/* Timer */
.timer-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 10px 0; }
.timer-display { font: 700 clamp(72px, 15vw, 180px)/1 var(--f-num); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.stage:fullscreen .timer-display, .stage.presenting .timer-display { font-size: 26vh; }
.timer-display.warn { color: var(--bad); }
.timer-display.done { animation: flash .5s steps(2) 6; color: var(--bad); }
@keyframes flash { 50% { opacity: .15; } }
.progress { width: min(100%, 640px); height: 12px; background: var(--sunk); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; width: 100%; background: var(--accent); transition: width .25s linear; }
.laps { list-style: none; padding: 0; margin: 0; width: min(100%, 360px); font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.laps li { display: flex; justify-content: space-between; padding: 6px 4px; border-bottom: 1px solid var(--line); }

/* Dice */
.dice-row { display: flex; gap: clamp(12px, 3vw, 28px); justify-content: center; flex-wrap: wrap; padding: 16px 0; }
.die {
  width: clamp(96px, 16vw, 150px); aspect-ratio: 1; border-radius: 22%; background: var(--surface); border: 3px solid var(--ink);
  box-shadow: 0 6px 0 var(--ink); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 14%; gap: 4%;
}
.die i { border-radius: 50%; background: var(--ink); visibility: hidden; }
.die i.on { visibility: visible; }
.die.word { display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; aspect-ratio: auto; min-height: clamp(96px, 16vw, 150px); width: clamp(140px, 20vw, 210px);
  font: 800 clamp(18px, 2.4vw, 26px)/1.15 var(--f-display); }
.die.word small { display: block; font: 700 11px/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.die.rolling { animation: wobble .12s linear infinite; }
@keyframes wobble { 0% { transform: rotate(-7deg) translateY(-3px); } 50% { transform: rotate(7deg); } 100% { transform: rotate(-7deg) translateY(-3px); } }

/* Letter */
.letter { font: 800 clamp(120px, 22vw, 240px)/1 var(--f-display); text-align: center; }
.stage:fullscreen .letter, .stage.presenting .letter { font-size: 40vh; }
.letter.pop { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } }
.cat-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.cat-list .pill { font-size: 15px; padding: 6px 12px; background: var(--sunk); color: var(--ink); }
.used { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; font-family: var(--f-num); }
.used span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: var(--sunk); color: var(--muted); font-size: 14px; }

/* Hangman */
.hang { display: grid; grid-template-columns: minmax(160px, 260px) minmax(0, 1fr); gap: 28px; align-items: center; }
.hang svg { width: 100%; height: auto; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; fill: none; }
.hang svg .part { opacity: 0; transition: opacity .2s; }
.hang svg .part.on { opacity: 1; }
.slots { display: flex; flex-wrap: wrap; gap: 10px 8px; font: 800 clamp(26px, 4vw, 42px)/1 var(--f-num); }
.slots .word { display: flex; gap: 8px; }
.slots .ch { width: 1.05em; border-bottom: 4px solid var(--ink); text-align: center; padding-bottom: 4px; min-height: 1.25em; }
.slots .ch.miss { color: var(--bad); }
.keyboard { display: flex; flex-wrap: wrap; gap: 6px; }
.keyboard button { width: 42px; height: 42px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); font: 700 17px/1 var(--f-num); cursor: pointer; }
.keyboard button:hover:not(:disabled) { border-color: var(--accent); }
.keyboard button.hit { background: var(--good); color: var(--surface); border-color: var(--good); }
.keyboard button.miss { background: var(--sunk); color: var(--muted); text-decoration: line-through; }

/* Memory */
.mem-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mem-card { aspect-ratio: 4 / 3; perspective: 800px; border: 0; background: none; padding: 0; cursor: pointer; }
.mem-card .in { position: relative; width: 100%; height: 100%; transition: transform .35s ease; transform-style: preserve-3d; }
.mem-card.flip .in, .mem-card.done .in { transform: rotateY(180deg); }
.mem-card .face { position: absolute; inset: 0; border-radius: 12px; display: grid; place-items: center; padding: 6px; backface-visibility: hidden; text-align: center;
  font: 700 clamp(13px, 1.6vw, 18px)/1.15 var(--f-display); }
.mem-card .back { background: var(--accent); color: var(--accent-ink); font-size: 26px;
  background-image: radial-gradient(circle at 1px 1px, rgb(255 255 255 / .22) 1.2px, transparent 0); background-size: 12px 12px; }
.mem-card .front { background: var(--paper); border: 2px solid var(--line); transform: rotateY(180deg); color: var(--ink); }
.mem-card .front.es { font-family: var(--f-body); font-weight: 400; font-style: italic; }
.mem-card.done .front { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--surface)); }

/* Scramble */
.target, .pool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 62px; padding: 10px; border-radius: var(--r-md); align-items: center; }
.target { border: 2px dashed var(--line); }
.target.good { border-color: var(--good); border-style: solid; background: color-mix(in srgb, var(--good) 10%, transparent); }
.target.bad { border-color: var(--bad); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.tile { border: 2px solid var(--ink); background: var(--surface); border-radius: 10px; padding: 8px 14px; font: 700 clamp(17px, 2vw, 22px)/1.1 var(--f-display); cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.tile:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.punct { font: 800 24px/1 var(--f-display); color: var(--muted); }
.answer { font-size: 18px; }

/* Score */
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.player { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; background: var(--paper); position: relative; }
.player.lead { border-color: var(--hl); box-shadow: inset 0 0 0 2px var(--hl); }
.player input.pname { text-align: center; font: 700 19px/1.2 var(--f-display); background: transparent; border: 1px dashed transparent; }
.player input.pname:hover, .player input.pname:focus { border-color: var(--line); }
.player .pts { font: 700 clamp(56px, 8vw, 88px)/1 var(--f-num); font-variant-numeric: tabular-nums; }
.player .pts.bump { animation: pop .3s ease; }
.player .del { position: absolute; top: 6px; right: 6px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; padding: 4px 8px; border-radius: 6px; }
.player .del:hover { background: var(--sunk); }
.badge-lead { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--hl); color: var(--hl-ink); padding: 2px 8px; border-radius: 999px; }

/* Flashcards */
.flash-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.flash { width: min(100%, 620px); aspect-ratio: 16 / 9; perspective: 1200px; border: 0; background: none; padding: 0; cursor: pointer; }
.flash .in { position: relative; width: 100%; height: 100%; transition: transform .45s ease; transform-style: preserve-3d; }
.flash.flip .in { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; border-radius: 18px; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; padding: 20px; backface-visibility: hidden;
  border: 2px solid var(--line); background: var(--board); color: #161c33;
  background-image: linear-gradient(transparent 30px, transparent 0), repeating-linear-gradient(transparent 0 31px, var(--board-line) 31px 32px);
  box-shadow: var(--shadow); }
.flash .face b { font: 800 clamp(30px, 5vw, 58px)/1.1 var(--f-display); text-align: center; }
.flash .face small { font: 700 12px/1 var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: #5a6382; }
.flash .back { transform: rotateY(180deg); }
.flash .face::before { content: ""; position: absolute; left: 44px; top: 0; bottom: 0; width: 2px; background: #f1a5a0; }
.counter { font-family: var(--f-num); font-variant-numeric: tabular-nums; color: var(--muted); }

/* Conversation */
.qcard { border-radius: 18px; padding: clamp(22px, 4vw, 44px); background: var(--paper); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; min-height: 220px; justify-content: center; }
.qcard .topic { align-self: flex-start; }
.qcard q { quotes: none; font: 800 clamp(24px, 3.6vw, 44px)/1.18 var(--f-display); }
.stage:fullscreen .qcard q, .stage.presenting .qcard q { font-size: 6vh; }
.helpers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.helpers > div { background: var(--paper); border-radius: var(--r-md); padding: 14px 16px; }
.helpers h3 { font: 700 12px/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.helpers ul { margin: 0; padding-left: 18px; }

/* Listen */
.tts-out { font: 700 clamp(20px, 2.6vw, 28px)/1.4 var(--f-display); min-height: 1.4em; }
.tts-out .w { border-radius: 4px; padding: 0 1px; }
.tts-out .w.now { background: var(--hl); color: var(--hl-ink); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.box h3 { font-size: 20px; }
.feedback { font-weight: 700; min-height: 1.5em; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
input[type="range"] { width: 100%; accent-color: var(--accent); }

/* Whiteboard */
.wb-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.wb-wrap { position: relative; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); height: min(62vh, 640px); min-height: 320px; background-color: var(--board); touch-action: none; }
.stage:fullscreen .wb-wrap, .stage.presenting .wb-wrap { height: 82vh; }
.wb-wrap.lines { background-image: repeating-linear-gradient(transparent 0 39px, var(--board-line) 39px 40px); }
.wb-wrap.grid { background-image: linear-gradient(var(--board-line) 1px, transparent 1px), linear-gradient(90deg, var(--board-line) 1px, transparent 1px); background-size: 32px 32px; }
#board { width: 100%; height: 100%; display: block; cursor: crosshair; }
.divider { width: 1px; height: 26px; background: var(--line); }

/* Modal */
dialog { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); padding: 22px; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(10 14 30 / .45); }
dialog form { display: flex; flex-direction: column; gap: 12px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; z-index: 50; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .split { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; z-index: 10; }
  .brand small, .nav-label, .sidebar-foot { display: none; }
  .nav { display: flex; gap: 4px; }
  .nav-group { flex-direction: row; gap: 4px; }
  .nav-btn { white-space: nowrap; padding: 7px 10px; font-size: 14px; }
  .hang { grid-template-columns: 1fr; }
  .hang svg { max-width: 200px; margin: 0 auto; }
  .mem-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .mem-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keyboard button { width: 36px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Niveles (cada nivel tiene su color de acento) ---------- */
:root { --lv-A1: #1b7444; --lv-A2: #0e7383; --lv-B1: #2650c8; --lv-B2: #6a3fc4; --lv-C1: #b8322a; --lv-C2: #8a5a00; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --lv-A1: #62d394; --lv-A2: #4fcfdf; --lv-B1: #85a5ff; --lv-B2: #b9a0ff; --lv-C1: #ff8f80; --lv-C2: #f0b44c; }
}
:root[data-theme="dark"] { --lv-A1: #62d394; --lv-A2: #4fcfdf; --lv-B1: #85a5ff; --lv-B2: #b9a0ff; --lv-C1: #ff8f80; --lv-C2: #f0b44c; }
:root[data-level="A1"] { --accent: var(--lv-A1); }
:root[data-level="A2"] { --accent: var(--lv-A2); }
:root[data-level="B1"] { --accent: var(--lv-B1); }
:root[data-level="B2"] { --accent: var(--lv-B2); }
:root[data-level="C1"] { --accent: var(--lv-C1); }
:root[data-level="C2"] { --accent: var(--lv-C2); }
.lv-A1 { --lv: var(--lv-A1); } .lv-A2 { --lv: var(--lv-A2); } .lv-B1 { --lv: var(--lv-B1); }
.lv-B2 { --lv: var(--lv-B2); } .lv-C1 { --lv: var(--lv-C1); } .lv-C2 { --lv: var(--lv-C2); }

.levels { display: flex; flex-direction: column; gap: 22px; }
.level-block { display: flex; flex-direction: column; gap: 10px; }
.level-head { display: flex; gap: 12px; align-items: center; }
.level-head h3 { font-size: 20px; }
.level-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.level-badge { flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--lv); color: var(--surface); font: 800 19px/1 var(--f-display); }
.level-block .unit-card[aria-pressed="true"] { border-color: var(--lv); box-shadow: inset 0 0 0 1px var(--lv); }
.level-seg button { font-family: var(--f-num); min-width: 40px; }
.level-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.unit-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.unit-label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.unit-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.stage:fullscreen ~ .unit-bar, .stage.presenting ~ .unit-bar { display: none; }

.unit-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.unit-card { display: flex; flex-direction: column; gap: 6px; text-align: left; cursor: pointer; padding: 18px; border-radius: var(--r-md);
  background: var(--surface); border: 2px solid var(--line); transition: border-color .15s ease, transform .15s ease; min-width: 0; }
.unit-card:hover { transform: translateY(-2px); border-color: var(--muted); }
.unit-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.unit-card b { font: 800 20px/1.15 var(--f-display); }
.unit-es { color: var(--muted); font-style: italic; }
.unit-meta { font-size: 13px; font-weight: 700; color: var(--muted); }
.unit-sample { font-size: 14px; border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 4px; }

.rp-title { font-size: clamp(24px, 3vw, 34px); font-weight: 800; }
.roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.role { border: 2px solid var(--line); border-radius: var(--r-md); padding: 18px; background: var(--paper); min-width: 0; }
.role:first-child { border-color: var(--accent); }
.role-tag { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.role h3 { font-size: 24px; margin: 4px 0 10px; }
.role ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 17px; }
@media (max-width: 700px) { .roles { grid-template-columns: 1fr; } }

/* ---------- Inicio de sesión ---------- */
.auth { --night: #121833; --night-ink: #eef1fa; min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-side {
  background-color: var(--night); color: var(--night-ink);
  padding: clamp(24px, 5vw, 56px); display: flex; flex-direction: column; gap: clamp(24px, 5vh, 48px); justify-content: space-between;
  position: relative; overflow: hidden;
  background-image: repeating-linear-gradient(transparent 0 39px, rgb(255 255 255 / .06) 39px 40px);
}
.auth-side .brand small { color: color-mix(in srgb, var(--night-ink) 70%, transparent); }
.auth-side .brand-mark { background: #ffd43b; color: #161c33; }
.auth-side .hl { background: linear-gradient(transparent 12%, #ffd43b 12%, #ffd43b 88%, transparent 88%); color: #161c33; }
.auth-pitch h1 { font-size: clamp(44px, 7vw, 88px); font-weight: 800; letter-spacing: -.03em; line-height: .95; }
.auth-pitch p { font-size: 18px; max-width: 42ch; margin: 18px 0 0; color: color-mix(in srgb, var(--night-ink) 82%, transparent); }
.auth-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.auth-facts li { display: flex; align-items: baseline; gap: 14px; border-top: 1px solid rgb(255 255 255 / .15); padding-top: 12px; }
.auth-facts b { font: 700 28px/1 var(--f-num); min-width: 2.2ch; color: #ffd43b; }
.auth-levels { display: flex; gap: 8px; flex-wrap: wrap; }
.auth-levels span { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font: 800 16px/1 var(--f-num); border: 1px solid rgb(255 255 255 / .22); color: var(--night-ink); }

.auth-main { display: grid; place-items: center; padding: clamp(24px, 5vw, 56px) 16px; background: var(--paper); }
.auth-card { width: min(100%, 420px); display: flex; flex-direction: column; gap: 22px; }
.auth-tabs { align-self: flex-start; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form h2 { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.auth-form input[type="email"], .auth-form input[type="text"], .auth-form input[type="password"] { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 13px; font-size: 16px; background: var(--surface); }
.auth-form .btn.big { width: 100%; }
.auth-form .feedback:empty { display: none; }
.pw { position: relative; display: block; }
.pw input { padding-right: 76px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--sunk); color: var(--ink); border-radius: 6px; padding: 5px 10px; font-size: 13px; font-weight: 700; cursor: pointer; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
.auth-note { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin: 0; }

.who { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 800 15px/1 var(--f-display); }
.who-name { font-weight: 700; font-size: 14px; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { gap: 20px; }
  .auth-facts, .auth-levels { display: none; }
  .auth-pitch h1 { font-size: 44px; }
  .who { margin-left: 0; }
}

/* ---------- Buscador ---------- */
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; height: 48px; max-width: 640px; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.search .icon { color: var(--muted); }
.search input { border: 0; background: transparent; width: 100%; font-size: 15px; outline: none; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.unit-grammar { font-size: 12.5px; font-weight: 700; color: var(--accent); }
.level-block .unit-grammar { color: var(--lv); }

/* ---------- Plan de clase ---------- */
.crumbs { margin: 0; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--accent); text-decoration: none; font-weight: 700; }
.eyebrow { margin: 0 0 6px; font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.cl-hero { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; justify-content: space-between; }
.cl-hero-main { flex: 1 1 480px; min-width: 0; }
.cl-hero h2 { font-size: clamp(34px, 4.6vw, 52px); font-weight: 800; letter-spacing: -.02em; }
.cl-es { margin: 6px 0 0; color: var(--muted); font-style: italic; }
.cl-lead { margin: 12px 0 16px; color: var(--muted); max-width: 62ch; }
.chip { display: inline-flex; align-items: center; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--sunk); color: var(--ink); }
.chip.gram { background: color-mix(in srgb, var(--hl) 35%, var(--surface)); color: var(--ink); }
.cl-hero-actions { flex: 0 1 auto; }
.cl-hero-actions .btn { height: 48px; border-radius: 12px; }
.cl-vocab { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-block: 16px; }
.cl-vocab h3 { font-size: 15px; font-family: var(--f-body); }
.chips { flex: 1 1 400px; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chips span { border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 14px; background: var(--paper); }
.chips .more { border: 0; background: none; color: var(--muted); }

.cl-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.cl-stages { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 26px; }
.cl-aside { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); }
.cl-stage-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 12px; }
.cl-stage-n { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--surface); display: grid; place-items: center; font: 700 15px/1 var(--f-num); }
.cl-stage-head h3 { font-size: 24px; font-weight: 800; }
.cl-stage-head span:last-child { font-size: 14px; color: var(--muted); }
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.act { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.act.on { border-color: var(--accent); }
.act-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.act-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); }
.act-mins { font-size: 13px; color: var(--muted); font-family: var(--f-num); white-space: nowrap; }
.act h4 { margin: 4px 0 0; font: 700 17px/1.2 var(--f-display); }
.act p { margin: 0; font-size: 14px; color: var(--muted); flex-grow: 1; }
.act-btns { display: flex; gap: 8px; margin-top: 6px; }
.act-btns .btn { flex: 1 1 auto; border-radius: 10px; height: 42px; }
.act-add { border-style: dashed; }
.act.on .act-add { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-style: solid; }

.plan-card { --pc-bg: #161c33; --pc-ink: #ffffff; --pc-muted: #c3cbe0; --pc-row: #232b48; background: var(--pc-bg); color: var(--pc-ink); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.plan-card h3 { font-size: 22px; font-weight: 800; }
.plan-meta { margin: -6px 0 0; font-size: 14px; color: var(--pc-muted); }
.plan-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; counter-reset: plan; }
.plan-list li { counter-increment: plan; display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 9px 10px 9px 12px; background: var(--pc-row); border-radius: 10px; }
.plan-list li::before { content: counter(plan); font: 700 12px/1 var(--f-num); color: var(--pc-muted); }
.plan-list li span { flex: 1 1 auto; min-width: 0; }
.plan-list li small { color: var(--pc-muted); white-space: nowrap; font-family: var(--f-num); }
.plan-list li button { border: 0; background: none; color: var(--pc-muted); cursor: pointer; font-size: 16px; padding: 0 4px; border-radius: 4px; }
.plan-list li button:hover { color: var(--pc-ink); }
.plan-empty { margin: 0; font-size: 14px; color: var(--pc-muted); }
.plan-card .plan-go { background: var(--pc-ink); color: var(--pc-bg); border: 0; width: 100%; border-radius: 12px; }
.plan-card .plan-clear { background: transparent; color: var(--pc-ink); border-color: #3b4466; align-self: center; }
.cl-next h3 { font-size: 16px; font-family: var(--f-body); }
.cl-next .hint { margin: 2px 0 12px; }
.next-link { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; margin-top: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 700; cursor: pointer; text-align: left; }
.next-link:hover { border-color: var(--accent); }
.next-link small { color: var(--muted); font-weight: 400; font-size: 12.5px; text-align: right; }

/* ---------- Barra de modo clase ---------- */
.class-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  width: min(760px, calc(100vw - 32px)); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  background: #161c33; color: #ffffff; border-radius: 16px; padding: 10px 12px 10px 18px; box-shadow: 0 10px 30px rgb(0 0 0 / .3); }
.cb-info { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.cb-step { font: 700 12px/1 var(--f-num); color: #ffd43b; }
.cb-mins { font-size: 13px; color: #c3cbe0; }
.class-bar .btn { background: transparent; color: #ffffff; border-color: #3b4466; }
.class-bar .btn.primary { background: #ffffff; color: #161c33; border-color: #ffffff; }
body.in-class .main { padding-bottom: 110px; }
@media (max-width: 860px) { .cl-aside { position: static; } }

/* ---------- Temáticas en espiral ---------- */
.spiral { display: flex; flex-direction: column; gap: 10px; }
.spiral-badge { background: var(--ink); color: var(--surface); font-size: 22px; }
.spiral-tag { align-self: flex-start; display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: var(--surface); }
.spiral-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2.4fr); gap: 18px; align-items: center; }
.spiral-card h3 { font-size: 24px; font-weight: 800; margin-top: 8px; }
.spiral-card .hint { margin-top: 6px; }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: end; }
.ladder li { display: flex; }
/* Cada peldaño es un poco más alto que el anterior: la dificultad sube. */
.ladder li:nth-child(1) .ladder-step { min-height: 112px; } .ladder li:nth-child(2) .ladder-step { min-height: 124px; }
.ladder li:nth-child(3) .ladder-step { min-height: 136px; } .ladder li:nth-child(4) .ladder-step { min-height: 148px; }
.ladder li:nth-child(5) .ladder-step { min-height: 160px; } .ladder li:nth-child(6) .ladder-step { min-height: 172px; }
.ladder-step { width: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; text-align: left; cursor: pointer; padding: 10px; border-radius: 12px;
  border: 1px solid var(--line); border-top: 5px solid var(--lv); background: var(--paper); color: var(--ink); min-width: 0; transition: transform .15s ease, border-color .15s ease; }
.ladder-step:hover { transform: translateY(-2px); border-color: var(--lv); }
.ladder-lv { font: 800 18px/1 var(--f-display); color: var(--lv); }
.ladder-focus { font-weight: 700; font-size: 13.5px; line-height: 1.25; overflow-wrap: break-word; hyphens: auto; }
.ladder-step small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.cl-ladder { margin-top: 18px; }
.ladder-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ladder-row .ladder-step { width: auto; flex: 1 1 120px; min-height: 0; padding: 8px 10px; border-top-width: 4px; }
.ladder-row .ladder-step[aria-pressed="true"] { background: var(--lv); border-color: var(--lv); }
.ladder-row .ladder-step[aria-pressed="true"] .ladder-lv, .ladder-row .ladder-step[aria-pressed="true"] .ladder-focus { color: var(--surface); }
.unit-card .spiral-tag { margin-bottom: 2px; }
@media (max-width: 1020px) { .spiral-card { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .ladder { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ladder li .ladder-step { min-height: 0 !important; } }

/* ---------- Editar temática ---------- */
.ed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-block: 16px; }
.ed-head h3 { font-size: 26px; font-weight: 800; }
.ed-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ed-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ed-card.wide { grid-column: 1 / -1; }
.ed-card.changed { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.ed-card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ed-card-head h3 { font-size: 18px; }
.ed-count { font-size: 13px; color: var(--muted); font-family: var(--f-num); }
.ed-changed, .ed-restore { display: none; }
.ed-card.changed .ed-changed { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.ed-card.changed .ed-restore { display: inline; margin-left: auto; font-size: 13.5px; }
.ed-card textarea { font-size: 14.5px; }
.ed-card #ed-wheel-name { font-weight: 700; }
.rp-edit { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0 0 10px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rp-edit legend { font-weight: 700; padding: 0 6px; font-family: var(--f-display); }
.rp-remove { align-self: flex-start; font-size: 13.5px; color: var(--bad); }
.edited-tag { display: none; align-self: flex-start; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--hl) 45%, var(--surface)); color: var(--ink); }
.unit-card.is-edited .edited-tag { display: inline-block; }
.chip.edited { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); }
@media (max-width: 860px) { .ed-grid { grid-template-columns: 1fr; } }
#ed-msg:empty { display: none; }

/* ---------- Lista de temáticas + detalle ---------- */
.browser { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
.theme-list { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.list-level { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.list-level .level-badge { width: 34px; height: 34px; border-radius: 9px; font-size: 14px; }
.list-level b { display: block; font-family: var(--f-display); font-size: 15px; }
.list-level small { color: var(--muted); font-size: 12.5px; }
.theme-rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.theme-rows li + li { border-top: 1px solid var(--line); }
.theme-rows .unit-card { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 0; background: transparent; text-align: left; cursor: pointer; transform: none; box-shadow: none; flex-direction: row; }
.theme-rows .unit-card:hover { background: var(--sunk); transform: none; }
.theme-rows .unit-card[aria-pressed="true"] { background: color-mix(in srgb, var(--lv) 14%, var(--surface)); box-shadow: inset 4px 0 0 var(--lv); border: 0; }
.row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font: 700 15px/1.25 var(--f-display); }
.row-main .unit-es { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-tags { display: flex; gap: 4px; flex: none; }
.row-tags .spiral-tag, .row-tags .edited-tag { font-size: 10.5px; padding: 2px 6px; margin: 0; }
.row-chev { width: 16px; height: 16px; color: var(--muted); flex: none; }

.theme-detail { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px); max-height: calc(100vh - 24px); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.dt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.dt-title { display: flex; gap: 12px; align-items: center; min-width: 0; }
.dt-title .level-badge { background: var(--lv); }
.dt-title h3 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; }
.dt-title .unit-es { margin: 2px 0 0; }
.dt-stats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.dt-stats li { background: var(--paper); border-radius: 10px; padding: 10px; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; }
.dt-stats b { font: 700 22px/1.1 var(--f-num); color: var(--ink); }
.dt-sec { border-top: 1px solid var(--line); padding-top: 10px; }
.dt-sec summary { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; font: 700 17px/1.3 var(--f-display); padding: 4px 0; }
.dt-sec summary::-webkit-details-marker { display: none; }
.dt-sec summary span::before { content: "▸"; display: inline-block; width: 1.1em; color: var(--muted); transition: transform .15s; }
.dt-sec[open] summary span::before { transform: rotate(90deg); }
.dt-sec summary small { font: 400 13px/1 var(--f-body); color: var(--muted); }
.dt-table-wrap { overflow-x: auto; margin-top: 8px; }
.dt-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.dt-table th { text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); }
.dt-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dt-table td:first-child { font-weight: 700; }
.dt-table td:last-child { color: var(--muted); }
.dt-table tbody tr:nth-child(even) { background: var(--paper); }
.dt-list { margin: 8px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 5px; font-size: 15px; }
.dt-rp { background: var(--paper); border-radius: 12px; padding: 12px 14px; margin-top: 8px; }
.dt-rp h4 { margin: 0 0 8px; font: 700 16px/1.2 var(--f-display); }
.dt-rp-roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; font-size: 14px; }
.dt-rp-roles ul { margin: 4px 0 0; padding-left: 18px; }
.dt-label { margin: 12px 0 6px; font-weight: 700; font-size: 14px; }
.dt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-chips span { border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 14px; background: var(--paper); }
@media (max-width: 900px) {
  .browser { grid-template-columns: 1fr; }
  .theme-detail { position: static; max-height: none; }
  .dt-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dt-rp-roles { grid-template-columns: 1fr; }
}
.dt-badges .chip { max-width: 100%; white-space: normal; line-height: 1.35; }


/* =====================================================================
   Capa minimalista (rediseño): barra superior, menos color, menos texto
   ===================================================================== */
/* Un solo acento: los niveles ya no cambian el color de toda la página.
   Los niveles se distinguen por una escala de gris, de claro (A1) a oscuro (C2). */
:root, :root[data-level] { --lv-A1: #b7bcc4; --lv-A2: #9aa0a9; --lv-B1: #7c838d; --lv-B2: #5d646e; --lv-C1: #3e444c; --lv-C2: #141619; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]), :root[data-level]:not([data-theme="light"]) { --lv-A1: #4a5059; --lv-A2: #5f666f; --lv-B1: #767d87; --lv-B2: #8f96a0; --lv-C1: #b3b9c1; --lv-C2: #ebedf0; }
}
:root[data-theme="dark"], :root[data-theme="dark"][data-level] { --lv-A1: #4a5059; --lv-A2: #5f666f; --lv-B1: #767d87; --lv-B2: #8f96a0; --lv-C1: #b3b9c1; --lv-C2: #ebedf0; }
:root[data-level] { --accent: #0e6b62; }
@media (prefers-color-scheme: dark) { :root[data-level]:not([data-theme="light"]) { --accent: #4fbfae; } }
:root[data-theme="dark"][data-level] { --accent: #4fbfae; }

body { font-size: 15px; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { letter-spacing: -.02em; }

/* Shell */
.app { display: flex; flex-direction: column; min-height: 100%; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 8px 28px; flex-wrap: wrap;
  padding: 10px clamp(16px, 3vw, 32px); background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { padding: 0; gap: 10px; }
.topbar .brand b { font: 600 16px/1 var(--f-display); letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; font: 700 15px/1 var(--f-display); background: var(--ink); color: var(--surface); }
.topnav { display: flex; gap: 2px; }
.topnav button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font: 500 14.5px/1 var(--f-body); color: var(--muted); cursor: pointer; }
.topnav button:hover { color: var(--ink); background: var(--sunk); }
.topnav button[aria-current="page"] { color: var(--ink); background: var(--sunk); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.ctx-pill { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px 5px 6px; cursor: pointer; font-size: 13.5px; color: var(--ink); }
.ctx-pill:hover { border-color: var(--muted); }
.ctx-lv { font: 600 11.5px/1 var(--f-num); background: var(--ink); color: var(--surface); border-radius: 999px; padding: 4px 7px; }
.ctx-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who { margin: 0; gap: 8px; }
.who-avatar { width: 28px; height: 28px; font-size: 13px; background: var(--sunk); color: var(--ink); }
.who-name { font-weight: 500; font-size: 13.5px; }
.who .btn { border: 0; color: var(--muted); padding: 6px 8px; }

.main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px clamp(16px, 3vw, 32px) 56px; gap: 24px; }
.page-head h2, .view-head h2 { font: 600 clamp(26px, 3vw, 32px)/1.1 var(--f-display); }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.view-head p { display: none; } /* menos texto: el título basta */
.view-head { align-items: center; }
.fs-btn { color: var(--muted); }

/* Componentes más sobrios */
.stage { box-shadow: none; border-radius: var(--r-md); }
.btn { font-weight: 500; font-size: 14px; border-radius: 8px; padding: 8px 14px; }
.btn.big { font-size: 15.5px; padding: 12px 22px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.primary:hover { background: var(--ink); filter: none; opacity: .88; }
.seg { border-radius: 9px; }
.seg button { border-radius: 7px; font-weight: 500; }
.chip { font-weight: 500; }
.chip.gram { background: var(--hl); color: var(--hl-ink); }
.pill { font-weight: 500; }
.hint { font-size: 13.5px; }
.field > span, .field-label { font-weight: 500; letter-spacing: 0; }
.eyebrow { font-weight: 600; color: var(--muted); }
.level-badge { background: var(--sunk); color: var(--ink); font-family: var(--f-num); font-weight: 600; }
.spiral-tag { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 600; }
.edited-tag { background: var(--hl); color: var(--hl-ink); }
.hl { background: var(--hl); color: var(--hl-ink); }

/* Temáticas: filtros + lista + detalle */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .search { flex: 1 1 320px; max-width: none; height: 42px; border-radius: 10px; box-shadow: none; }
.level-filter button { font-family: var(--f-num); font-size: 13px; padding: 7px 11px; }
.level-filter button:first-child { font-family: var(--f-body); }
.browser { gap: 24px; }
@media (min-width: 901px) { .browser { grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); } }
.theme-list { gap: 18px; }
.list-level { margin: 0 0 6px 2px; }
.list-level .level-badge { width: auto; height: auto; padding: 3px 7px; border-radius: 6px; font-size: 12px; }
.list-level b { font: 600 13px/1.2 var(--f-body); color: var(--muted); }
.list-level small { display: none; }
.list-level > div { display: flex; align-items: baseline; gap: 8px; }
.theme-rows { border-radius: 10px; }
.theme-rows .unit-card { padding: 11px 12px; }
.theme-rows .unit-card[aria-pressed="true"] { background: var(--sunk); box-shadow: inset 2px 0 0 var(--accent); }
.row-main b { font: 500 14.5px/1.3 var(--f-body); }
.theme-detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: clamp(18px, 2.4vw, 28px); gap: 18px; }
.dt-title .level-badge { background: var(--sunk); color: var(--ink); width: 40px; height: 40px; border-radius: 10px; font-size: 14px; }
.dt-title h3 { font: 600 clamp(22px, 2.6vw, 28px)/1.15 var(--f-display); }
.dt-stats { gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.dt-stats li { background: none; border-radius: 0; padding: 10px 12px; }
.dt-stats li + li { border-left: 1px solid var(--line); }
.dt-stats b { font: 600 20px/1.1 var(--f-num); }
.dt-sec summary { font: 600 15px/1.3 var(--f-body); }
.dt-table tbody tr:nth-child(even) { background: none; }
.dt-table td:first-child { font-weight: 500; }
.dt-rp { background: var(--paper); border: 1px solid var(--line); }
.dt-ladder .dt-label { display: block; margin: 0 0 8px; color: var(--muted); font-weight: 500; font-size: 13px; }

/* Peldaños por nivel: neutros, el seleccionado con el acento */
.ladder-step { border-top-color: var(--lv); background: var(--surface); }
.ladder-lv { color: var(--ink); font: 600 14px/1 var(--f-num); }
.ladder-row .ladder-step[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
.ladder-row .ladder-step[aria-pressed="true"] .ladder-lv, .ladder-row .ladder-step[aria-pressed="true"] .ladder-focus { color: var(--surface); }

/* Herramientas */
.tool-groups { display: flex; flex-direction: column; gap: 24px; }
.home-group h3 { font: 600 12px/1 var(--f-body); letter-spacing: .08em; color: var(--muted); }
.cards { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.tool-card { padding: 14px; border-radius: 10px; flex-direction: row; align-items: center; gap: 12px; }
.tool-card:hover { transform: none; border-color: var(--ink); }
.tool-card .ic { width: 34px; height: 34px; border-radius: 8px; color: var(--ink); flex: none; }
.tool-card b { font: 500 15px/1.2 var(--f-body); }
.tool-card span:last-child { display: none; } /* sin descripción: menos texto */

/* Plan de clase */
.cl-hero h2 { font: 600 clamp(30px, 4vw, 42px)/1.05 var(--f-display); }
.cl-stage-n { background: var(--sunk); color: var(--ink); }
.cl-stage-head h3 { font: 600 19px/1.2 var(--f-display); }
.act { border-width: 1px; border-radius: 12px; }
.act.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.act-ic { background: var(--sunk); color: var(--ink); }
.act h4 { font: 600 15.5px/1.25 var(--f-body); }
.act p { font-size: 13.5px; }
.act.on .act-add { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.plan-card { --pc-bg: #141619; --pc-row: #23272c; --pc-muted: #a9afb8; border-radius: 14px; }
.plan-card h3 { font: 600 19px/1.2 var(--f-display); }

/* Editor */
.ed-card.changed { border-color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.ed-card-head h3 { font: 600 15.5px/1.2 var(--f-body); }

/* Login, a tono */
.auth { --night: #141619; }
.auth-pitch h1 { font-weight: 600; letter-spacing: -.04em; }
.auth-side { background-image: none; }
.auth-facts b { color: #7fd6c8; font-weight: 600; }
.auth-side .brand-mark { background: #ffffff; color: #141619; }
.auth-side .hl { background: #1f4d47; color: #e6fbf7; }

@media (max-width: 760px) {
  .topbar { gap: 8px 12px; }
  .topnav { order: 3; width: 100%; overflow-x: auto; }
  .ctx-pill { max-width: 160px; }
  .who-name { display: none; }
  .main { padding-top: 22px; }
}
.ladder-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.ladder-row .ladder-step { flex: none; }
@media (max-width: 640px) { .ladder-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* =====================================================================
   Paleta pastel & nude (sobre la estructura minimalista)
   Base arena/marfil, texto cacao, acento palo de rosa y un pastel por nivel.
   ===================================================================== */
:root, :root[data-level] {
  --paper: #f5efe9;
  --surface: #fffcf9;
  --sunk: #efe6de;
  --ink: #3a2f2b;
  --muted: #8c7d75;
  --line: #e8ddd3;
  --accent: #b0706b;
  --accent-ink: #fffcf9;
  --hl: #f6ddcf;
  --hl-ink: #3a2f2b;
  --good: #5e8a5a;
  --bad: #c0584f;
  --board: #fffdfa;
  --board-line: #eadfd4;
  --cocoa: #3a2f2b;
  --cocoa-row: #4a3d38;
  --cocoa-muted: #cdbdb4;
  --lv-A1: #f4cfca; --lv-A2: #f7d9bf; --lv-B1: #f0e2ac; --lv-B2: #cfe0c9; --lv-C1: #c9dbeb; --lv-C2: #dccfeb;
  --lv-ink: #3a2f2b;
  --shadow: 0 1px 2px rgb(58 47 43 / .05), 0 6px 18px rgb(58 47 43 / .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]), :root[data-level]:not([data-theme="light"]) {
    --paper: #1d1916; --surface: #25201d; --sunk: #2f2925; --ink: #f2e8e1; --muted: #b5a69d; --line: #3b332e;
    --accent: #e3a7a1; --accent-ink: #1d1916; --hl: #5a4136; --hl-ink: #f8ede6;
    --good: #9cc795; --bad: #f08f86; --board: #fffdfa; --board-line: #eadfd4;
    --cocoa: #120f0d; --cocoa-row: #2a2421; --cocoa-muted: #b5a69d;
    --lv-A1: #6d4744; --lv-A2: #6e5038; --lv-B1: #66592f; --lv-B2: #455a42; --lv-C1: #3f5468; --lv-C2: #54476a;
    --lv-ink: #f8ede6;
    --shadow: 0 1px 2px rgb(0 0 0 / .3);
  }
}
:root[data-theme="dark"], :root[data-theme="dark"][data-level] {
  --paper: #1d1916; --surface: #25201d; --sunk: #2f2925; --ink: #f2e8e1; --muted: #b5a69d; --line: #3b332e;
  --accent: #e3a7a1; --accent-ink: #1d1916; --hl: #5a4136; --hl-ink: #f8ede6;
  --good: #9cc795; --bad: #f08f86; --board: #fffdfa; --board-line: #eadfd4;
  --cocoa: #120f0d; --cocoa-row: #2a2421; --cocoa-muted: #b5a69d;
  --lv-A1: #6d4744; --lv-A2: #6e5038; --lv-B1: #66592f; --lv-B2: #455a42; --lv-C1: #3f5468; --lv-C2: #54476a;
  --lv-ink: #f8ede6;
  --shadow: 0 1px 2px rgb(0 0 0 / .3);
}

/* Barra superior y botones */
.topbar { background: color-mix(in srgb, var(--paper) 86%, transparent); }
.brand-mark { background: var(--accent); color: var(--accent-ink); border-radius: 9px; }
.topnav button[aria-current="page"] { background: var(--hl); color: var(--hl-ink); }
.btn { border-radius: 999px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.seg { background: var(--sunk); border-radius: 999px; }
.seg button { border-radius: 999px; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgb(58 47 43 / .12); }
.search, .filters .search { background: var(--surface); border-radius: 999px; }
input[type="text"], input[type="number"], input[type="email"], input[type="password"], select, textarea { background: var(--surface); }

/* Niveles en pastel */
.level-badge, .list-level .level-badge, .dt-title .level-badge { background: var(--lv, var(--sunk)); color: var(--lv-ink); }
.ctx-lv { background: var(--hl); color: var(--hl-ink); }
.level-filter button[data-lv="A1"][aria-pressed="true"] { background: var(--lv-A1); color: var(--lv-ink); }
.level-filter button[data-lv="A2"][aria-pressed="true"] { background: var(--lv-A2); color: var(--lv-ink); }
.level-filter button[data-lv="B1"][aria-pressed="true"] { background: var(--lv-B1); color: var(--lv-ink); }
.level-filter button[data-lv="B2"][aria-pressed="true"] { background: var(--lv-B2); color: var(--lv-ink); }
.level-filter button[data-lv="C1"][aria-pressed="true"] { background: var(--lv-C1); color: var(--lv-ink); }
.level-filter button[data-lv="C2"][aria-pressed="true"] { background: var(--lv-C2); color: var(--lv-ink); }
.theme-rows { background: var(--surface); }
.theme-rows .unit-card[aria-pressed="true"] { background: color-mix(in srgb, var(--lv) 55%, var(--surface)); box-shadow: inset 3px 0 0 var(--accent); }
.theme-detail { background: var(--surface); box-shadow: var(--shadow); border-radius: 16px; }
.dt-stats li:nth-child(1) { background: color-mix(in srgb, var(--lv-A1) 45%, transparent); }
.dt-stats li:nth-child(2) { background: color-mix(in srgb, var(--lv-A2) 45%, transparent); }
.dt-stats li:nth-child(3) { background: color-mix(in srgb, var(--lv-B1) 45%, transparent); }
.dt-stats li:nth-child(4) { background: color-mix(in srgb, var(--lv-B2) 45%, transparent); }
.dt-stats li:nth-child(5) { background: color-mix(in srgb, var(--lv-C1) 45%, transparent); }
.dt-stats li + li { border-left-color: var(--surface); }
.dt-stats { border-color: transparent; }
.chip { background: var(--sunk); }
.chip.gram { background: var(--hl); color: var(--hl-ink); }
.spiral-tag { border-color: var(--line); color: var(--accent); }
.edited-tag { background: var(--lv-C2); color: var(--lv-ink); }

/* Escalera de niveles en pastel: el seleccionado se rellena con su color */
.ladder-step { border-top: 5px solid var(--lv); background: var(--surface); }
.ladder-row .ladder-step[aria-pressed="true"] { background: var(--lv); border-color: var(--lv); }
.ladder-row .ladder-step[aria-pressed="true"] .ladder-lv, .ladder-row .ladder-step[aria-pressed="true"] .ladder-focus { color: var(--lv-ink); }

/* Herramientas: íconos sobre pastel, alternando tonos */
.tool-card { background: var(--surface); border-radius: 14px; }
.tool-card:hover { border-color: var(--accent); }
.cards .tool-card:nth-child(6n+1) .ic { background: var(--lv-A1); }
.cards .tool-card:nth-child(6n+2) .ic { background: var(--lv-A2); }
.cards .tool-card:nth-child(6n+3) .ic { background: var(--lv-B1); }
.cards .tool-card:nth-child(6n+4) .ic { background: var(--lv-B2); }
.cards .tool-card:nth-child(6n+5) .ic { background: var(--lv-C1); }
.cards .tool-card:nth-child(6n+6) .ic { background: var(--lv-C2); }
.tool-card .ic { color: var(--lv-ink); }

/* Plan de clase: una etapa, un pastel */
.cl-stages > section:nth-child(1) { --stage: var(--lv-A1); } .cl-stages > section:nth-child(2) { --stage: var(--lv-A2); }
.cl-stages > section:nth-child(3) { --stage: var(--lv-B2); } .cl-stages > section:nth-child(4) { --stage: var(--lv-C1); }
.cl-stages > section:nth-child(5) { --stage: var(--lv-C2); }
.cl-stage-n { background: var(--stage, var(--sunk)); color: var(--lv-ink); }
.act-ic { background: var(--stage, var(--sunk)); color: var(--lv-ink); }
.act { background: var(--surface); border-radius: 16px; }
.act.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.act.on .act-add { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.plan-card { --pc-bg: var(--cocoa); --pc-row: var(--cocoa-row); --pc-muted: var(--cocoa-muted); border-radius: 18px; }
.plan-card .plan-go { background: var(--lv-A1); color: #3a2f2b; }
.class-bar { background: var(--cocoa); }
.class-bar .btn.primary { background: var(--lv-A1); color: #3a2f2b; border-color: var(--lv-A1); }
.cb-step { color: var(--lv-A2); }
.stage { background: var(--surface); border-radius: 16px; }
.ed-card { border-radius: 14px; }

/* Herramientas internas */
.mem-card .back { background-color: var(--accent); }
.player.lead { border-color: var(--lv-B1); box-shadow: inset 0 0 0 2px var(--lv-B1); }
.badge-lead { background: var(--lv-B1); color: var(--lv-ink); }
.target.good { border-color: var(--good); background: color-mix(in srgb, var(--lv-B2) 40%, transparent); }
.tile { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); border-radius: 12px; }
.die { border-color: var(--ink); box-shadow: 0 6px 0 var(--ink); }
.keyboard button.hit { background: var(--lv-B2); color: var(--lv-ink); border-color: var(--lv-B2); }
.qcard { background: color-mix(in srgb, var(--lv-A2) 30%, var(--surface)); border-color: transparent; }
.progress > div { background: var(--accent); }

/* Inicio de sesión en tonos cacao y pastel */
.auth { --night: #3a2f2b; --night-ink: #fbf3ee; }
.auth-side .brand-mark { background: #f4cfca; color: #3a2f2b; }
.auth-side .hl { background: #f4cfca; color: #3a2f2b; }
.auth-facts b { color: #f7d9bf; }
.auth-levels span:nth-child(1) { background: #f4cfca; } .auth-levels span:nth-child(2) { background: #f7d9bf; }
.auth-levels span:nth-child(3) { background: #f0e2ac; } .auth-levels span:nth-child(4) { background: #cfe0c9; }
.auth-levels span:nth-child(5) { background: #c9dbeb; } .auth-levels span:nth-child(6) { background: #dccfeb; }
.auth-levels span { color: #3a2f2b; border-color: transparent; }
.auth-main { background: var(--paper); }
.theme-detail > * { flex-shrink: 0; } /* el panel hace scroll; sus secciones no deben encogerse */

/* =====================================================================
   Paleta "arcoíris del MCER": los niveles recorren el círculo cromático
   de cálido (A1) a frío (C2). Base blanca cálida, texto azul marino.
   Cada nivel: relleno vivo (--lv), texto sobre relleno (--lv-ink),
   tono oscuro para texto (--lv-text) y tinte suave (--lv-soft).
   ===================================================================== */
:root, :root[data-level] {
  --paper: #faf9f6; --surface: #ffffff; --sunk: #f1f0ec; --ink: #1e2340; --muted: #646a82; --line: #e4e3de;
  --accent: #3a63d8; --accent-ink: #ffffff; --hl: #fcf2cf; --hl-ink: #1e2340;
  --good: #1c7a57; --bad: #c2412b; --board: #ffffff; --board-line: #dfe3ec;
  --cocoa: #1e2340; --cocoa-row: #2c3256; --cocoa-muted: #b9bfd6;
  --lv-A1: #f06449; --ink-A1: #ffffff; --text-A1: #c2412b; --soft-A1: #fde4df;
  --lv-A2: #f59e2f; --ink-A2: #2a1a05; --text-A2: #a85a0c; --soft-A2: #fdebd3;
  --lv-B1: #f2c230; --ink-B1: #2a2205; --text-B1: #806100; --soft-B1: #fcf2cf;
  --lv-B2: #2da67a; --ink-B2: #ffffff; --text-B2: #1c7a57; --soft-B2: #d7f1e6;
  --lv-C1: #3a63d8; --ink-C1: #ffffff; --text-C1: #2e50b8; --soft-C1: #dde5fa;
  --lv-C2: #8a4fc2; --ink-C2: #ffffff; --text-C2: #6e38a3; --soft-C2: #ebddf7;
  --shadow: 0 1px 2px rgb(30 35 64 / .05), 0 6px 18px rgb(30 35 64 / .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]), :root[data-level]:not([data-theme="light"]) {
    --paper: #12142a; --surface: #1a1d36; --sunk: #232746; --ink: #eef0fa; --muted: #a3a9c4; --line: #2e3356;
    --accent-ink: #12142a; --hl-ink: #eef0fa; --good: #5fd3a5; --bad: #ff8a78; --board: #ffffff; --board-line: #dfe3ec;
    --cocoa: #0b0d1c; --cocoa-row: #222645; --cocoa-muted: #a3a9c4;
    --lv-A1: #ff8a73; --ink-A1: #2a0e08; --text-A1: #ff9b86; --soft-A1: #4a2620;
    --lv-A2: #ffb35a; --ink-A2: #2a1a05; --text-A2: #ffbe73; --soft-A2: #4a3418;
    --lv-B1: #ffd75a; --ink-B1: #2a2205; --text-B1: #ffdd73; --soft-B1: #463c14;
    --lv-B2: #4fd3a0; --ink-B2: #062a1c; --text-B2: #6fdcb0; --soft-B2: #17402f;
    --lv-C1: #7d9bff; --ink-C1: #0b1640; --text-C1: #93acff; --soft-C1: #202d5c;
    --lv-C2: #c08cf0; --ink-C2: #24103a; --text-C2: #cba0f3; --soft-C2: #3a2554;
    --shadow: 0 1px 2px rgb(0 0 0 / .3);
  }
}
:root[data-theme="dark"], :root[data-theme="dark"][data-level] {
  --paper: #12142a; --surface: #1a1d36; --sunk: #232746; --ink: #eef0fa; --muted: #a3a9c4; --line: #2e3356;
  --accent-ink: #12142a; --hl-ink: #eef0fa; --good: #5fd3a5; --bad: #ff8a78; --board: #ffffff; --board-line: #dfe3ec;
  --cocoa: #0b0d1c; --cocoa-row: #222645; --cocoa-muted: #a3a9c4;
  --lv-A1: #ff8a73; --ink-A1: #2a0e08; --text-A1: #ff9b86; --soft-A1: #4a2620;
  --lv-A2: #ffb35a; --ink-A2: #2a1a05; --text-A2: #ffbe73; --soft-A2: #4a3418;
  --lv-B1: #ffd75a; --ink-B1: #2a2205; --text-B1: #ffdd73; --soft-B1: #463c14;
  --lv-B2: #4fd3a0; --ink-B2: #062a1c; --text-B2: #6fdcb0; --soft-B2: #17402f;
  --lv-C1: #7d9bff; --ink-C1: #0b1640; --text-C1: #93acff; --soft-C1: #202d5c;
  --lv-C2: #c08cf0; --ink-C2: #24103a; --text-C2: #cba0f3; --soft-C2: #3a2554;
  --shadow: 0 1px 2px rgb(0 0 0 / .3);
}
/* Elementos marcados con un nivel */
.lv-A1 { --lv: var(--lv-A1); --lv-ink: var(--ink-A1); --lv-text: var(--text-A1); --lv-soft: var(--soft-A1); }
.lv-A2 { --lv: var(--lv-A2); --lv-ink: var(--ink-A2); --lv-text: var(--text-A2); --lv-soft: var(--soft-A2); }
.lv-B1 { --lv: var(--lv-B1); --lv-ink: var(--ink-B1); --lv-text: var(--text-B1); --lv-soft: var(--soft-B1); }
.lv-B2 { --lv: var(--lv-B2); --lv-ink: var(--ink-B2); --lv-text: var(--text-B2); --lv-soft: var(--soft-B2); }
.lv-C1 { --lv: var(--lv-C1); --lv-ink: var(--ink-C1); --lv-text: var(--text-C1); --lv-soft: var(--soft-C1); }
.lv-C2 { --lv: var(--lv-C2); --lv-ink: var(--ink-C2); --lv-text: var(--text-C2); --lv-soft: var(--soft-C2); }
/* La página toma el color del nivel activo */
:root[data-level="A1"] { --accent: var(--text-A1); --accent-fill: var(--lv-A1); --accent-fill-ink: var(--ink-A1); --hl: var(--soft-A1); }
:root[data-level="A2"] { --accent: var(--text-A2); --accent-fill: var(--lv-A2); --accent-fill-ink: var(--ink-A2); --hl: var(--soft-A2); }
:root[data-level="B1"] { --accent: var(--text-B1); --accent-fill: var(--lv-B1); --accent-fill-ink: var(--ink-B1); --hl: var(--soft-B1); }
:root[data-level="B2"] { --accent: var(--text-B2); --accent-fill: var(--lv-B2); --accent-fill-ink: var(--ink-B2); --hl: var(--soft-B2); }
:root[data-level="C1"] { --accent: var(--text-C1); --accent-fill: var(--lv-C1); --accent-fill-ink: var(--ink-C1); --hl: var(--soft-C1); }
:root[data-level="C2"] { --accent: var(--text-C2); --accent-fill: var(--lv-C2); --accent-fill-ink: var(--ink-C2); --hl: var(--soft-C2); }

/* Shell */
.topbar { background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: inset 0 -3px 0 var(--accent-fill, var(--accent)); border-bottom: 0; }
.brand-mark { background: var(--ink); color: var(--surface); }
.topnav button[aria-current="page"] { background: var(--hl); color: var(--ink); }
.ctx-lv { background: var(--accent-fill, var(--accent)); color: var(--accent-fill-ink, #fff); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.search, .filters .search { background: var(--surface); }

/* Niveles: relleno vivo + texto que contrasta */
.level-badge, .list-level .level-badge, .dt-title .level-badge { background: var(--lv, var(--sunk)); color: var(--lv-ink, var(--ink)); }
.list-level b { color: var(--lv-text, var(--muted)); }
.level-filter button[data-lv="A1"][aria-pressed="true"] { background: var(--lv-A1); color: var(--ink-A1); }
.level-filter button[data-lv="A2"][aria-pressed="true"] { background: var(--lv-A2); color: var(--ink-A2); }
.level-filter button[data-lv="B1"][aria-pressed="true"] { background: var(--lv-B1); color: var(--ink-B1); }
.level-filter button[data-lv="B2"][aria-pressed="true"] { background: var(--lv-B2); color: var(--ink-B2); }
.level-filter button[data-lv="C1"][aria-pressed="true"] { background: var(--lv-C1); color: var(--ink-C1); }
.level-filter button[data-lv="C2"][aria-pressed="true"] { background: var(--lv-C2); color: var(--ink-C2); }
.theme-rows .unit-card[aria-pressed="true"] { background: var(--lv-soft); box-shadow: inset 4px 0 0 var(--lv); }
.theme-detail { border-top: 6px solid var(--lv); }
.dt-stats li:nth-child(1) { background: var(--soft-A1); } .dt-stats li:nth-child(2) { background: var(--soft-A2); }
.dt-stats li:nth-child(3) { background: var(--soft-B1); } .dt-stats li:nth-child(4) { background: var(--soft-B2); }
.dt-stats li:nth-child(5) { background: var(--soft-C1); }
.chip.gram { background: var(--lv-soft, var(--hl)); color: var(--ink); }
.spiral-tag { color: var(--muted); }
.edited-tag { background: var(--soft-C2); color: var(--text-C2); }
.ladder-step { border-top: 5px solid var(--lv); }
.ladder-lv { color: var(--lv-text); }
.ladder-row .ladder-step[aria-pressed="true"] { background: var(--lv); border-color: var(--lv); }
.ladder-row .ladder-step[aria-pressed="true"] .ladder-lv, .ladder-row .ladder-step[aria-pressed="true"] .ladder-focus { color: var(--lv-ink); }

/* Herramientas: íconos de colores */
.cards .tool-card:nth-child(6n+1) .ic { background: var(--soft-A1); color: var(--text-A1); }
.cards .tool-card:nth-child(6n+2) .ic { background: var(--soft-A2); color: var(--text-A2); }
.cards .tool-card:nth-child(6n+3) .ic { background: var(--soft-B1); color: var(--text-B1); }
.cards .tool-card:nth-child(6n+4) .ic { background: var(--soft-B2); color: var(--text-B2); }
.cards .tool-card:nth-child(6n+5) .ic { background: var(--soft-C1); color: var(--text-C1); }
.cards .tool-card:nth-child(6n+6) .ic { background: var(--soft-C2); color: var(--text-C2); }
.tool-card:hover { border-color: var(--accent); }

/* Plan de clase: cada etapa con su color */
.cl-stages > section:nth-child(1) { --stage: var(--soft-A1); --stage-ink: var(--text-A1); } .cl-stages > section:nth-child(2) { --stage: var(--soft-A2); --stage-ink: var(--text-A2); }
.cl-stages > section:nth-child(3) { --stage: var(--soft-B2); --stage-ink: var(--text-B2); } .cl-stages > section:nth-child(4) { --stage: var(--soft-C1); --stage-ink: var(--text-C1); }
.cl-stages > section:nth-child(5) { --stage: var(--soft-C2); --stage-ink: var(--text-C2); }
.cl-stage-n, .act-ic { background: var(--stage, var(--sunk)); color: var(--stage-ink, var(--ink)); }
.act.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.act.on .act-add { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.plan-card .plan-go { background: var(--lv-B1); color: var(--ink-B1); }
.class-bar .btn.primary { background: var(--lv-B1); color: var(--ink-B1); border-color: var(--lv-B1); }
.cb-step { color: var(--lv-B1); }

/* Juegos */
.player.lead { border-color: var(--lv-B1); box-shadow: inset 0 0 0 2px var(--lv-B1); }
.badge-lead { background: var(--lv-B1); color: var(--ink-B1); }
.keyboard button.hit { background: var(--lv-B2); color: var(--ink-B2); border-color: var(--lv-B2); }
.target.good { background: var(--soft-B2); }
.qcard { background: var(--hl); }

/* Inicio de sesión: marino con los seis colores */
.auth { --night: #1e2340; --night-ink: #f4f5fb; }
.auth-side .brand-mark { background: #f2c230; color: #2a2205; }
.auth-side .hl { background: #f2c230; color: #2a2205; }
.auth-facts b { color: #f2c230; }
.auth-levels span:nth-child(1) { background: #f06449; color: #fff; } .auth-levels span:nth-child(2) { background: #f59e2f; color: #2a1a05; }
.auth-levels span:nth-child(3) { background: #f2c230; color: #2a2205; } .auth-levels span:nth-child(4) { background: #2da67a; color: #fff; }
.auth-levels span:nth-child(5) { background: #3a63d8; color: #fff; } .auth-levels span:nth-child(6) { background: #8a4fc2; color: #fff; }

/* En modo oscuro también manda el color del nivel */
@media (prefers-color-scheme: dark) {
  :root[data-level="A1"]:not([data-theme="light"]) { --accent: var(--text-A1); --accent-fill: var(--lv-A1); --accent-fill-ink: var(--ink-A1); --hl: var(--soft-A1); }
  :root[data-level="A2"]:not([data-theme="light"]) { --accent: var(--text-A2); --accent-fill: var(--lv-A2); --accent-fill-ink: var(--ink-A2); --hl: var(--soft-A2); }
  :root[data-level="B1"]:not([data-theme="light"]) { --accent: var(--text-B1); --accent-fill: var(--lv-B1); --accent-fill-ink: var(--ink-B1); --hl: var(--soft-B1); }
  :root[data-level="B2"]:not([data-theme="light"]) { --accent: var(--text-B2); --accent-fill: var(--lv-B2); --accent-fill-ink: var(--ink-B2); --hl: var(--soft-B2); }
  :root[data-level="C1"]:not([data-theme="light"]) { --accent: var(--text-C1); --accent-fill: var(--lv-C1); --accent-fill-ink: var(--ink-C1); --hl: var(--soft-C1); }
  :root[data-level="C2"]:not([data-theme="light"]) { --accent: var(--text-C2); --accent-fill: var(--lv-C2); --accent-fill-ink: var(--ink-C2); --hl: var(--soft-C2); }
}
:root[data-theme="dark"][data-level="A1"] { --accent: var(--text-A1); --accent-fill: var(--lv-A1); --accent-fill-ink: var(--ink-A1); --hl: var(--soft-A1); }
:root[data-theme="dark"][data-level="A2"] { --accent: var(--text-A2); --accent-fill: var(--lv-A2); --accent-fill-ink: var(--ink-A2); --hl: var(--soft-A2); }
:root[data-theme="dark"][data-level="B1"] { --accent: var(--text-B1); --accent-fill: var(--lv-B1); --accent-fill-ink: var(--ink-B1); --hl: var(--soft-B1); }
:root[data-theme="dark"][data-level="B2"] { --accent: var(--text-B2); --accent-fill: var(--lv-B2); --accent-fill-ink: var(--ink-B2); --hl: var(--soft-B2); }
:root[data-theme="dark"][data-level="C1"] { --accent: var(--text-C1); --accent-fill: var(--lv-C1); --accent-fill-ink: var(--ink-C1); --hl: var(--soft-C1); }
:root[data-theme="dark"][data-level="C2"] { --accent: var(--text-C2); --accent-fill: var(--lv-C2); --accent-fill-ink: var(--ink-C2); --hl: var(--soft-C2); }

/* ---------- Inicio de sesión: arcoíris del MCER ---------- */
.auth { --night: #1e2340; --night-ink: #f4f5fb; }
.auth-side { background: #1e2340; background-image: radial-gradient(circle at 85% 8%, rgb(58 99 216 / .35), transparent 45%), radial-gradient(circle at 8% 92%, rgb(240 100 73 / .22), transparent 40%); }
.auth-side .brand-mark { background: #f2c230; color: #2a2205; }
.auth-pitch h1 { font-weight: 700; }
.auth-side .hl { background: #f2c230; color: #2a2205; border-radius: 6px; padding: 0 .12em; }
.auth-facts li { border-top-color: rgb(255 255 255 / .14); }
.auth-facts li:nth-child(1) b { color: #ff8a73; }
.auth-facts li:nth-child(2) b { color: #ffd75a; }
.auth-facts li:nth-child(3) b { color: #4fd3a0; }

/* Escalera de niveles: cada peldaño más alto, de coral a ciruela */
.auth-stairs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; align-items: end; }
.auth-stairs li { background: var(--lv); color: var(--lv-ink); border-radius: 10px 10px 4px 4px; padding: 10px 8px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 0; }
.auth-stairs li:nth-child(1) { height: 64px; } .auth-stairs li:nth-child(2) { height: 84px; } .auth-stairs li:nth-child(3) { height: 104px; }
.auth-stairs li:nth-child(4) { height: 124px; } .auth-stairs li:nth-child(5) { height: 144px; } .auth-stairs li:nth-child(6) { height: 164px; }
.auth-stairs b { font: 600 17px/1 var(--f-num); }
.auth-stairs span { font-size: 11.5px; line-height: 1.2; overflow-wrap: anywhere; opacity: .9; }
.auth-side .lv-A1 { --lv: #f06449; --lv-ink: #ffffff; } .auth-side .lv-A2 { --lv: #f59e2f; --lv-ink: #2a1a05; }
.auth-side .lv-B1 { --lv: #f2c230; --lv-ink: #2a2205; } .auth-side .lv-B2 { --lv: #2da67a; --lv-ink: #ffffff; }
.auth-side .lv-C1 { --lv: #3a63d8; --lv-ink: #ffffff; } .auth-side .lv-C2 { --lv: #8a4fc2; --lv-ink: #ffffff; }

/* Formulario */
.auth-main { background: var(--paper); }
.auth-card { background: var(--surface); border-radius: 18px; padding: clamp(22px, 3vw, 34px); box-shadow: 0 1px 2px rgb(30 35 64 / .05), 0 18px 40px rgb(30 35 64 / .08); position: relative; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px;
  background: linear-gradient(90deg, #f06449 0 16.66%, #f59e2f 16.66% 33.33%, #f2c230 33.33% 50%, #2da67a 50% 66.66%, #3a63d8 66.66% 83.33%, #8a4fc2 83.33%); }
.auth-tabs button[aria-pressed="true"] { color: var(--ink); }
.auth-form h2 { font-weight: 700; }
.auth-form input:focus { border-color: #3a63d8; outline: none; box-shadow: 0 0 0 3px rgb(58 99 216 / .18); }
.auth-form .btn.primary { background: #1e2340; border-color: #1e2340; color: #ffffff; border-radius: 12px; }
.auth .link { color: #2e50b8; }
.auth-note { border-top-color: var(--line); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-form .btn.primary { background: #ffd75a; border-color: #ffd75a; color: #2a2205; }
  :root:not([data-theme="light"]) .auth .link { color: #93acff; }
}
:root[data-theme="dark"] .auth-form .btn.primary { background: #ffd75a; border-color: #ffd75a; color: #2a2205; }
:root[data-theme="dark"] .auth .link { color: #93acff; }
@media (max-width: 860px) {
  .auth-stairs { display: grid; }
  .auth-stairs li { height: auto !important; padding: 8px 6px; }
  .auth-stairs span { display: none; }
}

/* ---------- Imágenes en flashcards y memorice ---------- */
.flash { aspect-ratio: 4 / 3; max-width: 560px; }
.flash .face { gap: 6px; }
.fc-img { width: 100%; height: 52%; display: grid; place-items: center; }
.fc-img[hidden] { display: none !important; }
.fc-img img { max-width: 78%; max-height: 100%; object-fit: contain; border-radius: 12px; box-shadow: 0 2px 10px rgb(30 35 64 / .12); background: #fff; }
.fc-emoji { font-size: clamp(64px, 11vw, 120px); line-height: 1; filter: drop-shadow(0 4px 6px rgb(30 35 64 / .12)); }
.flash.has-img .face b { font-size: clamp(26px, 4vw, 44px); }
.stage:fullscreen .flash, .stage.presenting .flash { max-width: min(80vw, 110vh); }
.fc-img-tools .btn { border-radius: 999px; }
.mem-card .front.pic { padding: 6px; }
.mem-card .front.pic img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.mem-emoji { font-size: clamp(30px, 5vw, 52px); line-height: 1; }
.wd-drop { display: flex; gap: 14px; align-items: center; border: 2px dashed var(--line); border-radius: 12px; padding: 12px; }
.wd-drop.over { border-color: var(--accent); background: var(--hl); }
.wd-preview { width: 84px; height: 84px; flex: none; border-radius: 10px; background: var(--sunk); display: grid; place-items: center; overflow: hidden; font-size: 44px; }
.wd-preview img { width: 100%; height: 100%; object-fit: cover; }
.wd-preview .hint { font-size: 11px; text-align: center; }
#wd-msg:empty { display: none; }
.fc-img { min-height: 0; overflow: hidden; }
.fc-img img { height: 100%; width: auto; max-width: 85%; max-height: none; }
.fc-img { padding: 4px 0; }
.fc-img img { width: 100%; height: 100%; max-width: 100%; object-fit: contain; box-shadow: none; background: transparent; border-radius: 10px; }
/* La imagen se ajusta dentro de su caja (flex resuelve bien la altura en %) */
.fc-img { display: flex; align-items: center; justify-content: center; }
.fc-img img { width: auto; height: auto; max-width: 100%; max-height: 100%; }

/* =====================================================================
   Módulos nuevos: alumnos, agenda, bitácora, ejercicios y contenido
   ===================================================================== */
.row-between { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.empty { padding: 28px 16px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.empty b { font-family: var(--f-display); font-size: 17px; }
.emo { font-size: 1em; line-height: 1; }
.student-pill .icon { width: 15px; height: 15px; }
.student-pill { background: var(--soft-B2); border-color: transparent; padding-left: 10px; }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { font: 600 24px/1.1 var(--f-num); }
.kpi:nth-child(1) { box-shadow: inset 0 4px 0 var(--lv-A1); } .kpi:nth-child(2) { box-shadow: inset 0 4px 0 var(--lv-B1); }
.kpi:nth-child(3) { box-shadow: inset 0 4px 0 var(--lv-C2); } .kpi:nth-child(4) { box-shadow: inset 0 4px 0 var(--lv-B2); }

/* Agenda */
.agenda-card { display: flex; flex-direction: column; gap: 12px; }
.agenda-card h3 { font: 600 17px/1.2 var(--f-display); }
.ag-form { display: grid; grid-template-columns: 2fr 2fr 1fr 1fr auto; gap: 10px; align-items: end; background: var(--paper); padding: 12px; border-radius: 12px; }
.ag-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) minmax(110px, 1.2fr) minmax(100px, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ag-row:last-child { border-bottom: 0; }
.ag-row.realizada .ag-date { color: var(--good); }
.ag-row.cancelada { opacity: .55; }
.ag-row.cancelada .ag-name { text-decoration: line-through; }
.ag-date { font-family: var(--f-num); font-size: 13px; text-transform: capitalize; }
.ag-row select { width: auto; padding: 5px 8px; font-size: 13px; }
.ag-sub { margin: 10px 0 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.link { font-size: 13.5px; }

/* Alumnos: lista + ficha */
.students { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 20px; align-items: start; }
.st-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--ink); }
.st-row:hover { background: var(--sunk); }
.st-row[aria-pressed="true"] { background: var(--lv-soft); box-shadow: inset 4px 0 0 var(--lv); }
.st-row .level-badge { width: 32px; height: 32px; border-radius: 8px; font-size: 12.5px; flex: none; }
.st-detail { display: flex; flex-direction: column; gap: 16px; border-top: 6px solid var(--lv, var(--line)); min-width: 0; }
.st-tabs { align-self: flex-start; }
.st-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.st-form .wide { grid-column: 1 / -1; }
.log-entry { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; background: var(--surface); }
.log-entry summary { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; cursor: pointer; }
.log-entry summary small { color: var(--muted); margin-left: auto; }
.log-entry p, .log-entry ul { margin: 8px 0 0; font-size: 14px; }
.err-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.err-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; border-radius: 10px; background: var(--paper); font-size: 14.5px; }
.err-list small { color: var(--muted); margin-left: auto; }
.wrong { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.wrong::before { content: "✗ "; text-decoration: none; display: inline-block; }
.right { color: var(--good); font-weight: 600; }
.right::before { content: "✓ "; }

/* Bitácora */
.log-fab { position: fixed; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 45;
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--ink); color: var(--surface); font: 600 14px/1 var(--f-body); box-shadow: 0 8px 24px rgb(30 35 64 / .25); }
.log-fab .icon { width: 17px; height: 17px; }
.log-count { background: var(--lv-A1); color: var(--ink-A1); border-radius: 999px; padding: 2px 7px; font: 600 12px/1.3 var(--f-num); }
.log-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 46; width: min(400px, 100vw); background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px rgb(30 35 64 / .12); padding: calc(16px + env(safe-area-inset-top, 0px)) 18px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.log-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.log-head h2 { font: 600 20px/1.2 var(--f-display); }
.log-sec h3 { font: 600 14px/1.2 var(--f-body); margin-bottom: 8px; }
.log-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }
.log-add input { padding: 8px 10px; font-size: 14px; min-width: 0; }
.log-items { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.log-items li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 6px 10px; background: var(--paper); border-radius: 8px; font-size: 14px; }
.log-items li .link { margin-left: auto; }
.log-foot { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); padding-top: 10px; }
.log-foot .btn.primary { margin-left: auto; }
body.log-open .log-fab { display: none; }

/* Plan de clase: plantillas y planes guardados */
.tpl-select { width: auto; border-radius: 999px; height: 48px; padding: 0 16px; font-weight: 500; }
.plan-actions { justify-content: center; }
.saved-plans h4 { margin: 8px 0 6px; font: 600 13px/1 var(--f-body); color: var(--pc-muted); }
.saved-plans ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.saved-plans li { display: flex; gap: 4px; }
.sp-load { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; border: 0; border-radius: 10px; padding: 8px 10px; background: var(--pc-row); color: var(--pc-ink); cursor: pointer; font-size: 13.5px; }
.sp-load small { color: var(--pc-muted); font-size: 12px; }
.sp-del { border: 0; background: none; color: var(--pc-muted); cursor: pointer; font-size: 16px; padding: 0 6px; }

/* Quiz y diagnóstico */
.quiz, .diag { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 10px 0; }
.qz-top { display: flex; gap: 8px; }
.qz-prompt { font: 600 clamp(30px, 5vw, 52px)/1.15 var(--f-display); text-align: center; min-height: 1.3em; }
.qz-prompt.img { font-size: clamp(80px, 12vw, 140px); }
.qz-prompt img { max-height: 200px; max-width: 280px; border-radius: 12px; object-fit: contain; }
.qz-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: min(100%, 640px); }
.qz-opt { padding: 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font: 600 18px/1.25 var(--f-body); color: var(--ink); cursor: pointer; transition: border-color .15s, transform .1s; }
.qz-opt:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.qz-opt.right { background: var(--soft-B2); border-color: var(--lv-B2); }
.qz-opt.wrong { background: var(--soft-A1); border-color: var(--lv-A1); }
.qz-opt:disabled { cursor: default; }
.qz-end, .dg-result, .dg-intro { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 560px; }
.qz-score, .dg-level { font: 700 clamp(48px, 8vw, 80px)/1 var(--f-num); color: var(--accent); }
.dg-intro h3 { font: 600 24px/1.2 var(--f-display); }
.dg-q { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(100%, 680px); }
.dg-q .progress { width: 100%; }
.dg-sentence { font: 600 clamp(22px, 3vw, 30px)/1.3 var(--f-display); text-align: center; margin: 0; }
.dg-gap { color: var(--accent); }
.dg-skip { border-style: dashed; color: var(--muted); }
.dg-bars { list-style: none; padding: 0; margin: 6px 0; width: min(100%, 420px); display: flex; flex-direction: column; gap: 6px; }
.dg-bars li { display: grid; grid-template-columns: 34px 1fr 36px; gap: 10px; align-items: center; font: 600 13px/1 var(--f-num); }
.dg-bars div { height: 12px; background: var(--sunk); border-radius: 999px; overflow: hidden; }
.dg-bars i { display: block; height: 100%; background: var(--lv); border-radius: 999px; }

/* Completar */
.fb-bank { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; background: var(--hl); border-radius: 12px; margin: 14px 0; }
.fb-bank span { background: var(--surface); border-radius: 8px; padding: 5px 12px; font-weight: 600; }
.fb-list { margin: 0 0 16px; padding-left: 26px; display: flex; flex-direction: column; gap: 14px; font-size: clamp(17px, 2vw, 21px); line-height: 1.7; }
.fb-in { display: inline-block; width: auto; margin: 0 4px; padding: 3px 8px; border: 0; border-bottom: 2px solid var(--ink); border-radius: 4px 4px 0 0; background: var(--paper); font: inherit; font-weight: 600; text-align: center; }
.fb-in.good, .gr-in.good { background: var(--soft-B2); border-color: var(--lv-B2); }
.fb-in.bad, .gr-in.bad { background: var(--soft-A1); border-color: var(--lv-A1); }

/* Unir */
.match { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 12px 0; }
.mt-col { display: flex; flex-direction: column; gap: 8px; }
.mt-item { min-height: 56px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font: 600 17px/1.25 var(--f-body); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.mt-item.pic { font-size: 34px; }
.mt-item img { max-height: 64px; max-width: 100%; object-fit: contain; border-radius: 8px; }
.mt-item.sel { border-color: var(--ink); box-shadow: 0 0 0 3px var(--hl); }
.mt-item.done { cursor: default; }
.c0 { background: var(--soft-A1) !important; border-color: var(--lv-A1) !important; } .c1 { background: var(--soft-A2) !important; border-color: var(--lv-A2) !important; }
.c2 { background: var(--soft-B1) !important; border-color: var(--lv-B1) !important; } .c3 { background: var(--soft-B2) !important; border-color: var(--lv-B2) !important; }
.c4 { background: var(--soft-C1) !important; border-color: var(--lv-C1) !important; } .c5 { background: var(--soft-C2) !important; border-color: var(--lv-C2) !important; }
.shake { animation: shake .3s; }

/* Bingo */
.bingo-wrap { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 20px; align-items: start; margin: 14px 0; }
.bingo-call { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; background: var(--hl); border: 0; }
.bg-clue { font: 600 clamp(24px, 3vw, 34px)/1.2 var(--f-display); min-height: 1.4em; }
.bg-clue .emo { font-size: 72px; }
.bg-clue img { max-height: 140px; max-width: 100%; border-radius: 10px; }
.bg-list summary { cursor: pointer; font-size: 13px; }
.bingo-card { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 6px; }
.bg-cell { aspect-ratio: 1; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font: 600 clamp(12px, 1.5vw, 16px)/1.15 var(--f-body); color: var(--ink); cursor: pointer; padding: 6px; overflow-wrap: anywhere; }
.bg-cell.on { background: var(--accent-fill, var(--accent)); color: var(--accent-fill-ink, #fff); border-color: transparent; transform: rotate(-2deg); }

/* Sopa de letras */
.ws-wrap { display: grid; grid-template-columns: minmax(0, auto) minmax(160px, 1fr); gap: 24px; align-items: start; margin: 12px 0; }
.ws-grid { display: grid; grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr)); gap: 3px; width: min(100%, 560px); }
.ws-cell { aspect-ratio: 1; border: 0; border-radius: 6px; background: var(--paper); font: 600 clamp(12px, 1.7vw, 19px)/1 var(--f-num); color: var(--ink); cursor: pointer; padding: 0; }
.ws-cell:hover { background: var(--sunk); }
.ws-cell.start { background: var(--ink); color: var(--surface); }
.ws-words { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 17px; font-weight: 600; }
.ws-words li.found { text-decoration: line-through; color: var(--muted); }

/* Gramática */
.gr-sheet { display: flex; flex-direction: column; gap: 18px; margin-top: 16px; }
.gr-sheet .dt-title h3 { font: 600 clamp(24px, 3vw, 32px)/1.15 var(--f-display); }
.gr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.gr-grid section, .gr-practice { background: var(--paper); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.gr-sheet h4 { margin: 0 0 8px; font: 600 14px/1.2 var(--f-body); color: var(--lv-text, var(--accent)); text-transform: uppercase; letter-spacing: .06em; }
.gr-sheet ul, .gr-sheet ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15.5px; }
.gr-examples { list-style: none; padding-left: 0 !important; }
.gr-form th { width: 30%; font-size: 13px; color: var(--muted); text-transform: none; letter-spacing: 0; vertical-align: top; }
.gr-in { display: inline-block; width: auto; margin: 0 4px; padding: 2px 8px; border: 0; border-bottom: 2px solid var(--ink); border-radius: 4px 4px 0 0; background: var(--surface); font: inherit; font-weight: 600; }
.gr-practice .row { margin-top: 12px; }

/* Lectura */
.reading { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; }
.reading .dt-title h3 { font: 600 clamp(22px, 2.8vw, 30px)/1.15 var(--f-display); }
.rd-text { font-size: clamp(17px, 2vw, 21px); line-height: 1.75; max-width: 70ch; transition: filter .2s; }
.rd-text mark { padding: 0 2px; border-radius: 4px; }
.rd-text.blurred { filter: blur(7px); user-select: none; }
.rd-q { background: var(--paper); border-radius: 14px; padding: 14px 18px; }
.rd-q h4 { margin: 0 0 8px; font: 600 14px/1.2 var(--f-body); text-transform: uppercase; letter-spacing: .06em; color: var(--lv-text, var(--accent)); }
.rd-q ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.rd-q details { font-size: 14px; color: var(--muted); }
.rd-q summary { cursor: pointer; color: var(--accent); font-weight: 600; }

/* Banco de actividades */
.ac-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ac-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.ac-card.pick { border-color: var(--accent); box-shadow: 0 0 0 3px var(--hl); }
.ac-top { display: flex; justify-content: space-between; align-items: center; }
.ac-card h4 { margin: 0; font: 600 16.5px/1.25 var(--f-display); }
.ac-card p { margin: 0; font-size: 14px; color: var(--muted); flex-grow: 1; }
.ac-foot { justify-content: space-between; }

/* Tarea */
.hw-opts { margin-bottom: 12px; gap: 6px 18px; }
#hw-text { font: 14.5px/1.55 var(--f-num); background: var(--paper); margin-bottom: 12px; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .students, .bingo-wrap, .ws-wrap, .gr-grid { grid-template-columns: 1fr; }
  .ag-form { grid-template-columns: 1fr 1fr; }
  .ag-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .qz-options, .match, .st-form { grid-template-columns: 1fr; }
  .log-add { grid-template-columns: 1fr; }
}
.bingo-card { max-width: 560px; width: 100%; justify-self: center; }
.ws-wrap { grid-template-columns: minmax(0, 520px) minmax(160px, 1fr); }
.ws-grid { width: 100%; }
@media (max-width: 900px) { .ws-wrap { grid-template-columns: 1fr; } }

/* ---------- Temáticas propias ---------- */
.mine-tag { color: var(--text-B2); border-color: var(--lv-B2); }
.ed-custom .ed-restore, .ed-custom .ed-changed, .ed-custom #ed-reset-all { display: none !important; }
.ed-custom .ed-card.changed { border-color: var(--line); box-shadow: none; }
.ed-meta { background: var(--hl); border-color: transparent; }
#ed-rd-title { font-weight: 600; }
#td-msg:empty { display: none; }

/* ---------- Botón Volver ---------- */
.back-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 6px 10px 6px 4px; margin: -6px 0 -10px -4px; border-radius: 8px;
  color: var(--muted); font: 500 14px/1 var(--f-body); cursor: pointer; }
.back-link:hover { color: var(--ink); background: var(--sunk); }
.back-link .icon { width: 18px; height: 18px; }

/* ---------- Flashcards: vista de todas ---------- */
.fc-modebar { justify-content: space-between; }
.fc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stage:fullscreen .fc-grid, .stage.presenting .fc-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.fcg-card { position: relative; aspect-ratio: 4 / 4.4; perspective: 900px; }
.fcg-flip { width: 100%; height: 100%; border: 0; padding: 0; background: none; cursor: pointer; }
.fcg-flip .in { position: relative; display: block; width: 100%; height: 100%; transition: transform .4s ease; transform-style: preserve-3d; }
.fcg-card.flip .fcg-flip .in { transform: rotateY(180deg); }
.fcg-flip .face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px 10px; border-radius: 16px; backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; color: var(--ink); }
.fcg-flip .face b { font: 600 clamp(15px, 1.5vw, 19px)/1.2 var(--f-display); overflow-wrap: anywhere; }
.fcg-flip .back { transform: rotateY(180deg); background: var(--hl); border-color: transparent; }
.fcg-flip .back small { font: 600 11px/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.fcg-img { font-size: clamp(44px, 5vw, 60px); line-height: 1; height: 52%; display: flex; align-items: center; justify-content: center; width: 100%; }
.fcg-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; }
.fcg-open, .fcg-say { position: absolute; top: 8px; width: 30px; height: 30px; border-radius: 8px; border: 0; background: var(--sunk); color: var(--muted); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s; z-index: 2; }
.fcg-open { right: 8px; } .fcg-say { left: 8px; }
.fcg-open .icon, .fcg-say .icon { width: 16px; height: 16px; }
.fcg-card:hover .fcg-open, .fcg-card:hover .fcg-say, .fcg-open:focus-visible, .fcg-say:focus-visible { opacity: 1; }
@media (hover: none) { .fcg-open, .fcg-say { opacity: 1; } }
.fcg-open:hover, .fcg-say:hover { color: var(--ink); background: var(--line); }
.fcg-card.known .front { box-shadow: inset 0 0 0 2px var(--lv-B2); }

/* ---------- Modo sin temática ---------- */
.tools-scope button { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tools-scope button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
:root[data-level="Libre"] .ctx-lv { background: var(--ink); color: var(--surface); }

/* =====================================================================
   Plataforma: planes, aviso de prueba y estado de guardado
   ===================================================================== */
.setup-notice { border: 1px dashed var(--lv-A2); background: var(--soft-A2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.setup-notice code { background: var(--surface); padding: 1px 6px; border-radius: 4px; }
.auth-form .feedback.good { color: var(--good); }
.auth-form .check a { color: var(--accent); }

.paywall { min-height: 100%; background: var(--paper); display: grid; place-items: start center; padding: clamp(24px, 5vw, 56px) 16px; }
.paywall-inner { width: min(100%, 860px); display: flex; flex-direction: column; gap: 22px; }
.paywall-card { background: var(--surface); border-radius: 20px; padding: clamp(22px, 4vw, 40px); box-shadow: 0 1px 2px rgb(30 35 64 / .05), 0 18px 40px rgb(30 35 64 / .08); display: flex; flex-direction: column; gap: 18px; position: relative; overflow: hidden; }
.paywall-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px;
  background: linear-gradient(90deg, #f06449 0 16.66%, #f59e2f 16.66% 33.33%, #f2c230 33.33% 50%, #2da67a 50% 66.66%, #3a63d8 66.66% 83.33%, #8a4fc2 83.33%); }
.paywall-card h2 { font: 700 clamp(26px, 3.4vw, 36px)/1.15 var(--f-display); }
.pw-lead { margin: -8px 0 0; color: var(--muted); font-size: 16px; max-width: 60ch; }
.pw-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pw-plan { position: relative; border: 2px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.pw-plan.featured { border-color: var(--lv-C1); box-shadow: 0 0 0 4px var(--soft-C1); }
.pw-plan h3 { font: 600 18px/1.2 var(--f-display); }
.pw-badge { position: absolute; top: -12px; left: 18px; background: var(--lv-B1); color: var(--ink-B1); font: 600 12px/1 var(--f-body); padding: 5px 10px; border-radius: 999px; }
.pw-price { margin: 0; display: flex; align-items: baseline; gap: 6px; }
.pw-price b { font: 700 34px/1 var(--f-num); }
.pw-price span { color: var(--muted); }
.pw-plan .btn { margin-top: auto; width: 100%; text-decoration: none; }
.pw-features { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; font-size: 14.5px; }
.pw-features li::before { content: "✓ "; color: var(--good); font-weight: 700; }
.pw-current { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.pw-current .btn { text-decoration: none; }
.pw-foot { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; }

.trial-banner { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: var(--soft-B1); color: var(--ink); font-size: 14px; font-weight: 500; text-align: center; }
.trial-banner .btn { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.sync { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sync[data-state="error"] { color: var(--bad); font-weight: 600; }
.sync[data-state="pending"] { color: var(--muted); font-style: italic; }
@media (max-width: 760px) { .pw-plans, .pw-features { grid-template-columns: 1fr; } .sync { display: none; } }

/* La bitácora solo existe dentro de la plataforma, no en el inicio de sesión ni en los planes */
body:has(#app[hidden]) .log-fab, body.paywall-open .log-fab { display: none; }

/* ---------- Logo Profeloop: flechas en círculo ---------- */
.brand-mark svg { width: 62%; height: 62%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Logo Profeloop (imagen) ---------- */
.brand-logo { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo img { display: block; height: 26px; width: auto; }
.auth-side .brand-logo img { height: 36px; }
.paywall .brand-logo img { height: 32px; }
.logo-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none !important; }
  :root:not([data-theme="light"]) .logo-dark { display: block !important; }
}
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }

/* ---------- Títulos en Lexend (marca Profeloop) ---------- */
:root, :root[data-level] { --f-display: "Lexend", "Avenir Next", "Segoe UI", system-ui, sans-serif; }
.auth-pitch h1 { font-weight: 700; letter-spacing: -.03em; }

.auth-stairs span { overflow-wrap: normal; word-break: normal; hyphens: auto; -webkit-hyphens: auto; font-size: 11px; }

/* ---------- Lobby (sin temática elegida) ---------- */
.theme-detail.lobby { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(18px, 3vw, 32px); gap: 10px; }
.lobby-hi { margin: 0; font: 600 16px/1.2 var(--f-display); color: var(--muted); }
.lobby h3 { margin: 0; font: 700 clamp(26px, 3.4vw, 38px)/1.1 var(--f-display); letter-spacing: -.01em; }
.lobby-sub { margin: 0 0 8px; color: var(--muted); }
.lobby-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lobby-lv { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; border-radius: 14px; border: 1px solid transparent; background: color-mix(in srgb, var(--lv) 14%, var(--surface)); color: var(--ink); cursor: pointer; font: inherit; transition: transform .12s, border-color .12s; }
.lobby-lv:hover { transform: translateY(-2px); border-color: var(--lv); }
.lobby-lv .level-badge { background: var(--lv); width: 38px; height: 38px; border-radius: 10px; font-size: 15px; margin-bottom: 4px; }
.lobby-lv b { font: 700 15px/1.2 var(--f-display); }
.lobby-lv small { color: var(--muted); font-size: 12.5px; }
.lobby-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
@media (max-width: 560px) { .lobby-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .theme-detail.lobby { order: -1; } }

/* ---------- Aviso superior: botón para cerrarlo ---------- */
.trial-banner { position: relative; padding-right: 44px; }
.banner-close { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: 14px; cursor: pointer; }
.banner-close:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); }

/* ---------- Esquina inferior derecha libre ----------
   Netlify (plan gratis) pone su insignia ahí, encima de todo, así que la Bitácora va a la izquierda. */
.log-fab { right: auto; left: calc(16px + env(safe-area-inset-left, 0px)); }
@media (max-width: 900px) {
  .class-bar { bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
  body.in-class .main { padding-bottom: 190px; }
}

/* ---------- Celular: barra superior compacta, con las 4 secciones en una fila con íconos ---------- */
@media (max-width: 760px) {
  .trial-banner { font-size: 13px; padding: 6px 40px 6px 12px; gap: 6px 10px; }
  .trial-banner .btn { padding: 5px 10px; font-size: 12.5px; }
  .topbar { flex-wrap: wrap; gap: 6px 8px; padding: 8px 12px 6px; }
  .topbar .brand-logo img { height: 21px; }
  .topbar-right { gap: 6px; }
  .ctx-pill { max-width: 118px; padding: 4px 9px 4px 4px; font-size: 12.5px; }
  .student-pill { display: none !important; }
  .who-avatar, .sync { display: none; }
  .who .btn { padding: 6px 4px; font-size: 12.5px; }
  .topnav { order: 3; width: 100%; overflow: visible; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .topnav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; font-size: 11.5px; white-space: nowrap; border-radius: 10px; }
  .topnav button::before { font-size: 19px; line-height: 1; }
  .topnav button[data-section="inicio"]::before { content: "🗂️"; }
  .topnav button[data-section="clase"]::before { content: "📝"; }
  .topnav button[data-section="herramientas"]::before { content: "🛠️"; }
  .topnav button[data-section="alumnos"]::before { content: "🧑‍🎓"; }
  .topnav button[data-section="presentaciones"]::before { content: "📑"; }
  .topnav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .main { padding-bottom: 110px; }
  .log-fab { padding: 10px 14px; }
}

/* ---------- Bitácora: ventana aparte y botones fuera de la esquina de la insignia de Netlify ---------- */
.log-popout { align-self: flex-start; flex-wrap: wrap; text-align: left; }
.log-popout .hint { font-weight: 400; font-size: 12px; }
.log-foot { padding-bottom: 84px; }
body.log-window .log-panel { width: 100vw; border-left: 0; box-shadow: none; }
body.log-window .log-popout, body.log-window .log-fab, body.log-window .trial-banner { display: none !important; }

/* ---------- Bitácora en la barra superior (las esquinas de abajo las tapa la insignia de Netlify) ---------- */
.log-fab { position: static; left: auto; right: auto; bottom: auto; box-shadow: none; padding: 7px 12px; font-size: 13.5px; flex: none; }
body.log-open .log-fab { display: inline-flex; }
.log-foot { padding-bottom: 104px; }
@media (max-width: 760px) {
  .log-fab { padding: 6px 9px; gap: 5px; }
}
@media (max-width: 480px) {
  .log-fab-label { display: none; }
  .ctx-pill { max-width: 96px; }
}

/* ---------- Modo presentación: la herramienta llena la pestaña (sin pantalla completa del navegador) ----------
   Se comparte esta pestaña en la videollamada y el alumno ve solo la herramienta, en grande. */
.stage.presenting { position: fixed; inset: 0; z-index: 60; margin: 0; width: auto; max-width: none; height: auto; border: 0; border-radius: 0; box-shadow: none; }
body.presenting { overflow: hidden; }
body.presenting .class-bar { z-index: 70; }
.present-exit { position: fixed; top: 10px; right: 10px; z-index: 65; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: 500 12.5px/1 var(--f-body); cursor: pointer; opacity: .55; }
.present-exit:hover, .present-exit:focus-visible { opacity: 1; color: var(--ink); }

/* ---------- Botón modo claro / oscuro ---------- */
.theme-toggle { width: 34px; height: 34px; padding: 0; flex: none; justify-content: center; border-radius: 50%; font-size: 16px; line-height: 1; }
@media (max-width: 760px) { .theme-toggle { width: 30px; height: 30px; font-size: 14px; } }

/* ---------- Inicio de sesión con el mismo estilo de la portada ----------
   Fondo claro con manchas suaves de color, título en fichas, tarjeta blanca para el formulario. */
.auth { background: var(--paper); background-image: radial-gradient(560px 360px at 92% 12%, var(--soft-C1), transparent 70%), radial-gradient(460px 320px at 4% 96%, var(--soft-A2), transparent 70%); }
.auth-side { background: transparent; background-image: none; color: var(--ink); justify-content: center; gap: 36px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-side .brand-logo img { height: 30px; }
.auth-back { color: var(--muted); font-weight: 500; font-size: 14px; text-decoration: none; }
.auth-back:hover { color: var(--ink); }
.auth-badge { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px 7px 8px; font: 600 14px/1 var(--f-body); margin-bottom: 22px; box-shadow: 0 2px 8px rgb(30 35 64 / .06); }
.auth-badge > span { background: var(--soft-B1); border-radius: 999px; padding: 4px 7px; }
.auth-pitch h1 { font: 800 clamp(48px, 6.4vw, 84px)/1.12 var(--f-display); letter-spacing: -.03em; margin: 0; }
.auth-pitch h1 .chip { display: inline-block; font: inherit; letter-spacing: inherit; line-height: inherit; white-space: nowrap; border: 0; max-width: none; height: auto; padding: .02em .24em .08em; border-radius: .22em; margin: .04em 0; }
.auth-pitch h1 .k1 { background: #f06449; color: #fff; transform: rotate(-2.5deg); }
.auth-pitch h1 .k2 { background: #f2c230; color: #2a2205; transform: rotate(2deg); }
.auth-pitch h1 .k4 { background: var(--soft-B2); transform: rotate(3deg); }
.auth-pitch p { color: var(--muted); font-size: 18px; max-width: 44ch; margin: 20px 0 0; }
.auth-trust { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); gap: 10px 22px; }
.auth-trust li { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); font-weight: 500; }
.auth-trust li span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); font-size: 16px; }
.auth-stairs { max-width: 520px; }
.auth-main { background: transparent; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: clamp(22px, 3vw, 34px); box-shadow: 0 18px 50px rgb(30 35 64 / .10); }
.auth-form h2 { font-family: var(--f-display); font-weight: 800; letter-spacing: -.02em; }
@media (max-width: 860px) {
  .auth-side { gap: 18px; padding-bottom: 8px; }
  .auth-stairs, .auth-trust { display: none; }
  .auth-pitch h1 { font-size: 46px; }
  .auth-pitch p { font-size: 16px; margin-top: 14px; }
  .auth-badge { margin-bottom: 16px; }
}
/* Saludo del inicio de sesión: a la izquierda en computador (como la portada); centrado cuando va sobre el formulario */
@media (max-width: 860px) {
  .auth-pitch { text-align: center; }
  .auth-pitch h1 { text-wrap: balance; }
}

/* ---------- Fichas de gramática visuales ---------- */
.gr-sheet { gap: 18px; }
.gr-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.gr-head .level-badge { background: var(--lv); color: var(--lv-ink, #fff); }
.gr-titles { flex: 1 1 260px; min-width: 0; }
.gr-titles h3 { font: 800 clamp(28px, 3.6vw, 42px)/1.05 var(--f-display); letter-spacing: -.02em; margin: 0; }
.gr-titles p { margin: 4px 0 0; color: var(--muted); font-size: 16px; }
.gr-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.gr-cards .gr-form, .gr-cards .gr-err, .gr-cards .gr-prac { grid-column: 1 / -1; }
.gr-sec { background: var(--paper); border-radius: 18px; padding: 18px 20px; min-width: 0; }
.gr-sec h4 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font: 700 19px/1.2 var(--f-display); color: var(--ink); text-transform: none; letter-spacing: -.01em; }
.gr-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--lv-soft, var(--sunk)); font-size: 19px; flex: none; }
.gr-sheet ul, .gr-sheet ol { list-style: none; padding: 0; margin: 0; }
/* Cómo se forma: una tarjeta por forma, con su color */
.gr-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.gr-form-card { background: var(--surface); border-radius: 14px; padding: 14px; border-top: 6px solid var(--k); }
.gr-form-card > b { display: flex; align-items: center; gap: 6px; font: 700 15px/1.2 var(--f-display); margin-bottom: 10px; color: var(--kt); }
.gr-form-card.pos { --k: var(--lv-B2); --kt: var(--text-B2); } .gr-form-card.neg { --k: var(--lv-A1); --kt: var(--text-A1); }
.gr-form-card.q { --k: var(--lv-C1); --kt: var(--text-C1); } .gr-form-card.info { --k: var(--lv-B1); --kt: var(--text-B1); }
.gr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gr-chips span { background: color-mix(in srgb, var(--k) 14%, var(--surface)); border-radius: 9px; padding: 6px 10px; font: 600 16px/1.3 var(--f-body); }
/* Cuándo se usa */
.gr-uses { display: flex; flex-direction: column; gap: 8px; }
.gr-uses li, .gr-prac li { display: flex; align-items: flex-start; gap: 10px; font-size: 16px; line-height: 1.45; }
.gr-uses .n, .gr-prac .n { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--lv); color: var(--lv-ink, #fff); font: 700 13px/1 var(--f-num); margin-top: 1px; }
/* Ejemplos como globos de diálogo */
.gr-bubbles { display: flex; flex-direction: column; gap: 8px; }
.gr-bubbles li { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 18px 18px 18px 4px; padding: 10px 14px 10px 10px; font: 500 17px/1.35 var(--f-body); box-shadow: 0 1px 0 var(--line); }
.gr-say { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--lv-soft, var(--sunk)); cursor: pointer; font-size: 15px; }
.gr-say:hover { background: var(--lv); }
/* Errores: así no → así sí */
.gr-errs { display: flex; flex-direction: column; gap: 10px; }
.gr-errs li { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 10px; }
.gr-errs .no, .gr-errs .yes { border-radius: 12px; padding: 10px 14px; font: 500 16px/1.35 var(--f-body); display: flex; flex-direction: column; gap: 2px; }
.gr-errs .no { background: var(--soft-A1); } .gr-errs .yes { background: var(--soft-B2); }
.gr-errs b { font: 700 12px/1.2 var(--f-body); text-transform: uppercase; letter-spacing: .06em; }
.gr-errs .no b { color: var(--text-A1); } .gr-errs .yes b { color: var(--text-B2); }
.gr-errs s { text-decoration-color: color-mix(in srgb, var(--text-A1) 60%, transparent); text-decoration-thickness: 2px; }
.gr-errs .arrow { align-self: center; font-size: 20px; color: var(--muted); }
/* Práctica */
.gr-prac { display: flex; flex-direction: column; gap: 10px; }
.gr-prac li { background: var(--surface); border-radius: 12px; padding: 12px 14px; align-items: center; font-size: 17px; }
.gr-prac .q { flex: 1; }
.gr-prac .mark { flex: none; font-size: 18px; min-width: 1.2em; }
.gr-in { font-size: inherit; min-width: 6ch; }
.gr-prac-actions { margin-top: 14px; }
/* Modo paso a paso: una parte a la vez, en grande */
.gr-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.gr-dot { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 7px 12px; font: 600 13.5px/1 var(--f-body); cursor: pointer; }
.gr-dot[aria-current="step"] { background: var(--lv); border-color: var(--lv); color: var(--lv-ink, #fff); }
.gr-stepmode .gr-sec { padding: clamp(20px, 3vw, 36px); font-size: 120%; }
.gr-stepmode .gr-sec h4 { font-size: 26px; }
.gr-stepmode .gr-chips span, .gr-stepmode .gr-bubbles li, .gr-stepmode .gr-uses li, .gr-stepmode .gr-errs .no, .gr-stepmode .gr-errs .yes, .gr-stepmode .gr-prac li { font-size: 21px; }
.gr-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
@media (max-width: 700px) {
  .gr-cards { grid-template-columns: 1fr; }
  .gr-errs li { grid-template-columns: 1fr; }
  .gr-errs .arrow { transform: rotate(90deg); justify-self: center; }
  .gr-mode { width: 100%; }
}
.gr-sheet .gr-prac input.gr-in { display: inline-block; width: 9ch; min-width: 6ch; height: auto; margin: 0 6px; padding: 2px 8px; border: 0; border-bottom: 3px solid var(--lv); border-radius: 8px 8px 0 0; background: var(--paper); font: 600 1em/1.4 var(--f-body); color: var(--ink); vertical-align: baseline; box-shadow: none; }
.gr-sheet .gr-prac input.gr-in:focus { outline: 2px solid var(--lv); outline-offset: 2px; }
.gr-sheet .gr-prac input.gr-in.good { background: var(--soft-B2); border-bottom-color: var(--lv-B2); }
.gr-sheet .gr-prac input.gr-in.bad { background: var(--soft-A1); border-bottom-color: var(--lv-A1); }
@media (max-width: 700px) {
  .gr-errs { gap: 18px; }
  .gr-errs li { gap: 2px; }
  .gr-errs .arrow { font-size: 16px; line-height: 1; }
}

/* ---------- Mini temporizador flotante ---------- */
.mini-timer { position: fixed; left: calc(16px + env(safe-area-inset-left, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 66;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 999px; background: var(--ink); color: var(--surface);
  box-shadow: 0 10px 30px rgb(30 35 64 / .28); font: 600 14px/1 var(--f-body); }
.mini-timer[hidden] { display: none; }
.mt-ico { font-size: 18px; }
.mt-time { font: 700 22px/1 var(--f-num); min-width: 3.2ch; font-variant-numeric: tabular-nums; }
.mt-bar { width: 70px; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--surface) 25%, transparent); overflow: hidden; }
.mt-bar i { display: block; height: 100%; background: #f2c230; border-radius: inherit; transition: width .2s linear; }
.mt-btn { border: 0; background: color-mix(in srgb, var(--surface) 16%, transparent); color: inherit; border-radius: 999px; min-width: 32px; height: 32px; padding: 0 8px; font: 600 13px/1 var(--f-body); cursor: pointer; }
.mt-btn:hover { background: color-mix(in srgb, var(--surface) 28%, transparent); }
.mini-timer.ending .mt-time { color: #ff8a73; }
.mini-timer.ending .mt-bar i { background: #ff8a73; }
.mini-timer.done { background: #f06449; color: #fff; animation: mt-pop .5s ease 3; }
@keyframes mt-pop { 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .mini-timer.done { animation: none; } }
@media (max-width: 480px) { .mt-bar { display: none; } }

/* ---------- Ruleta flotante (sin salir de la clase) ---------- */
.quick-wheel { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.view.tool-float { position: fixed; z-index: 67; top: calc(70px + env(safe-area-inset-top, 0px)); right: 16px; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 90px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 60px rgb(30 35 64 / .28); padding: 12px 14px 16px; margin: 0; }
.tool-float .view-head, .tool-float .back-row, .tool-float .crumbs, .tool-float [data-back] { display: none !important; }
.tool-float .stage { padding: 4px; box-shadow: none; border: 0; background: transparent; }
.tool-float .split { grid-template-columns: 1fr; gap: 12px; }
.tool-float .panel.setup { display: none; }
.tool-float.show-setup .panel.setup { display: flex; }
.tool-float .wheel-wrap { width: min(100%, 340px); margin-inline: auto; }
.float-bar { display: none; }
.tool-float .float-bar { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
@media (max-width: 480px) { .qw-label { display: none; } .view.tool-float { top: auto; bottom: 12px; right: 12px; } }

/* Botones del modo presentación: ruleta + salir */
.present-exit { display: flex; gap: 6px; padding: 0; border: 0; background: none; opacity: 1; }
.present-exit button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: 500 12.5px/1 var(--f-body); cursor: pointer; opacity: .6; }
.present-exit button:hover, .present-exit button:focus-visible { opacity: 1; color: var(--ink); }

/* ---------- Menú de herramientas rápidas ---------- */
.tools-menu { position: fixed; z-index: 72; width: 270px; max-height: calc(100vh - 90px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 44px rgb(30 35 64 / .22); padding: 8px; display: flex; flex-direction: column; }
.tools-menu[hidden] { display: none; }
.tm-hint { margin: 4px 8px 6px; font-size: 12px; color: var(--muted); }
.tm-group { margin: 8px 8px 2px; font: 700 11px/1.2 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tools-menu button { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 9px 10px; border-radius: 10px; font: 500 15px/1.2 var(--f-body); color: var(--ink); cursor: pointer; }
.tools-menu button span { font-size: 18px; width: 22px; text-align: center; }
.tools-menu button:hover, .tools-menu button:focus-visible { background: var(--sunk); }
.tools-menu .tm-all { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; font-weight: 600; }
/* Herramientas abiertas encima: tamaños cómodos para cada una */
.tool-float .timer-display { font-size: clamp(56px, 14vw, 96px); }
.tool-float .letter { font-size: clamp(90px, 22vw, 150px); }
.tool-float .qcard q { font-size: 24px; }
/* Puntos del dado: el espacio interno va en medida fija para que se vean en cualquier tamaño (también en la ventana flotante) */
.die:not(.word) { padding: clamp(12px, 2.4vw, 22px); }
.tool-float .float-bar .float-close { margin-left: auto; }

/* ---------- Pestañas de nivel en Temáticas: un nivel a la vez, cada uno con su color ---------- */
.theme-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.level-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.lv-tab { border: 2px solid transparent; border-radius: 12px 12px 6px 6px; padding: 10px 0 9px; background: var(--lv-soft); color: var(--lv-text); font: 800 16px/1 var(--f-display); cursor: pointer; transition: transform .12s, background .12s; }
.lv-tab:hover { transform: translateY(-2px); border-color: var(--lv); }
.lv-tab[aria-pressed="true"] { background: var(--lv); color: var(--lv-ink); transform: translateY(-3px); box-shadow: 0 6px 14px color-mix(in srgb, var(--lv) 35%, transparent); }
.level-tabs.searching .lv-tab[aria-pressed="true"] { background: var(--lv-soft); color: var(--lv-text); transform: none; box-shadow: none; }
.theme-col .level-block .theme-rows { border-color: color-mix(in srgb, var(--lv) 45%, var(--line)); border-top: 4px solid var(--lv); }
.theme-col .list-level .level-badge { background: var(--lv); color: var(--lv-ink); }

/* ---------- Plan de clase con color: cada etapa tiene el suyo ---------- */
.st-0 { --st: var(--lv-A1); --st-soft: var(--soft-A1); --st-text: var(--text-A1); --st-ink: var(--ink-A1); }
.st-1 { --st: var(--lv-B1); --st-soft: var(--soft-B1); --st-text: var(--text-B1); --st-ink: var(--ink-B1); }
.st-2 { --st: var(--lv-B2); --st-soft: var(--soft-B2); --st-text: var(--text-B2); --st-ink: var(--ink-B2); }
.st-3 { --st: var(--lv-C1); --st-soft: var(--soft-C1); --st-text: var(--text-C1); --st-ink: var(--ink-C1); }
.st-4 { --st: var(--lv-C2); --st-soft: var(--soft-C2); --st-text: var(--text-C2); --st-ink: var(--ink-C2); }
/* Encabezado de la temática: banda suave del color del nivel */
.cl-hero.stage { background: linear-gradient(135deg, color-mix(in srgb, var(--lv-soft, var(--sunk)) 90%, var(--surface)), var(--surface) 70%); border-top: 6px solid var(--lv, var(--line)); }
.cl-hero .eyebrow { color: var(--lv-text, var(--muted)); }
.chip.c-a1 { background: var(--soft-A1); color: var(--text-A1); } .chip.c-b1 { background: var(--soft-B1); color: var(--text-B1); }
.chip.c-b2 { background: var(--soft-B2); color: var(--text-B2); } .chip.c-c1 { background: var(--soft-C1); color: var(--text-C1); }
.cl-vocab .chips span { background: var(--lv-soft, var(--paper)); border-color: transparent; }
/* Etapas */
.cl-stage { background: color-mix(in srgb, var(--st-soft) 55%, transparent); border-radius: 22px; padding: 16px; border-left: 6px solid var(--st); }
.cl-stage .cl-stage-n { background: var(--st); color: var(--st-ink); }
.cl-stage .cl-stage-head h3 { display: flex; align-items: center; gap: 8px; font: 800 22px/1.2 var(--f-display); color: var(--ink); }
.cl-stage-ico { font-size: 22px; }
.cl-stage .cl-stage-head span:last-child { color: var(--st-text); font-weight: 500; }
.cl-stage .act { border: 1px solid color-mix(in srgb, var(--st) 25%, var(--line)); border-top: 5px solid var(--st); border-radius: 16px; }
.cl-stage .act-ic { background: var(--st-soft); color: var(--st-text); }
.cl-stage .act-mins { background: var(--st-soft); color: var(--st-text); border-radius: 999px; padding: 4px 9px; font-weight: 600; }
.cl-stage .act.on { border-color: var(--st); box-shadow: 0 0 0 2px var(--st); }
.cl-stage .act-add { border-color: var(--st); color: var(--st-text); }
.cl-stage .act.on .act-add { background: var(--st); color: var(--st-ink); border-color: var(--st); }
/* Tarjeta "Tu clase de hoy": cada actividad con el color de su etapa y una barra de tiempo */
.plan-bar { display: flex; gap: 3px; height: 10px; border-radius: 99px; overflow: hidden; }
.plan-bar[hidden] { display: none; }
.plan-bar i { background: var(--st); min-width: 6px; }
.plan-list li { border-left: 4px solid var(--st); }
.plan-list li::before { color: var(--st); }

/* Botón de herramientas rápidas junto a la Bitácora */
.quick-tools { display: inline-flex; align-items: center; gap: 6px; flex: none; border-radius: 999px; background: var(--soft-B1); border-color: color-mix(in srgb, var(--lv-B1) 50%, var(--line)); color: var(--ink); font-weight: 600; }
.quick-tools:hover { background: color-mix(in srgb, var(--lv-B1) 35%, var(--surface)); }
.qt-caret { font-size: 11px; opacity: .7; }
@media (max-width: 900px) { .qt-label { display: none; } }
@media (max-width: 480px) {
  .qt-caret { display: none; }
  .quick-tools { padding: 6px 9px; }
  .topbar-right { gap: 4px; }
}
@media (max-width: 430px) { .ctx-pill { display: none; } }

/* ---------- Avisos emergentes (terminar clase, bitácora) ---------- */
dialog.pop { width: min(420px, calc(100vw - 32px)); text-align: center; border-radius: 22px; padding: 26px 24px 20px; border: 0; box-shadow: 0 30px 80px rgb(10 14 30 / .35); }
.pop-ico { width: 64px; height: 64px; margin: 0 auto 10px; display: grid; place-items: center; font-size: 32px; border-radius: 18px; background: var(--soft-B1); transform: rotate(-4deg); }
dialog.pop h2 { margin: 0; font: 800 24px/1.2 var(--f-display); letter-spacing: -.01em; }
dialog.pop p { margin: 8px 0 0; color: var(--muted); font-size: 15.5px; line-height: 1.5; }
.pop-btns { display: flex; gap: 10px; margin-top: 20px; }
.pop-btns .btn { flex: 1; height: 46px; border-radius: 12px; justify-content: center; }

/* Dos herramientas flotantes: una a la derecha y otra a la izquierda; la que se tocó al último queda adelante */
.view.tool-float.float-left { right: auto; left: 16px; }
.view.tool-float.float-front { z-index: 68; }
.tm-times { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 2px 4px 4px; }
.tools-menu .tm-times button { justify-content: center; padding: 8px 4px; border: 1px solid var(--line); border-radius: 9px; font: 600 13.5px/1 var(--f-body); }
.tools-menu .tm-times button:hover { background: var(--soft-B1); border-color: var(--lv-B1); }
@media (max-width: 480px) { .view.tool-float.float-left { left: 12px; right: 12px; } }
.mini-timer { z-index: 69; }
/* La bitácora siempre queda por encima del modo presentación y de las herramientas flotantes */
.log-panel { z-index: 75; }

/* ---------- Menú de la cuenta (apariencia, plan, salir) ---------- */
.who { position: relative; }
.who-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; color: var(--ink); font: 500 13.5px/1 var(--f-body); }
.who-btn:hover, .who-btn[aria-expanded="true"] { border-color: var(--muted); }
.who-btn .who-avatar { width: 28px; height: 28px; background: linear-gradient(135deg, var(--lv-A1), var(--lv-C2)); color: #fff; font-size: 13px; }
.who-caret { font-size: 10px; color: var(--muted); }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 72; width: 270px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 44px rgb(30 35 64 / .22); padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.account-menu[hidden] { display: none; }
.am-head { display: flex; align-items: center; gap: 10px; padding: 6px 6px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.am-avatar { width: 38px !important; height: 38px !important; font-size: 16px !important; background: linear-gradient(135deg, var(--lv-A1), var(--lv-C2)) !important; color: #fff !important; }
.am-head b { display: block; font: 700 15px/1.2 var(--f-display); }
.am-head small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
.am-label { margin: 4px 6px 2px; font: 700 11px/1.2 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.am-theme { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: var(--sunk); border-radius: 12px; padding: 4px; margin-bottom: 6px; }
.am-theme button { display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: transparent; border-radius: 9px; padding: 8px 2px; font-size: 18px; cursor: pointer; color: var(--muted); }
.am-theme button span { font: 600 11.5px/1 var(--f-body); }
.am-theme button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 2px 6px rgb(30 35 64 / .12); }
.am-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 10px; border-radius: 10px; font: 500 14.5px/1.2 var(--f-body); color: var(--ink); cursor: pointer; }
.am-item:hover { background: var(--sunk); }
.am-item[hidden] { display: none; }
.am-out { color: var(--text-A1); }
@media (max-width: 760px) { .who-btn .who-name { display: none; } .who-btn { padding-right: 8px; } }

/* ---------- Pantalla "Tu suscripción": botones más atractivos ---------- */
.pw-note { margin: -4px 0 0; align-self: flex-start; background: var(--soft-B2); color: var(--text-B2); border-radius: 999px; padding: 8px 16px; font: 700 15px/1.2 var(--f-display); }
.pw-current { gap: 16px; align-items: stretch; }
.pw-status { display: flex; align-items: center; gap: 14px; border-radius: 16px; padding: 16px 18px; background: var(--soft-B2); border: 1px solid color-mix(in srgb, var(--lv-B2) 35%, transparent); }
.pw-status.warn { background: var(--soft-B1); border-color: color-mix(in srgb, var(--lv-B1) 45%, transparent); }
.pw-status.bad { background: var(--soft-A1); border-color: color-mix(in srgb, var(--lv-A1) 40%, transparent); }
.pw-status-ico { font-size: 30px; line-height: 1; }
.pw-status b { display: block; font: 800 22px/1.15 var(--f-display); letter-spacing: -.01em; }
.pw-status span { display: block; margin-top: 3px; color: var(--muted); font-size: 15px; }
.pw-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pw-cta, .pw-manage { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 54px; padding: 0 24px; border-radius: 14px; font: 700 16.5px/1 var(--f-display); text-decoration: none; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.pw-cta { flex: 1 1 240px; border: 0; color: #2a2205; background: linear-gradient(135deg, #f2c230, #f59e2f); box-shadow: 0 8px 20px rgb(245 158 47 / .35); }
.pw-cta:hover, .pw-manage:hover { transform: translateY(-2px); }
.pw-manage { flex: 1 1 240px; color: #fff; background: #009ee3; box-shadow: 0 8px 20px rgb(0 158 227 / .28); }
.pw-current .hint { margin: 0; }
.pw-foot { gap: 6px 10px; align-items: center; }
.pw-link { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 8px 14px; font: 600 13.5px/1 var(--f-body); cursor: pointer; }
.pw-link:hover { color: var(--ink); border-color: var(--muted); background: var(--sunk); }
.pw-link.strong { color: var(--ink); }
@media (max-width: 560px) { .pw-cta, .pw-manage { flex-basis: 100%; } }

/* ---------- Inicio de sesión: columna izquierda ordenada (mismo ancho para todo, datos en grilla pareja) ---------- */
@media (min-width: 861px) {
  .auth-side { align-items: stretch; }
  .auth-side > * { width: 100%; max-width: 560px; }
  .auth-trust { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .auth-trust li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; color: var(--ink); font-size: 14.5px; line-height: 1.25; }
  .auth-trust li span { border: 0; background: var(--paper); flex: none; }
  .auth-stairs { max-width: 560px; margin-inline: 0; }
}
.auth-back { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; color: var(--ink); font-weight: 600; font-size: 13.5px; }
.auth-back:hover { border-color: var(--muted); }

/* ---------- Ingreso simple: solo el logo (vuelve a la portada) y la tarjeta para entrar, centrados ----------
   La portada es el único "inicio"; esta pantalla no repite su contenido. */
.auth { grid-template-columns: 1fr !important; place-content: center; justify-items: center; gap: 0; padding: clamp(24px, 5vh, 56px) 16px; }
.auth-side { padding: 0 0 22px; gap: 0; justify-content: center; align-items: center; background: transparent; }
.auth-side > * { max-width: none; width: auto; }
.auth-top { justify-content: center; }
.auth-side .brand-logo img { height: 34px; }
.auth-back, .auth-pitch, .auth-stairs, .auth-facts { display: none !important; }
.auth-main { padding: 0; width: 100%; display: grid; place-items: center; }
.auth-card { width: min(100%, 440px); }

/* Estado del plan junto a la inicial */
.who-plan { border-radius: 999px; padding: 4px 8px; font: 700 11.5px/1 var(--f-body); white-space: nowrap; }
.who-plan.good { background: var(--soft-B2); color: var(--text-B2); }
.who-plan.trial { background: var(--soft-B1); color: var(--text-B1); }
.am-plan { margin: -2px 6px 8px; padding: 8px 10px; border-radius: 10px; background: var(--paper); font-size: 13px; color: var(--ink); }
.who-plan { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 560px) { .who-plan .wp-t { display: none; } .who-plan { padding: 3px 5px; } }

/* ---------- Mis presentaciones ---------- */
.pr-lib { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.pr-lib-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pr-lib-head .hint { margin: 0; flex: 1 1 280px; }
#pr-msg:empty { display: none; }
.pr-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.pr-item { flex: none; display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pr-item.on { border-color: var(--lv-C1); box-shadow: 0 0 0 2px var(--soft-C1); }
.pr-open { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 10px 12px; text-align: left; cursor: pointer; color: var(--ink); max-width: 260px; }
.pr-open b { display: block; font: 700 14px/1.2 var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.pr-open small { color: var(--muted); font-size: 12px; }
.pr-ico { font-size: 22px; }
.pr-del { border: 0; border-left: 1px solid var(--line); background: none; padding: 0 12px; cursor: pointer; opacity: .55; }
.pr-del:hover { opacity: 1; background: var(--soft-A1); }
.pr-empty { padding: 4px 2px; }
.pr-start { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: clamp(28px, 6vw, 64px) 16px; }
.pr-start-ico { width: 72px; height: 72px; display: grid; place-items: center; font-size: 36px; border-radius: 20px; background: var(--soft-C1); transform: rotate(-4deg); }
.pr-start h3 { font: 800 clamp(22px, 3vw, 28px)/1.2 var(--f-display); margin: 6px 0 0; }
.pr-start .hint { max-width: 52ch; }
.pr-viewer { display: flex; flex-direction: column; gap: 10px; }
.pr-viewer[hidden] { display: none; }
.pr-wrap { height: min(68vh, 56vw); min-height: 240px; display: grid; place-items: center; background: var(--sunk); border-radius: 14px; overflow: hidden; cursor: pointer; }
.pr-wrap canvas { display: block; box-shadow: 0 6px 24px rgb(30 35 64 / .18); background: #fff; }
.pr-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pr-title { font: 700 15px/1.2 var(--f-display); color: var(--muted); }
.pr-count { font: 700 15px/1 var(--f-num); min-width: 5ch; text-align: center; }
/* En modo presentación / pantalla completa: la diapositiva usa todo el alto */
.stage.presenting.pr-stage { padding: 12px; display: flex; flex-direction: column; }
.stage.presenting .pr-viewer { flex: 1; }
.stage.presenting .pr-wrap { height: calc(100vh - 84px); background: #11131f; border-radius: 0; }
.stage.presenting .pr-title { display: none; }
body.in-class .stage.presenting .pr-wrap { height: calc(100vh - 150px); }

/* Herramientas flotantes y mini temporizador: se arrastran desde su barra y se pueden achicar */
.tool-float .float-bar { position: sticky; top: -12px; z-index: 2; margin: -12px -14px 6px; padding: 10px 14px 8px; background: var(--surface); border-radius: 20px 20px 0 0; cursor: grab; touch-action: none; user-select: none; align-items: center; }
.tool-float .float-bar .float-grip { margin-right: auto; }
.tool-float .float-bar .float-close { margin-left: 0; }
.float-grip { font: 600 13px/1 var(--f-body); color: var(--muted); padding: 6px 8px; border-radius: 999px; background: var(--sunk); white-space: nowrap; }
.tool-float.dragging, .mini-timer.dragging { cursor: grabbing; box-shadow: 0 30px 70px rgb(30 35 64 / .36); }
.tool-float.dragging .float-bar { cursor: grabbing; }
.view.tool-float.float-min { width: auto; overflow: hidden; padding-bottom: 4px; }
.tool-float.float-min > :not(.float-bar) { display: none !important; }
.tool-float.float-min .float-setup { display: none; }
.mini-timer { cursor: grab; touch-action: none; user-select: none; }
.tool-float .float-bar .float-smaller, .tool-float .float-bar .float-bigger { padding-inline: 8px; }
.tool-float .float-bar button:disabled { opacity: .4; cursor: default; }
.tool-float.float-min .float-smaller, .tool-float.float-min .float-bigger { display: none; }

/* ---------- Mis presentaciones, a la vista: pestaña arriba y tarjeta destacada en el inicio ---------- */
.lobby-pres { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 16px; padding: 14px 16px; text-align: left; cursor: pointer;
  border: 2px solid var(--lv-B2); border-radius: 18px; background: linear-gradient(120deg, var(--soft-B2), var(--soft-C1)); color: var(--ink); font: inherit; transition: transform .15s, box-shadow .15s; }
.lobby-pres:hover, .lobby-pres:focus-visible { transform: translateY(-2px); box-shadow: 0 12px 28px rgb(30 35 64 / .14); }
.lobby-pres .lp-ico { font-size: 32px; line-height: 1; }
.lobby-pres b { display: block; font: 700 17px/1.2 var(--f-head, var(--f-body)); }
.lobby-pres small { display: block; margin-top: 3px; color: var(--muted); font-size: 13.5px; line-height: 1.35; }
.lobby-pres .lp-go { margin-left: auto; font-size: 22px; font-weight: 700; color: var(--lv-B2); }
.pres-btn { border-color: var(--lv-B2); color: var(--lv-B2); background: var(--soft-B2); font-weight: 600; }
.pres-btn:hover { background: var(--surface); }

/* ---------- Oferta de lanzamiento: precio fundadora ---------- */
.pw-founder { margin: 0 0 14px; padding: 12px 16px; border-radius: 14px; background: linear-gradient(120deg, #fcf2cf, #fde4df); border: 1.5px solid #f2c230; font-size: 14.5px; line-height: 1.45; color: var(--ink); }
.pw-plan.founder { border-color: #f2c230; box-shadow: 0 0 0 4px #fcf2cf; }
.pw-badge.founder-badge { background: #f2c230; color: #2a2205; }
.pw-price s { color: var(--muted); font-size: 18px; font-weight: 500; margin-right: 4px; }
