/* Layout: one lit stage that every tool plays on, a quiet card row under it, and a dock of tools
   at the bottom. The stage light is the moving gradient: it changes colour with the
   reharmonizing level, turns green when a string is in tune, and pulses on the click. */
:root {
  --bg: oklch(0.98 0.004 280);
  --surface: oklch(0.95 0.007 280);
  --sunk: oklch(0.995 0.002 280);
  --fg: oklch(0.2 0.02 280);
  --muted: oklch(0.5 0.015 280);
  --line: oklch(0.2 0.02 280 / 0.12);
  --line-strong: oklch(0.2 0.02 280 / 0.3);
  --glow: rgb(60 140 196);
  --lv: rgb(60 140 196);
  --home: oklch(0.58 0.12 160);
  --away: oklch(0.56 0.14 255);
  --tension: oklch(0.6 0.18 35);
  /* the stage keeps one look in both themes */
  --st-back: radial-gradient(120% 90% at 70% 20%, #3a1a6e 0%, #1a0d38 55%, #0a0618 100%);
  --st-fg: #fff;
  --st-soft: rgb(255 255 255 / 0.7);
  --st-glass: rgb(255 255 255 / 0.13);
  --st-line: rgb(255 255 255 / 0.3);
  --st-ink: #14102a;
  --display: "Bricolage Grotesque", "Geist", system-ui, sans-serif;
  --body: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.14 0.015 280); --surface: oklch(0.195 0.018 280); --sunk: oklch(0.24 0.02 280);
    --fg: oklch(0.95 0.006 280); --muted: oklch(0.7 0.015 280); --line: oklch(1 0 0 / 0.11); --line-strong: oklch(1 0 0 / 0.26); --home: oklch(0.78 0.12 160); --away: oklch(0.76 0.12 255); --tension: oklch(0.76 0.15 40); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-wrap: anywhere; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; text-wrap: balance; }
button, textarea, select, input { font: inherit; color: inherit; }
button, select, label.check { cursor: pointer; }
button:disabled { opacity: 0.4; cursor: default; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.muted { color: var(--muted); }
.wrap { display: grid; gap: 18px; max-width: 66rem; margin: 0 auto; padding-block: calc(18px + env(safe-area-inset-top, 0px)) 7.5rem; padding-inline: clamp(16px, 3vw, 32px); }
.wrap > * { min-width: 0; }

header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 4; display: flex; align-items: center; gap: 8px; margin: -8px -8px; padding: 8px; border-radius: 16px; background: color-mix(in oklch, var(--bg) 82%, transparent); backdrop-filter: blur(14px); }
.mark { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.04em; margin-right: auto; white-space: nowrap; flex: none; }
.mark i { width: 22px; height: 22px; border-radius: 7px 7px 7px 2px; background: var(--glow); transition: background 0.8s; }
.song { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* stage */
.stage { position: relative; isolation: isolate; overflow: hidden; border-radius: 28px; background: var(--st-back); color: var(--st-fg); min-height: 27rem; display: grid; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.view { display: grid; grid-template-rows: auto 1fr auto; gap: 22px; padding: clamp(18px, 3vw, 32px); min-width: 0; }
.view > * { min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.top > div { min-width: 0; }
.top h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); line-height: 1.1; }
.top p { color: var(--st-soft); }
.tag { border: 1px solid var(--st-line); border-radius: 999px; padding: 3px 11px; background: var(--st-glass); white-space: nowrap; }
.ctl { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.round { width: 3.4rem; height: 3.4rem; flex: none; border-radius: 50%; border: 0; background: var(--st-fg); color: var(--st-ink); font-size: 15px; display: grid; place-items: center; transition: transform 0.2s var(--ease); }
.round:active { transform: scale(0.94); }
.seg { display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--st-glass); border: 1px solid var(--st-line); max-width: 100%; }
.seg button { border: 0; background: none; color: var(--st-fg); border-radius: 999px; min-width: 2.3rem; height: 2.3rem; padding: 0 6px; font-family: var(--display); font-weight: 600; font-size: 15px; }
.seg button[aria-pressed="true"] { background: var(--st-fg); color: var(--st-ink); }
.ends { color: var(--st-soft); }
.glass { border: 1px solid var(--st-line); background: var(--st-glass); color: var(--st-fg); border-radius: 999px; height: 2.6rem; padding: 0 16px; font-weight: 500; max-width: 100%; }
.glass option { color: var(--st-ink); background: #fff; }
.glass.check { display: inline-flex; align-items: center; gap: 8px; }
input.glass { min-width: 0; flex: 1 1 12rem; font-family: var(--mono); }
input.glass::placeholder { color: var(--st-soft); }
.empty { grid-column: 1 / -1; color: var(--st-soft); font-size: 16px; align-self: center; }

/* chart: lead sheet lines, four bars across, with real bar lines */
.chart { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 14px; max-height: min(56vh, 26rem); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--st-line) transparent; padding-right: 4px; }
.sec { grid-column: 1 / -1; color: var(--st-soft); margin-top: 6px; text-transform: none; letter-spacing: 0.03em; font-size: 12px; line-height: 1.7; }
.sec b { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; margin-right: 0.8em; }
.sec span { color: var(--st-fg); }
.bar { container-type: inline-size; display: grid; gap: 6px; align-content: center; padding: 12px clamp(6px, 1.2vw, 16px); border-left: 1px solid var(--st-line); border-radius: 0 10px 10px 0; min-width: 0; transition: background 0.2s; }
.bar.on { background: var(--st-glass); }
.bar.pinned { border-left: 3px solid var(--st-fg); }
.was { color: var(--st-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chs { display: flex; flex-wrap: wrap; gap: 2px 0.3em; align-items: baseline; font-size: clamp(1.05rem, calc(92cqi / var(--w, 2)), 3.1rem); }
.ch { border: 0; background: none; padding: 0; color: var(--st-soft); font-family: var(--display); font-weight: 700; font-size: 1em; line-height: 1.05; letter-spacing: -0.04em; white-space: nowrap; border-bottom: 3px solid transparent; }
.ch sup, .big sup, .held sup, .shape sup { font-size: 0.46em; font-weight: 600; letter-spacing: 0; vertical-align: 0.75em; margin-left: 1px; }
.ch.new { color: var(--st-fg); }
.ch[aria-pressed="true"] { border-bottom-color: var(--st-fg); color: var(--st-fg); }
@media (prefers-reduced-motion: no-preference) {
  @keyframes drop { from { opacity: 0.2; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
  .ch.new { animation: drop 0.45s var(--ease) both; }
  @keyframes buzz { to { transform: translateY(1.5px); } }
  .str[aria-pressed="true"] i { animation: buzz 0.07s linear infinite alternate; }
}

/* shapes */
.shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.6rem, 1fr)); gap: 10px; align-self: center; }
.shape { border: 1px solid var(--st-line); background: var(--st-glass); border-radius: 16px; padding: 8px 6px 6px; display: grid; justify-items: center; gap: 2px; min-width: 0; }
.shape b, .held b { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; }
.shape b { font-size: 19px; }
.shape .mono { color: var(--st-soft); }
.hear { border: 0; background: none; color: var(--st-fg); display: grid; justify-items: center; gap: 2px; width: 100%; padding: 0; }
.shape svg { width: 100%; max-width: 8rem; height: auto; }
.alts { display: flex; align-items: center; gap: 6px; }
.alts button { border: 0; background: none; color: var(--st-fg); width: 2rem; height: 2rem; border-radius: 50%; font-size: 18px; }
.alts button:hover { background: var(--st-glass); }

/* practice */
.duo { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-self: center; align-items: end; }
.held { display: grid; justify-items: start; gap: 6px; opacity: 0.75; }
.held b { font-size: clamp(1.8rem, 6vw, 3rem); line-height: 1; }
.held svg { width: clamp(5.5rem, 16vw, 8rem); height: auto; }
.held.now { opacity: 1; }
.held.now b { font-size: clamp(3rem, 12vw, 6.5rem); }
.held.now svg { width: clamp(8rem, 26vw, 13rem); }

/* tuner: the six strings drawn thick to thin, so the one to pluck is obvious */
.tuner { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: center; align-self: center; }
.neck { display: grid; gap: 4px; }
.str { display: grid; grid-template-columns: 1.7rem 1.6rem minmax(0, 1fr) 5.2rem; align-items: center; gap: 10px; border: 1px solid transparent; background: none; color: var(--st-soft); border-radius: 14px; padding: 8px 10px; text-align: left; }
.str[aria-pressed="true"] { background: var(--st-glass); border-color: var(--st-line); color: var(--st-fg); }
.str .n { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 1px solid currentColor; letter-spacing: 0; }
.str b { font-family: var(--display); font-size: 18px; }
.str i { display: block; height: var(--w); border-radius: 9px; background: currentColor; }
.str em { font-style: normal; text-align: right; }
.note { display: grid; justify-items: center; gap: 10px; text-align: center; min-width: 0; }
.note strong { font-family: var(--display); font-weight: 800; font-size: clamp(4.2rem, 11vw, 7rem); line-height: 0.9; letter-spacing: -0.06em; }
#live { display: grid; justify-items: center; gap: 6px; width: 100%; }
.scale { position: relative; width: min(100%, 34rem); height: 3rem; margin-top: 8px; background: repeating-linear-gradient(90deg, var(--st-line) 0 1px, transparent 1px 10%); border-right: 1px solid var(--st-line); }
.scale::before { content: ""; position: absolute; left: 50%; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--st-fg); }
.scale i { position: absolute; top: 4px; bottom: 4px; left: 50%; width: 14px; margin-left: -7px; border-radius: 7px; background: var(--st-fg); transition: left 0.08s linear; }
.zones { display: flex; justify-content: space-between; width: min(100%, 34rem); color: var(--st-soft); }

/* click */
.bpm { align-self: center; display: grid; justify-items: center; gap: 10px; }
.bpm strong { font-family: var(--display); font-weight: 800; font-size: clamp(5rem, 16vw, 9rem); line-height: 0.9; letter-spacing: -0.06em; font-variant-numeric: tabular-nums; }
.beats { display: flex; gap: 12px; }
.beats i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--st-fg); transition: background 0.25s; }
.beats i.on { background: var(--st-fg); transition: none; }
input[type="range"] { flex: 1 1 8rem; min-width: 0; accent-color: #fff; }

/* cards under the stage */
.below { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 18px; align-items: start; }
.card { background: var(--surface); border-radius: 20px; padding: clamp(16px, 2.4vw, 24px); display: grid; gap: 12px; min-width: 0; }
.card > * { min-width: 0; }
.card h2 { font-size: 19px; }
.card .big { font-family: var(--display); font-weight: 700; font-size: 2.6rem; line-height: 1; letter-spacing: -0.04em; }
.card dl { margin: 0; display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.card dd { margin: 2px 0 0; font-size: 15px; }
.card p .mono { text-transform: none; letter-spacing: 0; font-size: 12px; }
textarea, #title { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--sunk); padding: 10px 12px; }
#title { font-family: var(--display); font-weight: 600; font-size: 17px; }
textarea { min-height: 11rem; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.6; white-space: pre; overflow: auto; }
.row { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.row select { border: 1px solid var(--line); border-radius: 999px; background: var(--sunk); padding: 6px 12px; min-width: 0; max-width: 100%; }
#songs { flex: 1 1 8rem; text-overflow: ellipsis; }
.pill { border: 0; border-radius: 999px; background: var(--fg); color: var(--bg); padding: 8px 18px; font-weight: 500; }
.link { border: 0; background: none; padding: 4px 2px; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); }
.link:hover { color: var(--fg); }
.step { width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--line); background: var(--sunk); }
#shiftNo { min-width: 1.6rem; text-align: center; font-variant-numeric: tabular-nums; }

.dock { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); margin-bottom: 14px; padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 5; max-width: calc(100% - 16px); }
.dock div { overflow-x: auto; display: flex; gap: 2px; padding: 5px; border-radius: 999px; background: color-mix(in oklch, var(--surface) 86%, transparent); border: 1px solid var(--line); backdrop-filter: blur(16px); }
.dock button { border: 0; background: none; border-radius: 999px; padding: 9px 15px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.dock button[aria-current="page"] { background: var(--fg); color: var(--bg); }

@media (max-width: 640px) {
  .chart { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage { border-radius: 22px; }
  .tuner, .duo { grid-template-columns: minmax(0, 1fr); }
  .seg button { min-width: 2rem; height: 2.1rem; }
  .dock button { padding: 9px 7px; font-size: 12.5px; }
  .hero .figs { width: 100%; }
}

/* split views: a gradient hero for the headline facts, then a plain panel that is easy to read.
   Inside the panel the stage colours are swapped for the page's own, so every part follows. */
.stage:has(.split:not([hidden])) { min-height: 0; }
.view.split { display: block; padding: 0; }
.hero { display: grid; gap: 18px; padding: clamp(18px, 3vw, 32px); background: linear-gradient(to top, rgb(10 6 24 / 0.55), rgb(10 6 24 / 0.12)); }
.hero > * { min-width: 0; }
.figs { display: flex; gap: 10px; flex-wrap: wrap; }
.fig { display: grid; gap: 2px; padding: 8px 14px; border-radius: 12px; background: var(--st-glass); border: 1px solid var(--st-line); backdrop-filter: blur(14px); min-width: 4.6rem; }
.fig strong { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; white-space: nowrap; }
.fig span { color: var(--st-soft); }
.tag:empty { display: none; }
.pane { --st-fg: var(--fg); --st-soft: var(--muted); --st-glass: var(--sunk); --st-line: var(--line-strong); --st-ink: var(--bg);
  background: var(--surface); color: var(--fg); padding: clamp(14px, 2.4vw, 24px); display: grid; gap: 14px; }
.pane > * { min-width: 0; }
.pane .bar.on { background: color-mix(in oklch, var(--glow) 20%, transparent); }
.pane .empty { padding: 24px 0; }
.pane .step { background: var(--sunk); }

/* scales */
#neck { overflow-x: auto; scrollbar-width: thin; color: var(--fg); }
#neck svg { display: block; width: 100%; min-width: 46rem; height: auto; }
.dot circle { fill: var(--sunk); stroke: var(--line-strong); stroke-width: 1; }
.dot text { fill: var(--fg); font-family: var(--body); font-weight: 500; }
.dot.root circle { fill: var(--fg); }
.dot.root text { fill: var(--bg); }
.dot.blue circle { stroke-dasharray: 2 2; }
.dot.dim { opacity: 0.22; }
.dot.tone circle { stroke: var(--glow); stroke-width: 3.5; }
.dot.hit circle { fill: var(--glow); stroke: var(--fg); stroke-width: 2; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: none; border-radius: 999px; padding: 3px 12px; font-family: var(--display); font-weight: 600; font-size: 15px; }
.chip sup { font-size: 0.6em; vertical-align: 0.5em; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
#scTip { font-size: 15px; max-width: 60ch; }
.licks { display: grid; gap: 4px; }
.lick { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; border: 1px solid transparent; background: none; border-radius: 12px; padding: 8px 12px; text-align: left; }
.lick b { font-family: var(--display); font-weight: 600; font-size: 16px; }
.lick:hover { background: var(--sunk); }
.lick[aria-pressed="true"] { background: var(--sunk); border-color: var(--line-strong); }
.tab { margin: 0; overflow-x: auto; background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.35; white-space: pre; overflow-wrap: normal; }
#lickTitle { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--sunk); padding: 8px 12px; }
#lickPaste { min-height: 8rem; }

/* the level every tool is using, always in view */
.lvpill { flex: none; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--sunk); border-radius: 999px; padding: 4px 12px 4px 8px; white-space: nowrap; }
.lvpill::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--lv); transition: background 0.5s; }
.lvpill span { color: var(--muted); }
@media (max-width: 640px) { .lvpill span { display: none; } }

/* lessons */
.trail { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.trail span { display: inline-grid; gap: 1px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); }
.trail b { font-family: var(--display); font-weight: 600; font-size: 16px; }
.trail i { font-style: normal; font-size: 10px; }
.trail em { font-style: normal; color: var(--muted); }
.learn ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.learn p, .learn li { font-size: 15px; }
.eg { display: grid; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--sunk); border: 1px solid var(--line); }

/* a lick drawn as tab */
.lickbox { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--sunk); border: 1px solid var(--line); }
.lickbox > * { min-width: 0; }
#lickName { font-family: var(--display); font-size: 18px; }
#lickTab { overflow-x: auto; scrollbar-width: thin; }
#lickTab svg { display: block; height: auto; max-width: none; }
.tl { fill: var(--muted); font: 500 11px var(--mono); }
.ln { fill: var(--line-strong); }
.nb { fill: var(--surface); stroke: var(--fg); stroke-width: 1.3; }
.nf { fill: var(--fg); font: 600 13px var(--body); }
.nm { fill: var(--fg); font: 700 13px var(--body); }
.hold { fill: var(--line-strong); }
.tn.hit .nb { fill: var(--fg); }
.tn.hit .nf { fill: var(--bg); }
.tn.hit .hold { fill: var(--fg); }
details summary { cursor: pointer; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
#lickWords { margin: 8px 0 0; padding-left: 1.6em; display: grid; gap: 4px; }
#lickWords li.hit { font-weight: 600; }

/* tuner: shows that the app can hear the guitar */
.mic { display: grid; gap: 4px; width: min(100%, 14rem); justify-items: center; }
.mic div { width: 100%; height: 6px; border-radius: 3px; background: var(--st-glass); overflow: hidden; }
.mic i { display: block; height: 100%; width: 0; background: var(--st-fg); transition: width 0.08s linear; }
@media (max-width: 640px) { .tuner .note { order: -1; } } /* on a phone the note and needle come first, above the string list */

/* the seven chords of the key: number first, then the chord, coloured by family */
.keybox { display: grid; gap: 10px; }
.keybox > * { min-width: 0; }
.legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--muted); font-size: 13px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; margin-left: 8px; }
.legend .home, .kc.home { --c: var(--home); } .legend .away, .kc.away { --c: var(--away); } .legend .tension, .kc.tension { --c: var(--tension); }
.legend i { background: var(--c); }
.keyrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.kc { display: grid; justify-items: start; gap: 1px; padding: 8px 10px; border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: 12px; background: var(--sunk); text-align: left; min-width: 0; opacity: 0.55; }
.kc.used { opacity: 1; }
.kc b { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.1; color: var(--c); }
.kc strong { font-family: var(--display); font-weight: 600; font-size: 17px; }
.kc strong sup { font-size: 0.6em; vertical-align: 0.5em; }
.kc span, .kc i { font-style: normal; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kc[aria-pressed="true"] { outline: 2px solid var(--fg); outline-offset: 1px; opacity: 1; }
@media (max-width: 760px) { .keyrow { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
