/* Pupitre · estilos */
:root {
  --ink: #16243a;
  --ink-2: #45546b;
  --ink-3: #7a8699;
  --paper: #f7f3ec;
  --paper-2: #efe9df;
  --card: #ffffff;
  --line: #e5ded2;
  --navy: #1e3a5f;
  --navy-2: #2b4f7c;
  --sun: #fbbf24;
  --sun-2: #f59e0b;
  --ok: #15803d;
  --ok-bg: #e8f5ec;
  --warn: #b45309;
  --warn-bg: #fdf3e2;
  --bad: #b91c1c;
  --bad-bg: #fdecec;
  --violet: #6d28d9;
  --accent: #2563eb;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(22, 36, 58, .06), 0 6px 20px rgba(22, 36, 58, .06);
  --shadow-lg: 0 10px 40px rgba(22, 36, 58, .16);
  --display: "Baloo 2", "Nunito", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(rgba(30, 58, 95, .05) 1px, transparent 1px);
  background-size: 22px 22px;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); font-weight: 800; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--navy-2); }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Estructura ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: rgba(247, 243, 236, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 800; font-size: 1.35rem; color: var(--navy); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--navy); display: grid; place-items: center; }
.brand-mark svg { width: 22px; height: 22px; }
.topbar .spacer { flex: 1; }
.page { max-width: 1120px; margin: 0 auto; padding: 22px 16px 80px; }
.page.narrow { max-width: 760px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; text-decoration: none;
  padding: 11px 18px; border-radius: 999px;
  font-weight: 800; font-size: .95rem;
  background: var(--navy); color: #fff;
  transition: transform .12s ease, background .15s ease, box-shadow .15s;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .12);
  white-space: nowrap;
}
.btn:hover { background: var(--navy-2); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sun { background: var(--sun); color: var(--ink); }
.btn.sun:hover { background: var(--sun-2); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.soft { background: var(--paper-2); color: var(--ink); box-shadow: none; }
.btn.soft:hover { background: var(--line); }
.btn.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 2px #f3c9c9; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 7px 13px; font-size: .85rem; }
.btn.lg { padding: 15px 26px; font-size: 1.08rem; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.iconbtn:hover { background: var(--paper-2); }
.iconbtn svg { width: 22px; height: 22px; }

/* ---------- Tarjetas y formularios ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid rgba(229, 222, 210, .7); }
.card.flat { box-shadow: none; }
.card h3 + p { margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: .9rem; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--ink-3); }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 2px solid var(--line); background: #fff; outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--navy-2); }
textarea.input { resize: vertical; min-height: 80px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--navy); }
.error-msg { color: var(--bad); font-weight: 700; font-size: .9rem; min-height: 1.2em; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.violet { background: #efe8fd; color: var(--violet); }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); background: #eef4fb; color: var(--navy); font-size: .9rem; font-weight: 600; display: flex; gap: 10px; align-items: flex-start; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }

/* ---------- Acceso ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: var(--navy); color: #fff; padding: 48px clamp(24px, 5vw, 72px); display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-hero h1 { font-size: clamp(2.2rem, 4.5vw, 3.4rem); max-width: 12ch; }
.auth-hero h1 em { font-style: normal; color: var(--sun); }
.auth-hero p.lead { font-size: 1.12rem; opacity: .88; max-width: 44ch; margin-top: 16px; }
.auth-hero ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; max-width: 46ch; }
.auth-hero li { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; }
.auth-hero li span.b { flex: none; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .1); display: grid; place-items: center; font-size: 1.1rem; }
.auth-hero .deco { position: absolute; right: -60px; bottom: -60px; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, rgba(251, 191, 36, .35), transparent 65%); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 18px; }
.auth-form .card { width: 100%; max-width: 420px; padding: 30px; }
.tabs-auth { display: flex; gap: 6px; background: var(--paper-2); padding: 5px; border-radius: 999px; margin-bottom: 22px; }
.tabs-auth button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 999px; font-weight: 800; cursor: pointer; color: var(--ink-2); }
.tabs-auth button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 36px 22px; }
  .auth-hero ul { display: none; }
}

/* ---------- Selector de perfil ---------- */
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-top: 24px; }
.profile {
  border: 0; cursor: pointer; text-align: center;
  background: var(--card); border-radius: 24px; padding: 26px 16px 20px;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.profile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.avatar { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 46px; margin: 0 auto 12px; background: var(--paper-2); }
.avatar.sm { width: 44px; height: 44px; font-size: 24px; margin: 0; }
.profile .name { font-family: var(--display); font-weight: 800; font-size: 1.3rem; }
.profile.add { background: transparent; box-shadow: inset 0 0 0 2px var(--line); color: var(--ink-2); }
.profile.add .avatar { background: transparent; border: 2px dashed var(--line); font-size: 34px; }

/* ---------- Inicio del alumno ---------- */
.hello { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
.hello h1 span { color: var(--navy-2); }
.levelbox { background: var(--card); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); min-width: 260px; }
.levelbox .row { gap: 14px; }
.lvl { width: 52px; height: 52px; border-radius: 14px; background: var(--sun); color: var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 1.4rem; line-height: 1; flex-direction: column; }
.lvl small { font-size: .55rem; font-family: var(--body); letter-spacing: .06em; }
.bar { height: 10px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--sun-2); transition: width .6s ease; }
.streak { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: #c2410c; }
@media (max-width: 720px) { .hello { grid-template-columns: 1fr; } .levelbox { min-width: 0; } }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 32px 0 14px; }
.mission { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.mtask {
  position: relative; border: 0; text-align: left; cursor: pointer;
  background: var(--card); border-radius: var(--radius); padding: 18px 18px 16px;
  box-shadow: var(--shadow); border-top: 6px solid var(--c, var(--navy));
  display: flex; flex-direction: column; gap: 8px; transition: transform .15s;
}
.mtask:hover { transform: translateY(-2px); }
.mtask .kind { font-size: .75rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--c, var(--navy)); }
.mtask h4 { font-family: var(--display); font-size: 1.12rem; font-weight: 700; }
.mtask .meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--ink-3); font-weight: 600; margin-top: auto; }
.mtask.done { opacity: .6; }
.mtask.done::after { content: "✓"; position: absolute; top: 12px; right: 14px; width: 28px; height: 28px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-weight: 800; }
.empty { padding: 26px; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--ink-2); background: rgba(255, 255, 255, .5); }
.empty .big { font-size: 2.4rem; }

.subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.subj {
  border: 0; cursor: pointer; text-align: left; position: relative; overflow: hidden;
  background: var(--card); border-radius: 22px; padding: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px; min-height: 170px; transition: transform .15s, box-shadow .15s;
}
.subj:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.subj::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 78px; background: var(--c); opacity: .1; }
.subj .ico { position: relative; width: 52px; height: 52px; border-radius: 15px; background: var(--c); color: #fff; display: grid; place-items: center; }
.subj .ico svg { width: 28px; height: 28px; }
.subj h3 { font-size: 1.2rem; position: relative; }
.subj .foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.subj .bar > i { background: var(--c); }
.week { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 10px; }
.week .d { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.week .d i { width: 100%; max-width: 34px; background: var(--navy-2); border-radius: 8px 8px 4px 4px; min-height: 4px; transition: height .5s; }
.week .d.today i { background: var(--sun-2); }
.week .d span { font-size: .75rem; font-weight: 700; color: var(--ink-3); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.badge { text-align: center; padding: 14px 8px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.badge .b { font-size: 2rem; filter: grayscale(1); opacity: .35; }
.badge.on .b { filter: none; opacity: 1; }
.badge .n { font-weight: 800; font-size: .85rem; margin-top: 4px; }
.badge .t { font-size: .72rem; color: var(--ink-3); line-height: 1.3; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 820px) { .two { grid-template-columns: 1fr; } }

/* ---------- Asignatura ---------- */
.subj-head { border-radius: 26px; padding: 26px; color: #fff; background: var(--c); position: relative; overflow: hidden; box-shadow: var(--shadow); }
.subj-head::after { content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.subj-head .row { position: relative; z-index: 1; }
.subj-head .ico { width: 60px; height: 60px; border-radius: 18px; background: rgba(255, 255, 255, .2); display: grid; place-items: center; flex: none; }
.subj-head .ico svg { width: 34px; height: 34px; }
.subj-head .stats { display: flex; gap: 22px; margin-top: 18px; position: relative; z-index: 1; flex-wrap: wrap; }
.subj-head .stats b { display: block; font-family: var(--display); font-size: 1.6rem; line-height: 1; }
.subj-head .stats span { font-size: .8rem; opacity: .85; font-weight: 700; }
.tabs { display: flex; gap: 6px; margin: 18px 0; overflow-x: auto; padding-bottom: 2px; }
.tabs button { border: 0; background: transparent; padding: 10px 16px; border-radius: 999px; font-weight: 800; cursor: pointer; color: var(--ink-2); display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.tabs button svg { width: 18px; height: 18px; }
.topic { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.topic + .topic { margin-top: 10px; }
.topic h4 { font-family: var(--display); font-size: 1.08rem; font-weight: 700; }
.topic .sum { font-size: .88rem; color: var(--ink-2); margin-top: 2px; }
.topic .mbar { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.topic .mbar .bar { flex: 1; max-width: 260px; height: 8px; }
.topic .mbar b { font-family: var(--display); font-size: 1.05rem; min-width: 30px; }
.topic .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.act-btn { border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 10px; border-radius: 12px; background: var(--paper); font-weight: 800; font-size: .72rem; color: var(--ink-2); min-width: 66px; transition: background .15s; }
.act-btn:hover { background: var(--paper-2); color: var(--ink); }
.act-btn svg { width: 22px; height: 22px; color: var(--c); }
.act-btn.primary { background: var(--c); color: #fff; }
.act-btn.primary svg { color: #fff; }
@media (max-width: 760px) {
  .topic { grid-template-columns: 1fr; }
  .topic .acts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .act-btn { min-width: 0; padding: 8px 2px; font-size: .68rem; }
}
.status-dominado { --st: var(--ok); }
.status-en_progreso { --st: var(--warn); }
.status-reforzar { --st: var(--bad); }
.status-sin_evaluar { --st: var(--ink-3); }
.topic .bar > i { background: var(--st); }
.cta-diag { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 2px solid var(--sun); margin-bottom: 16px; }
.cta-diag .big { font-size: 2.6rem; }
@media (max-width: 640px) { .cta-diag { grid-template-columns: 1fr; text-align: center; } }

.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 18px; text-align: center; background: rgba(255, 255, 255, .6); transition: border-color .15s, background .15s; }
.dropzone.drag { border-color: var(--navy-2); background: #eef4fb; }
.dropzone .big { font-size: 2.4rem; }
.doc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.doc + .doc { margin-top: 8px; }
.doc .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--paper-2); display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.doc .bar { height: 6px; margin-top: 6px; }
.doc .bar > i { background: var(--navy-2); }

/* ---------- Chat del tutor ---------- */
.chat { display: flex; flex-direction: column; height: min(70vh, 640px); background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: linear-gradient(#fff, #fcfaf6); }
.msg { max-width: 82%; padding: 11px 15px; border-radius: 18px; line-height: 1.5; font-size: .97rem; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 6px; }
.msg.assistant { align-self: flex-start; background: var(--paper); border-bottom-left-radius: 6px; }
.msg .img-tag { display: inline-block; font-size: .78rem; font-weight: 800; opacity: .8; margin-bottom: 4px; }
.msg.typing { color: var(--ink-3); font-style: italic; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; background: #fff; }
.chat-form textarea { flex: 1; resize: none; min-height: 46px; max-height: 140px; border-radius: 16px; }
.chat-modes { display: flex; gap: 6px; padding: 10px 12px 0; flex-wrap: wrap; }
.chip { border: 0; cursor: pointer; padding: 6px 12px; border-radius: 999px; background: var(--paper); font-weight: 700; font-size: .82rem; color: var(--ink-2); }
.chip.on { background: var(--navy); color: #fff; }
.attach-preview { display: flex; align-items: center; gap: 8px; padding: 6px 12px 0; font-size: .85rem; font-weight: 700; color: var(--navy-2); }
.attach-preview img { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; }

/* ---------- Reproductor de actividades (pantalla completa) ---------- */
#overlay { position: fixed; inset: 0; z-index: 100; background: var(--paper); overflow-y: auto; }
.player { min-height: 100vh; display: flex; flex-direction: column; }
.player-top { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: rgba(247, 243, 236, .92); position: sticky; top: 0; z-index: 2; backdrop-filter: blur(8px); }
.player-top .bar { flex: 1; height: 12px; }
.player-top .bar > i { background: var(--c, var(--navy)); }
.player-body { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 28px 16px 48px; }
.pcard { width: 100%; max-width: 720px; }
.qlabel { font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--c, var(--navy)); }
.qtext { font-family: var(--display); font-size: clamp(1.3rem, 3vw, 1.75rem); font-weight: 700; margin: 8px 0 22px; line-height: 1.3; }
.opts { display: grid; gap: 10px; }
.opt { border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 15px 18px; text-align: left; cursor: pointer; font-weight: 700; font-size: 1.04rem; display: flex; gap: 14px; align-items: center; transition: border-color .12s, background .12s, transform .12s; }
.opt:hover:not(:disabled) { border-color: var(--c, var(--navy-2)); transform: translateX(2px); }
.opt .k { flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--paper-2); display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.right .k { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .k { background: var(--bad); color: #fff; }
.opt.chosen { border-color: var(--navy-2); background: #eef4fb; }
.opt:disabled { cursor: default; }
.feedback { margin-top: 18px; padding: 16px 18px; border-radius: 16px; font-weight: 600; display: flex; gap: 12px; align-items: flex-start; animation: rise .25s ease; }
.feedback.ok { background: var(--ok-bg); color: #14532d; }
.feedback.half { background: var(--warn-bg); color: #78350f; }
.feedback.bad { background: var(--bad-bg); color: #7f1d1d; }
.feedback .em { font-size: 1.6rem; line-height: 1; }
.player-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* Lección */
.slide { background: var(--card); border-radius: 26px; box-shadow: var(--shadow); padding: clamp(22px, 4vw, 40px); animation: rise .3s ease; }
.slide .emoji { font-size: 3.4rem; line-height: 1; }
.slide h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); margin: 12px 0 14px; }
.slide .text { font-size: 1.15rem; line-height: 1.65; }
.slide .text b { color: var(--c, var(--navy)); }
.slide .example { margin-top: 18px; padding: 14px 16px; border-radius: 14px; background: var(--paper); border-left: 4px solid var(--c, var(--navy)); font-size: 1.02rem; }
.slide .example::before { content: "Por ejemplo"; display: block; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--c, var(--navy)); margin-bottom: 4px; }
.slide .keys { display: grid; gap: 10px; margin-top: 6px; }
.slide .keys div { padding: 14px 16px; border-radius: 14px; background: var(--paper); font-weight: 700; font-size: 1.05rem; display: flex; gap: 12px; }
.slide .keys div span { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--c, var(--navy)); color: #fff; display: grid; place-items: center; font-size: .85rem; }
.check-box { margin-top: 22px; padding-top: 20px; border-top: 2px dashed var(--line); }
.check-box .qlabel { margin-bottom: 8px; }
.check-box .q { font-weight: 800; font-size: 1.08rem; margin-bottom: 12px; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--c, var(--navy)); width: 22px; border-radius: 6px; }

/* Tarjetas */
.flip { perspective: 1200px; cursor: pointer; }
.flip-inner { position: relative; height: 320px; transition: transform .5s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.flip.on .flip-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 26px; background: var(--card); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; }
.face.back { transform: rotateY(180deg); background: var(--c, var(--navy)); color: #fff; }
.face .txt { font-family: var(--display); font-size: clamp(1.3rem, 3.2vw, 1.8rem); font-weight: 700; line-height: 1.3; }
.face.back .txt { font-family: var(--body); font-size: clamp(1.1rem, 2.6vw, 1.35rem); font-weight: 700; }
.face .hint { position: absolute; bottom: 16px; font-size: .8rem; font-weight: 700; color: var(--ink-3); }
.face.back .hint { color: rgba(255, 255, 255, .7); }
.face .tp { position: absolute; top: 16px; font-size: .75rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.grades .btn { padding: 14px 8px; border-radius: 16px; flex-direction: column; gap: 2px; }
.grades .btn span { font-size: 1.5rem; }
.g-no { background: var(--bad); }
.g-no:hover { background: #991b1b; }
.g-casi { background: var(--sun-2); color: var(--ink); }
.g-casi:hover { background: #d97706; }
.g-si { background: var(--ok); }
.g-si:hover { background: #166534; }

/* Contrarreloj */
.timer { font-family: var(--display); font-weight: 800; font-size: 1.5rem; min-width: 64px; text-align: center; padding: 2px 12px; border-radius: 12px; background: var(--ink); color: #fff; }
.timer.low { background: var(--bad); animation: pop .5s infinite; }
.score-bubble { font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--ink); background: var(--sun); padding: 4px 14px; border-radius: 999px; }
.combo { font-weight: 800; color: #c2410c; font-size: .9rem; min-height: 1.4em; }

/* Parejas */
.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pairs .col { display: grid; gap: 10px; align-content: start; }
.tile { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 14px; font-weight: 700; cursor: pointer; text-align: center; min-height: 64px; display: grid; place-items: center; transition: all .15s; font-size: .98rem; }
.tile:hover:not(:disabled) { border-color: var(--c, var(--navy-2)); }
.tile.sel { border-color: var(--c, var(--navy)); background: #eef4fb; transform: scale(1.02); }
.tile.done { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); cursor: default; opacity: .75; }
.tile.miss { border-color: var(--bad); background: var(--bad-bg); animation: pop .3s; }

/* Resultado */
.result { text-align: center; }
.result .trophy { font-size: 4.4rem; animation: pop .6s ease; }
.result .big-score { font-family: var(--display); font-size: 3.4rem; font-weight: 800; line-height: 1; margin: 6px 0; }
.xp-gain { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; background: var(--sun); padding: 6px 16px; border-radius: 999px; margin-top: 12px; }
.tchange { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); text-align: left; }
.tchange + .tchange { margin-top: 8px; }
.tchange .bar { flex: 1; max-width: 200px; }
.review-item { text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--card); border-left: 4px solid var(--ok); font-size: .92rem; }
.review-item.bad { border-left-color: var(--bad); }
.review-item.half { border-left-color: var(--sun-2); }
.review-item + .review-item { margin-top: 8px; }
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 70px 16px; text-align: center; }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 5px solid var(--paper-2); border-top-color: var(--c, var(--navy)); animation: spin .9s linear infinite; }
.spinner.sm { width: 20px; height: 20px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* ---------- Zona familia ---------- */
.parent-shell { display: grid; grid-template-columns: 250px 1fr; gap: 22px; }
.side { position: sticky; top: 76px; align-self: start; display: flex; flex-direction: column; gap: 4px; }
.side .lbl { font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin: 14px 10px 6px; }
.side button { border: 0; background: transparent; text-align: left; padding: 10px 12px; border-radius: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.side button:hover { background: var(--paper-2); }
.side button.on { background: var(--card); box-shadow: var(--shadow); color: var(--ink); }
.side .avatar.sm { width: 30px; height: 30px; font-size: 17px; }
.side button svg { width: 20px; height: 20px; flex: none; }
@media (max-width: 860px) {
  .parent-shell { grid-template-columns: 1fr; }
  .side { position: static; flex-direction: row; overflow-x: auto; }
  .side .lbl { display: none; }
}
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.kpi b { display: block; font-family: var(--display); font-size: 1.8rem; line-height: 1.1; }
.kpi span { font-size: .82rem; font-weight: 700; color: var(--ink-3); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--paper-2); vertical-align: middle; }
.table .bar { height: 7px; width: 120px; display: inline-block; vertical-align: middle; margin-right: 8px; }
.table .bar > i { background: var(--st); }
.sicon { width: 48px; height: 48px; border-radius: 14px; color: #fff; display: grid; place-items: center; flex: none; }
.sicon svg { width: 26px; height: 26px; }
.subj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 8px; }
.diff { padding: 12px 14px; border-radius: 14px; background: var(--bad-bg); border-left: 4px solid var(--bad); }
.diff + .diff { margin-top: 8px; }
.report-frame { width: 100%; height: 680px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatches button.on { border-color: var(--ink); }
.icons-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.icons-pick button { width: 42px; height: 42px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; }
.icons-pick button.on { border-color: var(--ink); background: var(--paper-2); }
.icons-pick svg { width: 22px; height: 22px; }
.avatars { display: flex; gap: 8px; flex-wrap: wrap; }
.avatars button { width: 50px; height: 50px; border-radius: 50%; border: 3px solid transparent; background: var(--paper-2); font-size: 26px; cursor: pointer; }
.avatars button.on { border-color: var(--navy); }

/* ---------- Diálogos y avisos ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(22, 36, 58, .45); z-index: 150; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--card); border-radius: 22px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; padding: 26px; animation: rise .2s; max-height: 92vh; overflow-y: auto; }
.modal h3 { margin-bottom: 6px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
@keyframes fade { from { opacity: 0; } }
.pin-pad { display: flex; gap: 10px; justify-content: center; margin: 18px 0 6px; }
.pin-pad input { width: 54px; height: 62px; text-align: center; font-size: 1.6rem; font-weight: 800; border-radius: 14px; border: 2px solid var(--line); outline: none; }
.pin-pad input:focus { border-color: var(--navy-2); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 700; z-index: 300; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); animation: rise .2s; }
#toast.bad { background: var(--bad); }

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

/* ---------- Barra de menús ---------- */
html { font-size: var(--fs, 100%); }
body { font-size: 1rem; }
.menubar { display: flex; align-items: center; margin-left: 6px; }
.mb-menus { display: flex; gap: 2px; }
.mb-top { border: 0; background: transparent; padding: 7px 11px; border-radius: 8px; font-weight: 700; font-size: .92rem; color: var(--ink-2); cursor: pointer; }
.mb-top:hover, .mb-top.on, .mb-top:focus-visible { background: var(--paper-2); color: var(--ink); outline: none; }
.mb-burger { display: none; border: 0; background: var(--paper-2); padding: 8px 12px; border-radius: 10px; font-weight: 800; cursor: pointer; align-items: center; gap: 6px; }
.mb-burger svg { width: 18px; height: 18px; }
.mb-dropdown { position: fixed; z-index: 160; min-width: 270px; max-width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: rise .12s ease; max-height: calc(100vh - 90px); overflow-y: auto; }
.mb-item { width: 100%; border: 0; background: transparent; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; text-align: left; cursor: pointer; font-size: .92rem; font-weight: 600; color: var(--ink); }
.mb-item:hover, .mb-item:focus-visible { background: #eef4fb; outline: none; }
.mb-item[aria-disabled] { color: var(--ink-3); opacity: .55; cursor: default; }
.mb-item[aria-disabled]:hover { background: transparent; }
.mb-mark { width: 14px; flex: none; text-align: center; font-size: .8rem; color: var(--navy-2); }
.mb-label { flex: 1; }
.mb-right { display: flex; align-items: center; gap: 6px; color: var(--ink-3); }
.mb-lock svg { width: 14px; height: 14px; }
.mb-item .subj-dot { margin-right: 0; }
.mb-sep { height: 1px; background: var(--line); margin: 5px 8px; }
kbd { font-family: var(--body); font-size: .75rem; font-weight: 800; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--paper); color: var(--ink-2); }
.mm-list { margin-top: 10px; }
.mm-group + .mm-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.mm-title { font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); padding: 0 10px 4px; }
@media (max-width: 760px) {
  .mb-menus { display: none; }
  .mb-burger { display: inline-flex; }
}
.auth-bar { background: rgba(247, 243, 236, .95); }
.auth { min-height: calc(100vh - 62px); }
.help-body { margin-top: 12px; line-height: 1.6; font-size: .95rem; }
.help-body h4 { font-family: var(--display); font-size: 1.05rem; margin: 16px 0 6px; }
.help-body ol, .help-body ul { padding-left: 20px; margin: 6px 0; }
.help-body li { margin: 4px 0; }
.help-body p + p { margin-top: 8px; }
.help-body svg { width: 14px; height: 14px; vertical-align: -2px; }
.help-body code { background: var(--paper-2); padding: 1px 6px; border-radius: 5px; font-size: .88em; }

/* Aviso de IA no disponible */
.ai-banner { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; background: var(--bad-bg); color: #7f1d1d; font-weight: 700; font-size: .9rem; padding: 9px 16px; border-bottom: 1px solid #f3c9c9; text-align: center; }
.ai-banner svg { width: 18px; height: 18px; flex: none; }
.ai-banner .btn { background: var(--bad); }
.danger-zone { border: 1px solid #f3c9c9; }
.danger-zone h3 { color: var(--bad); }
.hint.match.ok { color: var(--ok); font-weight: 700; }
.hint.match.bad { color: var(--bad); font-weight: 700; }
.ai-banner .btn.ghost-light { background: transparent; color: #7f1d1d; box-shadow: inset 0 0 0 2px #f3c9c9; }
.ai-banner .btn.ghost-light:hover { background: #fde2e2; }
