/* ===========================================================================
   Setlist Trainer — «Memoriza tu repertorio» (/setlist).
   Built on the Quiz's pieces (practice-quiz.css: cards, the question bar,
   the options, feedback, stats) and the Music Lab tokens. Nothing here
   defines a colour of its own. Mobile first; targets ≥ 44px.
   =========================================================================== */

.ml-st__eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ml-dim); }
.ml-st__private {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--ml-line); background: var(--ml-surface-2); color: var(--ml-muted);
}

/* ── The gate ────────────────────────────────────────────────────────── */

.ml-st__gate-card { max-width: 560px; }
.ml-st__gate-card h2 { font-size: 1.25rem; }
.ml-st__gate-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.ml-st__gate-actions .ml-btn { min-height: 44px; }

/* ── Setup ───────────────────────────────────────────────────────────── */

.ml-st__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ml-st__stat {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 14px 8px;
  border-radius: 14px; background: var(--ml-surface-2); border: 1px solid var(--ml-line); min-width: 0;
}
.ml-st__stat strong { font-family: "Space Grotesk", sans-serif; font-size: 1.7rem; line-height: 1; }
.ml-st__stat small { font-size: 13px; font-weight: 600; color: var(--ml-text); }
.ml-st__stat span { font-size: 12px; color: var(--ml-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.ml-st-pick {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 48px;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--ml-line); background: var(--ml-surface-2); color: var(--ml-text);
  font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.ml-st-pick:hover, .ml-st-pick[aria-expanded="true"] { border-color: color-mix(in srgb, var(--ml-pink) 50%, transparent); }
.ml-st-pick__value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-st-pick svg { flex: none; color: var(--ml-muted); }

/* The songs popover: under the field on a wide screen, a bottom sheet on a phone. */
.ml-st-pop {
  position: fixed; z-index: 1200; display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100vw - 24px)); max-height: min(70vh, 560px);
  padding: 12px 14px; border-radius: 16px; border: 1px solid var(--ml-line); background: var(--ml-surface); box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.ml-st-pop[hidden] { display: none; }
.ml-st-pop.is-sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: min(82vh, 640px); border-radius: 18px 18px 0 0; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.ml-st-pop__backdrop { position: fixed; inset: 0; z-index: 1190; background: rgba(0, 0, 0, .45); }
.ml-st-pop__backdrop[hidden] { display: none; }
.ml-st-pop__head { display: flex; gap: 8px; align-items: center; }
.ml-st-pop__head .ml-input { flex: 1; min-width: 0; }
.ml-st-pop__tools { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.ml-st-pop__list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 4px; -webkit-overflow-scrolling: touch; }
.ml-st-pop__item { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.ml-st-pop__item:hover { background: var(--ml-surface-2); }
.ml-st-pop__item.is-off { opacity: .55; }
.ml-st-pop__item input { width: 20px; height: 20px; accent-color: var(--ml-pink); flex: none; }
.ml-st-pop__item[hidden] { display: none; }
.ml-st-pop__txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ml-st-pop__txt strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-st-pop__txt small { font-size: 12px; color: var(--ml-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-st-pop__badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--ml-line); color: var(--ml-dim); white-space: nowrap; }
.ml-st-pop__badge.is-ok { color: var(--ml-emerald); border-color: color-mix(in srgb, var(--ml-emerald) 45%, transparent); }
.ml-st-pop__badge.is-warn { color: var(--ml-amber); border-color: color-mix(in srgb, var(--ml-amber) 45%, transparent); }
.ml-st-pop__star {
  appearance: none; border: 0; background: none; cursor: pointer; width: 36px; height: 36px; border-radius: 10px; color: var(--ml-dim); font-size: 18px; line-height: 1; flex: none;
}
.ml-st-pop__star.is-on { color: var(--ml-amber); }
.ml-st-pop__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 6px; border-top: 1px solid var(--ml-line); }

/* ── Mastery and the review list ─────────────────────────────────────── */

.ml-st-mastery { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ml-st-mastery__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--ml-surface-2); }
.ml-st-mastery__row strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-st-mastery__row small { font-size: 12px; color: var(--ml-muted); }
.ml-st-mastery__pct { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.ml-st-mastery__bar { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: var(--ml-surface); overflow: hidden; }
.ml-st-mastery__bar span { display: block; height: 100%; width: calc(var(--p, 0) * 1%); border-radius: inherit; background: var(--ml-dim); }
.ml-st-mastery__row.is-dominada .ml-st-mastery__bar span, .ml-st-mastery__row.is-dominada .ml-st-mastery__pct { background: var(--ml-emerald); }
.ml-st-mastery__row.is-dominada .ml-st-mastery__pct { background: none; color: var(--ml-emerald); }
.ml-st-mastery__row.is-en-progreso .ml-st-mastery__bar span { background: var(--ml-amber); }
.ml-st-mastery__row.is-necesita-practica .ml-st-mastery__bar span { background: var(--ml-rose); }
.ml-st-mastery__act { grid-column: 1 / -1; display: flex; gap: 10px; }
.ml-st__mastery-def { margin-top: 10px; font-size: 12px; }

.ml-st-due { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ml-st-due li { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13.5px; padding: 8px 10px; border-radius: 10px; background: var(--ml-surface-2); }
.ml-st-due li small { color: var(--ml-rose); white-space: nowrap; }

.ml-st-recent { width: 100%; border-collapse: collapse; font-size: 13px; }
.ml-st-recent th, .ml-st-recent td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--ml-line); white-space: nowrap; }
.ml-st-recent th { color: var(--ml-dim); font-weight: 600; font-size: 11.5px; }
.ml-st-recent__wrap { overflow: auto; }

/* ── Playing ─────────────────────────────────────────────────────────── */

.ml-st__bar { grid-template-columns: 1fr auto auto auto auto; grid-template-areas: "count timer focus pause quit" "progress progress progress progress progress"; }
#ml-st-focus { grid-area: focus; }
#ml-st-pause { grid-area: pause; }
#ml-st-quit { grid-area: quit; }
#ml-st-focus[aria-pressed="true"] { background: var(--ml-grad); color: #fff; border-color: transparent; }

.ml-st__stage { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.ml-st__where { margin: 0; font-size: 13px; color: var(--ml-muted); text-align: center; }
.ml-st__where strong { color: var(--ml-text); }
.ml-st__ctx { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; min-height: 48px; }
.ml-st__ctx[hidden] { display: none; }
.ml-st-tok {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 58px; min-height: 58px; padding: 6px 12px;
  border-radius: 14px; border: 1px solid var(--ml-line); background: var(--ml-surface-2); font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.3rem;
}
.ml-st-tok small { font-family: Inter, sans-serif; font-weight: 500; font-size: 11px; color: var(--ml-muted); }
.ml-st-tok--gap { border-style: dashed; color: var(--ml-dim); border-color: color-mix(in srgb, var(--ml-pink) 55%, transparent); }
.ml-st-tok.is-root { border-color: color-mix(in srgb, var(--root, var(--ml-pink)) 60%, transparent); background: color-mix(in srgb, var(--root, var(--ml-pink)) 14%, var(--ml-surface-2)); }
.ml-st__ctx-arrow { color: var(--ml-dim); font-size: 1.2rem; }
.ml-st__listen { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ml-st__listen[hidden] { display: none; }

/* Chord options: the chord name big, the quality under it. */
.ml-st__options { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.ml-st__options--n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ml-st__options--n3, .ml-st__options--n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ml-st__options--n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ml-st__options--n5 { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.ml-st__options .ml-qz-opt { min-height: 64px; }
.ml-st__options--text .ml-qz-opt__main { font-size: 1.05rem; }
.ml-st__options.is-revealed .ml-qz-opt.is-correct .ml-qz-opt__main { color: var(--ml-emerald); }

/* The instrument aid: diagram and tones. */
.ml-st__aid { display: flex; flex-direction: column; gap: 10px; }
.ml-st__aid[hidden] { display: none; }
.ml-st__aid-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ml-st__aid-head h3 { margin: 0; font-size: 1rem; }
.ml-st__aid-body { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; justify-content: center; }
.ml-st__aid-body .ml-cd { width: 120px; height: auto; }
.ml-st__aid-body .ml-kb { width: 100%; max-width: 420px; height: auto; }
.ml-st__aid-body .ml-fb { width: 100%; max-width: 480px; height: auto; }
.ml-st__aid-shape { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--ml-muted); }
.ml-st__tones { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ml-st__tone { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--ml-line); font-size: 13px; }
.ml-st__tone b { font-family: "Space Grotesk", sans-serif; }
.ml-st__tone i { font-style: normal; color: var(--ml-dim); font-size: 11.5px; }
.ml-st__structure { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ml-st__structure span { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--ml-line); font-size: 13px; }
.ml-st__structure span.is-now { border-color: var(--ml-pink); color: var(--ml-pink); font-weight: 600; }

.ml-st__feedback { display: flex; flex-direction: column; gap: 8px; }
.ml-st__feedback p { margin: 0; }
.ml-st__feedback-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ml-st__feedback .ml-st__ctx { justify-content: flex-start; min-height: 0; }
.ml-st__feedback .ml-st-tok { min-width: 46px; min-height: 46px; font-size: 1.05rem; padding: 4px 10px; }

.ml-st-songs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.ml-st-songs li { display: flex; justify-content: space-between; gap: 8px; }
.ml-st-songs li span { color: var(--ml-muted); white-space: nowrap; }

/* ── Results ─────────────────────────────────────────────────────────── */

.ml-st-res__table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ml-st-res__table th, .ml-st-res__table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--ml-line); }
.ml-st-res__table th { color: var(--ml-dim); font-weight: 600; font-size: 12px; }
.ml-st-res__table td.is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ml-st-res__table tr.is-section td:first-child { padding-left: 22px; color: var(--ml-muted); }
.ml-st-res__table .ml-btn { min-height: 32px; padding: 4px 10px; font-size: 12.5px; }
.ml-st-res__wrap { overflow: auto; }
.ml-st-res__recs { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--ml-muted); font-size: 14px; }
.ml-st-res__recs strong { color: var(--ml-text); }
.ml-st-res__mistakes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ml-st-res__mistake { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--ml-surface-2); font-size: 14px; }
.ml-st-res__mistake small { color: var(--ml-muted); }
.ml-st-res__mistake .ml-st-res__links { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; }

.ml-qz-rev__ctx { margin: 6px 0 2px; }
.ml-qz-rev__item .ml-st__aid-body { margin-top: 6px; }

/* ── Focus mode ──────────────────────────────────────────────────────── */

.ml-setlist-focus .ml-nav, .ml-setlist-focus .ml-footer, .ml-setlist-focus .mlb,
.ml-setlist-focus .ml-qz__head, .ml-setlist-focus .ml-qz__side--play { display: none !important; }
.ml-setlist-focus .ml-st__bar { top: 0; }
.ml-setlist-focus .ml-qz { padding-top: 12px; }

/* ── Breakpoints ─────────────────────────────────────────────────────── */

@media (max-width: 520px) {
  /* The count on its own line; the clock and the buttons under it. */
  .ml-st__bar { grid-template-columns: 1fr auto auto auto; grid-template-areas: "count count count count" "timer focus pause quit" "progress progress progress progress"; }
  .ml-st__bar .ml-qz__count strong { font-size: 1rem; }
  .ml-st__bar .ml-qz__kind { display: inline-block; }
  .ml-st__stats { gap: 6px; }
  .ml-st__stat { padding: 10px 4px; }
  .ml-st__stat strong { font-size: 1.4rem; }
  .ml-st__stat span { display: none; }
  .ml-st-tok { min-width: 50px; min-height: 50px; font-size: 1.1rem; padding: 4px 8px; }
  .ml-st__options--n3, .ml-st__options--n6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 760px) {
  .ml-st__bar { grid-template-columns: auto minmax(120px, 1fr) auto auto auto auto; grid-template-areas: "count progress timer focus pause quit"; }
  .ml-st__options--n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ml-st__options--n5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ml-st__options--n6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (min-width: 1000px) {
  .ml-st__setup { grid-template-columns: minmax(0, 1fr) 360px; }
}
