/* GuitarHelper — one dark theme. Tokens first, then shell, controls, shared blocks,
   then the fretboard and each section. */

:root {
  color-scheme: dark;
  --bg: #0a0c14;
  --bg-2: #0e1120;
  --card: #131729;
  --card-border: #242944;
  --line: #1d2238;
  --surface: #1a1f36;
  --surface-hover: #232946;
  --text: #eef0f8;
  --muted: #98a0c0;
  --faint: #6b7294;
  --accent: #4f8cff;
  --accent-hover: #3b78f0;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --good: #22c55e;
  --warn: #eab308;
  --bad: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);

  /* fretboard */
  --wood: #2a1d14;
  --fret: #b9b4a8;
  --string: #d8d2c4;
  --inlay: #5b4a3a;
  --dot-root: #ef4444;
  --dot-guide: #f59e0b;
  --dot-tone: #3b82f6;
  --dot-scale: #64748b;
  --dot-next: #22c55e;
  --dot-text: #ffffff;
  --pos0: #ef4444; --pos1: #f59e0b; --pos2: #22c55e; --pos3: #3b82f6; --pos4: #a855f7;
  --side-a: #3b82f6; --side-b: #f59e0b; --side-both: #e5e7eb;
  --colour-note: #f0abfc;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

/* Paint the background on <html> too, so short pages and overscroll never show the
   browser's own grey canvas below the content. */
html { background: var(--bg); min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 500px at 50% -200px, #141a33 0%, var(--bg) 70%) no-repeat, var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, select, input, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: #8cb4ff; }

/* ---------- Shell ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(10, 12, 20, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; letter-spacing: 0.01em; white-space: nowrap; cursor: pointer; background: none; border: 0; color: var(--text); padding: 12px 0; font-size: 1.02rem; }
.brand-mark { width: 26px; height: 26px; display: block; }
#tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
#tabs::-webkit-scrollbar { display: none; }
#tabs button {
  background: none; border: none; color: var(--muted); padding: 16px 12px 14px; cursor: pointer;
  font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap;
}
#tabs button[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
#tabs button:hover { color: var(--text); }
.subnav { max-width: 1180px; margin: 0 auto; padding: 8px 16px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); }
.subnav[hidden] { display: none; }
.subnav button { background: none; border: 1px solid transparent; color: var(--muted); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 0.88rem; font-weight: 600; white-space: nowrap; }
.subnav button:hover { color: var(--text); background: var(--surface); }
.subnav button[aria-current="page"] { color: var(--text); background: var(--accent-soft); border-color: rgba(79, 140, 255, 0.4); }

main { max-width: 1180px; width: 100%; margin: 0 auto; padding: 20px 16px 32px; flex: 1; }
.card { background: none; border: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.card > .modes { margin-bottom: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 4px 16px; margin-bottom: 2px; }
.card-head > h2, .card-head > p { flex-basis: 100%; }
.card-head h2 { margin: 0; font-size: 1.45rem; letter-spacing: -0.01em; }
.card-head p { margin: 2px 0 0; color: var(--muted); max-width: 70ch; }
.card-head .head-actions { display: flex; gap: 8px; align-items: center; }
h3 { font-size: 0.95rem; margin: 18px 0 8px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.85rem; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }

/* Blocks */
.surface { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }

/* Collapsible panel */
.panel { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 11px 16px; font-weight: 650; user-select: none; }
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform 0.15s; flex: none; margin-right: 2px; }
.panel[open] > summary::before { transform: rotate(45deg); }
.panel > summary:hover { color: #fff; }
.panel-badge { margin-left: auto; font-weight: 500; font-size: 0.85rem; color: var(--muted); text-align: right; }
.panel-badge.good { color: #86efac; }
.panel-badge.warn { color: #fde047; }
.panel-body { padding: 2px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.panels { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* Empty state */
.empty { text-align: center; padding: 28px 16px; }
.empty h3 { margin: 6px 0; font-size: 1.1rem; }
.empty p { margin: 0 auto 14px; color: var(--muted); max-width: 52ch; }
.empty .controls { justify-content: center; }

/* Two columns that stack on small screens */
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Controls ---------- */
.row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.toolbar + .toolbar { margin-top: 10px; }
.field { display: inline-flex; flex-direction: column; gap: 4px; font-size: 0.72rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.field > span:first-child { padding-left: 2px; }
.field.grow { flex: 1 1 220px; }
.field.grow select, .field.grow input { width: 100%; }
.label { font-size: 0.72rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 0.92rem; color: var(--text); }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
select, input[type="number"], input[type="text"], input[type="url"], textarea {
  background: var(--surface); color: var(--text); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 7px 10px; font-size: 0.92rem; min-height: 36px;
}
select { padding-right: 28px; }
select:hover, input:hover, textarea:hover { border-color: #33395c; }
textarea { width: 100%; resize: vertical; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; }
input.num { width: 5.2em; }
input[type="range"] { accent-color: var(--accent); }
input[type="file"] { color: var(--muted); font-size: 0.88rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--card-border);
  padding: 0 14px; min-height: 36px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.9rem; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-hover); border-color: #343a60; }
.btn:disabled { opacity: 0.6; color: var(--faint); cursor: default; }
.btn.primary:disabled { background: #2a3a66; border-color: #2a3a66; color: #a8b6d8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); background: var(--surface); }
.btn.on { border-color: var(--good); color: #bbf7d0; }
.btn.danger { border-color: rgba(239, 68, 68, 0.6); color: #fecaca; }
.btn.small { min-height: 30px; padding: 0 11px; font-size: 0.84rem; }
.btn.big { min-height: 44px; padding: 0 22px; font-size: 1rem; }
.btn.icon { width: 36px; padding: 0; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--card-border); border-radius: 10px; padding: 2px; gap: 2px; }
.seg-btn { background: none; color: var(--muted); border: none; padding: 5px 11px; cursor: pointer; font-size: 0.88rem; border-radius: 8px; font-weight: 600; white-space: nowrap; min-height: 30px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--accent); color: #fff; }
.seg-btn small { display: block; font-weight: 500; font-size: 0.7rem; opacity: 0.75; line-height: 1.1; }
.chips { gap: 6px; }
.chip { background: var(--surface); color: var(--text); border: 1px solid var(--card-border); border-radius: 999px; padding: 3px 11px; cursor: pointer; font-size: 0.85rem; }
.chip:hover { border-color: #3a4170; }
.chip.on { background: var(--dot-guide); border-color: var(--dot-guide); color: #111; font-weight: 600; }

/* Section mode tabs (inside a page) */
.modes { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.modes .mode { background: none; border: 1px solid transparent; color: var(--muted); border-radius: 10px; padding: 7px 13px; cursor: pointer; font-weight: 650; font-size: 0.93rem; }
.modes .mode:hover { color: var(--text); background: var(--surface); }
.modes .mode.on { color: var(--text); background: var(--card); border-color: var(--card-border); box-shadow: inset 0 -2px 0 var(--accent); }
.modes .sep { width: 1px; height: 22px; background: var(--card-border); margin: 0 6px; }

.msg { min-height: 1.4em; font-size: 0.92rem; color: var(--muted); }
.msg:empty { display: none; }
.msg[data-level="good"] { color: #86efac; }
.msg[data-level="bad"] { color: #fca5a5; }
.msg[data-level="warn"] { color: #fde047; }
.stats { font-size: 0.92rem; color: var(--muted); }
.info { font-size: 0.95rem; display: flex; flex-direction: column; gap: 6px; }
.info:empty { display: none; }
.hint { font-size: 0.86rem; color: var(--muted); }
.kbd { display: inline-block; border: 1px solid var(--card-border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 0.78rem; color: var(--text); background: var(--surface); font-family: ui-monospace, Consolas, monospace; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px; font-size: 0.8rem; font-weight: 600; background: var(--surface); color: var(--muted); border: 1px solid var(--card-border); }
.pill.good { color: #86efac; border-color: rgba(34, 197, 94, 0.4); background: rgba(34, 197, 94, 0.08); }
.pill.warn { color: #fde047; border-color: rgba(234, 179, 8, 0.4); background: rgba(234, 179, 8, 0.08); }

.big-prompt { font-size: 1.6rem; font-weight: 700; margin: 8px 0; }
.big-prompt .str { color: #7dd3fc; }
.big-prompt .note { color: #fcd34d; }
.small-prompt { font-size: 1.08rem; font-weight: 650; margin: 0; }

/* ---------- Board card (fretboard with caption) ---------- */
.board-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px 10px; }

.board-head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between; }
.board-title { font-weight: 700; font-size: 1.05rem; }
.board-sub { color: var(--muted); font-size: 0.9rem; }
.board-opts { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.board-opts select { min-height: 30px; padding: 3px 26px 3px 8px; font-size: 0.85rem; }
.board-foot { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.board-foot:empty { display: none; }

/* ---------- Fretboard ---------- */
.board-wrap { overflow-x: auto; margin: 6px 0; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #2b3152 transparent; }
.board-wrap::-webkit-scrollbar { height: 8px; }
.board-wrap::-webkit-scrollbar-thumb { background: #2b3152; border-radius: 4px; }
.board-wrap::-webkit-scrollbar-track { background: transparent; }
.fretboard { display: block; width: 100%; height: auto; user-select: none; }
.fb-wood { fill: var(--wood); }
.fb-window { fill: rgba(255, 255, 255, 0.07); }
.fb-fret { stroke: var(--fret); stroke-width: 2; }
.fb-nut { stroke: #eee; stroke-width: 6; }
.fb-string { stroke: var(--string); }
.fb-inlay { fill: var(--inlay); }
.fb-fretnum, .fb-strnum { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.fb-dot circle { stroke: rgba(0, 0, 0, 0.5); stroke-width: 1; }
.fb-dot text { fill: var(--dot-text); font-size: 10px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.fb-dot.clickable { cursor: pointer; }
.fb-dot.clickable:hover circle { stroke: #fff; stroke-width: 2; }
.kind-root circle { fill: var(--dot-root); }
.kind-guide circle { fill: var(--dot-guide); }
.kind-guide text { fill: #111; }
.kind-tone circle { fill: var(--dot-tone); }
.kind-scale circle { fill: var(--dot-scale); }
.kind-next circle { fill: var(--dot-next); }
.kind-hit circle { fill: var(--good); }
.kind-miss circle { fill: var(--bad); }
.kind-active circle { fill: #fff; }
.kind-played circle { fill: #e5e7eb; }
.kind-played text { fill: #111; }
.fb-dot.dim { opacity: 0.38; }
.fb-dot.ring circle { fill: none; stroke: var(--dot-next); stroke-width: 2.5; stroke-dasharray: 3 2; }
.kind-p0 circle { fill: var(--pos0); } .kind-p1 circle { fill: var(--pos1); } .kind-p2 circle { fill: var(--pos2); }
.kind-p3 circle { fill: var(--pos3); } .kind-p4 circle { fill: var(--pos4); }
.kind-p1 text, .kind-p2 text { fill: #111; }
.kind-shared circle { fill: var(--side-both); stroke: #111; }
.kind-shared text, .kind-both text { fill: #111; }
.kind-a circle { fill: var(--side-a); } .kind-b circle { fill: var(--side-b); } .kind-b text { fill: #111; }
.kind-both circle { fill: var(--side-both); }
.kind-picked circle { fill: #94a3b8; }
.kind-wrong circle { fill: var(--bad); }
.kind-missed circle { fill: none; stroke: var(--bad); stroke-width: 2.5; stroke-dasharray: 3 2; }
.kind-missed text { fill: #fca5a5; }
.kind-ask circle { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.kind-ask text { fill: #111; }
.fb-dot.mark-colour circle { stroke: var(--colour-note); stroke-width: 3; }
.fb-dot.mark-anchor circle { stroke: #fff; stroke-width: 2.5; }
.fb-dot.mark-now circle { stroke: #fff; stroke-width: 4; }
.fb-dot.mark-now { filter: drop-shadow(0 0 6px #fff); }
.fb-dot.mark-shared circle { stroke: #fff; stroke-width: 2; }
.fb-cell { fill: transparent; cursor: pointer; }
.fb-cell:hover { fill: rgba(255, 255, 255, 0.08); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.82rem; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.legend i.ring { background: none !important; border: 2px solid var(--colour-note); }

/* chord boxes */
.chordboxes { display: flex; flex-wrap: wrap; gap: 8px; }
.chordbox-btn { background: var(--surface); border: 1px solid var(--card-border); border-radius: 10px; padding: 6px; cursor: pointer; color: var(--text); text-align: center; }
.chordbox-btn:hover { border-color: #3a4170; }
.chordbox-btn.on { border-color: var(--dot-guide); box-shadow: 0 0 0 1px var(--dot-guide); }
.chordbox { width: 110px; height: auto; display: block; }
.cb-title { fill: var(--text); font-size: 10px; text-anchor: middle; font-weight: 700; }
.cb-line { stroke: var(--muted); stroke-width: 1; }
.cb-nut { stroke: var(--text); stroke-width: 4; }
.cb-base { fill: var(--muted); font-size: 9px; text-anchor: end; }
.cb-x { fill: var(--muted); font-size: 9px; text-anchor: middle; }
.cb-open { fill: none; stroke: var(--text); stroke-width: 1; }
.cb-dot { fill: var(--dot-tone); }
.cb-label { fill: #fff; font-size: 7px; font-weight: 700; text-anchor: middle; }

/* ---------- Diagrams ---------- */
.progress-grid { border-collapse: collapse; font-size: 0.88rem; width: 100%; }
.progress-grid th, .progress-grid td { padding: 5px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.progress-grid th { color: var(--faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 650; }
.progress-grid th:first-child, .progress-grid td:first-child { text-align: left; }
.progress-grid .group-row td { color: var(--faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 650; padding-top: 12px; border-bottom: 0; }
.progress-wrap { overflow-x: auto; }
.cell-btn { min-width: 2.8em; min-height: 28px; border-radius: 7px; border: 1px solid var(--card-border); background: var(--surface); color: var(--faint); cursor: pointer; padding: 2px 6px; }
.cell-btn:hover { border-color: var(--accent); color: var(--text); }
.cell-btn[data-level="1"] { background: #3f3a12; border-color: #5c5418; color: #fde047; }
.cell-btn[data-level="2"] { background: #14532d; border-color: #1d7040; color: #86efac; }
.meter-bar { height: 8px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.meter-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--good)); }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--card-border); border-radius: 10px; padding: 8px 14px; min-width: 110px; }
.stat b { display: block; font-size: 1.25rem; }
.stat span { color: var(--muted); font-size: 0.8rem; }
.answer-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.answer-btns .btn { min-width: 3.2em; }
.diff-list { margin: 0; padding-left: 1.2em; }
.quiz-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }

/* ---------- Tuner ---------- */
.tuner { text-align: center; margin: 10px 0; }
.tuner-note { font-size: 3.6rem; font-weight: 800; color: #fcd34d; line-height: 1.1; }
.tuner-cents { margin-top: 6px; font-size: 1rem; }
.meter { position: relative; height: 54px; margin: 16px auto 6px; max-width: 520px; border-radius: 8px; background: var(--surface); }
.meter-zone { position: absolute; left: 47%; width: 6%; top: 0; bottom: 0; background: rgba(34, 197, 94, 0.25); }
.meter .tick { position: absolute; bottom: 2px; transform: translateX(-50%); font-size: 0.7rem; color: var(--muted); }
.needle { position: absolute; left: 50%; top: 4px; bottom: 18px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--muted); transition: left 0.08s linear; }
.needle[data-state="good"] { background: var(--good); }
.needle[data-state="close"] { background: var(--warn); }
.needle[data-state="off"] { background: var(--bad); }

/* ---------- Metronome ---------- */
.beat-lights { display: flex; gap: 8px; margin: 8px 0; }
.beat { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 1px solid var(--card-border); }
.beat.accent { border-color: var(--warn); }
.beat.on { background: var(--accent); }
.beat.on.accent { background: var(--warn); }

/* ---------- Triads ---------- */
.seq { display: flex; gap: 8px; margin: 6px 0; }
.seq-note { min-width: 2.4em; text-align: center; padding: 4px 8px; border-radius: 8px; background: var(--surface); font-weight: 700; }
.seq-note.done { background: var(--good); color: #052e16; }

/* ---------- Chord charts (Changes, Play-along) ---------- */
.chart { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.chart-bar { position: relative; display: flex; gap: 6px; justify-content: space-around; padding: 10px 4px 8px; background: var(--surface); border-radius: 6px; border-left: 2px solid var(--card-border); cursor: default; }
.chart-bar.clickable { cursor: pointer; }
.chart-bar.clickable:hover { background: var(--surface-hover); }
.chart-bar.here { border-left-color: var(--accent); background: var(--surface-hover); }
.chart-bar.in-loop { box-shadow: inset 0 -2px 0 var(--warn); }
.chart-chord { font-weight: 700; padding: 0 4px; border-radius: 4px; }
.chart-chord.on { background: var(--accent); }
.bar-num { position: absolute; top: 1px; left: 5px; font-size: 0.65rem; color: var(--faint); }
.nowbar { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-end; }
.now-chord { font-size: 2.6rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }
.next-chord { font-size: 1.4rem; font-weight: 700; color: var(--muted); }
.scorebox { background: var(--surface); border-radius: 10px; padding: 10px 12px; }
.score-nums { display: flex; gap: 18px; flex-wrap: wrap; }
.score-nums b { font-size: 1.2rem; }
.feed { list-style: none; margin: 6px 0 0; padding: 0; font-size: 0.88rem; }
.feed li[data-level="good"] { color: #86efac; }
.feed li[data-level="bad"] { color: #fca5a5; }
.editor { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 10px 16px; }
.editor summary { cursor: pointer; font-weight: 650; }
.history table { border-collapse: collapse; font-size: 0.85rem; width: 100%; }
.history th, .history td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.transport { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }

/* ---------- Play-along ---------- */
.media { display: flex; flex-direction: column; gap: 8px; }
.media-audio { width: 100%; }
.media-video, .media-yt iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: 10px; background: #000; display: block; }
.media.small .media-video, .media.small .media-yt iframe { max-width: 360px; }
input.wide { flex: 1 1 300px; min-width: 0; }
.timecode { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.88rem; }
.big-tap { font-size: 1.1rem; padding: 12px 28px; }
.source-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.source-pick .surface { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 700px) { .source-pick { grid-template-columns: 1fr; } }
.progress-line { height: 4px; border-radius: 2px; background: var(--surface); overflow: hidden; }
.progress-line > i { display: block; height: 100%; width: 40%; background: var(--accent); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---------- Path ---------- */
.path { padding-left: 0; list-style: none; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.stage { padding: 0; border: 1px solid var(--card-border); border-radius: var(--radius); background: var(--card); }
.stage > summary { list-style: none; cursor: pointer; display: flex; gap: 10px; align-items: center; padding: 12px 16px; }
.stage > summary::-webkit-details-marker { display: none; }
.stage .stage-body { padding: 0 16px 14px 48px; }
.stage.done > summary { opacity: 0.6; }
.stage.current { border-color: var(--accent); }
.stage p { margin: 6px 0; }
.stage-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--muted); font-size: 0.8rem; font-weight: 700; flex: none; }
.stage.done .stage-num { background: var(--good); color: #052e16; }
.stage.current .stage-num { background: var(--accent); color: #fff; }
.stage-title { font-weight: 650; }
.stage-head { display: flex; gap: 10px; align-items: center; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 0.75rem; font-weight: 700; }

/* ---------- Setup ---------- */
.level { position: relative; height: 18px; background: var(--surface); border-radius: 9px; overflow: hidden; margin: 10px 0; max-width: 520px; }
.level-fill { height: 100%; width: 0; background: var(--muted); transition: width 0.05s linear; }
.level[data-over="yes"] .level-fill { background: var(--good); }
.level-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--warn); }

@media (max-width: 600px) {
  main { padding: 14px 12px 40px; }
  .top-inner { gap: 10px; padding: 0 12px; }
  .brand-name { display: none; }
  #tabs button { padding: 14px 9px 12px; font-size: 0.92rem; }
  .card-head h2 { font-size: 1.25rem; }
  .chart { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .now-chord { font-size: 2.1rem; }
  .surface, .board-card { padding: 12px; }
  .panel > summary { padding: 11px 12px; }
  .panel-body { padding: 2px 12px 12px; }
  .stage .stage-body { padding: 0 12px 12px 12px; }
}

/* Phone fixes: controls never overflow; nav and mode tabs scroll instead of wrapping. */
.field { min-width: 0; max-width: 100%; }
.field select, .field input { max-width: 100%; }
.nav-short { display: none; }
@media (max-width: 600px) {
  .nav-long { display: none; }
  .nav-short { display: inline; }
  .modes { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -12px; margin-right: -12px; padding: 0 12px; }
  .modes::-webkit-scrollbar { display: none; }
  .modes .mode { white-space: nowrap; padding: 7px 11px; }
  .card-head p { font-size: 0.9rem; }
}
.tool-body { gap: 12px; }
.panels:empty, .stack:empty, .info:empty { display: none; }

.board-card .stat-row { margin-top: 6px; }
/* A soft fade on the right edge says "this row scrolls" on phones. */
@media (max-width: 600px) {
  .modes, #tabs, .subnav { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
