/* Clases de piano — papel de partitura para leer, laca negra para tocar. */
@font-face { font-family: 'Bodoni Moda'; src: url('/fonts/bodoni-moda-latin-opsz-normal.woff2') format('woff2'); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bodoni Moda'; src: url('/fonts/bodoni-moda-latin-opsz-italic.woff2') format('woff2'); font-weight: 400 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Atkinson Next'; src: url('/fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2') format('woff2'); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Atkinson Next'; src: url('/fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2') format('woff2'); font-weight: 200 800; font-style: italic; font-display: swap; }

:root {
  --paper: #eef1f6;
  --surface: #ffffff;
  --ink: #171a2b;
  --ink-2: #4b5068;
  --line: #d4d9e5;
  --lacquer: #14151f;
  --felt: #bf1e45;
  --brass: #a87b1c;
  --rh: #2463d1;
  --lh: #cf5f12;
  --ok: #157f55;
  --ok-bg: #e2f5ec;
  --bad-bg: #fbe6eb;
  --staff-line: #6f7489;
  --font-display: 'Bodoni Moda', 'Didot', 'Bodoni MT', Georgia, serif;
  --font-body: 'Atkinson Next', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --wrap: 1080px;
  --text: 42rem;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.6 var(--font-body); min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3, p, ul, ol, dl, dd, figure, table { margin: 0; }
h1, h2 { font-family: var(--font-display); font-weight: 650; line-height: 1.08; letter-spacing: -0.012em; font-optical-sizing: none; font-variation-settings: 'opsz' 16; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.25rem); }
h2 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem); }
h3 { font-size: 1.08rem; font-weight: 700; line-height: 1.3; }
a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--felt); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--rh); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: 0; }
.muted { color: var(--ink-2); font-size: .95rem; }
.icon { display: inline-flex; flex: none; }
.rh-text { color: var(--rh); } .lh-text { color: var(--lh); }

/* ---------- Cabecera ---------- */
.site-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1.5rem; padding: .55rem max(1rem, calc((100vw - var(--wrap)) / 2)); background: var(--lacquer); color: #f4f5f9; border-bottom: 4px solid var(--felt); min-height: 3.4rem; }
.site-header a { text-decoration: none; }
.site-header a:hover { color: #fff; }
.brand { display: flex; align-items: center; gap: .6rem; flex: none; }
.brand-keys { display: flex; gap: 2px; height: 1.5rem; }
.brand-keys i { width: 7px; background: #f6f5ef; border-radius: 0 0 2px 2px; position: relative; }
.brand-keys i + i::before { content: ''; position: absolute; left: -4px; top: 0; width: 6px; height: 58%; background: var(--lacquer); border-radius: 0 0 1.5px 1.5px; outline: 1px solid var(--lacquer); }
.brand-name { font: italic 600 1.3rem/1 var(--font-display); letter-spacing: -.01em; white-space: nowrap; }
.main-nav { display: flex; gap: .25rem; flex: 1; }
.main-nav a { padding: .4rem .75rem; border-radius: 7px; color: #c9ccdb; font-weight: 500; white-space: nowrap; }
.main-nav a.on { background: #2b2d40; color: #fff; }
.header-right { display: flex; align-items: center; gap: .5rem; flex: none; }
.icon-btn { display: inline-flex; align-items: center; gap: .4rem; background: none; border: 1px solid #3a3d55; color: #c9ccdb; border-radius: 7px; padding: .35rem .6rem; font-size: .9rem; }
.icon-btn:hover { border-color: #7d81a0; color: #fff; }
.icon-btn.on { border-color: #3fbf8a; color: #8fe6c0; }
.account-link { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .75rem; border-radius: 7px; background: #f6f5ef; color: var(--ink) !important; font-weight: 600; font-size: .95rem; max-width: 12rem; }
.account-link span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-link { color: #c9ccdb; font-size: .9rem; white-space: nowrap; text-decoration: underline !important; }

/* ---------- Estructura ---------- */
main { flex: 1; width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 2rem 1rem 4rem; }
.site-footer { background: var(--lacquer); color: #a9adc2; font-size: .85rem; padding: 1.2rem max(1rem, calc((100vw - var(--wrap)) / 2)); }
.page-head { margin-bottom: 2rem; display: grid; gap: .8rem; }
.section-lead { color: var(--ink-2); max-width: var(--text); }
.band { margin-top: 3.5rem; }
.band > h2 { margin-bottom: .7rem; }
.band > .section-lead { margin-bottom: 1.4rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .7rem; }
.row.center { justify-content: center; }
.empty { text-align: center; padding: 4rem 1rem; display: grid; gap: 1rem; justify-items: center; }
.callout { background: #fff7e0; border: 1px solid #e6cf8f; padding: .9rem 1.1rem; border-radius: var(--radius); display: grid; gap: .7rem; max-width: var(--text); }
p.callout { display: flex; gap: .5rem; align-items: flex-start; }
.callout .icon { color: var(--ok); margin-top: .2rem; }

/* ---------- Botones y controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; background: var(--lacquer); color: #fff; border: 1.5px solid var(--lacquer); border-radius: 4px 4px 9px 9px; padding: .55rem 1.05rem; font-weight: 600; text-decoration: none; line-height: 1.2; box-shadow: 0 2px 0 #000, 0 3px 6px rgba(20, 21, 31, .25); transition: transform .06s, box-shadow .06s, background .15s; }
.btn:hover { background: #2a2c40; color: #fff; }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 #000; }
.btn.big { padding: .8rem 1.4rem; font-size: 1.08rem; }
.btn.small { padding: .3rem .7rem; font-size: .92rem; }
.btn.ghost { background: #fbfaf6; color: var(--ink); border-color: #b9bcc9; box-shadow: 0 2px 0 #b9bcc9; }
.btn.ghost:hover { background: #fff; border-color: var(--ink); color: var(--ink); }
.btn.ghost:active { box-shadow: none; }
.btn.stop { background: var(--felt); border-color: var(--felt); box-shadow: 0 2px 0 #7d1230; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ready { animation: ready .5s ease-out; }
@keyframes ready { 0% { box-shadow: 0 0 0 0 rgba(21, 127, 85, .7); } 100% { box-shadow: 0 0 0 14px rgba(21, 127, 85, 0); } }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; font-size: .95rem; }
.link:hover { color: var(--felt); }
.link.danger { color: var(--felt); }
.segmented { display: inline-flex; flex-wrap: wrap; background: #dfe3ec; border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: none; padding: .35rem .8rem; border-radius: 7px; font-weight: 500; font-size: .95rem; color: var(--ink-2); }
.segmented button.on { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(23, 26, 43, .18); }
.toggle { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .95rem; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { width: 2.3rem; height: 1.3rem; border-radius: 1rem; background: #b9bcc9; position: relative; transition: background .15s; flex: none; }
.toggle-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: calc(1.3rem - 4px); height: calc(1.3rem - 4px); border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + .toggle-track { background: var(--ok); }
.toggle input:checked + .toggle-track::after { transform: translateX(1rem); }
.toggle input:focus-visible + .toggle-track { outline: 3px solid var(--rh); outline-offset: 2px; }
.select, .search, form input { border: 1.5px solid #b9bcc9; background: var(--surface); border-radius: 7px; padding: .5rem .7rem; }
.search { width: 100%; max-width: 30rem; }
input[type=range] { accent-color: var(--ink); width: 100%; }
.tag { font-size: .8rem; font-weight: 700; padding: .12rem .5rem; border-radius: 5px; background: var(--ink); color: #fff; white-space: nowrap; }
.tag.rh { background: #dbe7fb; color: #17479c; } .tag.lh { background: #fbe3d0; color: #8f3f08; } .tag.both { background: #e4e0f5; color: #3d2f85; }
.stars { display: inline-flex; gap: 1px; color: #c7cbd8; vertical-align: middle; }
.stars .on { color: var(--brass); }
#toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 200%); background: var(--lacquer); color: #fff; padding: .7rem 1.1rem; border-radius: 9px; z-index: 60; max-width: calc(100vw - 2rem); transition: transform .25s; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
#toast.show { transform: translate(-50%, 0); }
#toast.bad { background: var(--felt); }
.tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: .55rem 1rem; text-decoration: none; font-weight: 600; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.on { color: var(--ink); border-color: var(--felt); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips a { text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 2rem; padding: .2rem .8rem; font-size: .92rem; }

/* ---------- Superficies musicales ---------- */
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; overflow: hidden; }
.paper.center { display: flex; justify-content: center; }
.paper.center .score { width: auto; }
.stage { background: var(--lacquer); border-radius: var(--radius); padding: 1rem .8rem 0; overflow: hidden; }
.stage .kbd { margin-bottom: -4px; }
.figure { display: grid; gap: .9rem; margin-top: 1.4rem; }
.figure > .segmented, .figure > .row > .segmented { justify-self: start; }
.fig-caption { color: var(--ink-2); font-size: .97rem; max-width: var(--text); min-height: 1.5em; }
.fig-caption b { color: var(--ink); }
.axis { display: flex; justify-content: space-between; font-size: .9rem; color: var(--ink-2); font-weight: 600; }
.fig-svg { display: block; width: 100%; max-width: 34rem; height: auto; margin-inline: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.staff-fig .staff-line { stroke: var(--staff-line); stroke-width: 1.3; }
.staff-fig .staff-line.anchor { stroke: var(--felt); stroke-width: 3; }
.staff-fig .mg { font-family: 'Bravura'; fill: var(--ink); }
.staff-fig .big-head { fill: var(--rh); transition: y .18s ease-out; }
.staff-fig .hl-line { stroke: var(--rh); stroke-width: 3; opacity: .35; }
.staff-fig .line-no, .staff-fig .space-no { font: 600 12px var(--font-body); fill: var(--ink-2); text-anchor: end; }
.staff-fig .space-no { fill: var(--brass); }
.staff-fig .side-label { font: 600 11px var(--font-body); fill: var(--ink-2); text-anchor: middle; }
.staff-fig .anchor-ring { fill: none; stroke: var(--felt); stroke-width: 2; stroke-dasharray: 4 4; animation: spin 14s linear infinite; transform-box: fill-box; transform-origin: center; }
.staff-fig .anchor-note { fill: var(--felt); }
.staff-fig .anchor-label { font: 700 20px var(--font-body); fill: var(--felt); text-anchor: middle; }
.staff-fig .anchor-arrow { stroke: var(--felt); stroke-width: 1.5; fill: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Manos */
.hands-row { display: flex; justify-content: center; gap: clamp(1rem, 6vw, 4rem); }
.hand-fig { text-align: center; width: min(42%, 13rem); }
.hand-fig.small { width: 7.5rem; flex: none; }
.hand-fig figcaption { font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.hand { width: 100%; height: auto; display: block; }
.hand .palm, .hand .finger { fill: #f1d9c5; stroke: #c9a78c; stroke-width: 1.5; }
.hand .finger { cursor: pointer; transition: fill .15s; }
.hand.rh .finger.on { fill: #a9c6f7; } .hand.lh .finger.on { fill: #f8c9a2; }
.hand .tip circle { fill: var(--ink); }
.hand.rh .tip.on circle { fill: var(--rh); } .hand.lh .tip.on circle { fill: var(--lh); }
.hand .tip text { font: 700 13px var(--font-body); fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.position-row { display: flex; align-items: flex-end; gap: 1rem; }
.position-row .stage { flex: 1; min-width: 0; }

/* Metrónomo y pulsos */
.metro-box { display: flex; gap: 1.5rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; }
.metro { width: 5.5rem; height: 7rem; flex: none; background: linear-gradient(#2a2c40, var(--lacquer)); clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%); position: relative; }
.metro-arm { position: absolute; left: calc(50% - 1.5px); bottom: 12%; width: 3px; height: 78%; background: #f6f5ef; transform-origin: bottom center; transition: transform linear; }
.metro-arm::after { content: ''; position: absolute; left: -5px; top: 22%; width: 13px; height: 10px; background: var(--brass); border-radius: 2px; }
.metro-info { display: grid; gap: .5rem; flex: 1; min-width: 0; justify-items: start; }
.metro-read { font-size: .95rem; color: var(--ink-2); }
.metro-bpm { font: 600 2.4rem/1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.metro-term { font-size: 1rem; }
.beat-dots { display: flex; gap: .45rem; }
.beat-dots i { width: 1rem; height: 1rem; border-radius: 50%; background: #dfe3ec; font-style: normal; display: grid; place-items: center; transition: transform .08s, background .08s; }
.beat-dots i:first-child, .beat-dots i.acc { box-shadow: inset 0 0 0 2px var(--felt); }
.beat-dots i.on { background: var(--ink); transform: scale(1.25); color: #fff; }
.beat-dots i.acc.on, .beat-dots i:first-child.on { background: var(--felt); }
.beat-dots.large i { width: 2.6rem; height: 2.6rem; font-weight: 700; color: var(--ink-2); }
.beat-dots.large i.on { color: #fff; }
.ts-row { display: flex; align-items: center; gap: 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.5rem; flex-wrap: wrap; }
.ts-big { display: grid; font-size: 2.6rem; line-height: 1; gap: 2rem; padding: 1.3rem .6rem 1.2rem; }

/* Figuras rítmicas */
.dur-grid { display: grid; gap: .45rem; }
.dur-row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: .8rem; align-items: stretch; background: none; border: 0; padding: 0; text-align: left; }
.dur-name { font-weight: 700; display: grid; align-content: center; }
.dur-name small { font-weight: 400; color: var(--ink-2); }
.dur-cells { display: flex; gap: 3px; }
.dur-cell { background: var(--surface); border: 1.5px solid var(--line); border-radius: 6px; min-width: 0; height: 3.4rem; display: grid; place-items: center; transition: background .08s; overflow: hidden; }
.dur-cell .mg-inline { font-size: 1.7rem; transform: translateY(.45rem); }
.dur-row:hover .dur-cell { border-color: var(--ink-2); }
.dur-cell.on { background: var(--rh); border-color: var(--rh); color: #fff; }
.dot-bars { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.dot-line { display: flex; align-items: center; gap: 1rem; }
.dot-glyph { width: 4rem; text-align: center; padding-top: 1.2rem; flex: none; }
.mg-inline.xl { font-size: 2.2em; }
.dot-track { display: flex; flex: 1; gap: 3px; height: 2.6rem; }
.dot-track .seg { border-radius: 6px; display: grid; place-items: center; font-weight: 700; color: #fff; min-width: 0; }
.seg.base { background: var(--rh); } .seg.extra { background: var(--felt); } .seg.void { background: repeating-linear-gradient(90deg, #eef1f6 0 8px, #fff 8px 16px); }
.step-strip { display: flex; gap: 3px; }
.step-strip span { flex: 2; background: var(--ink); color: #fff; text-align: center; font-size: .82rem; font-weight: 600; padding: .25rem 0; border-radius: 5px; min-width: 0; overflow: hidden; }
.step-strip span.semi { flex: 1; background: var(--felt); }

/* Tablas */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sym-table, .compare { border-collapse: collapse; width: 100%; font-size: .97rem; }
.sym-table th, .sym-table td, .compare th, .compare td { text-align: left; padding: .5rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sym-table thead th, .compare thead th { font-size: .85rem; color: var(--ink-2); font-weight: 600; background: #f6f7fa; }
.sym-table tbody tr:last-child > *, .compare tbody tr:last-child > * { border-bottom: 0; }
.glyph-cell { line-height: 1; }
td.glyph-cell > .mg-inline { transform: translateY(.5rem); }
.compare { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: table; margin: .4rem 0; }
.compare tbody th { font-weight: 600; width: 38%; }

/* Círculo de quintas */
.circle-row { display: grid; grid-template-columns: minmax(0, 22rem) 1fr; gap: 1.5rem; align-items: center; }
.circle5 { border: 0; background: none; max-width: 22rem; }
.circle5 .sector { cursor: pointer; outline: none; }
.circle5 .sector path { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; transition: fill .15s; }
.circle5 .sector:hover path { fill: #e3e8f3; }
.circle5 .sector:focus-visible path { stroke: var(--rh); stroke-width: 3; }
.circle5 .sector.on path { fill: var(--ink); }
.circle5 text { text-anchor: middle; dominant-baseline: central; pointer-events: none; font-family: var(--font-body); }
.circle5 .maj { font-weight: 700; font-size: 17px; fill: var(--ink); }
.circle5 .min { font-size: 11px; fill: var(--ink-2); }
.circle5 .cnt { font-size: 11px; font-weight: 600; fill: var(--brass); }
.circle5 .sector.on .maj { fill: #fff; } .circle5 .sector.on .min { fill: #c9ccdb; }
.circle-row > div { display: grid; gap: .8rem; }

/* Matices */
.dyn-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.dyn-btn { background: none; border: 1.5px solid transparent; border-radius: 8px; padding: .5rem .2rem; display: grid; justify-items: center; gap: .4rem; align-content: end; height: 100%; }
.dyn-btn:hover { border-color: var(--ink); }
.dyn-btn .mg-inline { font-size: 2rem; height: 2rem; line-height: 2rem; }
.dyn-bar { width: 60%; background: linear-gradient(var(--felt), #e6839c); border-radius: 4px 4px 0 0; }
.dyn-btn small { color: var(--ink-2); font-size: .8rem; line-height: 1.2; }

/* Repeticiones */
.rep-track { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.2rem 1rem 2.1rem; overflow-x: auto; }
.rep-bar { flex: 1; min-width: 4.2rem; height: 3.6rem; border-left: 2px solid var(--ink); position: relative; display: grid; place-items: center; background: repeating-linear-gradient(var(--line) 0 1px, transparent 1px 25%); background-position-y: 6px; background-size: 100% calc(100% - 12px); background-repeat: no-repeat; transition: background-color .12s; }
.rep-bar:last-child { border-right: 5px double var(--ink); }
.rep-bar b { font: 700 1.5rem var(--font-display); background: var(--surface); padding: 0 .4rem; border-radius: 4px; }
.rep-bar.on { background-color: #ffe9a8; }
.rep-bar.on b { background: var(--ink); color: #fff; }
.rep-sign { position: absolute; font-size: 2.15rem; top: 50%; line-height: 0; transform: translateY(.92rem); }
.rep-sign.l { left: -3px; } .rep-sign.r { right: -5px; }
.rep-volta { position: absolute; top: -1.75rem; left: 0; right: 4px; height: 1.4rem; border: 1.5px solid var(--ink); border-bottom: 0; border-right: 0; font-size: .82rem; font-weight: 700; padding-left: .3rem; line-height: 1.3; }
.rep-top { position: absolute; top: -1.2rem; left: .2rem; font-size: 1.3rem; }
.rep-top.right { left: auto; right: .3rem; }
.rep-under { position: absolute; bottom: -1.65rem; right: .2rem; font: italic 600 .88rem var(--font-display); white-space: nowrap; }
.rep-order { display: flex; gap: 3px; }
.rep-order span { width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 5px; background: #dfe3ec; font-weight: 700; font-size: .9rem; }
.rep-order span.on { background: var(--ink); color: #fff; }
.rep-order-label { font-size: .92rem; color: var(--ink-2); }

/* Anatomía */
.anatomy .hotspot { cursor: pointer; outline: none; }
.anatomy .hotspot circle { fill: var(--felt); stroke: #fff; stroke-width: 1.5; transition: r .12s; }
.anatomy .hotspot text { font: 700 10px var(--font-body); fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.anatomy .hotspot:hover circle, .anatomy .hotspot.on circle, .anatomy .hotspot:focus-visible circle { r: 11.5; fill: var(--ink); }
.anatomy-panel { background: var(--lacquer); color: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; min-height: 5.6rem; }
.anatomy-panel p { color: #d5d8e6; margin-top: .2rem; }

/* ---------- Ejercicios ---------- */
.exercise { display: grid; gap: .9rem; margin-top: 1.4rem; background: #e3e7f0; border-radius: 14px; padding: 1.1rem; }
.exercise .paper, .exercise .stage { min-width: 0; }
.question { font-size: 1.14rem; font-weight: 600; max-width: var(--text); }
.question .mg-inline { font-size: 1.9em; }
.dots { display: flex; gap: 4px; flex-wrap: wrap; }
.dots i { width: 1.4rem; height: .38rem; border-radius: 3px; background: #c4c9d6; }
.dots i.cur { background: var(--ink); } .dots i.ok { background: var(--ok); } .dots i.half { background: var(--brass); }
.feedback { min-height: 1.7rem; font-size: 1rem; }
.feedback .btn { margin-left: .5rem; vertical-align: middle; }
.feedback:empty { display: none; }
.feedback.ok, .feedback.bad { padding: .55rem .9rem; border-radius: 8px; }
.feedback.ok { background: var(--ok-bg); color: #0b4f34; }
.feedback.bad { background: var(--bad-bg); color: #7d1230; }
.quiz-body { display: grid; gap: .9rem; }
.mini-fig { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.mini-fig .kbd { min-width: min(100%, 15rem); }
.mini-fig .kbd-svg { filter: none; }
.big-glyph { font-size: 2.4rem; line-height: 1; padding: 1.6rem 1rem .9rem; }
.big-glyph .txt-sym { font: italic 600 1.5rem var(--font-display); display: block; padding-bottom: .7rem; margin-top: -.8rem; }
.options { display: grid; gap: .5rem; }
.options.short { grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); }
.options.names { grid-template-columns: repeat(7, 1fr); }
.option { background: var(--surface); border: 1.5px solid #b9bcc9; border-bottom-width: 4px; border-radius: 6px 6px 10px 10px; padding: .65rem .9rem; text-align: left; font-weight: 600; min-height: 3rem; transition: border-color .1s, background .1s; }
.options.short .option { text-align: center; }
.option:hover:not(:disabled) { border-color: var(--ink); }
.option:active:not(:disabled) { border-bottom-width: 1.5px; margin-top: 2.5px; }
.option .mg-inline { font-size: 1.9em; padding: 0 .25em; }
.option.ok { background: var(--ok-bg); border-color: var(--ok); color: #0b4f34; }
.option.bad { background: var(--bad-bg); border-color: var(--felt); color: #7d1230; opacity: .75; }
.option:disabled { cursor: default; }
.count-in { font: 600 3rem/1 var(--font-display); text-align: center; height: 0; overflow: visible; color: var(--felt); opacity: 0; pointer-events: none; position: relative; z-index: 2; }
.count-in.show { opacity: 1; height: 3rem; }
.tap-pad { background: var(--lacquer); color: #fff; border: 0; border-radius: 6px 6px 14px 14px; padding: 1.6rem 1rem; font-size: 1.2rem; font-weight: 700; display: grid; gap: .2rem; box-shadow: 0 4px 0 #000; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tap-pad small { font-weight: 400; color: #a9adc2; font-size: .85rem; }
.tap-pad.hit { transform: translateY(4px); box-shadow: none; background: #34374f; }
.meter { color: var(--ink-2); min-height: 1.6em; }
.palette { align-items: stretch; }
.fig-btn { background: var(--surface); border: 1.5px solid #b9bcc9; border-bottom-width: 4px; border-radius: 6px 6px 10px 10px; padding: 1.5rem .8rem .4rem; display: grid; justify-items: center; gap: .5rem; min-width: 5.2rem; }
.fig-btn:hover:not(:disabled) { border-color: var(--ink); }
.fig-btn:disabled { opacity: .35; cursor: not-allowed; }
.fig-glyph { font-size: 1.5rem; line-height: 1; height: 1.2rem; }
.fig-btn small { font-size: .78rem; color: var(--ink-2); }

/* ---------- Portada ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; padding: clamp(.5rem, 3vw, 2.5rem) 0 1rem; }
.hero-text { display: grid; gap: 1.2rem; }
.hero .lead { font-size: 1.2rem; color: var(--ink-2); max-width: 34rem; }
.hero-note { font-size: .95rem; color: var(--ink-2); max-width: 32rem; }
.hero-demo { display: grid; gap: .7rem; }
.hero-demo .paper { min-height: 15.5rem; align-items: center; }
.hero-demo .fig-caption { min-height: 3.1em; }
.module-path { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 0 2rem; counter-reset: mod; }
.module-path li { counter-increment: mod; border-top: 1.5px solid var(--staff-line); }
.module-path a { display: grid; gap: .3rem; padding: 1rem 0 1.4rem 3rem; text-decoration: none; position: relative; height: 100%; align-content: start; }
.module-path a::before { content: counter(mod); position: absolute; left: 0; top: .75rem; font: 600 2.1rem/1 var(--font-display); color: var(--felt); }
.module-path p { color: var(--ink-2); font-size: .97rem; }
.module-path a:hover h3 { text-decoration: underline; }
.meter-text { font-size: .88rem; font-weight: 600; color: var(--ink-2); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.tool-card { background: var(--surface); border: 1px solid var(--line); box-shadow: 0 4px 0 var(--ink); border-radius: 6px 6px 12px 12px; padding: 1.1rem 1.2rem 1.3rem; text-decoration: none; display: grid; gap: .4rem; align-content: start; transition: transform .1s; }
.tool-card:hover { transform: translateY(-3px); color: inherit; box-shadow: 0 4px 0 var(--felt); }
.tool-card p { color: var(--ink-2); font-size: .97rem; }
.how-list { padding-left: 1.2rem; display: grid; gap: .5rem; max-width: var(--text); }

/* ---------- Mapa del curso y listas ---------- */
.module { margin-top: 2.6rem; scroll-margin-top: 5rem; }
.module-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .6rem; }
.module-head > div { flex: 1; display: grid; gap: .2rem; }
.module-head p { color: var(--ink-2); }
.module-no { font: 600 2.6rem/1 var(--font-display); color: var(--felt); min-width: 2rem; }
.module-count { font-weight: 700; font-size: .92rem; color: var(--ink-2); white-space: nowrap; padding-top: .5rem; }
.module-count.full { color: var(--ok); }
.lesson-list, .song-list { list-style: none; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lesson-list li + li, .song-list li + li { border-top: 1.5px solid var(--line); }
.lesson-list a, .song-list a { display: flex; align-items: center; gap: 1rem; padding: .85rem 1.1rem; text-decoration: none; color: inherit; }
.lesson-list a:hover, .song-list a:hover { background: #f5f7fb; }
.notehead { width: 1.35rem; height: .95rem; border: 2.5px solid var(--ink); border-radius: 50%; transform: rotate(-22deg); flex: none; }
.lesson-list li.done .notehead { background: var(--ink); }
.lesson-list li.next .notehead { border-color: var(--felt); box-shadow: 0 0 0 4px rgba(191, 30, 69, .16); }
.lesson-main, .song-main { flex: 1; min-width: 0; display: grid; }
.lesson-title, .song-title { font-weight: 700; }
.lesson-sum, .song-by { color: var(--ink-2); font-size: .93rem; }
.lesson-meta, .song-meta { display: flex; align-items: center; gap: .6rem; flex: none; }
.mins { color: var(--ink-2); font-size: .88rem; white-space: nowrap; }
.tag.next, .lesson-list .tag { background: var(--felt); }
.song-list.compact a { padding: .55rem 1rem; }

/* ---------- Lección ---------- */
.lesson, .song { max-width: 52rem; margin-inline: auto; }
.lesson-head { display: grid; gap: .6rem; margin-bottom: 1.6rem; }
.crumb { display: inline-flex; align-items: center; gap: .3rem; font-size: .92rem; font-weight: 600; color: var(--ink-2); text-decoration: none; justify-self: start; }
.lesson-head h1 { font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.5rem); }
.step-bar { list-style: none; padding: 0; display: flex; gap: 4px; margin-top: .4rem; }
.step-bar li { flex: 1; }
.step-bar button { display: block; width: 100%; height: 1.5rem; border: 0; background: none; padding: .55rem 0; }
.step-bar button::before { content: ''; display: block; height: .4rem; border-radius: 3px; background: #c4c9d6; }
.step-bar li.seen button::before { background: var(--ink-2); }
.step-bar li.ex.done button::before { background: var(--ok); }
.step-bar li.cur button::before { background: var(--felt); height: .6rem; margin-top: -.1rem; }
.step-count { font-size: .9rem; font-weight: 600; color: var(--ink-2); margin-bottom: .3rem; }
.step > h2 { margin-bottom: .9rem; }
.prose { max-width: var(--text); display: grid; gap: .8rem; }
.prose ul, .prose ol { padding-left: 1.3rem; display: grid; gap: .35rem; }
.prose .note { background: #fff7e0; border: 1px solid #e6cf8f; padding: .6rem .9rem; font-size: .97rem; border-radius: 8px; }
.prose .formula { font: 600 1.25rem var(--font-display); text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; }
.prose .mg-inline { font-size: 1.7em; }
.step-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 2rem; padding-top: 1.2rem; border-top: 1.5px solid var(--line); }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.lesson-end { text-align: center; display: grid; gap: .8rem; justify-items: center; padding: 2rem 0 1rem; }
.lesson-end .stars { gap: 6px; }
.lesson-end .stars .on { animation: pop .45s ease-out backwards; }
.lesson-end .stars .on:nth-child(2) { animation-delay: .15s; } .lesson-end .stars .on:nth-child(3) { animation-delay: .3s; }
@keyframes pop { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25); } }
.missing { padding-left: 1.2rem; margin-top: .6rem; }

/* ---------- Canción ---------- */
.song { max-width: 62rem; }
.song-sub { color: var(--ink-2); }
.song-best { display: inline-flex; align-items: center; gap: .4rem; font-size: .93rem; color: var(--ink-2); }
.tip { display: flex; gap: .6rem; background: #fff7e0; border: 1px solid #e6cf8f; padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1.1rem; max-width: 48rem; }
.tip .icon { color: var(--brass); margin-top: .2rem; }
.song-controls, .practice-config { display: flex; flex-wrap: wrap; gap: .9rem 1.6rem; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.ctrl { display: grid; gap: .25rem; }
.ctrl-label { font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.ctrl.toggles { gap: .45rem; }
.speed { display: flex; align-items: center; gap: .6rem; min-width: 14rem; }
.speed output { font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 7.5rem; }
.start-row { margin: 1rem 0; min-height: 3.2rem; }
.start-row .feedback { flex: 1; min-width: 12rem; }
.song-paper { max-height: 21rem; overflow-y: auto; scroll-behavior: smooth; }
.song-paper .score { overflow: visible; }
.song-result { text-align: center; background: var(--surface); border: 2px solid var(--brass); border-radius: var(--radius); padding: 1.2rem; margin-top: 1rem; display: grid; gap: .4rem; justify-items: center; }
.song-stage { margin-top: 1rem; padding-top: 0; position: relative; }
.waterfall { display: block; width: 100%; height: clamp(9rem, 26vh, 16rem); }
.song-stage .count-in { position: absolute; left: 0; right: 0; top: 2.5rem; height: auto; color: #fff; font-size: 4.5rem; text-shadow: 0 2px 12px #000; }
.kbd-help { font-size: .88rem; color: var(--ink-2); margin-top: .9rem; }

/* ---------- Práctica ---------- */
.practice-body { display: grid; gap: 1.2rem; }
.practice-body > h2 { margin-top: 1.5rem; font-size: 1.4rem; }
.practice-run { margin-top: 0; }

/* ---------- Símbolos ---------- */
.sym-section { margin-top: 2.6rem; scroll-margin-top: 5rem; }
.sym-section > h2 { margin-bottom: 1rem; }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: .9rem; }
.sym-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 1rem 1rem; display: grid; gap: .35rem; align-content: start; }
.sym-card .mini-fig { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; margin: 0 -1rem .5rem; min-height: 7.4rem; padding: .5rem; }
.sym-card p { color: var(--ink-2); font-size: .95rem; }
.sym-link { font-size: .88rem; font-weight: 600; margin-top: .2rem; }

/* ---------- Progreso y cuenta ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 0 1.5rem; }
.stat { border-top: 1.5px solid var(--staff-line); padding: .7rem 0 1.1rem; display: grid; gap: .1rem; }
.stat dt { font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.stat dd b { font: 600 2.3rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat dd span { color: var(--ink-2); font-size: .92rem; }
.cal-wrap { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; }
.cal-days { display: grid; grid-template-rows: repeat(7, 1.05rem); gap: 3px; font-size: .7rem; color: var(--ink-2); line-height: 1.05rem; }
.calendar { display: grid; grid-template-rows: repeat(7, 1.05rem); grid-auto-flow: column; grid-auto-columns: 1.05rem; gap: 3px; }
.calendar i, .cal-legend i { border-radius: 3px; background: #dce0ea; }
.cal-legend { display: flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--ink-2); margin-top: .6rem; flex-wrap: wrap; }
.cal-legend i { width: .9rem; height: .9rem; }
i.lv1 { background: #b5cbf2; } i.lv2 { background: #7ea4e8; } i.lv3 { background: #3f75d8; } i.lv4 { background: #183f8f; }
.mod-progress { display: grid; gap: .1rem; }
.mod-row { display: grid; grid-template-columns: minmax(8rem, 18rem) 1fr 3.5rem; gap: 1rem; align-items: center; text-decoration: none; padding: .45rem 0; }
.mod-name { font-weight: 600; }
.bar { height: .6rem; background: #dce0ea; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.mod-count { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .92rem; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.5rem; margin: 1.2rem 0 1.6rem; }
form { display: grid; gap: .8rem; align-content: start; }
form label { display: grid; gap: .25rem; font-weight: 600; font-size: .95rem; }
form label small { font-weight: 400; color: var(--ink-2); }
form input { font-weight: 400; font-size: 1.05rem; width: 100%; }
form .btn { justify-self: start; }
.form-error { color: var(--felt); font-weight: 600; }
.form-error:empty { display: none; }
.auth { max-width: 27rem; margin: 1rem auto; display: grid; gap: 1.1rem; }
.auth-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; gap: 1rem; }
.auth-switch { color: var(--ink-2); }

/* La abreviatura `font` reinicia los ejes variables: se fija el tamaño óptico al final. */
.module-no, .module-path a::before, .metro-bpm, .stat dd b, .count-in, .rep-bar b, .brand-name, .prose .formula, .score-tempo { font-optical-sizing: none; font-variation-settings: 'opsz' 14; }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 860px) {
  .site-header { flex-wrap: wrap; gap: .4rem 1rem; padding-block: .5rem .35rem; }
  .main-nav { order: 3; flex-basis: 100%; overflow-x: auto; margin-inline: -.4rem; scrollbar-width: none; }
  .header-right { margin-left: auto; }
  .icon-btn-text, .progress-link { display: none; }
  .hero { grid-template-columns: 1fr; }
  .circle-row { grid-template-columns: 1fr; justify-items: center; }
  html { scroll-padding-top: 7rem; }
}
@media (max-width: 560px) {
  body { font-size: 1rem; }
  main { padding: 1.3rem .8rem 3rem; }
  .exercise { padding: .8rem; margin-inline: -.3rem; }
  .stage { padding: .7rem .4rem 0; }
  .paper { padding: .6rem .5rem; }
  .lesson-list a, .song-list a { flex-wrap: wrap; gap: .4rem .8rem; padding: .75rem .8rem; }
  .lesson-meta, .song-meta { margin-left: 2.35rem; }
  .song-meta { margin-left: 0; }
  .options.names { grid-template-columns: repeat(4, 1fr); }
  .dur-row { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .dur-cell .mg-inline { font-size: 1.25rem; }
  .dur-name { display: flex; gap: .6rem; align-items: baseline; }
  .dyn-row { grid-template-columns: repeat(3, 1fr); }
  .metro-box { flex-direction: column; align-items: flex-start; }
  .position-row { flex-direction: column; align-items: center; }
  .position-row .stage { width: 100%; }
  .mod-row { grid-template-columns: 1fr 3.5rem; }
  .mod-row .bar { grid-column: 1 / -1; order: 3; }
  .step-nav { flex-wrap: wrap; }
  .speed { min-width: 0; width: 100%; }
  .song-controls .ctrl { width: 100%; }
  .brand-name { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
