/* =====================================================================
   Aula — estilos
   Concepto: cuaderno de música ordenado. Barra lateral tinta profunda
   para el docente; el estudiante ve una sola hoja limpia al centro.
   ===================================================================== */
:root {
  --bg: #F3F5F9; --surface: #FFFFFF; --surface-2: #EDF1F7; --ink: #142036; --muted: #5A6680; --line: #DAE1EC;
  --accent: #2350D8; --accent-ink: #FFFFFF; --accent-soft: #E3EAFD;
  --ok: #157347; --ok-soft: #DCF2E5; --warn: #A95306; --warn-soft: #FCEFD7; --bad: #B8321A; --bad-soft: #FCE4DD;
  --side: #101A31; --side-2: #1A2645; --side-ink: #C3CEE6; --side-on: #FFFFFF;
  --key: #FFFFFF; --key-edge: #B7C1D4; --key-black: #151923; --hand: #F3E2D3; --hand-edge: #9C7F69;
  --n0: #2563EB; --n1: #16A34A; --n2: #E07409; --n3: #8B5CF6; --n4: #92633A; --n5: #E11D48; --n6: #C49102;
  --shadow: 0 1px 2px rgba(20, 32, 54, .06), 0 4px 16px rgba(20, 32, 54, .06);
  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1220; --surface: #151C2E; --surface-2: #1C2438; --ink: #E5EAF6; --muted: #98A4C0; --line: #29324A;
    --accent: #7EA2FF; --accent-ink: #0D1220; --accent-soft: #1E2A4F;
    --ok: #4ADE80; --ok-soft: #14301F; --warn: #F5B454; --warn-soft: #36270F; --bad: #FB8A6A; --bad-soft: #3A1D15;
    --side: #0A0F1C; --side-2: #151D33; --side-ink: #A9B5D1; --side-on: #FFFFFF;
    --key: #E6EAF2; --key-edge: #8C96AB; --key-black: #05070C; --hand: #C9B3A1; --hand-edge: #6E5746;
    --n0: #6B9BFF; --n1: #4ADE80; --n2: #FBA046; --n3: #B197FC; --n4: #C8976A; --n5: #FB7191; --n6: #F2C94C;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1220; --surface: #151C2E; --surface-2: #1C2438; --ink: #E5EAF6; --muted: #98A4C0; --line: #29324A;
  --accent: #7EA2FF; --accent-ink: #0D1220; --accent-soft: #1E2A4F;
  --ok: #4ADE80; --ok-soft: #14301F; --warn: #F5B454; --warn-soft: #36270F; --bad: #FB8A6A; --bad-soft: #3A1D15;
  --side: #0A0F1C; --side-2: #151D33; --side-ink: #A9B5D1; --side-on: #FFFFFF;
  --key: #E6EAF2; --key-edge: #8C96AB; --key-black: #05070C; --hand: #C9B3A1; --hand-edge: #6E5746;
  --n0: #6B9BFF; --n1: #4ADE80; --n2: #FBA046; --n3: #B197FC; --n4: #C8976A; --n5: #FB7191; --n6: #F2C94C;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-family: var(--body); font-weight: 800; }
p { margin: 0; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.block { display: block; }
.strong { font-weight: 800; }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; justify-content: center; }
.err { color: var(--bad); font-weight: 700; min-height: 0; }
.err:empty { display: none; }
.warn-text { color: var(--warn); font-weight: 700; }

/* ---------- Estructura del docente ---------- */
.layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; gap: 18px; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1.4rem; color: inherit; text-decoration: none; }
.side .brand { color: var(--side-on); padding: 0 8px; }
.brand-mark { display: inline-flex; gap: 2px; height: 26px; align-items: flex-start; }
.brand-mark i { width: 8px; height: 26px; background: #fff; border-radius: 0 0 3px 3px; box-shadow: inset 0 -3px 0 #C9D3EA; position: relative; }
.brand-mark i:nth-child(1)::after, .brand-mark i:nth-child(2)::after { content: ""; position: absolute; right: -4px; top: 0; width: 6px; height: 15px; background: #2350D8; border-radius: 0 0 2px 2px; z-index: 1; }
.side nav { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.nav { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; color: var(--side-ink); text-decoration: none; font-weight: 700; font-size: 1.02rem; background: none; border: 0; width: 100%; text-align: left; }
.nav:hover { background: var(--side-2); color: var(--side-on); }
.nav.on { background: #2350D8; color: #fff; box-shadow: 0 6px 16px rgba(35, 80, 216, .35); }
.side-foot { margin-top: auto; display: grid; gap: 4px; border-top: 1px solid var(--side-2); padding-top: 14px; }
.me { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; color: var(--side-ink); text-decoration: none; min-width: 0; }
.me:hover, .me.on { background: var(--side-2); }
.me span:last-child { display: grid; min-width: 0; }
.me b { color: var(--side-on); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #7EA2FF; color: #0D1220; font-weight: 800; }
.main-col { min-width: 0; }
.topbar { display: none; }
.content { padding-block: 28px 64px; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.wrap.narrow { max-width: 720px; }
.center-page { min-height: 80vh; align-content: center; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.back { font-weight: 800; text-decoration: none; justify-self: start; font-size: .92rem; }
.section-title { margin-top: 8px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--side); color: var(--side-on); position: sticky; top: 0; z-index: 30; }
  .topbar .icon-btn { color: var(--side-on); background: transparent; border-color: var(--side-2); }
  .wrap { padding-inline: 16px; }
  .content { padding-top: 18px; }
}

/* ---------- Componentes básicos ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); display: grid; gap: 14px; min-width: 0; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head a { font-weight: 700; font-size: .9rem; text-decoration: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 11px; padding: 10px 18px; font-weight: 800; text-decoration: none; white-space: nowrap; transition: filter .15s, transform .1s; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); filter: none; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.primary { background: var(--accent); }
.btn.small { padding: 6px 12px; font-size: .9rem; border-radius: 9px; }
.btn.big { padding: 14px 24px; font-size: 1.08rem; }
.btn.wide { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; flex: none; padding: 0; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.ico { flex: none; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.small { gap: 8px; font-size: .86rem; }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-weight: 800; font-size: .9rem; }
.field small { color: var(--muted); font-size: .84rem; }
.input { width: 100%; min-width: 0; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--surface); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.big { font-size: 1.1rem; padding: 12px 14px; }
textarea.input { resize: vertical; line-height: 1.45; }
select.input { padding-right: 30px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.toggles { display: grid; gap: 14px; }
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { flex: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line); position: relative; transition: background .15s; margin-top: 1px; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--accent); outline-offset: 2px; }
.switch-text { display: grid; }
.switch-text small { color: var(--muted); font-size: .84rem; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border-radius: 11px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; font-weight: 800; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.big { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.seg.big button { display: grid; text-align: left; padding: 12px 14px; gap: 2px; }
.seg.big small { font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs > * { flex: none; }
.tabs button { border: 0; background: none; padding: 10px 16px; font-weight: 800; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 800; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.notice { background: var(--accent-soft); border-radius: 12px; padding: 12px 16px; }
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 40px 20px; color: var(--muted); }
.empty b { color: var(--ink); font-family: var(--display); font-weight: 600; font-size: 1.15rem; }
.empty .btn { margin-top: 6px; }
.loading { padding: 80px 20px; text-align: center; color: var(--muted); font-weight: 700; }

/* Avisos y ventanas */
.toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); transition: opacity .3s, transform .3s; }
.toast.error { background: var(--bad); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
.modal-back { position: fixed; inset: 0; background: rgba(10, 15, 28, .55); display: grid; place-items: center; padding: 16px; z-index: 60; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.modal-body { padding: 4px 20px 16px; overflow-y: auto; display: grid; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.errs { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
@keyframes fade { from { opacity: 0; } }

/* Tablas y listas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { text-align: left; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; background: var(--surface-2); white-space: nowrap; }
td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
td a { text-decoration: none; }
td a.strong, .strong a { color: var(--ink); }
td a.strong:hover { color: var(--accent); }
th.num, td.num { text-align: right; }
td.actions, .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
td.actions { display: table-cell; white-space: nowrap; text-align: right; }
td.actions > * { margin-left: 4px; }
td.low { color: var(--bad); font-weight: 800; }
.pct { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.pct-bar { display: inline-block; height: 6px; max-width: 60px; border-radius: 99px; background: var(--accent); }
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; color: var(--ink); text-decoration: none; }
.list-row:hover { background: var(--surface-2); }
.list-row > span:first-child { display: grid; min-width: 0; }
.list-row small { color: var(--muted); }
.list-end { display: flex; align-items: center; gap: 10px; flex: none; }
.timeline { list-style: none; margin: 0; padding: 8px 20px 16px; display: grid; gap: 10px; }
.timeline li { display: flex; justify-content: space-between; gap: 12px; padding-left: 16px; position: relative; flex-wrap: wrap; }
.timeline li::before { content: ""; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.timeline a { color: var(--ink); text-decoration: none; font-weight: 600; }
.timeline small { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.filters .input { width: auto; min-width: 180px; flex: 0 1 auto; }
.search { position: relative; flex: 1 1 240px; display: flex; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 36px; width: 100%; }

/* Panel */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.stat-label { font-size: .78rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-family: var(--display); font-weight: 600; font-size: 1.9rem; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 10px; }
.quick-btn { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-weight: 800; text-align: left; }
.quick-btn:hover { border-color: var(--accent); }
.quick-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.two-col.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1050px) { .two-col, .two-col.even { grid-template-columns: 1fr; } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.exam-card, .course-card { color: var(--ink); text-decoration: none; }
.exam-card:hover { border-color: var(--accent); }
.mini-stats { display: flex; gap: 22px; }
.mini-stats span { display: grid; }
.mini-stats b { font-family: var(--display); font-weight: 600; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.mini-stats small { color: var(--muted); font-size: .8rem; }
.course-link { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-size: 1.2rem; flex-wrap: wrap; }
.kv { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.kv span { display: grid; }
.kv small { font-size: .78rem; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }

/* Plantillas y compartir */
.tpl-grid, .type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 10px; }
.tpl { display: grid; gap: 4px; text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px; }
.tpl:hover { border-color: var(--accent); }
.tpl b { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.tpl span:not(.tpl-ico) { color: var(--muted); font-size: .88rem; }
.tpl small { color: var(--accent); font-weight: 800; font-size: .8rem; }
.tpl.small { padding: 12px; }
.tpl-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.share { display: grid; gap: 14px; }
.copy-row { display: flex; gap: 8px; }
.share-code { display: grid; justify-items: center; gap: 6px; background: var(--surface-2); border-radius: 14px; padding: 14px; }
.share-code b { font-family: var(--display); font-size: 2.2rem; letter-spacing: .18em; }
.qr { display: grid; place-items: center; min-height: 120px; color: var(--muted); }
.qr svg { width: 200px; height: 200px; background: #fff; border-radius: 12px; padding: 6px; }
.code { font-family: var(--display); letter-spacing: .12em; font-size: 1.2rem; }

/* Gráficos */
.hist { width: 100%; height: auto; }
.hist .grid, .spark .grid { stroke: var(--line); stroke-width: 1; }
.hist .axis { fill: var(--muted); font-size: 11px; font-family: var(--body); }
.hist .val { fill: var(--ink); font-size: 11px; font-weight: 800; font-family: var(--body); }
.hist .bar { fill: var(--accent); }
.hist .bar.low { fill: var(--muted); opacity: .55; }
.spark svg { width: 100%; height: auto; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.spark .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.hard { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 12px; }
.hard li b.num { white-space: nowrap; }
.hard li { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.qstats { display: grid; gap: 10px; }
.qstat { padding: 0; gap: 0; }
.qstat summary { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(80px, 160px) 90px; gap: 14px; align-items: center; padding: 14px 18px; cursor: pointer; list-style: none; }
.qstat summary::-webkit-details-marker { display: none; }
.qstat-text { display: grid; min-width: 0; }
.qstat-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qstat-text small { color: var(--muted); }
.qstat summary > b { text-align: right; }
.qstat-body { padding: 0 18px 16px; display: grid; gap: 10px; }
.meter { display: block; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter-ok, .meter-bad { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.meter-bad { background: var(--muted); opacity: .6; }
.dist { display: grid; gap: 8px; }
.dist-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, 200px) 40px; gap: 12px; align-items: center; }
.dist-row.ok .dist-label { color: var(--ok); font-weight: 800; }
.dist-row b { text-align: right; }
@media (max-width: 600px) { .qstat summary { grid-template-columns: auto minmax(0, 1fr) 70px; } .qstat summary .meter { display: none; } }

/* ---------- Constructor ---------- */
.builder { display: grid; }
.builder-head { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 24px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.bh-title { display: grid; gap: 4px; min-width: 0; }
.title-input { border: 0; background: transparent; font-family: var(--display); font-weight: 600; font-size: 1.45rem; padding: 2px 6px; border-radius: 8px; width: 100%; min-width: 0; }
.title-input:hover { background: var(--surface-2); }
.title-input:focus { outline: none; background: var(--surface-2); }
.save-status { font-size: .84rem; font-weight: 700; color: var(--muted); }
.save-status.ok::before { content: "✓ "; color: var(--ok); }
.save-status.busy { color: var(--warn); }
.save-status.bad { color: var(--bad); }
.builder-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; align-items: start; }
.palette { position: sticky; top: 100px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 14px; max-height: calc(100vh - 120px); overflow-y: auto; }
.pal-group { display: grid; gap: 4px; }
.pal-group h3 { margin-bottom: 4px; }
.pal-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: 9px; text-align: left; font-weight: 700; font-size: .93rem; }
.pal-item:hover { background: var(--accent-soft); color: var(--accent); }
.pal-item .ico { color: var(--accent); }
.builder-main { display: grid; gap: 16px; min-width: 0; }
.qlist { display: grid; gap: 12px; }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; transition: border-color .15s; }
.qcard.open { border-color: var(--accent); }
.qcard.over { border-color: var(--accent); border-style: dashed; }
.qcard.dragging { opacity: .5; }
.qcard-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.grip { cursor: grab; color: var(--muted); display: grid; place-items: center; padding: 4px; }
.qnum { flex: none; display: grid; place-items: center; min-width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: .9rem; font-variant-numeric: tabular-nums; }
.qsum { flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 0; background: none; text-align: left; padding: 6px 4px; }
.qtype { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.qprompt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.warn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
.qpts { font-size: .82rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.qacts { display: flex; gap: 4px; }
.qcard-body { padding: 4px 20px 20px; display: grid; gap: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.type-editor { background: var(--surface-2); border-radius: 12px; padding: 16px; display: grid; gap: 12px; }
.more { border-top: 1px dashed var(--line); padding-top: 10px; }
.more summary { cursor: pointer; font-weight: 800; color: var(--muted); font-size: .92rem; padding: 4px 0; }
.more[open] summary { margin-bottom: 10px; }
.more > div, .more > .field { margin-top: 10px; }
.media-ed { display: grid; gap: 10px; }
.media-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.media-item { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.media-item img { max-height: 90px; border-radius: 8px; }
.media-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.opt-ed { display: grid; gap: 8px; }
.opt-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.mark { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); font-weight: 800; color: var(--muted); display: grid; place-items: center; padding: 0; }
.mark.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.fill-preview { background: var(--surface); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; line-height: 2; }
.blank-chip { display: inline-block; padding: 0 10px; margin: 0 3px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-weight: 800; line-height: 1.8; }
.settings { display: grid; gap: 16px; }
.preview-list { display: grid; gap: 16px; }
.bank-pick { display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.bank-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.bank-row input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); }
.bank-row span { display: grid; }
.bank-row small { color: var(--muted); }
.bank-item { display: flex; gap: 16px; justify-content: space-between; align-items: center; padding: 14px 20px; flex-wrap: wrap; }
.bank-main { display: grid; gap: 6px; min-width: 0; flex: 1 1 320px; }
.crumbs { font-size: .86rem; color: var(--muted); }
@media (max-width: 900px) {
  .builder-head { grid-template-columns: 1fr; padding: 12px 16px; position: static; }
  .builder-grid { grid-template-columns: 1fr; padding: 16px; }
  .palette { position: static; max-height: none; order: 2; }
  .palette .pal-group { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .palette .pal-group h3 { grid-column: 1 / -1; }
  .qcard-head { flex-wrap: wrap; row-gap: 4px; }
  .qsum { flex: 1 1 calc(100% - 90px); grid-template-columns: minmax(0, 1fr) auto; }
  .qsum .qtype { grid-column: 1 / -1; }
  .qacts { width: 100%; justify-content: flex-end; }
  .qacts .icon-btn { width: 34px; height: 34px; }
  .qpts { display: none; }
  .add-fab { display: flex !important; }
}
.add-fab { display: none; position: sticky; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); justify-self: center; z-index: 10; box-shadow: 0 6px 20px rgba(35, 80, 216, .35); }

/* ---------- Revisión de intentos ---------- */
.review { display: grid; gap: 12px; }
.rv { gap: 10px; border-left: 5px solid var(--line); }
.rv.ok { border-left-color: var(--ok); }
.rv.bad { border-left-color: var(--bad); }
.rv.partial, .rv.pending { border-left-color: var(--warn); }
.rv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rv-prompt { flex: 1 1 200px; }
.rv-pts { font-weight: 800; }
.rv-dl { display: grid; grid-template-columns: minmax(140px, auto) minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.rv-dl dt { color: var(--muted); font-size: .88rem; font-weight: 800; }
.rv-dl dd { margin: 0; }
.long-answer { white-space: pre-wrap; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; }
.rv .row .input { width: auto; flex: 1 1 200px; }
.rv .row .input[type=number] { flex: 0 0 90px; }
@media (max-width: 600px) { .rv-dl { grid-template-columns: 1fr; } }

/* ---------- Página de inicio y acceso ---------- */
.landing { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.land-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; }
.land-hero { display: grid; justify-items: center; align-content: center; gap: 14px; padding: 40px 16px; text-align: center; }
.land-hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
.lead { font-size: 1.1rem; color: var(--muted); }
.keys-deco { display: flex; position: relative; width: 176px; height: 70px; margin-bottom: 10px; filter: drop-shadow(0 6px 14px rgba(20,32,54,.12)); }
.keys-deco .k { width: 22px; height: 70px; background: var(--key); border: 1px solid var(--key-edge); border-radius: 0 0 5px 5px; margin-left: -1px; }
.keys-deco .k.b { position: absolute; top: 0; width: 14px; height: 44px; background: var(--key-black); border-color: var(--key-black); margin: 0; z-index: 1; }
.code-form { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: min(460px, 100%); }
.code-input { flex: 1 1 220px; min-width: 0; font-family: var(--display); font-size: 1.8rem; letter-spacing: .18em; text-transform: uppercase; text-align: center; border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; background: var(--surface); }
.code-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.land-feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 16px; max-width: 980px; margin: 0 auto; padding: 24px 16px 48px; width: 100%; }
.feat { display: grid; gap: 6px; }
.feat p { color: var(--muted); font-size: .94rem; }
.feat-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.auth-card { gap: 18px; }
.auth-card .brand { color: var(--ink); }

/* ---------- Estudiante ---------- */
.student { min-height: 100vh; }
.student .wrap { padding-block: 28px 64px; }
.intro .org, .result .org { font-size: .82rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-info { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 99px; padding: 5px 12px; font-size: .88rem; font-weight: 700; }
.instructions { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; display: grid; gap: 4px; white-space: pre-wrap; }
.take-bar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px; display: grid; gap: 8px; }
.take-top { display: flex; align-items: center; gap: 14px; max-width: 720px; width: 100%; margin: 0 auto; }
.take-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.timer { font-weight: 800; font-variant-numeric: tabular-nums; background: var(--surface-2); padding: 3px 10px; border-radius: 99px; }
.timer.low { background: var(--bad-soft); color: var(--bad); }
.prog { display: flex; align-items: center; gap: 12px; max-width: 720px; width: 100%; margin: 0 auto; }
.prog-track { flex: 1; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.prog-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.prog-text { font-size: .86rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nav-grid { display: flex; flex-wrap: wrap; gap: 6px; max-width: 720px; width: 100%; margin: 0 auto; }
.nav-cell { width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 800; font-variant-numeric: tabular-nums; }
.nav-cell.done { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.nav-cell.cur { box-shadow: 0 0 0 3px var(--accent); }
.take-main { gap: 18px; }
.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; display: grid; gap: 16px; box-shadow: var(--shadow); min-width: 0; }
.q-head { display: flex; justify-content: space-between; align-items: center; }
.q-num { font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.q-prompt { font-family: var(--display); font-weight: 500; font-size: 1.3rem; line-height: 1.3; white-space: pre-wrap; }
.take-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.feedback { border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px; }
.feedback.good { background: var(--ok-soft); }
.feedback.good > b { color: var(--ok); }
.feedback.bad { background: var(--bad-soft); }
.feedback.bad > b { color: var(--bad); }
.result { justify-items: center; text-align: center; padding: 28px 22px; }
.result-ico { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.score-ring { --p: 0; width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); }
.score-ring b { display: grid; place-items: center; width: 118px; height: 118px; border-radius: 50%; background: var(--surface); font-family: var(--display); font-size: 1.8rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.q-media { display: grid; gap: 10px; }
.q-img { border-radius: 12px; max-height: 360px; object-fit: contain; justify-self: center; background: var(--surface-2); }
.q-audio { width: 100%; }
.q-video { position: relative; aspect-ratio: 16 / 9; max-width: 100%; }
.q-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 12px; }
.q-vid { width: 100%; border-radius: 12px; }
.q-file { font-weight: 800; }

/* Opciones */
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 14px; text-align: left; border: 2px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; font-weight: 700; font-size: 1.02rem; transition: border-color .12s, background .12s; }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice.on { border-color: var(--accent); background: var(--accent-soft); }
.choice-key { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); font-weight: 800; }
.choices.multi .choice-key { border-radius: 7px; border: 2px solid var(--line); background: var(--surface); }
.choice.on .choice-key { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.is-correct { border-color: var(--ok) !important; background: var(--ok-soft) !important; }
.is-wrong { border-color: var(--bad) !important; background: var(--bad-soft) !important; }
.tf-big { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-opt { display: grid; justify-items: center; gap: 6px; border: 2px solid var(--line); background: var(--surface); border-radius: 16px; padding: 18px 10px; font-weight: 800; font-size: 1.05rem; }
.tf-sym { font-size: 1.8rem; line-height: 1; }
.tf-opt.yes .tf-sym { color: var(--ok); }
.tf-opt.no .tf-sym { color: var(--bad); }
.tf-opt.on.yes { border-color: var(--ok); background: var(--ok-soft); }
.tf-opt.on.no { border-color: var(--bad); background: var(--bad-soft); }
.unit { font-weight: 800; color: var(--muted); }
.fill-line { font-size: 1.1rem; line-height: 2.4; }
.blank { font-weight: 800; border: 2px solid var(--line); border-radius: 9px; background: var(--surface); padding: 3px 8px; margin: 0 4px; color: var(--accent); max-width: 100%; }
.blank:focus { outline: none; border-color: var(--accent); }
.fix { color: var(--ok); font-weight: 800; margin-right: 6px; }

/* Relacionar */
.match { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(36px, .8fr) minmax(0, 1fr); }
.match .col { display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 1; }
.match .chip { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; }
.match .col.r .chip { flex-direction: row-reverse; text-align: right; }
.match svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.match line { stroke-width: 3; stroke-linecap: round; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); flex: none; }
[data-c="0"] { --n: var(--n0); } [data-c="1"] { --n: var(--n1); } [data-c="2"] { --n: var(--n2); } [data-c="3"] { --n: var(--n3); }
[data-c="4"] { --n: var(--n4); } [data-c="5"] { --n: var(--n5); } [data-c="6"] { --n: var(--n6); }
.chip { font-family: var(--display); font-weight: 600; font-size: 1.05rem; border-radius: 11px; border: 2px solid var(--line); background: var(--surface); padding: 7px 12px; min-height: 44px; transition: transform .12s, border-color .12s, background .12s; }
.chip[data-c] { border-color: var(--n); background: color-mix(in srgb, var(--n) 16%, var(--surface)); }
.chip:hover:not(:disabled) { transform: translateY(-1px); }
.chip.sel { box-shadow: 0 0 0 3px var(--accent); }
.chip.used { opacity: .5; }

/* Ordenar */
.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.order-item { display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 10px; }
.order-item[draggable] { cursor: grab; }
.order-item.dragging { opacity: .4; }
.order-item.over { border-color: var(--accent); border-style: dashed; }
.order-pos { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.order-text { flex: 1; font-weight: 700; min-width: 0; }
.order-btns { display: flex; gap: 4px; }

/* Teclado */
.kb { position: relative; display: flex; height: 170px; border: 3px solid var(--key-black); border-radius: 8px 8px 10px 10px; overflow: hidden; background: var(--key-black); touch-action: manipulation; user-select: none; }
.wk { flex: 1; min-width: 0; background: var(--key); border: 0; border-right: 1.5px solid var(--key-edge); border-radius: 0 0 6px 6px; display: flex; align-items: flex-end; justify-content: center; padding: 0 0 8px; color: #15203D; font-family: var(--display); font-weight: 600; font-size: .85rem; }
.wk:last-of-type { border-right: 0; }
.wk.sel { background: color-mix(in srgb, var(--key) 65%, #7EA2FF); }
.wk:active:not(:disabled) { background: color-mix(in srgb, var(--key) 80%, #98A4C0); }
.bk { position: absolute; top: 0; width: calc(100% / var(--wn) * .58); height: 58%; background: var(--key-black); border: 0; border-radius: 0 0 5px 5px; transform: translateX(-50%); box-shadow: inset 0 -6px 0 #2B2F3A; padding: 0; z-index: 2; }
.bk:active:not(:disabled) { box-shadow: inset 0 -2px 0 #2B2F3A; background: #2A2F3D; }
.slots { display: grid; grid-template-columns: repeat(var(--wn), minmax(0, 1fr)); gap: 5px; }
.slot { min-height: 44px; border: 2px dashed var(--line); border-radius: 10px; background: var(--surface-2); font-family: var(--display); font-weight: 600; font-size: .95rem; padding: 0 2px; min-width: 0; }
.slot[data-c] { border-style: solid; border-color: var(--n); background: color-mix(in srgb, var(--n) 16%, var(--surface)); }
.slot.sel { border-color: var(--accent); border-style: solid; box-shadow: 0 0 0 3px var(--accent-soft); }
.bank { display: flex; flex-wrap: wrap; gap: 8px; }
.bank .chip { flex: 1 1 60px; }
.plays { display: flex; flex-wrap: wrap; gap: 8px; }
.play { display: grid; justify-items: center; gap: 2px; min-width: 84px; padding: 8px 10px; border-radius: 12px; border: 2px dashed var(--line); background: var(--surface-2); }
.play b { font-family: var(--display); font-weight: 600; font-size: 1.15rem; }
.play span { font-size: .8rem; color: var(--muted); }
.play.sel { border-style: solid; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.play.filled { border-style: solid; }

/* Manos */
.hands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hand-box { display: grid; justify-items: center; gap: 6px; min-width: 0; }
.hand { position: relative; width: 100%; max-width: 230px; aspect-ratio: 220 / 260; }
.hand svg { width: 100%; height: 100%; display: block; }
.hand .outline rect { fill: var(--hand); stroke: var(--hand-edge); stroke-width: 5; }
.hand .fillin rect { fill: var(--hand); }
.fb { position: absolute; width: 38px; height: 38px; border-radius: 50%; transform: translate(-50%, -50%); border: 2.5px solid var(--accent); background: var(--surface); font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--accent); padding: 0; }
.fb.sel { background: var(--accent); color: var(--accent-ink); }
.hand-label { font-weight: 800; font-size: .88rem; background: var(--accent-soft); color: var(--accent); padding: 2px 12px; border-radius: 99px; }
.pad { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pad button { min-width: 48px; height: 44px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface-2); font-family: var(--display); font-weight: 700; font-size: 1.2rem; padding: 0 12px; }
.pad button.small { font-size: .9rem; font-family: var(--body); }
.pad button:hover { border-color: var(--accent); }

@media (max-width: 520px) {
  .kb { height: 140px; }
  .wk { font-size: .72rem; }
  .slot { font-size: .8rem; }
  .fb { width: 32px; height: 32px; font-size: 1rem; }
  .q-card { padding: 16px; }
  .q-prompt { font-size: 1.15rem; }
  .take-nav .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Impresión (reportes en PDF) ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --shadow: none; }
  .side, .topbar, .no-print, .btn, .icon-btn, .filters, .builder-head, .toasts, details.more { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
  table { min-width: 0; }
  a { color: inherit; text-decoration: none; }
}
.gradebook .link { text-decoration: none; color: var(--ink); }
.gradebook .link:hover { color: var(--accent); }
th a { color: inherit; text-decoration: none; }
.brand-name { display: grid; line-height: 1; gap: 2px; }
.brand-name b { font-weight: 700; font-size: 1.15em; }
.brand-name small { font-family: var(--body); font-weight: 800; font-size: .52em; letter-spacing: .22em; text-transform: uppercase; opacity: .8; }
.rv-time { display: inline-flex; align-items: center; gap: 4px; font-size: .84rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.course-card.is-archived { opacity: .75; border-style: dashed; }
.archived-note { background: var(--warn-soft); }
/* Logo en fondos claros: teclas con contorno */
.brand-mark i { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink); }
.side .brand-mark i, .topbar .brand-mark i { background: #fff; box-shadow: inset 0 -3px 0 #C9D3EA; }

/* ================= Fase 2: grupos, asistencia, alumnos ================= */
.ok-text { color: var(--ok); } .bad-text { color: var(--bad); }
.stack.tight { gap: 6px; }
.fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 12px; min-width: 0; }
.fieldset legend { font-weight: 800; font-size: .9rem; padding: 0 6px; }
.badge.inst { background: var(--surface-2); color: var(--ink); }
.count-dot { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 99px; background: var(--bad); color: #fff; font-size: .74rem; font-weight: 800; }

/* Grupos */
.group-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.group-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: var(--surface-2); color: var(--ink); font-weight: 800; font-size: .88rem; text-decoration: none; }
.group-chip:hover { background: var(--accent-soft); color: var(--accent); }
.group-chip small { color: var(--muted); font-weight: 700; }
.join-mini { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.join-mini small { color: var(--muted); font-weight: 700; }
.join-box { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 22px; background: var(--accent-soft); border-radius: var(--r); padding: 16px 20px; }
.join-box > div:first-child { display: grid; gap: 2px; }
.join-box > div:first-child small { font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.join-box .code { font-size: 2rem; color: var(--accent); }
.join-box .row { grid-column: 1 / -1; }
@media (max-width: 600px) { .join-box { grid-template-columns: 1fr; } }
.group-preview { display: grid; gap: 4px; justify-items: start; background: var(--surface-2); border-radius: 12px; padding: 12px 16px; }
.group-preview b { font-family: var(--display); font-weight: 600; font-size: 1.2rem; }

/* Asistencia: colores */
.att-p { --att: var(--ok); --att-soft: var(--ok-soft); }
.att-t { --att: var(--warn); --att-soft: var(--warn-soft); }
.att-a { --att: var(--bad); --att-soft: var(--bad-soft); }
.att-j { --att: var(--accent); --att-soft: var(--accent-soft); }
.att-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: .82rem; font-weight: 800; background: var(--att-soft, var(--surface-2)); color: var(--att, var(--muted)); white-space: nowrap; }
.att-cell { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-weight: 800; font-size: .82rem; background: var(--att-soft); color: var(--att); flex: none; }
.att-cell.empty { background: none; color: var(--muted); }
.att-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.att-big { display: grid; line-height: 1.1; margin-right: 8px; }
.att-big b { font-family: var(--display); font-size: 1.8rem; font-weight: 600; }
.att-big small { color: var(--muted); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .86rem; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.att-table th, .att-table td { white-space: nowrap; }
.att-table .att-col { text-align: center; padding-left: 4px; padding-right: 4px; }
.att-table th.att-col a { color: var(--muted); font-weight: 800; font-size: .8rem; text-decoration: none; }
.att-table td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }

/* Lista de clases */
.class-row { display: flex; align-items: center; gap: 10px; }
.class-row .list-row { flex: 1; min-width: 0; }
.class-row .actions { padding-right: 14px; display: flex; gap: 4px; }
.class-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.class-list .class-row { font-size: .92rem; }
.class-list .rv-time { color: var(--muted); font-weight: 700; min-width: 72px; }

/* Pasar lista (celular primero) */
.roll-page { gap: 16px; }
.att-counter { display: flex; flex-wrap: wrap; gap: 6px; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; }
.roll { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.roll-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--att, var(--line)); border-radius: 12px; padding: 10px 12px; }
.roll-name { font-weight: 800; min-width: 0; flex: 1 1 140px; }
.roll-btns { display: flex; gap: 6px; }
.roll-btn { min-width: 48px; min-height: 44px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); color: var(--att); font-weight: 800; padding: 0 10px; transition: background .12s, border-color .12s; }
.roll-btn:hover { border-color: var(--att); }
.roll-btn.on { background: var(--att); border-color: var(--att); color: var(--surface); }
.roll-long { display: none; }
@media (min-width: 700px) { .roll-short { display: none; } .roll-long { display: inline; } }

/* Alumno */
.stu-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.stu-bar .brand { color: var(--ink); }
.stu-who { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.pin-input { letter-spacing: .6em; text-align: center; font-family: var(--display); max-width: 200px; }
.land-student { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-weight: 800; }
.group-card h3 { margin: 0; }
.group-card h4 { margin: 0; font-size: .9rem; color: var(--muted); }
.stu-bar .row { flex-wrap: nowrap; }
.result-list .list-row { padding: 12px 0; }
@media (max-width: 480px) { .stu-who span:last-child { display: none; } }
.card { grid-template-columns: minmax(0, 1fr); }
.card .code-form { width: 100%; justify-content: flex-start; }
.card .code-form .btn { flex: 1 1 auto; }

/* ================= Fase 3: tipos de actividad, asignaciones, calendario ================= */
.k-exam { --k: var(--accent); --k-soft: var(--accent-soft); }
.k-quiz { --k: var(--n3); --k-soft: color-mix(in srgb, var(--n3) 16%, var(--surface)); }
.k-homework { --k: var(--warn); --k-soft: var(--warn-soft); }
.k-practice { --k: var(--ok); --k-soft: var(--ok-soft); }
.badge.kind { background: var(--k-soft); color: var(--k); }
.kind-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 10px; }
.kind-opt { display: grid; gap: 4px; justify-items: start; text-align: left; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.kind-opt small { color: var(--muted); font-size: .84rem; line-height: 1.35; }
.kind-opt:hover { border-color: var(--k); }
.kind-opt.on { border-color: var(--k); background: var(--k-soft); box-shadow: 0 0 0 1px var(--k); }
.kind-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--k-soft); color: var(--k); }
.kind-opt.on .kind-ico { background: var(--k); color: var(--surface); }

.assign-list { display: grid; gap: 8px; }
.assign-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: grid; gap: 10px; }
.assign-row.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.assign-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 700; }
.assign-head input { width: 20px; height: 20px; }
.assign-head .save-status { margin-left: auto; }
.assign-head .save-status:empty { display: none; }

/* Portal: actividades */
.chip-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-f { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 14px; font-weight: 800; color: var(--muted); cursor: pointer; min-height: 36px; }
.chip-f.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.act-section h3 { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; font-size: 1rem; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--surface-2); font-size: .78rem; }
.act-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); border-left: 4px solid var(--k); background: var(--surface); }
.act-card.soon { background: color-mix(in srgb, var(--warn-soft) 55%, var(--surface)); }
.act-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--k-soft); color: var(--k); }
.act-body { display: grid; gap: 2px; min-width: 0; }
.act-kind { font-weight: 800; color: var(--k); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.act-title { font-size: 1.02rem; overflow-wrap: anywhere; }
.act-side { display: grid; justify-items: end; gap: 6px; }
.act-score { font-family: var(--display); font-size: 1.3rem; font-weight: 600; }
@media (max-width: 520px) {
  .act-card { grid-template-columns: auto minmax(0, 1fr); }
  .act-side { grid-column: 1 / -1; grid-template-columns: auto 1fr; justify-items: stretch; align-items: center; }
  .act-side .btn { justify-self: end; }
}
.more-card summary { cursor: pointer; font-weight: 800; }
.more-card[open] summary { margin-bottom: 10px; }
.day.empty header { justify-content: flex-start; justify-items: start; }

/* ================= Fase 4: lecciones ================= */
.lesson { display: grid; gap: 22px; max-width: 860px; margin: 0 auto; width: 100%; }
.lesson-body { display: grid; gap: 18px; }
.lesson-frame { background: var(--bg); border: 1px dashed var(--line); border-radius: var(--r); padding: 18px; }
.lesson-wrap { max-width: 900px; }

/* Portada */
.lesson-cover { display: grid; gap: 16px; }
.lesson-cover.has-img { position: relative; }
.lc-img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; border-radius: var(--r); display: block; }
.lc-body { display: flex; gap: 16px; align-items: center; }
.lc-num { flex: none; display: grid; place-items: center; align-content: center; width: 84px; height: 84px; border-radius: 50%; background: #1B11A8; color: #fff; line-height: 1; box-shadow: 0 6px 18px rgba(27, 17, 168, .3); }
.lc-num small { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.lc-num b { font-family: var(--display); font-size: 2.3rem; font-weight: 600; }
.lc-course { font-weight: 800; color: var(--accent); font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; }
.lesson-cover h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); line-height: 1.1; margin: 2px 0; }
.lc-sub { color: var(--muted); font-weight: 700; }
.lc-when { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-weight: 700; font-size: .9rem; margin-top: 6px; }
@media (max-width: 560px) { .lc-num { width: 64px; height: 64px; } .lc-num b { font-size: 1.8rem; } .lc-img { aspect-ratio: 16 / 9; } }

/* Bloques */
.lb-h { margin: 8px 0 0; line-height: 1.15; }
.lb-h1 { font-size: clamp(1.4rem, 3.6vw, 1.9rem); padding-bottom: 6px; border-bottom: 3px solid var(--accent-soft); }
.lb-h2 { font-size: 1.2rem; }
.rt { display: grid; gap: 10px; line-height: 1.6; font-size: 1.02rem; }
.rt p, .rt ul, .rt ol { margin: 0; }
.rt ul, .rt ol { padding-left: 1.3em; display: grid; gap: 4px; }
.rt a { color: var(--accent); overflow-wrap: anywhere; }
.lb-callout { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--co-soft); border: 2px solid var(--co); }
.lb-callout .co-body { display: grid; gap: 6px; min-width: 0; flex: 1; }
.co-title { font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--co); letter-spacing: .01em; }
.co-mascot { width: 76px; height: auto; flex: none; }
.co-nota { --co: #1F63C6; --co-soft: color-mix(in srgb, #1F63C6 10%, var(--surface)); }
.co-sabias { --co: #B7791F; --co-soft: color-mix(in srgb, #F2C94C 18%, var(--surface)); }
.co-tip { --co: #15803D; --co-soft: color-mix(in srgb, #22C55E 12%, var(--surface)); }
.co-imp { --co: var(--bad); --co-soft: var(--bad-soft); }
.co-obj { --co: #1B11A8; --co-soft: color-mix(in srgb, #1B11A8 8%, var(--surface)); }
.co-prac { --co: #7C3AED; --co-soft: color-mix(in srgb, #7C3AED 10%, var(--surface)); }
:root[data-theme="dark"] .co-obj, :root[data-theme="dark"] .co-nota { --co: #8FB4FF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .co-obj, :root:not([data-theme="light"]) .co-nota { --co: #8FB4FF; } }
.lc-obj ul { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
@media (max-width: 520px) { .co-mascot { width: 54px; } .lb-callout { padding: 12px; gap: 10px; } }
.lb-fig { margin: 0; display: grid; gap: 6px; justify-items: center; }
.lb-fig img { max-width: 100%; height: auto; border-radius: 12px; display: block; }
.lb-fig.size-medium img { max-width: min(100%, 520px); }
.lb-fig.size-small img { max-width: min(100%, 300px); }
.lb-fig figcaption, .lb-cap, .lb-audio figcaption { color: var(--muted); font-size: .88rem; text-align: center; }
.lb-cap-top { font-weight: 700; margin-bottom: 8px; }
.lb-imgtext { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; align-items: center; }
.lb-imgtext.img-right > .lb-fig { order: 2; }
@media (max-width: 640px) { .lb-imgtext { grid-template-columns: 1fr; } .lb-imgtext.img-right > .lb-fig { order: 0; } }
.lb-table { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
.lb-table table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.lb-table th, .lb-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.lb-table thead th { background: var(--ink); color: var(--surface); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.lb-table tbody th { background: var(--surface-2); font-weight: 800; }
.lb-table tr:last-child td, .lb-table tr:last-child th { border-bottom: 0; }
.lb-table + .lb-cap, .lb-table .lb-cap { padding: 8px 12px; }
.lb-video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.lb-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lb-vid { width: 100%; border-radius: 12px; }
.lb-audio { margin: 0; display: grid; gap: 6px; } .lb-audio audio { width: 100%; }
.lb-pdf { display: grid; gap: 8px; justify-items: start; }
.lb-pdf iframe { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
@media (max-width: 640px) { .lb-pdf iframe { height: 360px; } }
.lb-activity { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; border: 2px solid var(--k); background: var(--k-soft); }
.lb-activity b { display: block; font-size: 1.05rem; }
@media (max-width: 520px) { .lb-activity { grid-template-columns: auto minmax(0, 1fr); } .lb-activity > :last-child { grid-column: 1 / -1; justify-self: stretch; text-align: center; } }
.lb-slide-mark { text-align: center; font-size: .78rem; font-weight: 800; color: var(--muted); border-top: 2px dashed var(--line); padding-top: 4px; text-transform: uppercase; letter-spacing: .06em; }

/* Teclado de la lección */
.lb-kb { display: grid; }
.lk-wrap { display: grid; gap: 8px; }
.lk { height: 190px; }
.lk .wk { flex-direction: column; justify-content: flex-end; gap: 2px; padding-bottom: 10px; }
.lk .wk-main { font-size: 1.05rem; }
.lk .wk-sub { font-size: .72rem; font-family: var(--body); font-weight: 800; opacity: .75; }
.lk.colored .wk { box-shadow: inset 0 -8px 0 var(--nc); padding-bottom: 14px; }
.lk.colored .wk .wk-main, .lk.colored .wk .wk-sub { color: var(--nc); opacity: 1; }
.lk.colored .wk .wk-sub { color: #3A4460; }
.lk .bk { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 1px; padding-bottom: 6px; color: #fff; font-family: var(--display); font-size: .66rem; line-height: 1.05; }
.lk.colored .bk span { color: var(--nc, #fff); }
.lk.named-blacks .bk { height: 62%; }
.lk-said { font-weight: 800; color: var(--muted); font-size: .9rem; text-align: center; min-height: 1.4em; }
@media (max-width: 560px) { .lk { height: 160px; } .lk .wk-main { font-size: .9rem; } .lk .wk-sub { font-size: .62rem; } .lk .bk { font-size: .52rem; } }

/* Lista de lecciones */
.lesson-card { padding: 0; gap: 0; overflow: hidden; }
.lcard-link { display: grid; color: var(--ink); text-decoration: none; }
.lcard-img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; display: block; }
.lcard-img.empty { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.lcard-body { display: grid; gap: 4px; padding: 14px 16px 6px; }
.lcard-num { font-weight: 800; font-size: .8rem; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.lcard-actions { padding: 8px 12px 12px; gap: 6px; }

/* Editor de lecciones */
.lesson-builder .wrap { display: grid; gap: 16px; }
.lblocks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lbc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.lbc.open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.lbc.is-slide { background: var(--surface-2); }
.lbc-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 4px; border-bottom: 1px solid var(--line); }
.lbc-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 8px; text-align: left; color: var(--ink); cursor: pointer; }
.lbc-sum { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lbc-tools { display: flex; gap: 2px; flex: none; }
.lbc-preview { padding: 14px 16px; }
.lbc-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.lbc-editor { padding: 14px 16px; border-right: 1px solid var(--line); background: var(--surface-2); }
@media (max-width: 900px) { .lbc-body { grid-template-columns: 1fr; } .lbc-editor { border-right: 0; border-bottom: 1px solid var(--line); } }
.add-blocks { gap: 10px; }
.add-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.tbl-ed { display: grid; gap: 8px; }
.tbl-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(90px, 1fr)); gap: 4px; overflow-x: auto; }
.tbl-grid .input { padding: 6px 8px; font-size: .88rem; }
.tbl-grid .input.th { font-weight: 800; background: var(--surface-2); }
.url-field { display: flex; gap: 6px; }
.url-field .input { flex: 1; min-width: 0; }
.link-form { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.link-form .btn { justify-self: start; }

/* Presentación */
.present { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; background: var(--bg); z-index: 50; }
.pr-top, .pr-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; }
.pr-bottom { justify-content: center; gap: 22px; }
.pr-title { font-family: var(--display); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-btn { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.pr-btn:disabled { opacity: .35; cursor: default; }
.pr-count { font-weight: 800; color: var(--muted); min-width: 60px; text-align: center; }
.pr-stage { overflow-y: auto; padding: 8px 24px 24px; display: grid; }
.pr-slide { width: min(1100px, 100%); margin: auto; display: grid; gap: 22px; font-size: clamp(1rem, 1.6vw, 1.3rem); }
.pr-slide .rt { font-size: 1em; }
.pr-slide .lb-h1 { font-size: clamp(1.8rem, 4vw, 3rem); }
.pr-slide .lk { height: clamp(180px, 34vh, 320px); }
.pr-slide .lk .wk-main { font-size: clamp(1rem, 2vw, 1.6rem); }
.pr-slide .lk .bk { font-size: clamp(.6rem, 1.1vw, .95rem); }
.pr-slide .lb-fig img { max-height: 58vh; object-fit: contain; }
.pr-cover .lc-img { max-height: 42vh; }
.pr-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--line); }
.pr-progress i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.present:fullscreen { background: var(--bg); }

/* Portal: lecciones */
.les-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.les-row:hover { border-color: var(--accent); }
.les-row.done { background: color-mix(in srgb, var(--ok-soft) 45%, var(--surface)); }
.les-img { width: 64px; height: 48px; border-radius: 8px; object-fit: cover; display: block; }
.les-img.empty { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-family: var(--display); font-weight: 600; font-size: 1.3rem; }
.les-body { display: grid; gap: 1px; min-width: 0; }
.les-body b { overflow-wrap: anywhere; }
.les-course { font-size: .95rem; margin: 6px 0 0; }
.les-progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.les-progress i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.catch-up { padding: 12px; border-radius: 12px; background: var(--bad-soft); }
.catch-up > b { color: var(--bad); }
@media (max-width: 480px) { .les-row { grid-template-columns: auto minmax(0, 1fr); } .les-state { grid-column: 2; } }
.notice.missed { background: var(--bad-soft); }
.lesson-done { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); max-width: 860px; margin: 8px auto 0; width: 100%; }
.lesson-done > div { flex: 1; min-width: 180px; }
.ld-mascot { width: 70px; height: auto; }
.co-fel { --co: #0E7490; --co-soft: color-mix(in srgb, #06B6D4 12%, var(--surface)); }
.lb-table th, .lb-table td { white-space: normal; }
.lb-table tbody th { text-transform: none; letter-spacing: 0; font-size: inherit; color: var(--ink); }
@media (max-width: 560px) { .lb-table table { font-size: .84rem; } .lb-table th, .lb-table td { padding: 8px; } }
.lb-h.lb-h2 { text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 1.2rem; }
.lk.colored .bk span { color: #fff; border-bottom: 3px solid var(--nc, transparent); padding-bottom: 1px; }
.lc-when { display: block; }
.lc-when svg { vertical-align: -3px; }
.lc-when .att-pill { margin-left: 6px; }
.lb-table table { min-width: 0; }
.pr-slide { font-size: clamp(.98rem, 1.35vw, 1.2rem); gap: 16px; }
.pr-slide .lk { height: clamp(170px, 30vh, 300px); }
.pr-cover .lc-img { max-height: 34vh; }
.pr-cover .lesson-cover { gap: 12px; }
@media (min-width: 1000px) and (min-aspect-ratio: 4/3) {
  .pr-cover .lesson-cover.has-img { grid-template-columns: 1fr 1fr; align-items: center; }
  .pr-cover .lc-img { max-height: 60vh; grid-row: span 2; }
}
.pr-cols { display: grid; gap: 16px; }
.pr-col { display: grid; gap: 14px; align-content: start; min-width: 0; }
@media (min-width: 900px) { .pr-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 28px; align-items: start; } }
.pr-slide .lb-fig img { max-height: 52vh; }

/* ================= Calendario mensual ================= */
.cal-card { padding: 0; gap: 0; overflow: hidden; }
.cal-head { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cal-title { font-size: 1.35rem; margin: 0; flex: 1; min-width: 180px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i, .cal-chip i, .cal-dots i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--k, var(--accent)); flex: none; }
.ev-class { --k: #BE185D; --k-soft: color-mix(in srgb, #EC4899 12%, var(--surface)); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px 6px; text-align: center; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal-day { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 112px; padding: 6px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; min-width: 0; font: inherit; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.out { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); color: var(--muted); }
.cal-day.out .cal-chip { opacity: .7; }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-num { align-self: center; display: flex; align-items: center; justify-content: center; white-space: pre; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 99px; font-weight: 800; font-size: .88rem; }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-chips { display: grid; gap: 2px; min-width: 0; }
.cal-chip { display: flex; align-items: center; gap: 5px; padding: 2px 6px; border-radius: 6px; font-size: .74rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--k-soft); color: var(--ink); min-width: 0; }
.cal-chip b { font-weight: 800; }
.cal-chip.ev-open { background: transparent; box-shadow: inset 0 0 0 1px var(--k); }
.cal-chip.ev-class { background: var(--k); color: #fff; font-weight: 700; }
.cal-chip.ev-class i { background: #fff; }
.cal-more { font-size: .72rem; font-weight: 800; color: var(--muted); padding-left: 6px; }
.cal-dots { display: none; justify-content: center; gap: 3px; }
@media (max-width: 760px) {
  .cal-day { min-height: 58px; align-items: center; padding: 4px 2px; }
  .cal-chips { display: none; }
  .cal-dots { display: flex; }
  .cal-dots i { width: 6px; height: 6px; }
  .cal-num { font-size: .82rem; min-width: 26px; height: 26px; }
  .cal-legend { width: 100%; }
  .cal-mon { display: none; }
}
/* Agenda del día */
.cal-agenda { gap: 14px; }
.cal-agenda h2 { margin: 0; font-size: 1.25rem; }
.ag-kicker { font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; }
.ag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ag-row { display: grid; grid-template-columns: 76px 4px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--k-soft, var(--surface-2)); }
.ag-time { font-weight: 800; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.ag-bar { align-self: stretch; border-radius: 4px; background: var(--k); }
.ag-body { display: grid; gap: 2px; min-width: 0; }
.ag-body small { color: var(--muted); }
.ag-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ag-list.compact .ag-row { padding: 8px 12px; grid-template-columns: 4px minmax(0, 1fr) auto; background: var(--surface); border: 1px solid var(--line); }
.ag-list.compact .ag-time { display: none; }
.ag-sub { font-size: .95rem; margin: 4px 0 0; }
.ag-empty { display: flex; align-items: center; gap: 14px; padding: 8px 4px; color: var(--muted); }
.ag-empty img { width: 64px; height: auto; }
@media (max-width: 560px) {
  .ag-row { grid-template-columns: 4px minmax(0, 1fr); }
  .ag-time { display: none; }
  .ag-actions, .ag-row > .btn, .ag-row > .badge { grid-column: 2; justify-content: flex-start; justify-self: start; }
}

/* ================= Fase 5: pentagrama ================= */
.staff-wrap { overflow-x: auto; overflow-y: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 6px; -webkit-overflow-scrolling: touch; }
.staff-svg { display: block; height: 150px; width: calc(var(--w) * 1.15px); min-width: 100%; color: var(--ink); fill: currentColor; touch-action: pan-x; user-select: none; -webkit-user-select: none; }
.staff-wrap:not(.editable) .staff-svg { touch-action: pan-x pan-y; }
.st-line { stroke: currentColor; stroke-width: 1; opacity: .75; }
.st-bar { stroke: currentColor; stroke-width: 1.2; }
.st-final { fill: currentColor; }
.st-ledger { stroke: currentColor; stroke-width: 1.2; }
.st-stem { stroke: currentColor; stroke-width: 1.2; }
.st-hit { fill: transparent; }
.editable .st-hit { cursor: pointer; }
.st-note.sel .st-hit { fill: var(--accent-soft); }
.st-note.sel { color: var(--accent); }
.st-note.playing { color: #E07409; }
.st-note.hid { color: var(--muted); }
.st-note.hid .st-hit { fill: repeating-linear-gradient(0deg, transparent, transparent); fill: color-mix(in srgb, var(--muted) 12%, transparent); }
.st-note.m-ok { color: var(--ok); }
.st-note.m-bad { color: var(--bad); }
.st-note .ghost { fill: var(--ok); opacity: .55; }
.st-ledger.ghost { stroke: var(--ok); opacity: .55; }
.st-slot { fill: color-mix(in srgb, var(--accent-soft) 60%, transparent); stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 2; }
.st-note.sel .st-slot { fill: var(--accent-soft); stroke-width: 1.6; }
.st-q { font: 800 12px var(--body); fill: var(--accent); text-anchor: middle; }
.st-add { fill: transparent; stroke: var(--muted); stroke-dasharray: 4 3; stroke-width: 1; cursor: copy; opacity: .7; }
.st-label { font: 800 10px var(--body); text-anchor: middle; fill: currentColor; }
.staff-editor { display: grid; gap: 8px; outline: none; }
.staff-editor:focus-visible .staff-wrap { box-shadow: 0 0 0 3px var(--accent-soft); }
.st-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.st-group { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); align-items: center; }
.st-btn { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.st-btn.wide { font-size: .88rem; padding: 0 10px; display: inline-flex; gap: 4px; }
.st-btn:hover { background: var(--surface); }
.st-btn.on { background: var(--accent); color: var(--accent-ink); }
.st-btn:disabled { opacity: .4; cursor: default; }
.st-btn .mini-glyph { fill: currentColor; }
.st-hint { font-size: .8rem; color: var(--muted); padding: 0 6px; }
.st-help { font-size: .84rem; color: var(--muted); margin: 0; }
.st-prompts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: p; }
.st-prompts li { counter-increment: p; display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 99px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-family: var(--display); font-size: 1.05rem; }
.st-prompts li::before { content: counter(p); font: 800 .75rem var(--body); color: var(--muted); }
.st-prompts li.on { border-color: var(--accent); background: var(--accent-soft); }
.st-prompts li.done::after { content: "✓"; color: var(--ok); font-weight: 800; }
.lb-staff { margin: 0; display: grid; gap: 8px; }
.pr-slide .staff-svg { height: clamp(150px, 26vh, 240px); }
@media (max-width: 560px) { .staff-svg { height: 128px; width: calc(var(--w) * .98px); } .st-btn { min-width: 36px; height: 36px; } }

/* ================= Círculo de quintas ================= */
.cof { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .cof { grid-template-columns: 1fr; } }
.cof-wheel { display: grid; gap: 6px; justify-items: center; }
.cof-svg { width: 100%; max-width: 420px; height: auto; display: block; user-select: none; -webkit-user-select: none; }
.cof-q { display: grid; justify-items: center; }
.cof-q .cof-svg { max-width: 380px; }
.cof-seg path { stroke: var(--surface); stroke-width: 1.5; transition: fill .15s; }
.cof-seg.major path { fill: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.cof-seg.major.sharp path { fill: color-mix(in srgb, #E07409 16%, var(--surface)); }
.cof-seg.major.flat path { fill: color-mix(in srgb, #2350D8 16%, var(--surface)); }
.cof-seg.major.nat path { fill: color-mix(in srgb, #157347 18%, var(--surface)); }
.cof-seg.minor path { fill: var(--surface-2); }
.cof-seg[role="button"] { cursor: pointer; }
.cof-seg[role="button"]:hover path { filter: brightness(.94); }
.cof-seg:focus { outline: none; }
.cof-seg:focus-visible path { stroke: var(--accent); stroke-width: 3; }
.cof-svg .cof-seg.near path { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.cof-svg .cof-seg.rel path { fill: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.cof-svg .cof-seg.sel path { fill: var(--accent); }
.cof-seg.sel .cof-t { fill: var(--accent-ink); }
.cof-svg .cof-seg.hid path { fill: var(--surface); stroke: var(--accent); stroke-dasharray: 3 2; }
.cof-seg.hid .cof-t { fill: var(--accent); }
.cof-svg .cof-seg.act path { fill: var(--accent-soft); stroke-width: 2.5; stroke-dasharray: none; }
.cof-svg .cof-seg.m-ok path { fill: var(--ok-soft); stroke: var(--ok); }
.cof-seg.m-ok .cof-t { fill: var(--ok); }
.cof-svg .cof-seg.m-bad path { fill: var(--bad-soft); stroke: var(--bad); }
.cof-seg.m-bad .cof-t { fill: var(--bad); }
.cof-t { font: 700 12px var(--display); text-anchor: middle; fill: var(--ink); pointer-events: none; }
.cof-t.mi { font-size: 9.5px; font-family: var(--body); font-weight: 800; }
.cof-t.sm { font-size: 8.5px; font-family: var(--body); font-weight: 800; }
.cof-sig { font: 800 7px var(--body); text-anchor: middle; fill: var(--muted); }
.cof-sig.s { fill: #B45309; } .cof-sig.f { fill: #1D4ED8; }
.cof-core { fill: var(--surface); stroke: var(--line); }
.cof-center { font: 600 13px var(--display); text-anchor: middle; fill: var(--ink); }
.cof-center.sub { font: 700 7.5px var(--body); fill: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cof-legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: .8rem; font-weight: 800; }
.cof-legend .lg-s { color: #B45309; } .cof-legend .lg-f { color: #1D4ED8; }
.cof-side { display: grid; gap: 10px; min-width: 0; }
.cof-info { display: grid; gap: 10px; }
.cof-head { display: grid; gap: 2px; }
.cof-head b { font-family: var(--display); font-weight: 600; font-size: 1.5rem; }
.cof-head small { color: var(--muted); font-weight: 700; }
.cof-sigline { margin: 0; }
.lb-circle { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.ks-row { display: grid; grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
@media (max-width: 640px) { .ks-row { grid-template-columns: auto 1fr auto; } .ks-row > span { grid-column: 2; } }
.ks-ask { font-weight: 800; margin: 0; }
.ks-ask.shake { animation: shake .35s; color: var(--bad); }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
:root[data-theme="dark"] .cof-sig.s, :root[data-theme="dark"] .cof-legend .lg-s { color: #F5B454; fill: #F5B454; }
:root[data-theme="dark"] .cof-sig.f, :root[data-theme="dark"] .cof-legend .lg-f { color: #8FB4FF; fill: #8FB4FF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cof-sig.s, :root:not([data-theme="light"]) .cof-legend .lg-s { color: #F5B454; fill: #F5B454; }
  :root:not([data-theme="light"]) .cof-sig.f, :root:not([data-theme="light"]) .cof-legend .lg-f { color: #8FB4FF; fill: #8FB4FF; } }

/* ---------- Fase 6: teoría, metrónomo y ritmo ---------- */
.gen-box { border: 1.5px dashed var(--accent); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.gen-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--accent); }
.gen-head small { color: var(--muted); }
.fig-ico { fill: currentColor; color: var(--ink); display: block; }
.st-btn.fig { min-width: 42px; height: 46px; }
.st-btn.fig .fig-ico, .st-btn.on .fig-ico { color: inherit; }
.fig-check { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px 4px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.fig-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.rhythm-in { display: grid; gap: 10px; min-width: 0; }
.rhythm-in .st-note { cursor: pointer; }
.r-status { display: flex; flex-wrap: wrap; gap: 6px; }
.r-meas { font-size: .86rem; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); }
.r-meas.ok { background: var(--ok-soft); color: var(--ok); }
.r-meas.short { background: var(--warn-soft); color: var(--warn); }
.r-meas.over { background: var(--bad-soft); color: var(--bad); }
.r-count { font-weight: 800; color: var(--accent); min-height: 1.2em; margin: 0; }
.r-player { display: grid; gap: 8px; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.chip.bad { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.chip.miss { border-color: var(--bad); border-style: dashed; }
.fig-order { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; counter-reset: fo; }
.fig-order li { counter-increment: fo; position: relative; display: grid; justify-items: center; gap: 4px; padding: 18px 8px 6px; min-width: 92px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); text-align: center; }
.fig-order li::before { content: counter(fo); position: absolute; top: 4px; left: 8px; font-size: .75rem; font-weight: 800; color: var(--muted); }
.fig-order li small { font-size: .78rem; line-height: 1.2; max-width: 100px; }
.fig-order .fo-btns { display: flex; gap: 4px; }
.fig-order li.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.fig-order li.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.tap-pad { width: 100%; min-height: 150px; border: 2px dashed var(--accent); border-radius: 18px; background: var(--accent-soft); color: var(--accent); display: grid; place-content: center; gap: 4px; font: 800 1.4rem var(--display); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tap-pad small { font: 600 .85rem var(--body); color: var(--muted); }
.tap-pad:disabled { opacity: .45; border-style: dotted; }
.tap-pad.hit { animation: tapHit .18s ease-out; }
@keyframes tapHit { from { background: var(--accent); color: var(--accent-ink); transform: scale(.98); } to { background: var(--accent-soft); transform: none; } }
.tap-res { display: grid; gap: 6px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.tap-res p { margin: 0; }
.tap-line { width: 100%; max-width: 520px; height: auto; }
.tl-axis { stroke: var(--line); stroke-width: 2; }
.tl-t { fill: var(--surface); stroke-width: 2; }
.tl-t.ok { stroke: var(--ok); fill: var(--ok-soft); }
.tl-t.bad { stroke: var(--bad); fill: var(--bad-soft); }
.tl-tap { fill: var(--accent); }
.metro { display: grid; gap: 12px; background: var(--surface-2); border-radius: 14px; padding: 14px 16px; max-width: 460px; }
.mt-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt-read { display: grid; line-height: 1.1; }
.mt-bpm { font: 800 2.4rem var(--display); color: var(--accent); }
.mt-read span { font-size: .8rem; color: var(--muted); }
.mt-dots { display: flex; gap: 8px; }
.mt-dots i { width: 16px; height: 16px; border-radius: 50%; background: var(--line); transition: transform .08s; }
.mt-dots i.acc { box-shadow: inset 0 0 0 2px var(--accent); }
.mt-dots i.on { background: var(--accent); transform: scale(1.25); }
.mt-ctrl { display: flex; align-items: center; gap: 8px; }
.mt-ctrl input { flex: 1; accent-color: var(--accent); }
.mt-go.on { background: var(--bad); border-color: var(--bad); }
.lb-metro, .lb-rhythm { display: grid; gap: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Fase 7: oído ---------- */
.ear-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--accent-soft); border-radius: 14px; padding: 14px 16px; }
.ear-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--surface); color: var(--accent); flex: none; }
.ear-listen { align-items: center; }
.ear-play { font-size: 1.05rem; padding: 12px 20px; }
.ear-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.ear-slot { min-width: 58px; min-height: 52px; display: grid; place-items: center; align-content: center; border: 2px dashed var(--line); border-radius: 12px; font-weight: 800; color: var(--muted); background: var(--surface); padding: 4px 8px; line-height: 1.1; }
.ear-slot small { font-size: .72rem; font-weight: 700; color: var(--ok); }
.ear-slot.next { border-color: var(--accent); color: var(--accent); }
.ear-slot.filled { border-style: solid; border-color: var(--accent); color: var(--ink); }
.ear-slot.is-correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.ear-slot.is-wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.kb-wrap { overflow-x: auto; max-width: 100%; }
.ea-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.ea-row > .row { grid-column: 2; }
.ea-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); }
.ea-audio { display: grid; gap: 6px; min-width: 0; }
.ea-audio audio, .ea-q audio { width: 100%; max-width: 360px; height: 40px; }
.ea-q { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.ea-q:first-of-type { border-top: 0; }
.ear-page { display: grid; gap: 16px; padding-bottom: 40px; }
.ear-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ear-head h1 { margin: 0; }
.ear-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); gap: 8px; }
.ear-mode { display: grid; justify-items: start; gap: 2px; text-align: left; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); padding: 10px 12px; color: var(--ink); }
.ear-mode small { color: var(--muted); font-size: .78rem; line-height: 1.25; }
.ear-mode svg { color: var(--accent); }
.ear-mode.on { border-color: var(--accent); background: var(--accent-soft); }
.ear-score { display: flex; gap: 14px; flex-wrap: wrap; font-size: .92rem; align-items: center; }
.ear-score svg { color: var(--warn); vertical-align: -2px; }
.ear-card-main { gap: 16px; }
.ear-stage { display: grid; gap: 14px; }
.ear-ask { font: 700 1.25rem var(--display); margin: 0; }
.ear-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 8px; }
.ear-opt { min-height: 56px; }
.ear-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.ear-result.ok { background: var(--ok-soft); color: var(--ok); }
.ear-result.bad { background: var(--bad-soft); color: var(--bad); }
.ear-promo { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.ear-promo h2 { margin: 0; }
.ear-mini { display: flex; flex-wrap: wrap; gap: 12px; font-size: .9rem; }
.ear-mini svg { color: var(--warn); vertical-align: -2px; }
@media (max-width: 560px) { .ear-promo { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Fase 8: piano de 88 teclas y diapasón ---------- */
.p88-wrap { overflow-x: auto; overflow-y: hidden; max-width: 100%; -webkit-overflow-scrolling: touch; border-radius: 10px; }
.p88 { position: relative; display: flex; width: max(100%, calc(var(--wn) * 26px)); height: 150px; background: var(--key-black); border: 3px solid var(--key-black); border-radius: 8px 8px 10px 10px; touch-action: pan-x; user-select: none; -webkit-user-select: none; }
.pk { border: 0; padding: 0; font: inherit; cursor: pointer; }
.pk.w { flex: 1; min-width: 0; background: var(--key); border-right: 1.5px solid var(--key-edge); border-radius: 0 0 5px 5px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; color: #15203D; font-size: .66rem; font-weight: 700; }
.pk.w.mid { box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--accent) 45%, transparent); }
.pk.b { position: absolute; top: 0; width: calc(100% / var(--wn) * .6); height: 60%; background: var(--key-black); border-radius: 0 0 4px 4px; transform: translateX(-50%); box-shadow: inset 0 -5px 0 #2B2F3A; z-index: 2; }
.pk.press.w { background: color-mix(in srgb, var(--key) 75%, #98A4C0); }
.pk.press.b { background: #2A2F3D; }
.pk.rh.w, .pk.on.w { background: color-mix(in srgb, var(--key) 45%, var(--accent)); color: #fff; }
.pk.rh.b, .pk.on.b { background: var(--accent); box-shadow: none; }
.pk.lh.w { background: color-mix(in srgb, var(--key) 45%, var(--warn)); color: #fff; }
.pk.lh.b { background: var(--warn); box-shadow: none; }
.pk.ok.w { background: color-mix(in srgb, var(--key) 40%, var(--ok)); color: #fff; }
.pk.ok.b { background: var(--ok); box-shadow: none; }
.pk.bad.w { background: color-mix(in srgb, var(--key) 45%, var(--bad)); color: #fff; }
.pk.bad.b { background: var(--bad); box-shadow: none; }
.pk.hint.w { background: color-mix(in srgb, var(--key) 75%, var(--ok)); }
.pk:disabled { cursor: default; }
.oct-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.oct-chips { display: inline-flex; gap: 3px; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.oct { width: 32px; height: 32px; border: 0; border-radius: 7px; background: transparent; font-weight: 800; color: var(--muted); }
.oct.on { background: var(--accent); color: var(--accent-ink); }
.fb-wrap { overflow-x: auto; overflow-y: hidden; max-width: 100%; -webkit-overflow-scrolling: touch; }
.gfb { display: block; width: max(100%, calc(var(--w) * 1px)); height: auto; min-height: 150px; touch-action: pan-x; user-select: none; }
.fb-wood { fill: color-mix(in srgb, #8A5A35 70%, var(--surface)); }
.fb-nut { stroke: #EDE6D6; stroke-width: 5; }
.fb-fret { stroke: #C9CCD3; stroke-width: 2; }
.fb-str { stroke: #E4E0D6; }
.fb-inlay { fill: #F3EBDD; opacity: .85; }
.fb-num { font: 700 9px var(--body); fill: var(--muted); text-anchor: middle; }
.fb-num.strong { fill: var(--ink); }
.fb-open { font: 800 9px var(--body); fill: var(--muted); text-anchor: middle; }
.fb-name { font: 600 7.5px var(--body); fill: #FFF8EC; text-anchor: middle; opacity: .8; pointer-events: none; }
.fb-dim { fill: var(--bg); opacity: .62; pointer-events: none; }
.fb-mark circle { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }
.fb-mark text { font: 800 8.5px var(--body); fill: #fff; text-anchor: middle; pointer-events: none; }
.fb-mark text.sm { font-size: 7px; }
.fb-mark.ok circle { fill: var(--ok); }
.fb-mark.bad circle { fill: var(--bad); }
.fb-mark.lh circle { fill: var(--warn); }
.fb-mark.q circle { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.fb-mark.q text { fill: var(--accent); }
.fb-mark.ghost circle { fill: var(--ok); opacity: .55; }
.pseudo-full { position: fixed !important; inset: 0; z-index: 90; background: var(--bg); overflow: auto; padding: 10px; }
:fullscreen { background: var(--bg); overflow: auto; padding: 10px; }
.rotate-hint { display: none; }
@media (orientation: portrait) and (max-width: 700px) { .rotate-hint { display: flex; gap: 6px; align-items: center; font-size: .85rem; color: var(--muted); } }
/* partitura completa */
.score-wrap { overflow-x: auto; overflow-y: hidden; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; color: var(--ink); }
.score-svg { display: block; height: calc(var(--h) * 1px); width: calc(var(--w) * 1px); }
.sc-line { stroke: currentColor; stroke-width: 1; opacity: .7; }
.sc-line.tab { opacity: .45; }
.sc-bar { stroke: currentColor; stroke-width: 1.2; }
.sc-thick, .sc-rdot { fill: currentColor; }
.sc-brace { fill: none; stroke: currentColor; stroke-width: 2.2; }
.sc-clef, .sc-key, .sc-time, .sc-head, .sc-acc, .sc-dot, .sc-rest, .sc-flag { fill: currentColor; }
.sc-eight { font: 700 10px var(--body); fill: currentColor; text-anchor: middle; }
.sc-ledger, .sc-stem { stroke: currentColor; stroke-width: 1.2; }
.sc-beam { fill: currentColor; }
.sc-beam.thin { stroke: currentColor; stroke-width: 3; }
.sc-tie { fill: none; stroke: currentColor; stroke-width: 1.2; }
.sc-mnum { font: 700 9px var(--body); fill: var(--muted); }
.sc-orn { font: italic 700 11px Georgia, serif; fill: currentColor; text-anchor: middle; }
.sc-tuplet { font: italic 700 9px var(--body); fill: currentColor; text-anchor: middle; }
.sc-tabhead { font: 800 11px var(--body); fill: var(--muted); text-anchor: middle; }
.sc-tabbg { fill: var(--surface); }
.sc-tabnum { font: 700 9px var(--body); fill: currentColor; }
.sc-hit { fill: transparent; cursor: pointer; }
.sc-cur { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.sc-mcur { fill: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.sc-ev.on { color: var(--accent); }
.sc-ev.on .sc-head, .sc-ev.on .sc-stem, .sc-ev.on .sc-flag, .sc-ev.on .sc-acc, .sc-ev.on .sc-dot { fill: var(--accent); stroke: var(--accent); }
.sc-ev.on.lh .sc-head, .sc-ev.on.lh .sc-stem, .sc-ev.on.lh .sc-flag { fill: var(--warn); stroke: var(--warn); }
.sc-ev.on .sc-tabnum { fill: var(--accent); }
/* reproductor de partituras */
.sp { display: grid; gap: 10px; min-width: 0; }
.sp-bar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.sp-bar .input { width: auto; padding: 6px 8px; }
.sp-info { font-weight: 800; color: var(--accent); min-width: 90px; }
.sp-inst { display: grid; gap: 8px; }
.sp-src { margin: 0; }
.sp:fullscreen, .sp.pseudo-full { align-content: start; }
@media (orientation: landscape) and (max-height: 520px) {
  .sp .p88 { height: 110px; }
  .sp .score-wrap { max-height: 58vh; }
  .sp .score-svg { height: calc(var(--h) * 0.8px); width: calc(var(--w) * 0.8px); }
}
/* piezas */
.piece-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.piece-card { text-decoration: none; color: inherit; gap: 6px; transition: border-color .15s, transform .1s; }
.piece-card:hover { border-color: var(--accent); }
.piece-title { font: 700 1.1rem var(--display); letter-spacing: 0; text-transform: none; color: var(--ink); margin: 4px 0 0; }
.sec-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.sec-row .input.num { width: 64px; }
.sec-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); font-size: .85rem; }
@media (max-width: 560px) { .sec-row { grid-template-columns: auto minmax(0, 1fr) auto; } .sec-row > .row { grid-column: 2 / 4; } }
.pg-row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pg-row .input { width: auto; }
.pst { display: inline-grid; place-items: center; min-width: 44px; min-height: 34px; padding: 2px 6px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 800; font-size: .8rem; color: var(--muted); line-height: 1.05; }
.pst small { font-size: .65rem; font-weight: 700; opacity: .8; }
.legend .pst { min-height: 26px; padding: 2px 10px; }
.pst.st1 { background: color-mix(in srgb, var(--warn-soft) 60%, var(--surface)); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.pst.st2 { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.pst.st3 { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pst.st4 { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.pst.ver { background: var(--ok); color: #fff; border-color: var(--ok); }
.prog-table td.pcell { padding: 6px 4px; text-align: center; }
.prog-table th { text-align: center; }
.prog-table th:first-child { text-align: left; }
.mini-bar { width: 80px; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.mini-bar i { display: block; height: 100%; background: var(--ok); }
.sec-list { margin: 0; padding: 0 20px 16px 40px; display: grid; gap: 4px; }
.pdf-frame { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.sec-card { gap: 10px; }
.sec-card.verified { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.sec-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sec-steps .pst { min-height: 40px; font-size: .78rem; }
.sec-steps .pst.cur { box-shadow: 0 0 0 2px var(--accent); }
.sec-card .input.num { width: 76px; }
.pr-timer { grid-template-columns: minmax(0, 1fr); }
.pr-timer .btn.on { background: var(--ok); border-color: var(--ok); }
.pr-clock { font: 800 1.5rem var(--display); font-variant-numeric: tabular-nums; }
.practice-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.hub-tile { display: grid; gap: 4px; text-decoration: none; color: inherit; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface); }
.hub-tile:hover { border-color: var(--accent); }
.hub-tile svg { color: var(--accent); }
.hub-tile small { color: var(--muted); }
.piece-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; text-decoration: none; color: inherit; padding: 12px 0; border-top: 1px solid var(--line); }
.piece-row:first-of-type { border-top: 0; }
.piece-row .les-progress { grid-column: 1 / -1; }
/* diapasón por niveles */
.fret-levels { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.fl-n { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); font-weight: 800; }
.fl-t { display: grid; }
.fl-t small { color: var(--muted); }
.fl.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.fl.ok .fl-n { background: var(--ok); color: #fff; }
.fl.open .fl-n { background: var(--accent); color: var(--accent-ink); }
.fl.locked { opacity: .6; }
@media (max-width: 560px) { .fl { grid-template-columns: auto minmax(0, 1fr); } .fl > .row { grid-column: 1 / -1; } }
.fret-names { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.fret-names .chip { min-height: 44px; padding: 4px; font-size: .95rem; display: grid; place-items: center; line-height: 1.05; }
.fret-names .chip small { font-size: .7rem; color: var(--muted); }
@media (max-width: 480px) { .fret-names { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fret-result { text-align: center; justify-items: center; }
.big-score { font: 800 2.6rem var(--display); color: var(--accent); margin: 0; }
.played { font-weight: 700; color: var(--accent); min-height: 1.4em; margin: 0; }
.inst-stage:fullscreen, .inst-stage.pseudo-full { align-content: center; }
@media (max-width: 640px) {
  .sp-bar { gap: 6px; }
  .sp-bar .row { gap: 6px; }
  .sp-bar .seg button { padding: 6px 9px; font-size: .82rem; }
  .sp-bar .btn { padding: 8px 12px; }
  .sp-bar .input { font-size: .85rem; padding: 5px 6px; }
  .sp .p88 { height: 120px; }
}
/* acordes, rasgueo, tablatura y digitación */
.chord-svg { width: 150px; height: auto; color: var(--ink); display: block; }
.chord-svg.edit { width: 190px; }
.ch-name { font: 800 13px var(--display); fill: currentColor; text-anchor: middle; }
.ch-nut { fill: currentColor; }
.ch-base { font: 700 9px var(--body); fill: var(--muted); text-anchor: end; }
.ch-fret { stroke: var(--muted); stroke-width: 1; }
.ch-str { stroke: currentColor; stroke-width: 1.1; }
.ch-dot { fill: var(--accent); }
.ch-open { fill: none; stroke: currentColor; stroke-width: 1.4; }
.ch-x { font: 700 12px var(--body); fill: var(--muted); text-anchor: middle; }
.ch-dot.ok, .ch-open.ok { fill: var(--ok); stroke: var(--ok); }
.ch-dot.bad { fill: var(--bad); }
.ch-open.bad, .ch-x.bad { stroke: var(--bad); fill: var(--bad); }
.ch-hit { fill: transparent; cursor: pointer; }
.chord-ed { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.chord-list { display: flex; flex-wrap: wrap; gap: 10px; }
.chord-card { display: grid; justify-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 6px 4px 8px; color: var(--ink); }
.chord-card:hover { border-color: var(--accent); }
.chord-card .chord-svg { width: 110px; }
.chord-card small { color: var(--accent); font-weight: 700; }
.chord-mini .chord-svg { width: 80px; }
.strum-row { display: grid; grid-template-columns: repeat(8, minmax(34px, 1fr)); gap: 4px; max-width: 520px; flex: 1; }
.strum-cell { display: grid; justify-items: center; gap: 0; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); padding: 4px 0; color: var(--ink); line-height: 1.1; }
.strum-cell b { font-size: 1.5rem; }
.strum-cell small { font-size: .7rem; color: var(--muted); }
.strum-cell.down, .strum-cell.up { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.strum-cell.rest b { color: var(--muted); }
.strum-cell.cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.strum-cell.cur small { color: var(--accent-ink); }
.strum-cell.ok { border-color: var(--ok); background: var(--ok-soft); }
.strum-cell.bad { border-color: var(--bad); background: var(--bad-soft); }
.tab-wrap { overflow-x: auto; max-width: 100%; }
.tab-svg { display: block; height: 90px; width: calc(var(--w) * 1.3px); max-width: none; color: var(--ink); }
.sc-tabnum.muted { fill: var(--muted); }
.sc-tabnum.ok-text { fill: var(--ok); }
.sc-tabnum.bad-text { fill: var(--bad); }
.fing-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fing-pick { display: grid; gap: 2px; justify-items: center; }
.fing-pick .input { width: 60px; }
.fing-pad { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-width: 480px; }
.fing-btn { display: grid; place-items: center; font-size: 1.3rem; line-height: 1.05; min-height: 56px; }
.fing-btn small { font-size: .68rem; color: var(--muted); }
.pk-target { margin: 0; font-size: 1.1rem; }
.fb-mark.on circle { fill: var(--accent); }
.sp-bar > .row.wrap { flex: 1 1 420px; justify-content: flex-end; }
@media (max-width: 640px) { .sp-bar > .row.wrap { justify-content: flex-start; } }
.lb-strum > .btn, .lb-p88 > .btn { justify-self: start; }
/* lector de partituras (alphaTab) */
.atp { display: grid; gap: 8px; min-width: 0; background: var(--bg); }
.atp-bar, .atp-bar2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.atp-bar .input, .atp-bar2 .input { width: auto; padding: 6px 8px; }
.atp-info { font-weight: 800; color: var(--accent); min-width: 84px; }
.atp-sections { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.atp-sheet { position: relative; overflow: auto; background: #FFFFFF; color: #111; border: 1px solid var(--line); border-radius: 12px; max-height: 62vh; min-height: 220px; -webkit-overflow-scrolling: touch; }
.atp.page .atp-sheet { max-height: 75vh; }
.atp-render { min-width: 100%; }
.atp-status { margin: 0; }
.atp-src { margin: 0; }
.atp .at-cursor-bar { background: color-mix(in srgb, #2350D8 10%, transparent); }
.atp .at-selection div { background: color-mix(in srgb, #2350D8 14%, transparent); }
.atp .at-cursor-beat { background: #2350D8; width: 3px; }
.atp .at-highlight * { fill: #2350D8; stroke: #2350D8; }
.atp:fullscreen, .atp.pseudo-full { position: fixed; inset: 0; z-index: 95; padding: 8px; overflow: auto; background: var(--bg); align-content: start; }
.atp:fullscreen .atp-sheet, .atp.pseudo-full .atp-sheet { max-height: none; height: 60vh; height: 60dvh; }
.atp.is-full .p88 { height: 110px; }
body.no-scroll { overflow: hidden; }
@media (max-width: 640px) {
  .atp-bar .btn, .atp-bar2 .btn { padding: 7px 10px; }
  .atp-bar2 .muted.small { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .atp.is-full .atp-sheet { height: calc(100dvh - 72px); min-height: 150px; }
  .atp.is-full.with-inst .atp-sheet { height: 52dvh; }
  .atp.is-full .atp-src { display: none; }
  .atp.is-full .atp-inst .oct-pick { display: none; }
  .atp.is-full .p88 { height: 88px; }
  .atp.is-full .gfb { min-height: 110px; }
}
.atp-bar { flex-wrap: nowrap; justify-content: flex-start; }
.atp-where { display: grid; line-height: 1.15; min-width: 0; }
.atp-range { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atp-sp { flex: 1; }
.atp-bar2 { display: grid; gap: 8px; justify-content: stretch; }
.atp-sections { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; align-items: center; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.atp-sections .chip-f { flex: none; }
.atp-opts { display: grid; gap: 8px; background: var(--surface-2); border-radius: 12px; padding: 10px; }
.atp-opts p { margin: 0; }
.atp.is-full .atp-bar2 .atp-sections { display: none; }
@media (max-width: 640px) { .atp-lbl { display: none; } .atp-bar .btn { padding: 8px 10px; } }

/* ================= Fase 9: batería ================= */
.dstaff { display: flex; flex-wrap: wrap; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; color: var(--ink); }
.dstaff-bar { display: block; width: calc(var(--w) * 1.3px); max-width: 100%; height: auto; fill: currentColor; }
.dstaff.small .dstaff-bar { width: calc(var(--w) * .9px); }
.ds-cur { fill: color-mix(in srgb, var(--n2) 22%, transparent); }
.ds-beam { fill: currentColor; }
.ds-rest { opacity: .8; }
.ds-open { fill: none; stroke: currentColor; stroke-width: 1.2; }
.ds-accent { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.ds-dia { fill: currentColor; }
.ds-tri { font: 800 10px var(--body); text-anchor: middle; fill: var(--muted); }
.ds-head.m-ok { fill: var(--ok); } .ds-head.m-bad, .ds-head.m-miss { fill: var(--bad); }

.dgrid-wrap { display: grid; gap: 10px; }
.dgrid { display: grid; grid-template-columns: minmax(52px, auto) repeat(var(--n), minmax(17px, 1fr)); gap: 3px; align-items: center; }
.dg-bar { grid-column: 1 / -1; font-size: .8rem; font-weight: 800; color: var(--muted); }
.dg-count { font: 800 .72rem var(--body); color: var(--muted); text-align: center; }
.dg-count.beat { color: var(--ink); }
.dg-name { font-size: .78rem; font-weight: 800; white-space: nowrap; padding-right: 4px; }
.dg-cell { height: 30px; min-width: 0; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); padding: 0; font: 900 .8rem var(--body); color: var(--accent-ink); display: grid; place-content: center; touch-action: manipulation; }
.dg-cell.beat { border-color: color-mix(in srgb, var(--muted) 55%, var(--line)); }
button.dg-cell:hover { border-color: var(--accent); }
.dg-cell.on { background: var(--accent); border-color: var(--accent); }
.dg-cell.acc { background: color-mix(in srgb, var(--accent) 70%, var(--ink)); }
.dg-cell.cur { box-shadow: 0 0 0 2px var(--n2); }
.dg-cell.m-ok { background: var(--ok); border-color: var(--ok); }
.dg-cell.m-bad { background: var(--bad); border-color: var(--bad); }
.dg-cell.m-miss { background: var(--bad-soft); border: 2px dashed var(--bad); }
@media (max-width: 480px) { .dg-cell { height: 34px; } .dgrid { gap: 2px; grid-template-columns: minmax(44px, auto) repeat(var(--n), minmax(15px, 1fr)); } .dg-name { font-size: .7rem; } }

.dkit-wrap { background: var(--surface-2); border-radius: 16px; padding: 6px; max-width: 640px; margin-inline: auto; width: 100%; }
.dkit { display: block; width: 100%; max-height: 70vh; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.dk-part { cursor: pointer; }
.dk-shell { fill: color-mix(in srgb, var(--accent) 55%, var(--side)); stroke: var(--side); stroke-width: 1.5; }
.dk-head { fill: var(--surface); stroke: color-mix(in srgb, var(--muted) 60%, transparent); stroke-width: 1.5; }
.dk-rim { fill: #C9CED8; stroke: #8C93A3; stroke-width: 2; }
.dk-cym { fill: color-mix(in srgb, var(--n6) 75%, #fff); stroke: color-mix(in srgb, var(--n6) 70%, #000); stroke-width: 1.5; }
.dk-bell { fill: color-mix(in srgb, var(--n6) 90%, #000); stroke: color-mix(in srgb, var(--n6) 60%, #000); stroke-width: 1.2; }
.dk-pedal { fill: #5A6272; stroke: #2B303A; stroke-width: 1.2; }
.dk-pedal-b { fill: #5A6272; }
.dk-stand { stroke: #8C93A3; stroke-width: 3; }
.dk-lbl { font: 800 11px var(--body); fill: var(--ink); text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.dk-cym + .dk-lbl { fill: #3a2c00; stroke: #fff6d0; }
.dk-lbl.small { font-size: 9.5px; font-weight: 700; }
.dk-key { font: 800 9px var(--body); fill: var(--muted); text-anchor: middle; pointer-events: none; }
.dk-part.hit > :not(text) { animation: dkHit .16s ease-out; }
.dk-part.lit > :not(text) { filter: drop-shadow(0 0 5px var(--n2)); }
.dk-part.lit .dk-head, .dk-part.lit .dk-cym, .dk-part.lit .dk-pedal, .dk-part.lit .dk-rim, .dk-part.lit .dk-bell { fill: color-mix(in srgb, var(--n2) 55%, #fff); }
@keyframes dkHit { 0% { filter: brightness(1.5) drop-shadow(0 0 8px var(--n2)); } 100% { filter: none; } }

.dpads { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 10px; touch-action: none; user-select: none; -webkit-user-select: none; }
.dpad { min-height: 110px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); display: grid; place-content: center; gap: 4px; font: 700 1.1rem var(--display); color: var(--ink); touch-action: none; -webkit-touch-callout: none; }
.dpad kbd { font: 800 .75rem var(--body); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; justify-self: center; }
.dpad.p-kick, .dpad.p-pedal { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.dpad.p-snare, .dpad.p-stick, .dpad.p-tom1, .dpad.p-tom2, .dpad.p-floor { background: color-mix(in srgb, var(--n1) 12%, var(--surface)); }
.dpad.p-hat, .dpad.p-open, .dpad.p-crash, .dpad.p-ride, .dpad.p-bell { background: color-mix(in srgb, var(--n6) 18%, var(--surface)); }
.dpad.hit { animation: padHit .15s ease-out; }
@keyframes padHit { 0% { transform: scale(.96); border-color: var(--n2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--n2) 40%, transparent); } 100% { transform: none; } }
@media (hover: none) { .dpad kbd { display: none; } }
@media (max-width: 480px) { .dpad { min-height: 96px; } }

.dp-ctrl { align-items: center; gap: 10px; }
.row.tight { gap: 4px; }
.dp-status { font-weight: 800; color: var(--accent); min-height: 1.4em; font-size: 1.15rem; }
.dalong.rec .dpads { outline: 3px solid color-mix(in srgb, var(--n2) 55%, transparent); outline-offset: 4px; border-radius: 18px; }
.dp-res { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: center; background: var(--surface-2); border-radius: 14px; padding: 12px 14px; }
.dp-res .dtl, .dp-res .dtl-help { grid-column: 1 / -1; }
.dp-pct { display: grid; text-align: center; min-width: 88px; }
.dp-pct b { font: 700 2rem var(--display); line-height: 1; }
.dp-pct span { font-size: .75rem; color: var(--muted); }
.dp-res.good .dp-pct b { color: var(--ok); } .dp-res.mid .dp-pct b { color: var(--warn); } .dp-res.low .dp-pct b { color: var(--bad); }
.dtl { width: 100%; height: auto; display: block; }
.dtl-bar { stroke: var(--muted); stroke-width: 1; opacity: .6; } .dtl-beat { stroke: var(--line); stroke-width: 1; }
.dtl-name { font: 800 9px var(--body); fill: var(--muted); }
.dtl-t { fill: var(--surface); stroke-width: 2; }
.dtl-t.ok { stroke: var(--ok); fill: var(--ok-soft); } .dtl-t.near { stroke: var(--warn); fill: var(--warn-soft); } .dtl-t.bad { stroke: var(--bad); fill: var(--bad-soft); }
.dtl-hit { fill: var(--accent); }
.input.slim { width: auto; padding: 6px 8px; }

.dlevels { display: grid; gap: 8px; }
.dlevel { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); text-align: left; color: inherit; font: inherit; width: 100%; }
.dlevel:not(:disabled):hover { border-color: var(--accent); }
.dlevel:disabled { opacity: .55; cursor: not-allowed; }
.dlevel .dl-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-content: center; font-weight: 900; background: var(--surface-2); }
.dlevel.passed .dl-n { background: var(--ok); color: #fff; }
.dlevel.cur { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.dlevel small { display: block; color: var(--muted); }
.dpart-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dpart-chips button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: .82rem; font-weight: 700; }
.dpart-chips button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.did-kit { max-width: 420px; }
.did-kit .dk-part:not(.lit) > :not(text) { opacity: .45; }
.dmc-opts { display: grid; gap: 10px; }
.dmc-opt { display: grid; gap: 6px; text-align: left; border: 2px solid var(--line); border-radius: 12px; padding: 8px; background: var(--surface); color: inherit; }
.dmc-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.dmc-opt.ok { border-color: var(--ok); } .dmc-opt.bad { border-color: var(--bad); }
.dmc-opt .dstaff { border: 0; padding: 0; background: transparent; pointer-events: none; }
.inst-stage.dstage .dkit { max-height: calc(100vh - 140px); }
:fullscreen .dkit, .pseudo-full .dkit { max-height: calc(100vh - 90px); }
@media (hover: none) { .hide-touch { display: none; } }
.row.wrap { padding: 0; max-width: none; margin: 0; gap: 10px; }
.dstage .seg { justify-self: start; }
.dstage:fullscreen, .dstage.pseudo-full { padding: 6px 10px; gap: 4px; align-content: start; }
.dstage:fullscreen :is(.rotate-hint, .seg, .played, .hide-touch, h2), .dstage.pseudo-full :is(.rotate-hint, .seg, .played, .hide-touch, h2) { display: none; }
.dstage:fullscreen .dkit-wrap, .dstage.pseudo-full .dkit-wrap { max-width: none; }
.dstage:fullscreen .dkit, .dstage.pseudo-full .dkit { max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); }
.dstage:fullscreen .dpads, .dstage.pseudo-full .dpads { height: calc(100dvh - 60px); grid-auto-rows: 1fr; }
.dstage:fullscreen .dpad, .dstage.pseudo-full .dpad { min-height: 0; }

/* ================= Interfaz nueva del maestro ================= */
.grow { flex: 1; }
.side-foot .nav { font-size: .95rem; padding: 10px 14px; }
.side-scrim { display: none; }
.sec-tabs { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.sec-tabs-in { max-width: 1180px; margin: 0 auto; padding: 10px 24px 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.sec-tabs a { padding: 10px 16px 12px; font-weight: 800; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.sec-tabs a:hover { color: var(--ink); }
.sec-tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 900px) {
  .sec-tabs { top: 56px; }
  .sec-tabs-in { padding-inline: 12px; }
  .side-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .side.open + .side-scrim { opacity: 1; pointer-events: auto; }
  .topbar .theme-btn { color: var(--side-on); background: transparent; border-color: var(--side-2); }
}
h1.big-title { font-size: clamp(1.8rem, 3.4vw, 2.5rem); font-weight: 700; letter-spacing: -.01em; }
.page-ico { display: inline-flex; align-items: center; gap: 12px; }
.page-ico .ico { color: var(--accent); }
/* Inicio: la clase de hoy */
.today-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: var(--r); padding: 14px 18px; }
.tb-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.tb-txt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; flex: 1; min-width: 200px; }
.tb-txt b { font: 700 1.35rem var(--display); }
.tb-txt span { color: var(--muted); font-weight: 700; }
.tb-pick .input { min-width: 200px; background: var(--surface); }
.today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; counter-reset: none; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 12px; display: grid; justify-items: center; text-align: center; gap: 8px; grid-template-rows: auto auto auto 1fr auto; position: relative; }
.step:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 44%; color: var(--muted); font-weight: 800; opacity: .6; }
.step-top { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.step-n { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font: 700 1.2rem var(--display); background: var(--surface-2); color: var(--muted); }
.step.done .step-n { background: var(--ok); color: #fff; }
.step.now .step-n { background: #E07409; color: #fff; }
.step-mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.step-mark.ok { background: var(--ok); } .step-mark.now { background: #E07409; }
.step-ico { color: var(--accent); }
.step-title { font-size: 1.02rem; line-height: 1.2; }
.step-desc { color: var(--muted); line-height: 1.3; }
.step-btn { width: 100%; padding-inline: 8px; white-space: normal; line-height: 1.15; min-height: 44px; }
.step.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.step.now { border-color: #E07409; box-shadow: 0 0 0 2px color-mix(in srgb, #E07409 25%, transparent), var(--shadow); }
.today-side { padding: 6px 0; gap: 0; }
.ts-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; color: inherit; text-decoration: none; }
.ts-row + .ts-row { border-top: 1px solid var(--line); }
.ts-row:hover { background: var(--surface-2); }
.ts-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.ts-ico.ok { background: var(--ok-soft); color: var(--ok); } .ts-ico.warn { background: var(--warn-soft); color: var(--warn); }
.ts-txt { display: grid; flex: 1; min-width: 0; }
.ts-txt > b { font: 700 1.5rem var(--display); line-height: 1.1; }
.ts-txt > b.small { font: 800 .95rem var(--body); }
.ts-bar { height: 8px; border-radius: 99px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.ts-bar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.inst-quick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.iq { display: grid; justify-items: center; gap: 8px; padding: 18px 10px 14px; border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none; background: var(--surface); }
.iq .ico { color: var(--accent); }
.iq:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.iq-open { width: 100%; text-align: center; background: var(--accent-soft); color: var(--accent); border-radius: 9px; padding: 6px; font-weight: 800; font-size: .9rem; }
.pick-row { display: flex; gap: 10px; align-items: baseline; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; }
.pick-row:hover { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 1180px) { .today-grid { grid-template-columns: 1fr; } .today-side { grid-template-columns: repeat(3, minmax(0, 1fr)); display: grid; } .ts-row + .ts-row { border-top: 0; border-left: 1px solid var(--line); } }
@media (max-width: 900px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } .step:not(:last-child)::after { display: none; } .step:last-child { grid-column: 1 / -1; } .inst-quick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .today-side { grid-template-columns: 1fr; } .ts-row + .ts-row { border-left: 0; border-top: 1px solid var(--line); } .tb-pick, .tb-pick .input { width: 100%; } }
@media (max-width: 420px) { .steps { grid-template-columns: 1fr; } .step { grid-template-columns: auto 1fr; grid-template-rows: auto; text-align: left; justify-items: start; align-items: center; } .step-top { width: auto; grid-row: span 2; } .step-top .step-mark { display: none; } .step-ico { display: none; } .step-btn { grid-column: 1 / -1; } .inst-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Pasar lista */
.lista-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.lista-card { gap: 12px; }
.lista-card.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.lc-title { font: 700 1.15rem var(--display); }
.lista-date { min-width: 190px; }
.lista-date > span { font-weight: 800; font-size: .9rem; }
.roll-page2 { max-width: 980px; padding-bottom: 90px; }
.roll-info { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: var(--r); padding: 16px 18px; }
.ri-part { display: flex; gap: 14px; align-items: center; }
.ri-part + .ri-part { border-left: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); padding-left: 18px; }
.ri-part b { display: block; font: 700 1.2rem var(--display); }
.ri-part b.ri-date { font: 700 1.05rem var(--body); }
.ri-part small { color: var(--muted); font-weight: 700; font-size: .95rem; }
.ri-cal { color: var(--accent); }
.roll-all { display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px 20px; border-radius: var(--r); border: 1.5px solid color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--accent-soft); color: var(--accent); font: 700 1.2rem var(--display); text-align: left; }
.roll-all:hover { border-color: var(--accent); }
.roll-all > span:nth-child(2) { flex: 1; }
.ra-check { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.roll-hint { margin-top: -10px; }
.roll-count { font-size: 1.15rem; color: var(--muted); font-weight: 700; }
.roll-count b { color: var(--accent); font: 700 1.6rem var(--display); }
.roll-count b:nth-child(2) { color: var(--ink); font-size: 1.2rem; }
.roll2 { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.roll2-row { display: grid; grid-template-columns: auto minmax(120px, 1fr) auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; box-shadow: var(--shadow); }
.roll2-av { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 1.3rem var(--display); flex: none; }
.roll2-name b { display: block; font-size: 1.05rem; }
.roll2-name small { color: var(--muted); }
.roll2-btns { display: grid; grid-template-columns: repeat(4, minmax(78px, 1fr)); gap: 8px; }
.rb { --c: var(--ok); display: grid; justify-items: center; gap: 2px; padding: 7px 6px; border-radius: 10px; border: 1.5px solid color-mix(in srgb, var(--c) 45%, var(--line)); background: var(--surface); color: var(--c); font-weight: 800; font-size: .86rem; touch-action: manipulation; }
.rb-late { --c: #D96F06; } .rb-absent { --c: var(--bad); } .rb-excused { --c: #7C88A3; }
.rb:hover { border-color: var(--c); }
.rb.on { background: var(--c); border-color: var(--c); color: #fff; box-shadow: 0 3px 10px color-mix(in srgb, var(--c) 35%, transparent); }
.roll2-row.is-present { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.roll2-row.is-absent { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.roll2-row.is-late { border-color: color-mix(in srgb, #D96F06 40%, var(--line)); }
.roll-save { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); z-index: 15; display: flex; justify-content: center; }
.roll-save .btn { max-width: 940px; box-shadow: 0 8px 24px rgba(35, 80, 216, .35); }
@media (min-width: 901px) { .roll-save { left: 264px; } }
@media (max-width: 720px) {
  .roll-info { grid-template-columns: 1fr; } .ri-part + .ri-part { border-left: 0; padding-left: 0; border-top: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); padding-top: 12px; }
  .roll2-row { grid-template-columns: auto 1fr; }
  .roll2-btns { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .rb { font-size: .78rem; padding: 8px 2px; }
}
/* Instrumentos del maestro */
.inst-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.inst-card { display: grid; justify-items: center; gap: 6px; padding: 22px 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); text-align: center; }
.inst-card .ico { color: var(--accent); margin-bottom: 6px; }
.inst-card b { font: 700 1.1rem var(--display); }
.inst-card small { color: var(--muted); min-height: 1.2em; }
.inst-card .ic-open { margin-top: 8px; width: 100%; border: 1.5px solid var(--accent); color: var(--accent); border-radius: 10px; padding: 7px; font-weight: 800; }
.inst-card:hover { border-color: var(--accent); }
.inst-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }
.inst-card.on .ic-open { background: var(--accent); color: #fff; }
.inst-panel { gap: 16px; }
.ip-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ip-ico { color: var(--ink); }
.ip-head h2 { font-size: 1.35rem; }
.ip-tools { justify-content: flex-end; }
.ip-metro { max-width: 520px; margin: 0 auto; width: 100%; }
.inst-panel:fullscreen, .inst-panel.pseudo-full { background: var(--bg); align-content: center; padding: 12px; }
@media (max-width: 900px) { .inst-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .inst-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .inst-card { padding: 14px 8px 10px; } .inst-card .ico { width: 38px; height: 38px; } .ip-tools { justify-content: flex-start; } }
.main-col { min-width: 0; }
.input.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
/* Botón del pedal del piano */
.pedal-btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 10px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font: 700 .9rem var(--body); cursor: pointer; transition: background .15s, border-color .15s; }
.pedal-ico { width: 22px; height: 14px; border-radius: 4px 4px 7px 7px; background: linear-gradient(180deg, #C9D3EA, #8C96AB); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2); transition: transform .15s; }
.pedal-btn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.pedal-btn.on .pedal-ico { background: linear-gradient(180deg, #F5C33B, #C49102); transform: translateY(3px) scaleY(.8); }
/* Teclado y diapasón que se tocan deslizando el dedo (no se mueve la página) */
.slide-play { touch-action: none !important; }
.inst-scroll { position: relative; max-width: 100%; }
.inst-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 34px; height: 54px; border: 0; border-radius: 10px; background: color-mix(in srgb, var(--accent) 88%, transparent); color: #fff; font-size: 1rem; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.inst-arrow.l { left: 4px; } .inst-arrow.r { right: 4px; }
.inst-arrow[hidden] { display: none; }
