/* Fretnetic — core design system. View-specific styles live in css/views-*.css */
/* App-level roles, aliased to the design tokens in tokens.css (themes live there). */
:root {
  --bg: var(--fn-canvas);
  --bg-2: var(--fn-canvas);
  --surface: var(--fn-surface);
  --surface-2: var(--fn-surface-raised);
  --surface-3: color-mix(in srgb, var(--fn-surface-raised) 55%, var(--fn-border));
  --border: var(--fn-border);
  --border-strong: color-mix(in srgb, var(--fn-border) 45%, var(--fn-border-control));
  --text: var(--fn-text);
  --text-2: var(--fn-text-secondary);
  --text-3: var(--fn-text-muted);
  /* coral as text / icons / small fills — the text-safe coral */
  --accent: var(--fn-accent-text);
  --accent-ink: var(--fn-on-accent-text);
  --accent-soft: var(--fn-accent-subtle);
  /* bright coral is reserved for root notes and play / go actions */
  --action: var(--fn-accent);
  --action-hover: var(--fn-accent-hover);
  --action-pressed: var(--fn-accent-pressed);
  --action-ink: var(--fn-on-accent);
  /* selection (active toggles) uses ink, so coral keeps its meaning */
  --select: var(--fn-button-primary);
  --select-hover: var(--fn-button-primary-hover);
  --select-ink: var(--fn-on-primary);
  --accent-2: var(--fn-secondary);
  --accent-2-ink: var(--fn-on-secondary);
  --warn: var(--fn-warning-fill);
  --good: var(--fn-success-fill);
  --bad: var(--fn-error-fill);
  --good-text: var(--fn-success); --warn-text: var(--fn-warning); --bad-text: var(--fn-error);
  --info: var(--fn-info);
  --focus: var(--fn-focus);
  --shadow: var(--fn-shadow-float);
  --ctl: 38px;      /* standard control height: inputs, selects, buttons, segmented groups */
  --ctl-sm: 32px;   /* compact controls inside cards */
  --radius: var(--fn-radius-panel);
  --radius-sm: var(--fn-radius-control);
  --font: var(--fn-font-ui);
  --font-display: var(--fn-font-display);
  --mono: var(--fn-font-ui); /* no third family: Inter with tabular numerals */
  /* fretboard */
  --fb-wood-1: var(--fn-board);
  --fb-wood-2: var(--fn-board);
  --fb-fret: var(--fn-fret-line);
  --fb-nut: var(--fn-nut);
  --fb-string: var(--fn-fret-line);
  --fb-inlay: var(--fn-inlay);
  --fb-label: var(--fn-note-ink);
  --fb-marker-stroke: var(--fn-marker-ring);
  --fb-ghost: var(--fn-ghost-fill);
  --fb-text: var(--fn-text-secondary);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; font-optical-sizing: auto; font-variation-settings: var(--fn-font-display-axes); letter-spacing: var(--fn-tracking-heading); line-height: var(--fn-leading-heading); margin: 0; }
p { margin: 0 0 0.6em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: var(--fn-focus-width) solid var(--focus); outline-offset: var(--fn-focus-offset); }
::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); color: var(--text); }
html { accent-color: var(--accent); caret-color: var(--accent); scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius); border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bg-2); border-right: 1px solid var(--border); padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; color: var(--text); text-decoration: none !important; }
.brand-mark svg { width: 34px; height: 34px; display: block; }
.brand-name { font-family: var(--font-display); font-size: 25px; font-weight: 600; letter-spacing: -0.04em; font-optical-sizing: auto; }
.brand-name b { color: inherit; font-weight: inherit; }
.nav { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.nav-heading { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-3); padding: 0 10px 4px; font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-weight: 500; text-decoration: none !important; transition: background .15s, color .15s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-foot { color: var(--text-3); padding: 0 10px; }
.nav-scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.icon-btn.menu-btn { display: none; }
.stats { display: flex; align-items: center; gap: 10px; flex: 1; }
.stat { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none !important; }
.stat.streak { color: var(--text-3); }
.stat.streak.lit { color: #ff8a3d; }
.stat.streak b { color: var(--text); }
.lvl-badge { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--action); color: var(--action-ink); font-weight: 700; font-size: 12px; }
.lvl-meta { display: flex; flex-direction: column; gap: 3px; min-width: 110px; }
.lvl-meta small { font-size: 11px; color: var(--text-2); line-height: 1; }
.xpbar { display: block; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.xpbar i { display: block; width: 100%; height: 100%; background: var(--action); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .5s cubic-bezier(.16, 1, .3, 1); }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: var(--ctl); height: var(--ctl); border-radius: var(--radius); background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.view { padding: 24px 28px 64px; max-width: 1400px; width: 100%; margin: 0 auto; outline: none; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fadeOnly { from { opacity: 0; } }

/* ---------- Page structure ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-header h1 { font-size: clamp(28px, 2.6vw, 38px); font-weight: 600; letter-spacing: var(--fn-tracking-display); line-height: var(--fn-leading-display); }
.page-sub { color: var(--text-2); margin: 4px 0 0; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.card + .card { margin-top: 16px; }
.card-title { font-size: 19px; font-weight: 600; margin-bottom: 10px; }
.card.error pre { white-space: pre-wrap; color: var(--bad-text); font-size: 12px; margin: 8px 0 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.section-gap { margin-top: 18px; }
/* In toolbars everything shares one height so rows line up */
.toolbar .btn-sm { height: var(--ctl); }
.toolbar .seg.small .seg-btn { height: calc(var(--ctl) - 8px); }
.toolbar .seg.wrap { row-gap: 2px; }
.toolbar > .btn, .toolbar > .btn-sm { align-self: flex-end; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }

/* ---------- Controls ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.grow { flex: 1; }
.field-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 600; }
.select { min-width: 150px; appearance: none; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2376809a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 0 34px 0 12px; font: inherit; height: var(--ctl); line-height: normal; cursor: pointer; max-width: 100%; }
.select:hover { border-color: var(--border-strong); }
.seg { display: inline-flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg.wrap { flex-wrap: wrap; }
.seg-btn { display: inline-flex; align-items: center; justify-content: center; height: calc(var(--ctl) - 8px); background: transparent; border: 0; padding: 0 12px; border-radius: 7px; color: var(--text-2); cursor: pointer; font-weight: 500; white-space: nowrap; }
.seg.small .seg-btn { height: calc(var(--ctl-sm) - 8px); padding: 0 10px; font-size: 13px; }
.seg-btn:hover { color: var(--text); background: var(--surface-3); }
.seg-btn.active { background: var(--select); color: var(--select-ink); font-weight: 600; }
.root-picker .seg-btn { min-width: 38px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--ctl); padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 600; line-height: 1; white-space: nowrap; transition: transform .08s, background .15s, border-color .15s; }
.btn:hover { border-color: var(--border-strong); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { height: var(--ctl-sm); padding: 0 11px; font-size: 13px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-accent { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.btn-accent:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn-accent:active { background: var(--action-pressed); border-color: var(--action-pressed); box-shadow: inset 0 0 0 1.5px var(--action-ink); }
.btn-pink { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-2-ink); }
.btn-ghost { background: transparent; }
.btn-big { height: 48px; padding: 0 22px; font-size: 16px; border-radius: var(--radius); }
.range { accent-color: var(--accent); width: 100%; }
input[type="text"], input[type="number"], input[type="search"], textarea { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 0 12px; font: inherit; height: var(--ctl); }
textarea { height: auto; padding: 8px 12px; }
.toggle { display: inline-flex; align-items: center; min-height: var(--ctl-sm); gap: 8px; cursor: pointer; color: var(--text-2); font-size: 14px; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.chip-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip-pink { background: color-mix(in srgb, var(--accent-2) 16%, transparent); color: var(--accent-2); border-color: transparent; }
.note-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.note-chip { display: inline-flex; flex-direction: column; align-items: center; min-width: 46px; padding: 6px 8px 5px; border-radius: var(--radius); background: color-mix(in srgb, var(--c) 18%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); }
.note-chip b { font-size: 16px; font-family: var(--font-display); }
.note-chip small { font-size: 11px; color: color-mix(in srgb, var(--text) 82%, transparent); font-weight: 600; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

/* ---------- Fretboard ---------- */
.fretboard-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 12px 8px; overflow-x: auto; }
.fretboard { display: block; width: 100%; height: auto; user-select: none; }
.fb-fret { stroke: var(--fb-fret); stroke-width: 2.2; opacity: .75; }
.fb-nut { stroke: var(--fb-nut); stroke-width: 7; }
.fb-string { stroke: var(--fb-string); opacity: .8; }
.fb-inlay { fill: var(--fb-inlay); }
.fb-strname, .fb-fretnum { fill: var(--fb-text); font-size: 13px; font-family: var(--font); font-weight: 600; font-variant-numeric: tabular-nums; }
.fb-fretnum.strong { fill: var(--text-2); }
.fb-window { fill: var(--fn-position-fill); stroke: color-mix(in srgb, var(--fn-focus) 45%, transparent); stroke-width: 1; }
.fb-hit { fill: transparent; cursor: pointer; }
.fb-hit:hover { fill: rgba(255, 255, 255, 0.08); }
.fb-hit:focus { outline: none; }
.fb-hit:focus-visible { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; rx: 6px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 200; padding: 10px 16px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none !important; transition: top .15s; }
.skip-link:focus { top: 12px; }
.card.error { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); display: flex; flex-direction: column; gap: 10px; }
.card.error h2 { font-size: 20px; }
.card.error details { font-size: 13px; color: var(--text-3); }
.card.error summary { cursor: pointer; }
.fb-marker { transition: opacity .2s; }
/* notes arriving on the neck: ripple out from the nut in fret order */
.fb-marker.fb-in { animation: fbIn .34s cubic-bezier(.16, 1, .3, 1) both; animation-delay: var(--d, 0ms); transform-box: fill-box; transform-origin: center; }
@keyframes fbIn { from { opacity: 0; transform: scale(.45); } }
/* a plucked string: a quick decaying vibration + accent flash */
.fb-string.vibrate { animation: fbPluck .5s cubic-bezier(.3, .7, .4, 1); transform-box: fill-box; }
@keyframes fbPluck {
  0% { transform: translateY(0); stroke: var(--accent); opacity: 1; }
  12% { transform: translateY(-1.8px); }
  26% { transform: translateY(1.4px); }
  40% { transform: translateY(-1px); }
  54% { transform: translateY(.6px); }
  70% { transform: translateY(-.3px); }
  100% { transform: translateY(0); }
}
.fb-marker.ghost { opacity: .55; }
.fb-label { font-size: 14px; font-weight: 600; font-family: var(--font); pointer-events: none; }
.fb-label.small { font-size: 11px; }
.fb-label.compact { font-size: 11.5px; }
.fb-label.compact.small { font-size: 9px; }
.fb-marker.pulse circle, .fb-marker.pulse rect { animation: pulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 50% { transform: scale(1.18); } }
.fb-marker.correct circle, .fb-marker.correct rect { stroke: var(--good); stroke-width: 3; }
.fb-marker.wrong circle, .fb-marker.wrong rect { stroke: var(--bad); stroke-width: 3; }
.fb-marker.active-note circle, .fb-marker.active-note rect { stroke: #fff; stroke-width: 3.5; }

/* ---------- Chord diagrams ---------- */
.chord-diagram { width: 150px; height: auto; display: block; }
.chord-diagram.sm { width: 110px; }
.chord-diagram.lg { width: 200px; }
.cd-title { fill: var(--text); font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.cd-nut { fill: var(--text); }
.cd-fret { stroke: var(--border-strong); stroke-width: 1.4; }
.cd-string { stroke: var(--text-3); stroke-width: 1.3; }
.cd-basefret { fill: var(--text-2); font-size: 12px; font-weight: 700; }
.cd-x { fill: var(--text-3); font-size: 15px; font-weight: 700; }
.cd-open { fill: none; stroke: var(--text-2); stroke-width: 1.8; }
.cd-dot { stroke: rgba(0, 0, 0, .3); stroke-width: 1; }
.cd-dot.root { stroke: var(--text); stroke-width: 2; }
.cd-barre { fill: var(--text-3); opacity: .45; }
.cd-dot-label { fill: var(--fn-note-ink); font-size: 10px; font-weight: 700; }
.cd-dot-label.small { font-size: 8px; }
.chord-diagram.fingers .cd-dot { fill: var(--text) !important; }
.chord-diagram.fingers .cd-dot.root { fill: var(--action) !important; stroke: var(--text); }
.chord-diagram.fingers .cd-dot-label { fill: var(--bg); font-size: 11px; }
.cd-bottom { fill: var(--text-3); font-size: 10px; font-weight: 600; }
.voicing-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, transform .15s; }
.voicing-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.voicing-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.voicing-card .vc-meta { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.voicing-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }

/* ---------- Legend ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

/* ---------- Feedback ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text); padding: 10px 14px; border-radius: var(--radius); box-shadow: var(--shadow); animation: toastIn .3s ease; max-width: 340px; font-weight: 500; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .4s; }
.toast-level { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface-3)); }
.toast-achievement { border-color: var(--accent-2); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.xp-pop { position: fixed; top: 64px; right: 32px; z-index: 110; background: var(--action); color: var(--action-ink); font-weight: 700; padding: 6px 14px; border-radius: 999px; font-family: var(--font-display); animation: xpPop 1.4s ease forwards; display: flex; gap: 8px; align-items: baseline; box-shadow: var(--shadow); }
.xp-pop small { font-weight: 600; opacity: .8; }
@keyframes xpPop { 0% { opacity: 0; transform: translateY(10px) scale(.9); } 15% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.modal-back { position: fixed; inset: 0; background: rgba(5, 8, 14, .6); display: grid; place-items: center; z-index: 90; padding: 16px; animation: fadeIn .2s; }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); width: min(620px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 20px; }
.modal-body { padding: 18px 20px 22px; }
.settings-grid { display: grid; gap: 16px; }
.settings-danger { padding-top: 8px; border-top: 1px solid var(--border); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .25s; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .nav-scrim { display: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 25; }
  .icon-btn.menu-btn { display: inline-grid; }
  .view { padding: 18px 16px 56px; }
  .topbar { padding: 8px 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 24px; }
  .lvl-meta { min-width: 80px; }
}
@media (max-width: 520px) { .lvl-meta small { display: none; } }

/* ---------- Instrument button & drawer ---------- */
.instr-btn { display: inline-flex; align-items: center; gap: 10px; height: var(--ctl); padding: 0 10px 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; max-width: 100%; transition: border-color .15s; }
.instr-btn:hover { border-color: var(--accent); }
.instr-btn > .icon { width: 15px; height: 15px; color: var(--text-3); }
.instr-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; display: block; }
.instr-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.instr-text b { font-size: 13px; white-space: nowrap; }
.instr-text small { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.instr-btn.compact { height: 34px; border-radius: 999px; background: var(--surface); }
.topbar-instr { display: flex; }
.drawer-back { position: fixed; inset: 0; z-index: 95; background: rgba(5, 8, 14, .5); animation: fadeIn .2s; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: drawerIn .22s ease; }
.drawer-back.closing { opacity: 0; transition: opacity .2s; }
.drawer-back.closing .drawer { transform: translateX(100%); transition: transform .2s; }
@keyframes drawerIn { from { transform: translateX(100%); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 19px; }
.drawer-body { padding: 6px 20px 24px; overflow-y: auto; flex: 1; }
.drawer-section { padding: 14px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section .seg { align-self: flex-start; }
.drawer-section .range { flex: 1; }
.drawer-note { font-size: 13px; margin: 0; }
.tuning-list { display: flex; flex-direction: column; gap: 6px; }
.tuning-card { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.tuning-card:hover { border-color: var(--border-strong); }
.tuning-card.active { border-color: var(--accent); background: var(--accent-soft); }
.tc-name { font-weight: 600; }
.tuning-card.active .tc-name { color: var(--accent); }
.tc-notes { grid-column: 1; font-size: 12px; color: var(--text-3); }
.tc-play { grid-row: 1 / span 2; grid-column: 2; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--text-2); }
.tc-play:hover { background: var(--surface-3); color: var(--text); }
.tc-play .icon { width: 15px; height: 15px; }
.drawer-custom-btn { align-self: flex-start; }

/* ---------- Neck controls (secondary row) ---------- */
.neck-controls { display: inline-flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; }
.nc-pair { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.neck-controls .field-label { margin: 0; }
.neck-controls .range { width: 130px; }
.nc-val { min-width: 22px; font-size: 14px; }
.ch-neck-head { margin-bottom: 10px; }
@media (max-width: 600px) { .neck-controls { width: 100%; justify-content: space-between; } .neck-controls .range { width: auto; flex: 1; min-width: 110px; } .nc-pair:first-child { flex: 1; } }

/* ---------- Metronome card ---------- */
.metro-card { display: flex; flex-direction: column; gap: 10px; }
.metro-head { display: flex; align-items: center; justify-content: space-between; }
.metro-head .card-title { margin: 0; }
.metro-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metro-readout { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.metro-bpm { font-family: var(--font-display); font-size: 40px; font-weight: 700; letter-spacing: -0.02em; }
.metro-readout small { font-size: 10px; letter-spacing: .12em; color: var(--text-3); font-weight: 700; margin-top: 2px; }
.metro-tempo { font-size: 12px; margin-top: 4px; }
.icon-btn.metro-step { width: 44px; height: 44px; font-size: 22px; font-weight: 700; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.metro-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.metro-dots { display: inline-flex; gap: 6px; }
.metro-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .06s, transform .08s ease-out; }
.metro-dots i.first { box-shadow: inset 0 0 0 2px var(--surface); border-color: var(--accent-2); }
.metro-dots i.on { background: var(--action); border-color: var(--action); transform: scale(1.25); }
.metro-dots i.first.on { background: var(--accent-2); border-color: var(--accent-2); transform: scale(1.35); }
.custom-tuning { display: flex; flex-direction: column; gap: 14px; }
.ct-strings { display: flex; flex-direction: column; gap: 6px; }
.ct-row { display: flex; align-items: center; gap: 8px; }
.ct-row .select { min-width: 0; width: 90px; }
.ct-num { width: 72px; font-size: 13px; color: var(--text-2); }
.ct-actions { padding-top: 6px; border-top: 1px solid var(--border); }
@media (max-width: 1100px) { .topbar-instr { display: none; } }

/* fretboard-heavy tools use the full desktop width */
.view.view-explore, .view.view-scales, .view.view-chords, .view.view-arpeggios, .view.view-chord-finder,
.view.view-scale-finder, .view.view-chord-scales, .view.view-progressions, .view.view-games { max-width: none; }

/* ---------- Touch & small screens: 44px targets, safe areas ---------- */
@media (pointer: coarse), (max-width: 600px) {
  :root { --ctl: 46px; --ctl-sm: 44px; }
  .seg { padding: 2px; gap: 3px; }
  .seg-btn, .seg.small .seg-btn, .toolbar .seg.small .seg-btn { height: calc(var(--ctl-sm) - 6px); min-height: 40px; padding: 0 12px; }
  .root-picker .seg-btn { min-width: 44px; }
  .btn, .btn-sm, .toolbar .btn-sm { height: var(--ctl-sm); padding: 0 14px; }
  .icon-btn { width: 44px; height: 44px; }
  .stat { min-height: 40px; }
  .instr-btn, .instr-btn.compact { height: var(--ctl-sm); }
  .nav-link { min-height: 44px; }
  .range { height: 28px; }
  .fretboard.touch .fb-label { font-size: 16px; }
  .fretboard.touch .fb-label.small { font-size: 13px; }
  .fretboard.touch .fb-strname, .fretboard.touch .fb-fretnum { font-size: 16px; }
  .dia-chip, .degree-chip { min-height: 48px; }
  .tuning-card { min-height: 52px; }
  .ch-quick-btn, .prg-keybtn { min-height: 44px; }
}
/* no sticky "lifted" hover states on touch screens */
@media (hover: none) {
  .voicing-card:hover, .degree-chip:hover, .btn:active { transform: none; }
}
/* notched phones */
.topbar { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.sidebar { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
@media (max-width: 900px) {
  .topbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .view { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); padding-bottom: max(56px, env(safe-area-inset-bottom)); }
}

/* ---------- Reduced motion: keep state, drop movement ----------
   Colour, opacity and state changes stay (they carry meaning); translation, scaling, shaking,
   pulsing and hover lifts go. Not a global kill: feedback remains legible. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .view, .modal-back, .gm-results, .gm-prompt.in, .ln-quiz-result.show, .wo-done-inner, .gm-card { animation-name: fadeOnly; }
  .toast, .xp-pop { animation-name: fadeOnly; }
  .toast.out { transform: none; }
  .drawer { animation: fadeOnly .2s ease; }
  .drawer-back.closing .drawer { transform: none; }
  .fb-marker.fb-in { animation-name: fadeOnly; animation-delay: 0ms; animation-duration: .2s; }
  .fb-string.vibrate { animation: fbPluckStill .5s ease; }
  @keyframes fbPluckStill { 0% { stroke: var(--accent); opacity: 1; } }
  .fb-marker.pulse circle, .fb-marker.pulse rect, .gm-deg.ask, .gm-shake, .gm-note.bad, .gm-choice.bad, .ln-choice.bad,
  .gm-hud-combo.bump .gm-hud-val, .gm-newbest, .wo-item.checked .wo-check, .hm-badge.got .hm-badge-icon, .gm-listen.ping,
  .gm-board .fb-marker.gm-pop circle, .gm-board .fb-marker.gm-pop rect { animation: none; }
  .gm-banner.show { animation: gmBannerStill 1s ease forwards; transform: translate(-50%, -50%); }
  @keyframes gmBannerStill { 0% { opacity: 0; } 15%, 70% { opacity: 1; } 100% { opacity: 0; } }
  .gm-float { animation: fadeOnly .2s ease reverse forwards; transform: none; }
  .hm-xpbar i { animation: none; }
  .voicing-card:hover, .degree-chip:hover, .gm-card:hover, .prg-chord:hover, .ln-node:hover, .hm-cont:hover, .btn:active, .metro-dots i.on, .wo-dots i.on { transform: none; }
  .fb-marker.pulse circle, .fb-marker.pulse rect { stroke: var(--text); stroke-width: 3; }
  .gm-deg.ask { outline: 2px solid var(--accent-2); outline-offset: 2px; }
}
