/* ===========================================================================
   Progresiones — the progression laboratory of the Ejercicios module.
   Loaded after music-lab.css, practice-lab.css (shell, transport, fretboard,
   dock), practice-chords.css (instrument tabs, chord box, keyboard, drum
   grid, facts, diatonic chords) and practice-scales.css (the exercise field,
   the wide layout, ahora/sigue, cards, focus mode). This file adds the
   timeline, the route cards, the positions grid and comparator, the voice
   leading diagram and the layout of this page. No colour is defined here:
   notes use --ml-root-*, the rest the shared tokens (day and night themes).
   =========================================================================== */

.ml-pg [hidden] { display: none !important; }

/* The key names both notations ("Eb mayor · Mi♭ mayor"): it needs room. */
.ml-pg__field--key { flex: 1 1 200px; }

/* ── Timeline: one card per chord, as wide as its beats ───────────────── */

.ml-pg__timeline .ml-pl__seq-head { flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.ml-pg__label-seg { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ml-pg__track {
  display: flex; gap: 8px; margin: 10px 0 0; padding: 4px 2px 8px; list-style: none;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin;
}
.ml-pg__slot { flex: 1 0 calc(var(--beats, 4) * 26px + 30px); min-width: 92px; display: grid; gap: 6px; scroll-snap-align: start; position: relative; }
.ml-pg__slot + .ml-pg__slot::before {
  content: "→"; position: absolute; left: -8px; top: 30px; transform: translateX(-50%);
  color: var(--ml-dim); font-size: 13px;
}
.ml-pg__slot-btn {
  display: grid; justify-items: center; gap: 2px; width: 100%; min-height: 86px; padding: 10px 6px;
  border: 1px solid color-mix(in srgb, var(--note, var(--ml-line)) 45%, var(--ml-line));
  border-radius: 14px; background: color-mix(in srgb, var(--note, var(--ml-surface-2)) 14%, var(--ml-bg-2));
  color: var(--ml-text); font: inherit; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.ml-pg__slot-btn:hover { border-color: var(--note, var(--ml-pink)); }
.ml-pg__slot-btn:focus-visible { outline: 2px solid var(--ml-coral); outline-offset: 2px; }
.ml-pg__num { font: 700 13px "Space Grotesk", sans-serif; color: var(--ml-muted); }
.ml-pg__sym { font: 700 1.35rem "Space Grotesk", sans-serif; line-height: 1.1; }
.ml-pg__fn { font-size: 11px; color: var(--ml-dim); text-align: center; }
/* "Ver": which of the three leads (the others stay, smaller). */
.ml-pg__track[data-label="numeral"] .ml-pg__num { font-size: 1.05rem; color: var(--ml-text); }
.ml-pg__track[data-label="numeral"] .ml-pg__sym { font-size: 1.05rem; color: var(--ml-muted); }
.ml-pg__track[data-label="function"] .ml-pg__fn { font: 700 13px "Space Grotesk", sans-serif; color: var(--ml-text); }
.ml-pg__track[data-label="function"] .ml-pg__sym { font-size: 1.05rem; }
.ml-pg__beats { display: flex; gap: 4px; justify-content: center; }
.ml-pg__beats i { width: 6px; height: 6px; border-radius: 50%; background: var(--ml-line-strong); }
.ml-pg__beats i:first-child { background: var(--note, var(--ml-muted)); }
.ml-pg__slot.is-current .ml-pg__slot-btn {
  border-color: transparent; transform: translateY(-2px);
  box-shadow: 0 0 0 2px var(--ml-surface), 0 0 0 4px var(--note, var(--ml-coral));
  background: color-mix(in srgb, var(--note, var(--ml-surface-2)) 26%, var(--ml-bg-2));
}
.ml-pg__slot.is-current .ml-pg__slot-btn::after {
  content: "ahora"; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ml-text); font-weight: 700;
}
.ml-pg__slot.is-next .ml-pg__slot-btn, .ml-pg__slot.is-soon .ml-pg__slot-btn { outline: 2px dashed color-mix(in srgb, var(--ml-coral) 75%, transparent); outline-offset: 2px; }
.ml-pg__slot.is-soon .ml-pg__slot-btn::after { content: "sigue"; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ml-coral); font-weight: 700; }

/* ── Stage: tabs, route head, search ──────────────────────────────────── */

.ml-pg__tabs { flex: 1 1 auto; display: flex; overflow-x: auto; scrollbar-width: none; }
.ml-pg__tabs .ml-seg__b { flex: 1 0 auto; min-height: 40px; }
.ml-pg__route-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 12px 0 4px; }
.ml-pg__route-title { min-width: 0; flex: 1 1 260px; }
.ml-pg__route-title h2 { margin: 0; font: 700 1.05rem "Space Grotesk", sans-serif; text-transform: none; letter-spacing: 0; color: var(--ml-text); }
.ml-pg__criterion { margin: 2px 0 0; font-size: 13px; color: var(--ml-muted); }
.ml-pg__route-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ml-pg__route-count { font-size: 12.5px; color: var(--ml-muted); min-width: 52px; text-align: center; }
.ml-pg__route-nav .ml-pl__tbtn:disabled { opacity: .4; cursor: not-allowed; }

.ml-pg__search { display: grid; gap: 10px; margin: 8px 0 12px; padding: 12px; border: 1px solid var(--ml-line); border-radius: 14px; background: var(--ml-bg-2); }
.ml-pg__prio { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; border: 0; }
.ml-pg__prio legend { font-size: 12px; font-weight: 600; color: var(--ml-muted); margin-bottom: 6px; padding: 0; }
.ml-pg__check { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; font-size: 14px; cursor: pointer; }
.ml-pg__check input { width: 18px; height: 18px; accent-color: var(--ml-pink); margin: 0; }
.ml-pg__search > .ml-btn { justify-self: start; }
.ml-pg__routes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.ml-pg__route-opt {
  display: flex; flex-direction: column; gap: 3px; width: 100%; min-height: 56px; padding: 9px 12px; text-align: left;
  border: 1px solid var(--ml-line); border-radius: 12px; background: var(--ml-surface); color: var(--ml-text); font: inherit; cursor: pointer;
}
.ml-pg__route-opt strong { font: 600 14px "Space Grotesk", sans-serif; }
.ml-pg__route-opt small { font-size: 12px; color: var(--ml-muted); }
.ml-pg__route-opt.is-active { border-color: var(--ml-pink); box-shadow: inset 3px 0 0 var(--ml-pink); }
.ml-pg__route-opt:focus-visible { outline: 2px solid var(--ml-coral); outline-offset: 2px; }

.ml-pg__stage-body { gap: 14px; }
.ml-pg__stage-body h3, .ml-pg__h { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ml-dim); margin: 0 0 8px; }
.ml-pg__legend { margin: 0; font-size: 13px; color: var(--ml-muted); }

/* ── Route cards: the voicing of each chord, swipeable on a phone ─────── */

.ml-pg__route { display: grid; gap: 12px; }
.ml-pg__cards { display: flex; gap: 8px; margin: 0; padding: 4px 2px 10px; list-style: none; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; align-items: stretch; }
.ml-pg__vcard {
  flex: 0 0 auto; width: 150px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px;
  border: 1px solid var(--ml-line); border-radius: 14px; background: var(--ml-bg-2); scroll-snap-align: center; cursor: pointer;
}
.ml-pg__vcard .ml-cd { width: 100%; max-width: 128px; }
.ml-pg__vcard--piano { width: 190px; }
.ml-pg__vcard--piano .ml-kb { width: 100%; max-width: 172px; }
.ml-pg__vcard--bass { width: 170px; align-items: flex-start; }
.ml-pg__vhead { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; width: 100%; }
.ml-pg__vhead strong { font: 700 1.1rem "Space Grotesk", sans-serif; }
.ml-pg__vbadge { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--ml-dim); }
.ml-pg__code { font: 700 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ml-text); }
.ml-pg__vmeta { font-size: 11.5px; color: var(--ml-muted); text-align: center; }
.ml-pg__vcard--bass .ml-pg__vmeta { text-align: left; }
.ml-pg__vcard.is-current { border-color: transparent; box-shadow: 0 0 0 2px var(--ml-pink); background: var(--ml-surface-2); }
.ml-pg__vcard.is-next { outline: 2px dashed color-mix(in srgb, var(--ml-coral) 70%, transparent); outline-offset: 2px; }
.ml-pg__vcard.is-in-route { box-shadow: 0 0 0 2px var(--ml-emerald, var(--ml-pink)); }
.ml-pg__arrow { flex: none; align-self: center; color: var(--ml-dim); font-size: 18px; }
.ml-pg__vactions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 4px; }
.ml-pg__vactions .ml-btn { min-height: 34px; }
.ml-pg__vactions .ml-btn.is-active { border-color: var(--ml-pink); color: var(--ml-pink); }
.ml-pg__cards--grid { flex-wrap: wrap; overflow: visible; scroll-snap-type: none; }
.ml-pg__cards--grid .ml-pg__vcard { cursor: default; width: 168px; }
.ml-pg__more { justify-self: start; }

/* The chord box dots light when their chord sounds. */
.ml-pg .ml-cd__dot.is-active .ml-cd__disc { stroke: var(--ml-coral); stroke-width: 3; }

/* Moves between chords, and the route's numbers. */
.ml-pg__moves { border: 1px solid var(--ml-line); border-radius: 14px; padding: 10px 12px; background: var(--ml-bg-2); }
.ml-pg__moves ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ml-pg__moves li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: 13.5px; padding: 4px 6px; border-radius: 8px; }
.ml-pg__moves li strong { font-family: "Space Grotesk", sans-serif; }
.ml-pg__moves li span { color: var(--ml-muted); }
.ml-pg__moves li.is-current { background: var(--ml-surface-2); }
.ml-pg__moves-total { margin: 8px 0 0; font-size: 13px; font-weight: 600; }
.ml-pg__facts { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.ml-pg__neck .ml-fb { min-width: 640px; }
.ml-pg__stage[data-instrument="bajo"] .ml-pg__neck .ml-fb { min-width: 560px; }
.ml-pg .ml-fb__dot.is-root .ml-fb__disc { stroke-width: 4; }
.ml-pg .ml-fb__dot.is-target .ml-fb__halo { opacity: 1; fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 4 3; }

/* Piano: the chord on screen, large; Guiado marks what changes. */
.ml-pg__piano-now .ml-kb { max-height: 220px; }
.ml-pg .ml-kb__key.is-next .ml-kb__dot { stroke: var(--ml-coral); stroke-dasharray: 2 1.5; stroke-width: 1.8; fill-opacity: .35; }
.ml-pg .ml-kb__key.is-hold .ml-kb__dot { stroke: var(--ml-text); stroke-width: 1.8; }
.ml-pg .ml-kb__key.is-active .ml-kb__dot { stroke: var(--ml-coral); stroke-width: 2.4; }

/* Bass: the line of the chord on screen. */
.ml-pg__line { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ml-pg__lnote { display: grid; justify-items: center; gap: 2px; min-width: 44px; padding: 6px 8px; border-radius: 12px; border: 1px solid var(--ml-line); background: var(--ml-bg-2); }
.ml-pg__lnote b { font: 700 15px "Space Grotesk", sans-serif; color: var(--note, var(--ml-text)); }
.ml-pg__lnote small { font-size: 11px; color: var(--ml-muted); }
.ml-pg__lnote.is-approach { border-style: dashed; }

/* Drums. */
.ml-pg__bars .ml-ch__bar { cursor: default; }
.ml-pg__bars .ml-ch__bar.is-fill { border-style: dashed; }
.ml-pg__drumhead { display: grid; gap: 4px; }

/* Positions: chord and family chips, and the comparator. */
.ml-pg__chips, .ml-pg__filters { display: flex; flex-wrap: wrap; gap: 6px; }
.ml-pg__chips .ml-chip, .ml-pg__filters .ml-chip { cursor: pointer; font-family: inherit; min-height: 36px; }
.ml-pg__chips .ml-chip.is-active, .ml-pg__filters .ml-chip.is-active { background: var(--ml-grad); color: #fff; border-color: transparent; }
.ml-pg__filters .ml-chip small { opacity: .75; margin-left: 2px; }
.ml-pg__filters .ml-chip:disabled { opacity: .4; cursor: not-allowed; }
.ml-pg__chips .ml-chip:focus-visible, .ml-pg__filters .ml-chip:focus-visible { outline: 2px solid var(--ml-coral); outline-offset: 2px; }
.ml-pg__compare { border-top: 1px solid var(--ml-line); padding-top: 12px; display: grid; gap: 10px; }
.ml-pg__compare-pair { display: flex; flex-wrap: wrap; gap: 10px; }
.ml-pg__compare-pair .ml-pg__vcard { cursor: default; }
.ml-pg__compare-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 20px; }
.ml-pg__compare-cols h4 { margin: 0 0 6px; font-size: 13px; }
.ml-pg__compare-cols ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ml-muted); display: grid; gap: 3px; }

/* ── Conducción de voces ─────────────────────────────────────────────── */

.ml-pg__vl-head h3 { text-transform: none; letter-spacing: 0; font: 700 1rem "Space Grotesk", sans-serif; color: var(--ml-text); }
.ml-pg__vl-box { display: grid; gap: 8px; }
.ml-pg__vl { width: 100%; max-width: 520px; height: auto; }
.ml-pg__vl-title { font: 700 14px "Space Grotesk", sans-serif; fill: var(--ml-text); }
.ml-pg__vl-dot { fill: var(--note, var(--ml-surface-2)); stroke: var(--ml-surface); stroke-width: 2; }
.ml-pg__vl-note { font: 700 12px "Space Grotesk", sans-serif; fill: var(--ml-bg); }
.ml-pg__vl-line { stroke: var(--ml-muted); stroke-width: 2.2; }
.ml-pg__vl-pair.is-common .ml-pg__vl-line { stroke-width: 3; }
.ml-pg__vl-pair.is-up .ml-pg__vl-line, .ml-pg__vl-pair.is-down .ml-pg__vl-line { stroke: var(--ml-coral); stroke-dasharray: 7 4; }
.ml-pg__vl-tip { fill: var(--ml-coral); }
.ml-pg__vl-words { font: 600 12px Inter, sans-serif; fill: var(--ml-text); }
.ml-pg__vl-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 13.5px; }
.ml-pg__vl-list li { display: flex; align-items: center; gap: 8px; }
.ml-pg__vl-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--ml-line-strong); font-weight: 700; font-size: 12px; }
.ml-pg__vl-list li.is-common .ml-pg__vl-mark { border-style: solid; }
.ml-pg__vl-list li.is-up .ml-pg__vl-mark, .ml-pg__vl-list li.is-down .ml-pg__vl-mark { border-style: dashed; border-color: var(--ml-coral); }

/* ── Teoría ───────────────────────────────────────────────────────────── */

.ml-pg__theory { display: grid; gap: 8px; }
.ml-pg__theory p { margin: 0 0 6px; font-size: 14px; color: var(--ml-muted); }
.ml-pg__theory .ml-ch__deg { cursor: default; }
.ml-pg__theory .ml-ch__deg.is-used { border-color: transparent; box-shadow: 0 0 0 2px var(--ml-pink); }
.ml-pg__fns { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; color: var(--ml-muted); }
.ml-pg__fns b { color: var(--ml-text); }

/* ── Ahora / Sigue, explore ───────────────────────────────────────────── */

.ml-pg__now-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.ml-pg__now-actions .ml-ch__to-scale { margin-top: 0; }
.ml-pg__change { margin: 0; font-size: 13px; color: var(--ml-muted); }
.ml-pg__explore-title { margin: 0 0 10px; font-size: 14px; color: var(--ml-muted); }
.ml-pg__explore-title strong { font: 700 1.2rem "Space Grotesk", sans-serif; }
.ml-pg__explore .ml-pg__facts { margin-bottom: 10px; }

/* ── Focus mode: the progression, the instrument and the transport ────── */

.ml-pg.is-focus .ml-sc__head,
.ml-pg.is-focus .ml-sc__setup,
.ml-pg.is-focus .ml-pg__audio,
.ml-pg.is-focus .ml-pg__metrics,
.ml-pg.is-focus .ml-pg__explore,
.ml-pg.is-focus .ml-sc__progress,
.ml-pg.is-focus .ml-sc__tips,
.ml-pg.is-focus .ml-pl__mode-hint { display: none; }

/* ── Layout ───────────────────────────────────────────────────────────── */

@media (min-width: 760px) {
  .ml-pg__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "setup setup"
      "controls controls"
      "timeline timeline"
      "stage stage"
      "now now"
      "explore explore"
      "audio metrics"
      "progress tips";
  }
  .ml-pg__grid .ml-pg__timeline { grid-area: timeline; }
  .ml-pg__grid .ml-pg__stage { grid-area: stage; }
  .ml-pg__grid .ml-pg__now { grid-area: now; }
  .ml-pg__grid .ml-pg__explore { grid-area: explore; }
  .ml-pg__grid .ml-pg__audio { grid-area: audio; }
  .ml-pg__grid .ml-pg__metrics { grid-area: metrics; }
}

@media (min-width: 1100px) {
  .ml-pg__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      "setup setup setup"
      "controls controls controls"
      "timeline timeline timeline"
      "stage stage stage"
      "now now now"
      "explore explore explore"
      "audio metrics progress"
      "tips tips tips";
  }
  .ml-pg__vcard { width: 160px; }
  .ml-pg__route { grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); align-items: start; }
}

@media (max-width: 759px) {
  .ml-pg__label-seg { margin-left: 0; width: 100%; }
  .ml-pg__label-seg .ml-seg { flex: 1; display: flex; }
  .ml-pg__label-seg .ml-seg__b { flex: 1; }
  .ml-pg__slot { flex-basis: calc(var(--beats, 4) * 9px + 34px); min-width: 64px; }
  .ml-pg__sym { font-size: 1.15rem; }
  .ml-pg__slot-btn { min-height: 76px; padding: 8px 4px; }
  /* One voicing per screen width: swipe to the next. */
  .ml-pg__cards--route .ml-pg__vcard { width: min(62vw, 220px); }
  .ml-pg__cards--route .ml-pg__vcard .ml-cd { max-width: 150px; }
  .ml-pg__cards--grid .ml-pg__vcard { width: calc(50% - 4px); }
  .ml-pg__route-nav { width: 100%; justify-content: space-between; }
  /* The five views share the row instead of scrolling it. */
  .ml-pg__tabs { flex-basis: 100%; }
  .ml-pg__tabs .ml-seg__b { flex: 1 1 auto; min-width: 0; padding: 8px 4px; font-size: 12.5px; }
  .ml-pg__now-actions { flex-direction: column; align-items: flex-start; }
  .ml-pg__neck .ml-fb { min-width: 560px; }
}

@media (prefers-reduced-motion: reduce) {
  .ml-pg__slot-btn { transition: none; }
  .ml-pg__slot.is-current .ml-pg__slot-btn { transform: none; }
}
