:root {
  --canvas: #f4e4b7;
  --surface: #fff4d6;
  --paper: #fffbe9;
  --sage: #b9d79f;
  --sage-light: #e7f0d9;
  --peach: #f5bf92;
  --rose: #d96b78; /* shadows and decoration only: 3.0:1 on surface */
  --rose-strong: #a8414f; /* fills under surface text (5.4:1) and rose text on surface/paper/canvas */
  --rose-deep: #8e3442; /* rose text on sage or peach (4.9:1 on sage) */
  --ink: #28433a;
  --ink-soft: #3d5a4c;
  --muted: #566955; /* ≥4.5:1 on surface, paper, canvas and sage-light */
  --line: #9db591;
  --shadow: #365247;
  /* Type scale. 12px is only for uppercase labels; Jersey never goes below 16px. */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 20px;
  /* Spacing rhythm */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  /* Controls: one family, two sizes. Small = chips, segmented, small buttons; medium = Hear it, Random. */
  --border: 2px;
  --border-thick: 3px;
  --control-sm: 36px;
  --control-md: 44px;
  --press: translate(2px, 2px);
  --press-ms: 120ms;
  --radius: 14px;
  --radius-small: 9px;
  --font-display: "Jersey 10", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
body { margin: 0; background-color: var(--canvas); background-image: linear-gradient(rgba(40,67,58,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(40,67,58,.08) 1px, transparent 1px); background-size: 16px 16px; color: var(--ink); font-family: var(--font-body); font-size: var(--text-md); line-height: 1.5; font-weight: 600; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
/* Controls fire on tap without the double-tap-zoom wait, and a long press doesn't select their labels. */
button, a, select, label, summary { touch-action: manipulation; }
button { -webkit-user-select: none; user-select: none; }
html { scroll-padding-top: 88px; } /* keeps focused/scrolled-to content clear of the sticky top bar */
/* One focus ring everywhere: ink is ≥6.5:1 against every surface it can sit on (the rose ring was 2.1–2.6:1). */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }
h1, h2, p { margin-top: 0; }
kbd { border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px; color: var(--muted); font: 600 var(--text-xs) var(--font-body); white-space: nowrap; }
/* viewport-fit=cover paints edge to edge; content keeps clear of notches and rounded corners. */
.topbar, main, footer { --gutter: 48px; width: min(1080px, calc(100% - var(--gutter) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px))); margin: 0 auto; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 4; min-height: 68px; padding-top: env(safe-area-inset-top, 0px); display: flex; align-items: center; gap: 28px; border-bottom: 3px solid var(--ink); background: var(--canvas); }
.brand { display: flex; align-items: center; gap: 2px; color: var(--ink); font: 400 26px/1 var(--font-display); letter-spacing: .3px; text-decoration: none; }
.brand-name { display: flex; gap: 2px; } /* keeps the 2px between "chord" and "byte" */
.brand-accent { color: var(--rose); }
.brand-mark { width: 34px; height: 34px; margin-right: 8px; } /* the chord-box logo, shadow included */
.tabs { display: flex; gap: 6px; }
.tabs a { padding: 7px 12px; border: 2px solid transparent; border-radius: var(--radius-small); color: var(--ink-soft); font: 400 18px var(--font-display); text-decoration: none; }
.tabs a.active { border-color: var(--ink); }
.text-button { --shadow-color: var(--rose); margin-left: auto; padding: 8px 11px; color: var(--surface); background: var(--ink); font: 400 var(--text-md) var(--font-display); }
.text-button span[aria-hidden] { color: var(--sage); }
/* Guide and Left-handed sit in the top bar beside Random, so they're one tap away on every screen. */
.topbar .guide-link, .topbar .lefty-toggle { flex: none; min-height: var(--control-md); white-space: nowrap; }
.topbar .guide-link { display: inline-flex; align-items: center; margin-left: auto; text-decoration: none; }
.topbar .guide-link > span:first-child { font-size: 20px; line-height: 1; }
.topbar .guide-link.active { --shadow-color: var(--rose); color: var(--surface); background: var(--ink); }
.topbar .text-button { margin-left: 0; }
.lefty-toggle.active { --shadow-color: var(--rose); color: var(--surface); background: var(--ink); }

/* Intro line */
/* Headings take focus only so screen readers announce a view switch; they aren't controls, so no ring (Safari draws one). */
.intro h1:focus, .intro h1:focus-visible { outline: none; }
.intro { margin: 26px 0 20px; color: var(--ink-soft); font-size: var(--text-md); line-height: 1.55; }
.intro h1 { margin: 0 0 4px; color: var(--ink); font: 400 clamp(30px, 3.4vw, 40px)/1.05 var(--font-display); letter-spacing: .3px; }

/* Shared panel pieces */
.panel { border: 3px solid var(--ink); border-radius: var(--radius); padding: var(--s5); background: var(--surface); box-shadow: 7px 7px 0 var(--shadow); }
.eyebrow { color: var(--ink-soft); font: 700 var(--text-xs) var(--font-body); letter-spacing: .6px; text-transform: uppercase; margin: 0 0 10px; }
/* Every pressable shares one shape: ink border, hard offset shadow, lift on hover, sink on press. */
.chip, .small-button, .sound-button, .text-button {
  --depth: 3px;
  --shadow-color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--control-sm); border: var(--border) solid var(--ink); border-radius: var(--radius-small);
  box-shadow: var(--depth) var(--depth) 0 var(--shadow-color);
  transition: transform var(--press-ms) var(--ease-out), box-shadow var(--press-ms) var(--ease-out), background-color var(--press-ms) ease, color var(--press-ms) ease;
}
.sound-button, .text-button { --depth: 4px; min-height: var(--control-md); border-width: var(--border-thick); }
.chip { padding: 0 10px; color: var(--ink); background: var(--paper); font: 400 18px var(--font-display); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row.roots { display: grid; grid-template-columns: repeat(6, 1fr); }
.chip-row.roots .chip { padding: 0; }
#popularChips .chip:not(.active) { background: var(--sage); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border: var(--border) solid var(--ink); border-radius: var(--radius-small); background: var(--paper); }
.segmented button { min-height: 32px; border: 0; border-radius: 6px; padding: 6px 10px; background: transparent; color: var(--ink-soft); font: 400 18px var(--font-display); transition: transform var(--press-ms) var(--ease-out), box-shadow var(--press-ms) var(--ease-out), background-color var(--press-ms) ease, color var(--press-ms) ease; }
.segmented.small button { padding: 4px 10px; font-size: var(--text-md); }
.small-button { padding: 6px 12px; color: var(--ink); background: var(--paper); font: 400 var(--text-md) var(--font-display); }
.sound-button { padding: 8px 12px 8px 8px; color: var(--surface); background: var(--rose-strong); font: 400 19px var(--font-display); }
.sound-button span:first-child { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--ink); background: var(--surface); font-size: 12px; }
.sound-button:disabled { --depth: 2px; opacity: .45; cursor: not-allowed; }
.small-link { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 4px; margin: -2px -4px; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 800; letter-spacing: .4px; text-transform: uppercase; }

/* Selected looks the same everywhere: ink fill, surface text, rose offset shadow. Rose fill is only for the primary action. */
.chip.active, .segmented button.active, .tabs a.active { --shadow-color: var(--rose); color: var(--surface); background: var(--ink); }
.segmented button.active { box-shadow: 2px 2px 0 var(--rose); }
.tabs a.active { box-shadow: 3px 3px 0 var(--rose); }

@media (hover: hover) and (pointer: fine) {
  .chip:hover, .small-button:hover, .sound-button:not(:disabled):hover, .text-button:hover { transform: translate(-1px, -1px); box-shadow: calc(var(--depth) + 1px) calc(var(--depth) + 1px) 0 var(--shadow-color); }
  .chip:not(.active):hover { background: #f1f7e6; }
  .segmented button:not(.active):hover { color: var(--ink); background: var(--sage-light); }
  .tabs a:not(.active):hover, .small-link:hover { color: var(--rose-strong); }
}
/* One press rule: everything sinks into its shadow. */
.chip:active, .small-button:active, .sound-button:not(:disabled):active, .text-button:active, .segmented button:active { transform: var(--press); box-shadow: 0 0 0 transparent; }
@media (pointer: coarse) {
  .chip, .small-button, .segmented button { min-height: var(--control-md); }
}

/* Chords view */
.workspace { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); gap: 20px; align-items: start; margin-bottom: 40px; }
.finder { position: sticky; top: 88px; max-height: calc(100dvh - 108px); overflow-y: auto; overscroll-behavior: contain; }
.finder-block { padding-top: var(--s4); margin-top: var(--s4); border-top: 2px dashed var(--line); }
.finder-block h2 { margin: 0 0 var(--s2); color: var(--muted); font: 700 var(--text-xs) var(--font-body); letter-spacing: .5px; text-transform: uppercase; }
.chip-group + .chip-group { margin-top: var(--s3); }
.chip-group > span { display: block; margin-bottom: var(--s1); color: var(--ink-soft); font-size: var(--text-sm); }
.chip-group > div { display: flex; flex-wrap: wrap; gap: 6px; }
.search-wrap { position: relative; }
.search-box { display: flex; align-items: center; gap: 9px; padding: 10px; border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--paper); color: var(--muted); }
.search-box:focus-within { outline: 3px solid var(--ink); outline-offset: 3px; }
.search-icon { color: var(--rose); font: 400 24px/1 var(--font-display); }
@media (hover: none) { .search-box kbd, .kbd-hint { display: none; } }
.search-box input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--ink); background: none; font: 600 var(--text-md) var(--font-body); } /* ≥16px or iOS zooms on focus */
.search-box input::placeholder { color: var(--muted); opacity: 1; }
.suggestions { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none; border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--paper); box-shadow: 4px 4px 0 var(--ink); }
.suggestions { max-height: min(60vh, 360px); overflow-y: auto; overscroll-behavior: contain; }
.suggestions [role=option] { display: flex; justify-content: space-between; align-items: baseline; min-height: 40px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font: 400 20px var(--font-display); }
.suggestions [role=option] span { color: var(--muted); font: 700 var(--text-xs) var(--font-body); text-transform: uppercase; }
.suggestions [role=option].active { background: var(--sage-light); box-shadow: inset 3px 0 0 var(--ink); }
@media (hover: hover) and (pointer: fine) { .suggestions [role=option]:hover { background: var(--sage-light); } }
.search-empty { padding: 10px 12px; color: var(--ink-soft); font-size: var(--text-sm); }

/* A grid so the sound controls can sit top-right on desktop and under the diagram on phones. */
.shape-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 14px; border: 3px solid var(--ink); border-radius: var(--radius); padding: var(--s5); background: var(--sage); box-shadow: 7px 7px 0 var(--rose); }
.shape-card > * { grid-column: 1 / -1; }
.shape-card > .shape-card-head { grid-column: 1; }
.shape-card > .sound-controls { grid-column: 2; grid-row: 1; align-self: start; }
.chord-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.shape-card h2 { color: var(--ink); font: 400 80px/.85 var(--font-display); letter-spacing: .3px; margin: 0; }
.position-badge { padding: 5px 7px; border: 2px solid var(--ink); border-radius: var(--radius-small); color: var(--ink); background: var(--peach); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.chord-tones { display: flex; align-items: baseline; gap: 8px; margin: 12px 0 0; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; }
.chord-tones strong { color: var(--ink); font: 800 var(--text-md) var(--font-body); letter-spacing: .3px; text-transform: none; }
.sound-controls { display: grid; gap: 8px; justify-items: stretch; }
.voicing-picker { margin-top: var(--s5); }
.seg-level { white-space: nowrap; }
/* Swiping sideways on the diagram switches shape; vertical pans still scroll the page. */
.diagram-stage { display: grid; margin-top: var(--s3); padding: var(--s4) var(--s2); touch-action: pan-y; border: 3px solid var(--ink); border-radius: var(--radius-small); background: var(--surface); }
.diagram-canvas { display: grid; place-items: center; }
.diagram { width: min(100%, 300px); overflow: visible; }
/* Diagram colours and type: the SVG has no styles of its own, so themes (or a left-handed mirror) only touch CSS. */
.diagram .board { fill: var(--sage-light); stroke: var(--ink); stroke-width: 2; }
.diagram .string { fill: none; stroke: #54705b; stroke-width: 2; transition: stroke 240ms ease; }
.diagram .string.ringing { stroke: var(--rose); }
.diagram .fret { stroke: #6f8a6b; stroke-width: 2; } /* 3.2:1 on the board */
.diagram .nut { stroke: var(--ink); stroke-width: 5; }
.diagram .muted-mark { fill: var(--ink-soft); font: 700 20px var(--font-body); }
.diagram .open-mark { fill: var(--peach); }
.diagram .open-mark-edge { fill: var(--ink); }
.diagram .dot-halo { fill: var(--ink); }
.diagram .dot { fill: var(--rose-strong); }
.diagram .finger { fill: var(--surface); font: 800 12px var(--font-body); }
.diagram .base-label { fill: var(--ink); font: 800 13px var(--font-body); }
.diagram .note-name { fill: var(--ink); font: 800 16px var(--font-body); }
.diagram .note-name.root { fill: var(--rose-deep); }
.diagram .note-name.muted { fill: var(--muted); }
.diagram .string-name { fill: var(--muted); font: 700 11px var(--font-body); }
/* A finger that stays down through a change: a peach dot in the same ink outline. */
.diagram .mark.anchor .dot { fill: var(--peach); }
.diagram.compact .base-label { font-size: 20px; }
.diagram.compact .muted-mark { font-size: 26px; }
/* New chord: finger marks settle in, low string first, so the eye follows the shape forming. */
.diagram.enter .mark { transform-box: fill-box; transform-origin: center; animation: mark-in 140ms var(--ease-out) both; animation-delay: calc(var(--order, 0) * 14ms); }
@keyframes mark-in { from { opacity: 0; transform: scale(.7); } }
.shape-info { margin-top: var(--s3); padding: var(--s3); display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--surface); }
.shape-info div { padding-left: var(--s3); border-left: 2px solid var(--line); min-width: 0; }
.shape-info div:first-child { padding-left: 0; border: 0; }
.shape-info span { display: block; color: var(--muted); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; margin-bottom: 2px; }
.shape-info strong { display: block; color: var(--ink); font: 400 22px/1.1 var(--font-display); letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tip { color: var(--ink-soft); font-size: var(--text-md); line-height: 1.55; margin: var(--s4) 0 0; }
.tip::before { content: "TIP > "; color: var(--rose-deep); font-weight: 700; }
.hint { margin: 10px 0 0; color: var(--ink-soft); font-size: var(--text-sm); }
.hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .hint-keys { display: none; } .hint-touch { display: inline; } }

/* Practice view */
.practice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 40px; }
.practice-panel.four { grid-column: 1 / -1; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding-bottom: var(--s3); border-bottom: 2px dashed var(--line); }
.panel-head > div:first-child { display: flex; align-items: baseline; gap: 10px; }
.panel-head > div:first-child > span { color: var(--rose-strong); font-size: var(--text-xs); font-weight: 800; }
.panel-head h2 { margin: 0; white-space: nowrap; font: 400 26px/1 var(--font-display); letter-spacing: .3px; }
.panel-note { margin: var(--s3) 0 var(--s4); color: var(--ink-soft); font-size: var(--text-md); line-height: 1.55; }
.set-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s4); }
.head-actions { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }
.set-controls { display: flex; flex-wrap: wrap; gap: var(--s2); }
.beat-dots.mini { gap: 6px; margin: 0 var(--s1) 0 0; }
.beat-dots.mini span { width: 12px; height: 12px; }
.set-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.copy-link { min-height: 30px; padding: 2px 10px; font-size: var(--text-sm); }
.set-name { margin: 0; color: var(--ink-soft); font: 400 var(--text-lg)/1.2 var(--font-display); letter-spacing: .3px; }
.set-name strong { color: var(--ink); font-weight: 400; }
.set-name .numerals { color: var(--rose-strong); }
.practice-chords { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
.practice-chord { position: relative; display: grid; gap: var(--s2); padding: var(--s3); cursor: pointer; border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--paper); outline: 3px dashed transparent; outline-offset: 3px; transition: background-color 120ms ease, box-shadow 120ms ease, transform 120ms var(--ease-out), outline-color 120ms ease; }
.practice-chord .sound-button { --depth: 3px; padding: 6px 10px 6px 6px; font-size: var(--text-md); }
.practice-chord.active { background: #ffe6c7; box-shadow: inset 0 -4px 0 var(--rose), 4px 4px 0 var(--ink); transform: translate(-2px, -2px); }
/* Play along: the chord coming up after this beat. */
.practice-chord.next { outline-color: var(--rose-strong); }
.mini-diagram { position: relative; }
.change-hint { margin: 0; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.4; }
.change-hint b, .change-tip b { color: var(--ink); font-weight: 800; }
.change-tip { margin: var(--s3) 0 0; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.45; text-align: center; }
.anchor-key { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; border: 2px solid var(--ink); border-radius: 50%; background: var(--peach); }
.count-in { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 64px; height: 64px; margin: -32px 0 0 -32px; border: 3px solid var(--ink); border-radius: var(--radius-small); color: var(--surface); background: var(--ink); box-shadow: 4px 4px 0 var(--rose); font: 400 48px/1 var(--font-display); pointer-events: none; }
.practice-chord header { display: flex; align-items: baseline; gap: 8px; }
.practice-chord header .numeral { color: var(--rose-strong); font: 400 var(--text-lg)/1 var(--font-display); }
.practice-chord header strong { font: 400 30px/1 var(--font-display); letter-spacing: .3px; }
.mini-diagram { display: grid; justify-items: center; }
.mini-diagram .diagram { width: min(100%, 150px); }
.practice-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.practice-actions > * { white-space: nowrap; }
.drill-select { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.drill-select label { display: grid; gap: 6px; color: var(--muted); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; }
.drill-select select { width: 100%; min-height: 38px; appearance: none; border: 2px solid var(--ink); border-radius: var(--radius-small); padding: 0 27px 0 10px; background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%2328433a' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 9px center; font: 400 18px var(--font-display); }
.drill-pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s2); margin-top: var(--s3); }
.drill-pair .mini-diagram .diagram { width: min(100%, 110px); }
.drill-pair strong { font: 400 20px var(--font-display); }
.drill-swap { color: var(--rose); font: 400 28px var(--font-display); }
.drill-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: var(--s3); border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--sage-light); }
.drill-stats div { padding: var(--s3); text-align: center; }
.drill-stats div + div { border-left: 2px solid var(--line); }
.drill-stats span { display: block; color: var(--muted); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; }
.drill-stats strong { display: inline-block; font: 400 42px/1.1 var(--font-display); }
.drill-progress { height: 10px; margin-top: var(--s3); overflow: hidden; border: 2px solid var(--ink); border-radius: 5px; background: var(--paper); }
.drill-progress span { display: block; height: 100%; background: var(--rose); transform-origin: left; transition: transform 200ms linear; }
.drill-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s3); padding: var(--s3); border: 2px dashed var(--rose); border-radius: var(--radius-small); background: #fff0e6; }
.drill-confirm label { flex: 1 0 100%; color: var(--ink); font: 400 var(--text-lg) var(--font-display); }
.stepper { display: flex; align-items: stretch; gap: var(--s1); }
.stepper .small-button { width: var(--control-sm); padding: 0; font-size: var(--text-lg); }
.stepper input { width: 72px; min-height: var(--control-sm); border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--paper); text-align: center; font: 400 26px/1 var(--font-display); -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.confirm-actions { display: flex; align-items: center; gap: var(--s3); margin-left: auto; white-space: nowrap; }
.confirm-actions .sound-button { padding: 8px 16px; }
#drillTap { touch-action: manipulation; } /* rapid taps must never wait for a double-tap zoom */
.drill-actions { display: grid; grid-template-columns: auto 1fr; gap: var(--s3); margin-top: var(--s3); }
.drill-history { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.drill-history li { display: flex; gap: 6px; align-items: baseline; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: var(--text-sm); color: var(--muted); }
.drill-history li strong { color: var(--ink); font: 400 var(--text-lg) var(--font-display); }
.drill-history li.empty { border: 0; padding: 0; }
.bpm { display: flex; align-items: baseline; gap: 8px; }
.bpm strong { font: 400 70px/1 var(--font-display); letter-spacing: .3px; }
.bpm span { color: var(--muted); font-size: var(--text-xs); font-weight: 700; }
input[type="range"] { width: 100%; margin: 14px 0; accent-color: var(--rose-strong); }
.beat-dots { display: flex; gap: 10px; margin-bottom: 16px; }
.beat-dots span { width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); transition: background-color 60ms linear, transform 90ms var(--ease-out); }
.beat-dots span:first-child { border-width: 3px; }
.beat-dots span.on { background: var(--rose); transform: scale(1.12); }
.beat-dots span:first-child.on { transform: scale(1.3); } /* the downbeat lands harder */

.practice-panel.progress { grid-column: 1 / -1; }
.link-button { border: 0; background: none; text-decoration: underline; cursor: pointer; }
.progress-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.progress-stats div { padding: var(--s3); border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--sage-light); }
.progress-stats span { display: block; color: var(--muted); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; }
.progress-stats strong { font: 400 42px/1.1 var(--font-display); }
.focus-next h3 { margin: 16px 0 8px; color: var(--muted); font: 700 var(--text-xs) var(--font-body); text-transform: uppercase; }
.focus-next ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.focus-next .ladder { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); counter-reset: rung; }
.focus-next .ladder .focus-pair strong { margin-right: auto; }
.focus-next .ladder .focus-pair::before { counter-increment: rung; content: counter(rung); color: var(--rose-strong); font: 400 var(--text-md) var(--font-display); }
.drill-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); margin: var(--s3) 0 0; color: var(--ink-soft); font-size: var(--text-sm); }
.drill-suggest strong { color: var(--ink); font: 400 var(--text-lg) var(--font-display); }
.drill-suggest .suggest-on { color: var(--muted); }
.drill-select option:disabled { color: #9aa597; }
.focus-pair { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; border: 2px dashed var(--rose); border-radius: var(--radius-small); background: #fff0e6; }
.focus-pair strong { font: 400 19px var(--font-display); }
.focus-pair span { color: var(--muted); font-size: var(--text-sm); }
.pair-list { margin-top: 16px; }
.pair-row { display: grid; grid-template-columns: minmax(0, 2fr) 1.2fr .6fr 1.2fr auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 2px dashed var(--line); }
.pair-head { padding: 0 0 6px; border-top: 0; color: var(--muted); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; }
.pair-name { font: 400 21px/1.2 var(--font-display); }
.pair-name small { display: block; color: var(--muted); font: 600 var(--text-sm) var(--font-body); }
.pair-best { display: grid; gap: 4px; }
.pair-best b { font: 400 21px var(--font-display); }
.pair-best b small { margin-left: 2px; color: var(--muted); font-size: var(--text-md); }
.goal { display: block; height: 7px; border: 2px solid var(--ink); border-radius: 4px; background: linear-gradient(90deg, var(--rose) var(--goal), var(--paper) var(--goal)); }
.sparkline { width: 96px; height: 28px; }
.sparkline polyline { fill: none; stroke: var(--rose); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.sparkline-empty, .progress-empty { color: var(--muted); font-size: var(--text-sm); }
.progress-empty { display: grid; justify-items: center; gap: 12px; padding: 16px; border: 2px dashed var(--line); border-radius: var(--radius-small); text-align: center; }
.progress-empty p { margin: 0; color: var(--ink-soft); font-size: var(--text-md); }
/* No data yet: the zeros step back so the call to action leads. */
.progress.is-empty .progress-stats div { background: transparent; border-style: dashed; border-color: var(--line); }
.progress.is-empty .progress-stats strong { color: var(--muted); }

/* Mobile sticky play bar */
.mobile-bar { display: none; }

footer { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); border-top: 3px solid var(--ink); padding: 20px 0 30px; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s4); }
.toast { position: fixed; z-index: 6; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: transform 180ms var(--ease-out), opacity 180ms ease; border: 3px solid var(--ink); border-radius: var(--radius-small); padding: 10px 12px; color: var(--surface); background: var(--ink); box-shadow: 4px 4px 0 var(--rose); font: 600 var(--text-sm) var(--font-body); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Microphone: a pixel mic icon on Check my chord and Count by ear. */
.mic-icon { width: 11px; height: 14px; flex: none; fill: currentColor; }
.check-button, .listen-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.check-button.active, .listen-toggle.active { --shadow-color: var(--rose); color: var(--surface); background: var(--ink); }
.check-result { margin-top: var(--s3); padding: var(--s3); border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--paper); font-size: var(--text-sm); line-height: 1.45; }
.check-result p { margin: 0; }
.check-result p + p { margin-top: 6px; }
.check-listening b { color: var(--rose-strong); }
.check-again { text-align: right; }
.key-ok, .key-quiet { font-weight: 800; }
.key-ok { color: var(--ink); }
.key-quiet { color: var(--rose-strong); }
.diagram .string.check-ok { stroke: var(--ink); stroke-width: 3.5; }
.diagram .string.check-quiet { stroke: var(--rose-strong); stroke-width: 3.5; stroke-dasharray: 5 4; }
.diagram .string.check-ringing { stroke: var(--rose-strong); stroke-width: 3.5; }
.listen-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s3); }
.listen-status { flex: 1 1 180px; margin: 0; color: var(--ink-soft); font-size: var(--text-sm); }
.listen-status b { color: var(--ink); font: 400 var(--text-lg) var(--font-display); }

/* Welcome card on a first visit */
.welcome { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin: 0 0 var(--s4); padding: var(--s3) var(--s4); border: 3px solid var(--ink); border-radius: var(--radius-small); background: var(--peach); box-shadow: 4px 4px 0 var(--ink); }
.welcome p { margin: 0; color: var(--ink); }
.welcome strong { font: 400 var(--text-lg) var(--font-display); letter-spacing: .3px; }
.welcome-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); }

/* Today's practice */
.practice-panel.today { grid-column: 1 / -1; }
.panel-head .link-button { color: var(--ink-soft); }
.reminder { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s3); padding: var(--s3); border: 2px dashed var(--line); border-radius: var(--radius-small); }
.reminder label { color: var(--ink); font-weight: 800; }
.reminder input { min-height: var(--control-sm); padding: 0 8px; border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--paper); font: 600 var(--text-md) var(--font-body); }
.reminder p { flex: 1 0 100%; margin: 0; color: var(--muted); font-size: var(--text-sm); }
.plan { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin: 0; padding: 0; list-style: none; }
.plan-step { display: grid; grid-template-columns: auto 1fr; align-content: start; gap: var(--s2) var(--s3); padding: var(--s3); border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--paper); }
.plan-step > div { display: grid; gap: 2px; }
.plan-step strong { font: 400 var(--text-lg)/1.1 var(--font-display); letter-spacing: .3px; }
.plan-step > div > span { color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.4; }
.plan-step > .small-button { grid-column: 2; justify-self: start; text-decoration: none; }
.plan-check { display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 50%; background: var(--surface); font: 400 18px/1 var(--font-display); }
.plan-step.done { border-style: dashed; border-color: var(--line); background: transparent; }
.plan-step.done .plan-check { color: var(--surface); background: var(--ink); }
.plan-step.done strong { color: var(--ink-soft); }
.path { margin-top: var(--s4); padding-top: var(--s3); border-top: 2px dashed var(--line); }
.path-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s3); }
.path-head h3 { margin: 0; font: 400 var(--text-lg) var(--font-display); letter-spacing: .3px; }
.path-head p { margin: 0; color: var(--ink-soft); font-size: var(--text-sm); }
.path-steps { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0 0; padding: 0; list-style: none; counter-reset: path; }
.path-chip { display: grid; justify-items: start; gap: 0; min-width: 84px; padding: 6px 10px; border: 2px solid var(--ink); border-radius: var(--radius-small); color: var(--ink); background: var(--paper); text-align: left; font: inherit; }
.path-chip strong { font: 400 var(--text-lg)/1.1 var(--font-display); }
.path-chip small { color: var(--muted); font-size: var(--text-xs); font-weight: 700; }
button.path-chip { box-shadow: 3px 3px 0 var(--ink); transition: transform var(--press-ms) var(--ease-out), box-shadow var(--press-ms) var(--ease-out); }
button.path-chip:active { transform: var(--press); box-shadow: 0 0 0 transparent; }
.path-step.done .path-chip { color: var(--surface); background: var(--ink); box-shadow: 3px 3px 0 var(--rose); }
.path-step.done .path-chip small { color: var(--sage); }
.path-step.current .path-chip { background: var(--peach); box-shadow: 3px 3px 0 var(--rose-strong); }
.path-step.current .path-chip small { color: var(--ink-soft); }
.path-step.locked .path-chip { border-style: dashed; border-color: var(--line); color: var(--muted); background: transparent; }

/* Four to play: strum pattern, capo, songs */
.set-extras { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s2) var(--s4); margin-top: var(--s3); }
.mini-field { display: grid; gap: 4px; color: var(--muted); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; }
.mini-field select { min-height: 36px; appearance: none; border: 2px solid var(--ink); border-radius: var(--radius-small); padding: 0 27px 0 10px; color: var(--ink); background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%2328433a' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 9px center; font: 400 var(--text-md) var(--font-display); text-transform: none; }
.strum-arrows { display: flex; gap: 3px; margin: 0; }
.strum-arrows span { display: grid; place-items: center; width: 26px; height: 36px; border: 2px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--paper); font: 800 18px/1 var(--font-body); transition: background-color 60ms linear; }
.strum-arrows span:nth-child(odd) { border-color: var(--ink); }
.strum-arrows span.miss { color: var(--line); }
.strum-arrows span.on { color: var(--surface); background: var(--rose-strong); }
.strum-arrows span.miss.on { color: var(--surface); background: var(--rose); }
.strum-arrows .change-only { width: auto; padding: 0 10px; border-style: dashed; color: var(--muted); font: 700 var(--text-sm) var(--font-body); }
.capo-note { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin: var(--s3) 0 0; padding: var(--s2) var(--s3); border-left: 4px solid var(--rose); color: var(--ink); background: #fff0e6; font-size: var(--text-sm); }
.set-name .capo-label { color: var(--ink-soft); }
.set-songs { margin: calc(var(--s4) * -1 + 4px) 0 var(--s4); color: var(--ink-soft); font-size: var(--text-sm); }
.set-songs b { color: var(--ink); }

/* Guide */
.guide-start { margin: 0 0 var(--s5); }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 40px; }
.guide-grid > .guide-panel:nth-child(-n+2) { grid-column: 1 / -1; }
.guide-list { display: grid; gap: var(--s2); margin: var(--s3) 0 0; padding-left: 20px; color: var(--ink-soft); line-height: 1.5; }
.guide-list b { color: var(--ink); }
.guide-list a { color: var(--rose-strong); font-weight: 800; }
.guide-diagram-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s5); align-items: start; }
.guide-diagram-row figure { margin: var(--s3) 0 0; padding: var(--s3); border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--surface); text-align: center; }
.guide-diagram-row figcaption { color: var(--muted); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; }
.guide-diagram-row .diagram { width: 100%; }

/* Tour: the spotlight dims everything but its target; the card explains it. */
.tour { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.tour-spot { position: fixed; border: 3px solid var(--rose); border-radius: var(--radius-small); box-shadow: 0 0 0 9999px rgba(40, 67, 58, .55); transition: top 200ms var(--ease-out), left 200ms var(--ease-out), width 200ms var(--ease-out), height 200ms var(--ease-out); }
.tour-card { position: fixed; pointer-events: auto; padding: var(--s4); border: 3px solid var(--ink); border-radius: var(--radius); background: var(--surface); box-shadow: 6px 6px 0 var(--rose); }
.tour-card:focus { outline: none; }
.tour-card h2 { margin: 0 0 6px; font: 400 26px/1.05 var(--font-display); letter-spacing: .3px; }
.tour-card p { margin: 0; color: var(--ink-soft); }
.tour-count { margin-bottom: 4px !important; color: var(--rose-strong) !important; font-size: var(--text-xs); font-weight: 800; text-transform: uppercase; }
.tour-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s3); margin-top: var(--s4); }
.tour-actions .link-button { margin-right: auto; }
.tour-next { color: var(--surface) !important; background: var(--ink) !important; --shadow-color: var(--rose); }

@media (max-width: 860px) {
  .workspace, .practice-grid { grid-template-columns: minmax(0, 1fr); }
  .finder { position: static; max-height: none; overflow: visible; }
  /* Phones and narrow tablets: the finder shrinks to search + two swipeable rows so the chord is on the first screen. */
  .finder-popular { display: none; }
  .finder-block { margin-top: 10px; padding-top: 0; border-top: 0; }
  .finder-block h2, .chip-group > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #rootChips, #qualityChips, .chip-group > div { display: flex; flex-wrap: nowrap; gap: 6px; }
  /* position: relative keeps the hidden group labels inside the scroller; otherwise they widen the page on phones. */
  #rootChips, #qualityChips { position: relative; margin: 0 -16px; padding: 2px 16px 6px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: 16px; scrollbar-width: none; }
  #rootChips::-webkit-scrollbar, #qualityChips::-webkit-scrollbar { display: none; }
  #rootChips .chip { min-width: 44px; padding: 0 8px; }
  #qualityChips .chip-group + .chip-group { margin-top: 0; padding-left: 10px; border-left: 2px dashed var(--line); }
  #finder .chip { flex: none; scroll-snap-align: start; }
  .practice-chords { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-grid, .plan { grid-template-columns: minmax(0, 1fr); }
  /* One column: each step's button sits beside its text instead of under it. */
  .plan-step { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  .plan-step > .small-button { grid-column: 3; grid-row: 1; }
}
/* The top bar on one line at every width: tablets drop the Guide and Left-handed labels, then the wordmark. */
@media (max-width: 960px) {
  .topbar { gap: 16px; }
  .lefty-label, .guide-label { display: none; } /* icons only; both keep their aria-labels */
  .topbar .guide-link, .topbar .lefty-toggle { padding: 4px 10px; }
}
@media (max-width: 760px) { .brand-name { display: none; } .tabs a { padding: 7px 8px; } }
@media (max-width: 620px) {
  html { scroll-padding-top: 76px; scroll-padding-bottom: 96px; } /* sticky top bar + fixed play bar */
  .topbar, main, footer { --gutter: 32px; }
  .topbar { min-height: 56px; gap: 12px; }
  .brand { font-size: 18px; }
  .brand-mark { width: 26px; height: 26px; margin-right: 6px; }
  .tabs a { padding: 6px 8px; font-size: var(--text-md); }
  .text-button { padding: 7px 9px; box-shadow: 3px 3px 0 var(--rose); }
  .topbar .lefty-toggle { min-height: var(--control-sm); padding: 4px 7px; }
  .lefty-label { display: none; } /* icon only; the button keeps its aria-label */
  /* First screen on phones: the chord diagram must clear the fixed play bar at 375×700. The intro heading stays in
     the document (screen readers, view-switch focus) but takes no space; finder, card and frame paddings tighten. */
  .intro { margin: 12px 0 0; }
  .intro h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #practiceView .intro { margin: 18px 0 14px; }
  #practiceView .intro h1 { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; font-size: 26px; }
  .intro span { display: none; }
  .workspace { gap: var(--s2); }
  .finder { padding: var(--s3); }
  .search-box { padding: 6px 10px; }
  .finder-block { margin-top: var(--s2); }
  .panel, .shape-card { padding: var(--s4); }
  /* The fixed play bar has Hear it, so the card leads with the shape and moves playback style under the diagram. */
  .shape-card > .sound-controls { grid-column: 1 / -1; grid-row: auto; order: 1; margin-top: 12px; }
  .shape-card > .shape-info, .shape-card > .tip, .shape-card > .hint { order: 2; }
  body[data-view="chords"] #soundButton { display: none; }
  .shape-card .eyebrow { display: none; }
  .shape-card { padding: var(--s3); }
  /* Name, position and notes share one wrapping row. */
  .shape-card-head > div { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); }
  .chord-tones { margin: 0; }
  .voicing-picker { margin-top: var(--s2); }
  .voicing-picker button { padding: 2px 6px; }
  .diagram-stage { margin-top: var(--s2); padding: 0 var(--s2) var(--s1); }
  /* The SVG keeps 17px of air above its open-string rings; the frame's own border is enough here. */
  .diagram-stage .diagram { width: min(100%, 210px); margin-top: -12px; }
  .shape-card h2 { font-size: 48px; }
  .progress-stats strong { font-size: 26px; }
  .pair-head { display: none; }
  .pair-row { grid-template-columns: 1fr auto auto; row-gap: 8px; }
  .pair-name { grid-column: 1 / -1; }
  .pair-row > span:nth-of-type(2) { display: none; }
  body[data-view="chords"] .mobile-bar { position: fixed; z-index: 4; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px calc(16px + env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px)); border-top: 3px solid var(--ink); background: var(--canvas); }
  .mobile-bar strong { font: 400 32px/1 var(--font-display); }
  body[data-view="chords"] footer { padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
  body[data-view="chords"] .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } /* above the play bar */
  .topbar .guide-link { min-height: var(--control-sm); padding: 4px 9px; }
  .guide-label { display: none; } /* "?" only; the link keeps its aria-label */
  .guide-diagram-row { grid-template-columns: minmax(0, 1fr); }
  .guide-diagram-row figure { justify-self: center; width: 200px; }
  #guideView .intro, #tuneView .intro { margin: 18px 0 14px; }
  #guideView .intro h1, #tuneView .intro h1 { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; font-size: 26px; }
  .welcome { margin-top: var(--s2); }
  .tour-card { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .tour-card.top { top: calc(68px + env(safe-area-inset-top, 0px)); bottom: auto; }
  .strum-arrows span { width: 22px; }
}
@media (max-width: 420px) {
  .voicing-picker button { line-height: 1.1; }
  .seg-dot { display: none; }
  .chord-tones > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .seg-level { display: block; font: 800 var(--text-xs) var(--font-body); letter-spacing: .4px; text-transform: uppercase; }
}
@media (max-width: 620px) { .topbar { gap: 6px; } .tabs a { padding: 6px; } .text-button { padding: 7px 10px; } .text-button .random-word { display: none; } }
/* Phones keep the logo mark and drop the wordmark so the top bar fits on one line. */
@media (max-width: 620px) { .brand-name { display: none; } }
/* The narrowest: four tabs, ?, ⇆ and ↗ only fit without the logo (Today is home anyway). */
@media (max-width: 420px) {
  .brand { display: none; }
  .tabs { gap: 2px; }
  .tabs a { padding: 6px 4px; }
}
@media (max-width: 350px) { .topbar { gap: 2px; } .tabs { gap: 0; } .tabs a { padding: 6px 2px; } }

/* Reduced motion: no movement (presses, lifts, toast slide, mark scale-in, beat pulse); colour and opacity stay. */
@media (prefers-reduced-motion: reduce) {
  .chip, .small-button, .sound-button, .text-button, .segmented button { transition: background-color var(--press-ms) ease, color var(--press-ms) ease; }
  .chip:hover, .small-button:hover, .sound-button:hover, .text-button:hover, .chip:active, .small-button:active, .sound-button:active, .text-button:active, .segmented button:active { transform: none !important; }
  .toast, .toast.show { transform: translate(-50%, 0); transition: opacity 180ms ease; }
  .diagram.enter .mark { animation: none; }
  .beat-dots span, .beat-dots span.on { transform: none; transition: background-color 60ms linear; }
  .drill-progress span { transition: none; }
  .practice-chord, .practice-chord.active { transform: none; transition: background-color 120ms ease, outline-color 120ms ease; }
  .tour-spot { transition: none; }
  button.path-chip:active { transform: none; }
}

/* ---- Practice: songs ---- */
.practice-panel.songs, .practice-panel.loop { grid-column: 1 / -1; }
.song-meta { margin: 0; align-self: center; color: var(--ink-soft); font-size: var(--text-sm); }
.mark-ok { color: var(--ink); font-weight: 800; }
.mark-miss { color: var(--rose-strong); font-weight: 800; }
.song-chords { display: flex; flex-wrap: wrap; gap: var(--s3); margin-bottom: var(--s4); }
.song-chord { display: grid; justify-items: center; gap: 2px; width: 104px; padding: var(--s2); border: 2px solid var(--ink); border-radius: var(--radius-small); color: var(--ink); background: var(--paper); font: inherit; cursor: pointer; transition: background-color 120ms ease, box-shadow 120ms ease; }
.song-chord strong { font: 400 24px/1 var(--font-display); }
.song-chord .diagram { width: 100%; }
.song-chord.active { background: #ffe6c7; box-shadow: inset 0 -4px 0 var(--rose), 3px 3px 0 var(--ink); }
.song-sheet { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.song-bar { display: grid; align-content: start; gap: 2px; min-height: 72px; padding: var(--s2) var(--s3); border: 2px solid var(--line); border-radius: var(--radius-small); background: var(--paper); transition: background-color 90ms linear, border-color 90ms linear; }
.song-bar.active { border-color: var(--ink); background: #ffe6c7; box-shadow: 3px 3px 0 var(--rose); }
.song-bar.next { border-color: var(--ink); border-style: dashed; }
.bar-chords { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.bar-chord { color: var(--ink); font: 400 22px/1 var(--font-display); }
.bar-chord.now { color: var(--rose-strong); text-decoration: underline 3px; text-underline-offset: 3px; }
.bar-chord[data-mark]::after { margin-left: 3px; font: 800 15px var(--font-body); }
.bar-chord[data-mark=ok]::after { content: "✓"; color: var(--ink); }
.bar-chord[data-mark=miss]::after { content: "✗"; color: var(--rose-strong); }
.bar-words { color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.35; }
.song-result { min-height: 1.5em; margin: var(--s3) 0 0; color: var(--ink); font-size: var(--text-md); }
.song-result b { font: 400 var(--text-lg) var(--font-display); }
.song-result .count-big { color: var(--rose-strong); font: 400 28px/1 var(--font-display); }

/* ---- Practice: note loop ---- */
.loop-notes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
.loop-note { display: grid; justify-items: center; gap: 4px; padding: var(--s3) var(--s2); border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--paper); text-align: center; transition: background-color 120ms ease, transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out); }
.loop-note .loop-step { color: var(--rose-strong); font: 400 var(--text-md)/1 var(--font-display); }
.loop-note strong { font: 400 40px/1 var(--font-display); }
.loop-note p { margin: 0; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 700; }
.loop-note .tab { width: min(100%, 120px); }
.loop-note.active { background: #ffe6c7; box-shadow: inset 0 -4px 0 var(--rose), 4px 4px 0 var(--ink); transform: translate(-2px, -2px); }
.loop-note.hit { background: var(--sage); }
.loop-note.miss { background: #f6d3d6; }
.tab-line { stroke: var(--ink-soft); stroke-width: 1.5; }
.tab-name { fill: var(--muted); font: 700 8px var(--font-body); }
.tab-box { fill: var(--rose-strong); }
.tab-fret { fill: var(--surface); font: 400 15px var(--font-display); text-anchor: middle; }
.loop-stats { grid-template-columns: repeat(4, 1fr); }
.loop .listen-row .sound-button { display: inline-flex; align-items: center; gap: 8px; padding-left: 12px; }
@media (max-width: 620px) {
  .song-sheet, .loop-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .song-chords { gap: var(--s2); }
  .song-chord { width: 92px; }
  .loop-stats strong { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) { .loop-note.active { transform: none; } }

/* ---- Tune: tuner, mic check, what the mic hears ---- */
.tune-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 40px; }
.tune-grid .mic-debug { grid-column: 1 / -1; }
.tune-grid .listen-row .sound-button { display: inline-flex; align-items: center; gap: 8px; padding-left: 12px; }
.tuner-strings { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s2); margin-top: var(--s3); }
.tuner-strings .chip { min-height: var(--control-md); padding: 0; font-size: 22px; }
.tuner-strings .chip small { font: 700 var(--text-xs) var(--font-body); opacity: .7; }
.tuner-meter { position: relative; container-type: inline-size; height: 110px; margin-top: var(--s4); overflow: hidden; border: 2px solid var(--ink); border-radius: var(--radius-small); background:
  linear-gradient(90deg, transparent calc(50% - 14px), var(--sage-light) calc(50% - 14px), var(--sage-light) calc(50% + 14px), transparent calc(50% + 14px)), var(--paper); }
.tuner-scale { display: flex; justify-content: space-between; padding: 6px 10px; color: var(--muted); font-size: var(--text-xs); font-weight: 800; }
.tuner-needle { --cents: 0; position: absolute; left: calc(50% - 3px); top: 30px; bottom: 10px; width: 6px; border-radius: 3px; background: var(--ink-soft); opacity: .35; transform: translateX(calc(var(--cents) * .92cqw)); transition: transform 160ms var(--ease-out), background-color 160ms ease; }
.tuner-meter.live .tuner-needle { background: var(--rose-strong); opacity: 1; }
.tuner-meter.in-tune { background: var(--sage); }
.tuner-meter.in-tune .tuner-needle { background: var(--ink); }
.tuner-read { display: flex; align-items: center; gap: var(--s3); min-height: 56px; margin-top: var(--s3); }
.tuner-note { flex: none; min-width: 84px; font: 400 40px/1 var(--font-display); }
.tuner-hint { margin: 0; font-weight: 800; }
.mic-steps { margin: var(--s3) 0 0; padding-left: 22px; font-weight: 700; }
.mic-steps li { padding: 4px 0; color: var(--ink-soft); }
.mic-steps li[data-state=now] { color: var(--rose-strong); }
.mic-steps li[data-state=done] { color: var(--ink); text-decoration: line-through; }
.mic-debug summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; cursor: pointer; }
.mic-debug summary h2 { display: inline; margin: 0; font: 400 26px/1 var(--font-display); }
.mic-debug summary span { color: var(--ink-soft); font-size: var(--text-sm); }
.debug-readout { display: grid; gap: var(--s2); margin: var(--s4) 0 0; }
.debug-readout > div { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: var(--s3); }
.debug-readout dt { color: var(--muted); font-size: var(--text-xs); font-weight: 800; text-transform: uppercase; }
.debug-readout dd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin: 0; font-variant-numeric: tabular-nums; font-weight: 700; overflow-wrap: anywhere; }
.level-bar { position: relative; flex: 1 1 200px; height: 14px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper); }
.level-bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--sage); }
.level-bar b { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--muted); }
.level-bar b.loud-mark { background: var(--rose-strong); }
@media (max-width: 860px) { .tune-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 620px) { .tuner-strings .chip { font-size: 20px; } }
@media (prefers-reduced-motion: reduce) { .tuner-needle { transition: none; } }

/* ---- Motivation: player card, progress page ---- */
:root {
  --chart: #4a8458; /* bars: 3.9:1 on surface */
  --heat-1: #dcebc9;
  --heat-2: #a9cf8e;
  --heat-3: #6da55e;
  --heat-4: #3d7449;
}
.player-card { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); padding: var(--s4) var(--s5); }
.player-level { display: flex; align-items: center; gap: var(--s3); flex: 1 1 260px; min-width: 0; }
.level-badge { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border: 3px solid var(--ink); border-radius: 50%; background: var(--peach); box-shadow: 3px 3px 0 var(--ink); font: 400 30px/1 var(--font-display); }
.level-badge.big { width: 72px; height: 72px; font-size: 42px; }
.player-xp { display: grid; gap: 4px; flex: 1; min-width: 0; }
.player-title { font: 400 var(--text-lg)/1.1 var(--font-display); }
.player-xp small, .player-stat small { color: var(--muted); font-size: var(--text-xs); font-weight: 800; }
.xp-bar { display: block; height: 12px; overflow: hidden; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); }
.xp-bar i { display: block; height: 100%; background: var(--rose-strong); transition: width 400ms var(--ease-out); }
.player-stat { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; align-items: center; column-gap: var(--s2); }
.player-stat > svg { grid-row: 1 / 3; }
.player-stat strong { font: 400 30px/1 var(--font-display); }
.player-stat strong span { color: var(--muted); font-size: 20px; }
.flame-icon { width: 27px; height: 30px; fill: var(--line); }
.player-stat.lit .flame-icon { fill: var(--rose-strong); }
.goal-ring { width: 36px; height: 36px; }
.goal-ring circle { fill: none; stroke-width: 5; }
.ring-track { stroke: var(--sage-light); }
.ring-fill { stroke: var(--chart); stroke-linecap: round; }
.ring-fill.done { stroke: var(--rose-strong); }
.player-card > .small-button { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }

.progress-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 40px; }
.progress-calendar, .progress-minutes, .progress-badges { grid-column: 1 / -1; }
.progress-level .player-level { margin-top: var(--s4); }
.goal-picker { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s4); font-weight: 800; }
.week-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: var(--s4); }
.week-stats strong { font-size: 32px; }
.streak-now { margin: 0; color: var(--ink-soft); font-weight: 800; }
.streak-now b { color: var(--rose-strong); font: 400 26px/1 var(--font-display); }
.heat-grid { display: grid; grid-template-rows: repeat(7, auto); grid-auto-flow: column; grid-auto-columns: minmax(0, 22px); gap: 3px; margin-top: var(--s4); }
.heat-cell { aspect-ratio: 1; border-radius: 3px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.heat-cell[data-level="1"] { background: var(--heat-1); }
.heat-cell[data-level="2"] { background: var(--heat-2); }
.heat-cell[data-level="3"] { background: var(--heat-3); box-shadow: none; }
.heat-cell[data-level="4"] { background: var(--heat-4); box-shadow: none; }
.heat-cell.future { visibility: hidden; }
.heat-cell[data-today] { outline: 2px solid var(--ink); outline-offset: 1px; }
.heat-cell.tip-on { outline: 2px solid var(--rose-strong); outline-offset: 1px; }
.heat-legend { display: flex; align-items: center; gap: 4px; margin-top: var(--s3); color: var(--muted); font-size: var(--text-xs); font-weight: 800; }
.heat-legend .heat-cell { width: 14px; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--chart); }
.chart .hit { fill: transparent; }
.chart .hit.tip-on { fill: var(--ink); fill-opacity: .06; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; opacity: .5; }
.chart .goal-line { stroke: var(--rose-strong); stroke-width: 2; stroke-dasharray: 6 5; }
.chart .axis-label { fill: var(--muted); font: 700 12px var(--font-body); }
.chart .goal-label { fill: var(--rose-strong); font: 800 12px var(--font-body); }
.chart-tip { position: fixed; z-index: 60; padding: 6px 10px; border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--ink); color: var(--surface); font-size: var(--text-sm); font-weight: 800; pointer-events: none; white-space: nowrap; }
.song-bests { display: grid; gap: var(--s3); margin: var(--s4) 0 0; padding: 0; list-style: none; }
.song-bests li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(60px, 1fr) 44px; align-items: center; gap: var(--s3); font-weight: 700; }
.song-bests li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.best-bar { height: 12px; overflow: hidden; border-radius: 0 4px 4px 0; background: var(--sage-light); }
.best-bar i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--chart); }
.song-bests b { text-align: right; font: 400 var(--text-lg) var(--font-display); }
.badge-count { color: var(--ink-soft); font-weight: 800; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); margin: var(--s4) 0 0; padding: 0; list-style: none; }
.badge { display: grid; justify-items: center; gap: 4px; padding: var(--s3); border: 2px dashed var(--line); border-radius: var(--radius-small); text-align: center; color: var(--muted); }
.badge strong { color: var(--ink-soft); font: 400 var(--text-lg)/1.1 var(--font-display); }
.badge small { font-size: var(--text-xs); font-weight: 700; }
.badge-mark { display: grid; place-items: center; width: 40px; height: 40px; border: 2px dashed var(--line); border-radius: 50%; font: 400 24px/1 var(--font-display); }
.badge.earned { border: 2px solid var(--ink); background: var(--paper); box-shadow: 3px 3px 0 var(--ink); color: var(--ink-soft); }
.badge.earned strong { color: var(--ink); }
.badge.earned .badge-mark { border: 2px solid var(--ink); background: var(--peach); color: var(--rose-strong); }
@media (max-width: 860px) { .progress-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 620px) {
  #progressView .intro { margin: 18px 0 14px; }
  #progressView .intro h1 { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; font-size: 26px; }
  .player-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); padding: var(--s3) var(--s4); }
  .player-card .player-level, .player-card > .small-button { grid-column: 1 / -1; }
  .player-card > .small-button { margin-left: 0; justify-content: center; }
  .badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heat-grid { gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { .xp-bar i { transition: none; } }

/* ---- Today: the home page ---- */
.today-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 40px; }
.quest-streak { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ink-soft); font-weight: 800; }
.quest-streak b { color: var(--ink); font: 400 26px/1 var(--font-display); }
.quest-streak .flame-icon { width: 18px; height: 20px; }
.quest-streak.lit .flame-icon { fill: var(--rose-strong); }
.quest-streak.lit b { color: var(--rose-strong); }
.quests { display: grid; gap: var(--s3); margin: 0; padding: 0; list-style: none; }
.quest, .quest-bonus { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: var(--s3); border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--paper); }
.quest-mark { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--sage-light); color: var(--ink); font: 400 24px/1 var(--font-display); }
.quest-icon { width: 20px; height: 20px; fill: var(--ink); }
.quest-body { display: grid; gap: 4px; min-width: 0; }
.quest-body h3 { margin: 0; font: 400 var(--text-lg)/1.1 var(--font-display); letter-spacing: .3px; }
.quest-body p { margin: 0; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.4; }
.quest-progress { display: flex; align-items: center; gap: var(--s2); margin-top: 2px; }
.quest-progress small { color: var(--muted); font-size: var(--text-xs); font-weight: 800; white-space: nowrap; }
.quest-bar { flex: 1; max-width: 220px; }
.quest-bar i { background: var(--chart); }
.quest-pips { display: flex; gap: 4px; }
.quest-pips i { width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); }
.quest-pips i.on { background: var(--chart); }
.quest-side { display: grid; justify-items: end; gap: var(--s2); }
.quest-xp { color: var(--rose-strong); font: 400 var(--text-lg)/1 var(--font-display); white-space: nowrap; }
.quest-side .small-button { gap: 6px; text-decoration: none; }
.quest-done-label { color: var(--muted); font-size: var(--text-xs); font-weight: 800; letter-spacing: .4px; text-transform: uppercase; }
.quest.done { border-style: dashed; border-color: var(--line); background: transparent; }
.quest.done .quest-mark, .quest-bonus.done .quest-mark { color: var(--surface); background: var(--ink); }
.quest.done h3 { color: var(--ink-soft); }
.quest.done .quest-bar i, .quest.done .quest-pips i.on { background: var(--rose-strong); }
.quest-bonus { margin-top: var(--s4); border-style: dashed; border-color: var(--line); background: transparent; }
.quest-bonus p { display: grid; gap: 2px; margin: 0; }
.quest-bonus strong { font: 400 var(--text-lg)/1.1 var(--font-display); letter-spacing: .3px; }
.quest-bonus p > span { color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.4; }
.quest-bonus .quest-mark { background: var(--peach); }
.quest-bonus.done { border: 2px solid var(--ink); background: var(--peach); box-shadow: 3px 3px 0 var(--ink); }
.shortcuts { display: grid; gap: var(--s3); margin: var(--s4) 0 0; padding: 0; list-style: none; }
.shortcut { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: var(--s3); border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--paper); box-shadow: 3px 3px 0 var(--ink); color: var(--ink); text-decoration: none; transition: transform var(--press-ms) var(--ease-out), box-shadow var(--press-ms) var(--ease-out); }
.shortcut > span:nth-child(2) { display: grid; gap: 2px; }
.shortcut strong { font: 400 var(--text-lg)/1.1 var(--font-display); letter-spacing: .3px; }
.shortcut small { color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.35; }
.shortcut-arrow { color: var(--rose-strong); font: 400 var(--text-lg) var(--font-display); }
.shortcut:active { transform: var(--press); box-shadow: 0 0 0 transparent; }
@media (hover: hover) and (pointer: fine) { .shortcut:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); } }
@media (max-width: 860px) { .today-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 620px) {
  #todayView .intro { margin: 18px 0 14px; }
  #todayView .intro h1 { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; font-size: 26px; }
  /* Narrow cards: the XP and Go sit under the text instead of beside it. */
  .quest { grid-template-columns: auto minmax(0, 1fr); }
  .quest-side { grid-column: 2; display: flex; align-items: center; justify-content: space-between; }
  .quest-mark { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) { .shortcut { transition: none; } .shortcut:hover, .shortcut:active { transform: none; } }
