/* Fretbored — styles. Dark theme by default; other app themes via [data-theme="…"] (list in app.js). */

:root {
  --bg: #0c0f14;
  --bg-glow-1: rgba(124, 108, 255, 0.16);
  --bg-glow-2: rgba(255, 122, 89, 0.1);
  --surface: #131823;
  --surface-2: #1a2130;
  --surface-3: #232b3d;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e8ecf4;
  --text-2: #a7b0c2;
  --text-3: #6f7a8f;
  --accent: #ff7a59;
  --accent-2: #7c6cff;
  --accent-soft: rgba(255, 122, 89, 0.14);
  --accent-text: #ffb199;
  --good: #3dd6c3;
  --danger: #ff5c7a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
  --fretnum: #6f7a8f;
  --focus: 0 0 0 3px rgba(124, 108, 255, 0.55);
  --on-accent: #ffffff; /* text on accent-filled buttons */
  color-scheme: dark;
  --dot-root: #ff7a59; /* fretboard note dots: root and other notes, with their label colours */
  --dot-root-ink: #ffffff;
  --dot-note: #7c6cff;
  --dot-note-ink: #ffffff;
}

:root[data-theme='light'] {
  --bg: #f5f6fa;
  --bg-glow-1: rgba(124, 58, 237, 0.08);
  --bg-glow-2: rgba(37, 99, 235, 0.08);
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --surface-3: #e7eaf2;
  --border: rgba(20, 30, 60, 0.08);
  --border-strong: rgba(20, 30, 60, 0.16);
  --text: #171c28;
  --text-2: #4b5468;
  --text-3: #808aa0;
  --accent: #2563eb;
  --accent-2: #7c3aed;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --accent-text: #1d4ed8;
  --shadow: 0 8px 24px rgba(20, 30, 60, 0.08);
  --fretnum: #808aa0;
  --focus: 0 0 0 3px rgba(37, 99, 235, 0.45);
  color-scheme: light;
  --dot-root: #e11d48;
  --dot-root-ink: #ffffff;
  --dot-note: #2563eb;
  --dot-note-ink: #ffffff;
}

/* Pure black for OLED screens: near-black boxes, no glows or shadows, neon cyan → blue accents. */
:root[data-theme='amoled'] {
  --bg: #000000;
  --bg-glow-1: transparent;
  --bg-glow-2: transparent;
  --surface: #030303;
  --surface-2: #0b0b0c;
  --surface-3: #161618;
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #ececf1;
  --text-2: #a3a6b0;
  --text-3: #6c707b;
  --accent: #22d3ee;
  --accent-2: #3b82f6;
  --accent-soft: rgba(34, 211, 238, 0.13);
  --accent-text: #67e8f9;
  --on-accent: #001318;
  --shadow: none;
  --fretnum: #6c707b;
  --focus: 0 0 0 3px rgba(34, 211, 238, 0.5);
  --dot-root: #22d3ee;
  --dot-root-ink: #001318;
  --dot-note: #3b82f6;
  --dot-note-ink: #ffffff;
}

/* Dracula palette (draculatheme.com): pink accent, purple second accent. */
:root[data-theme='dracula'] {
  --bg: #21222c;
  --bg-glow-1: rgba(189, 147, 249, 0.12);
  --bg-glow-2: rgba(255, 121, 198, 0.08);
  --surface: #282a36;
  --surface-2: #313342;
  --surface-3: #44475a;
  --border: rgba(248, 248, 242, 0.08);
  --border-strong: rgba(248, 248, 242, 0.16);
  --text: #f8f8f2;
  --text-2: #c5c8d6;
  --text-3: #7f8bbd;
  --accent: #ff79c6;
  --accent-2: #bd93f9;
  --accent-soft: rgba(255, 121, 198, 0.15);
  --accent-text: #ff9ad5;
  --on-accent: #21222c;
  --good: #50fa7b;
  --danger: #ff5555;
  --fretnum: #7f8bbd;
  --focus: 0 0 0 3px rgba(189, 147, 249, 0.6);
  --dot-root: #ff79c6;
  --dot-root-ink: #282a36;
  --dot-note: #8be9fd;
  --dot-note-ink: #282a36;
}

/* Solarized dark (ethanschoonover.com/solarized): yellow → orange accents. */
:root[data-theme='solarized'] {
  --bg: #002b36;
  --bg-glow-1: rgba(108, 113, 196, 0.12);
  --bg-glow-2: rgba(203, 75, 22, 0.08);
  --surface: #073642;
  --surface-2: #0c404d;
  --surface-3: #154b59;
  --border: rgba(147, 161, 161, 0.14);
  --border-strong: rgba(147, 161, 161, 0.28);
  --text: #eee8d5;
  --text-2: #a5b2b2;
  --text-3: #6f8a91;
  --accent: #b58900;
  --accent-2: #cb4b16;
  --accent-soft: rgba(181, 137, 0, 0.18);
  --accent-text: #e0b030;
  --on-accent: #002b36;
  --good: #2aa198;
  --danger: #dc322f;
  --fretnum: #6f8a91;
  --focus: 0 0 0 3px rgba(108, 113, 196, 0.6);
  --dot-root: #cb4b16;
  --dot-root-ink: #fdf6e3;
  --dot-note: #268bd2;
  --dot-note-ink: #fdf6e3;
}

/* Tokyo Night (night variant): deep navy, blue → cyan accents. */
:root[data-theme='tokyonight'] {
  --bg: #16161e;
  --bg-glow-1: rgba(122, 162, 247, 0.1);
  --bg-glow-2: rgba(187, 154, 247, 0.06);
  --surface: #1a1b26;
  --surface-2: #1f2335;
  --surface-3: #292e42;
  --border: rgba(192, 202, 245, 0.08);
  --border-strong: rgba(192, 202, 245, 0.16);
  --text: #c0caf5;
  --text-2: #a9b1d6;
  --text-3: #737aa2;
  --accent: #7aa2f7;
  --accent-2: #7dcfff;
  --accent-soft: rgba(122, 162, 247, 0.15);
  --accent-text: #7aa2f7;
  --on-accent: #16161e;
  --good: #9ece6a;
  --danger: #f7768e;
  --fretnum: #737aa2;
  --focus: 0 0 0 3px rgba(122, 162, 247, 0.5);
  --dot-root: #ff9e64;
  --dot-root-ink: #1a1b26;
  --dot-note: #7aa2f7;
  --dot-note-ink: #1a1b26;
}

/* Catppuccin Latte (light): mauve → pink accents. */
:root[data-theme='latte'] {
  --bg: #e6e9ef;
  --bg-glow-1: rgba(136, 57, 239, 0.06);
  --bg-glow-2: rgba(234, 118, 203, 0.06);
  --surface: #eff1f5;
  --surface-2: #e6e9ef;
  --surface-3: #ccd0da;
  --border: rgba(76, 79, 105, 0.12);
  --border-strong: rgba(76, 79, 105, 0.22);
  --text: #4c4f69;
  --text-2: #5c5f77;
  --text-3: #8c8fa1;
  --accent: #8839ef;
  --accent-2: #ea76cb;
  --accent-soft: rgba(136, 57, 239, 0.12);
  --accent-text: #8839ef;
  --on-accent: #ffffff;
  --good: #40a02b;
  --danger: #d20f39;
  --fretnum: #8c8fa1;
  --shadow: 0 8px 24px rgba(76, 79, 105, 0.1);
  --focus: 0 0 0 3px rgba(136, 57, 239, 0.4);
  color-scheme: light;
  --dot-root: #8839ef;
  --dot-root-ink: #ffffff;
  --dot-note: #179299;
  --dot-note-ink: #ffffff;
}

/* Catppuccin Frappé (catppuccin.com/palette): green → teal accents. */
:root[data-theme='frappe'] {
  --bg: #292c3c;
  --bg-glow-1: rgba(166, 209, 137, 0.08);
  --bg-glow-2: transparent;
  --surface: #303446;
  --surface-2: #414559;
  --surface-3: #51576d;
  --border: rgba(205, 214, 244, 0.08);
  --border-strong: rgba(205, 214, 244, 0.16);
  --text: #c6d0f5;
  --text-2: #a5adce;
  --text-3: #737994;
  --accent: #a6d189;
  --accent-2: #81c8be;
  --accent-soft: rgba(166, 209, 137, 0.15);
  --accent-text: #a6d189;
  --on-accent: #232634;
  --good: #a6d189;
  --danger: #e78284;
  --fretnum: #838ba7;
  --focus: 0 0 0 3px rgba(166, 209, 137, 0.5);
  --dot-root: #a6d189;
  --dot-root-ink: #232634;
  --dot-note: #ca9ee6;
  --dot-note-ink: #232634;
}

/* Catppuccin Macchiato (catppuccin.com/palette): peach → red accents. */
:root[data-theme='macchiato'] {
  --bg: #1e2030;
  --bg-glow-1: rgba(245, 169, 127, 0.08);
  --bg-glow-2: transparent;
  --surface: #24273a;
  --surface-2: #363a4f;
  --surface-3: #494d64;
  --border: rgba(205, 214, 244, 0.08);
  --border-strong: rgba(205, 214, 244, 0.16);
  --text: #cad3f5;
  --text-2: #a5adcb;
  --text-3: #6e738d;
  --accent: #f5a97f;
  --accent-2: #ed8796;
  --accent-soft: rgba(245, 169, 127, 0.15);
  --accent-text: #f5a97f;
  --on-accent: #181926;
  --good: #a6da95;
  --danger: #ed8796;
  --fretnum: #8087a2;
  --focus: 0 0 0 3px rgba(245, 169, 127, 0.5);
  --dot-root: #ed8796;
  --dot-root-ink: #181926;
  --dot-note: #eed49f;
  --dot-note-ink: #181926;
}

/* Catppuccin Mocha (catppuccin.com/palette): mauve → pink accents. */
:root[data-theme='mocha'] {
  --bg: #181825;
  --bg-glow-1: rgba(203, 166, 247, 0.08);
  --bg-glow-2: transparent;
  --surface: #1e1e2e;
  --surface-2: #313244;
  --surface-3: #45475a;
  --border: rgba(205, 214, 244, 0.08);
  --border-strong: rgba(205, 214, 244, 0.16);
  --text: #cdd6f4;
  --text-2: #a6adc8;
  --text-3: #6c7086;
  --accent: #cba6f7;
  --accent-2: #f5c2e7;
  --accent-soft: rgba(203, 166, 247, 0.15);
  --accent-text: #cba6f7;
  --on-accent: #11111b;
  --good: #a6e3a1;
  --danger: #f38ba8;
  --fretnum: #7f849c;
  --focus: 0 0 0 3px rgba(203, 166, 247, 0.5);
  --dot-root: #cba6f7;
  --dot-root-ink: #11111b;
  --dot-note: #94e2d5;
  --dot-note-ink: #11111b;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overscroll-behavior-x: none; } /* sideways swipes change tabs, not browser history */

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); }

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible { outline: none; box-shadow: var(--focus); }

[hidden] { display: none !important; }

/* ---------------------------------------------------------------- Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: 'brand tabs actions';
  align-items: center;
  gap: 16px;
  padding: 12px max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 19px;
  letter-spacing: -0.01em;
  font-weight: 600;
}
/* Wordmark: Audiowide glyphs converted to SVG paths (no web fonts at runtime) */
.wordmark { height: 19px; width: auto; flex: none; display: block; }
.wm-fret { fill: var(--text); }
.wm-bored { fill: var(--accent-2); }
.logo { width: 30px; height: 30px; flex: none; }

.tabs {
  grid-area: tabs;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  justify-self: center;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected='true'] {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent-2) 30%, transparent);
}

.top-actions { grid-area: actions; display: flex; gap: 6px; align-items: center; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.inline .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
.install-btn { padding: 7px 12px; }
@media (max-width: 760px) { .install-btn span { display: none; } }
.theme-picker { position: relative; }
.theme-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 190px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.theme-menu[hidden] { display: none; }
.theme-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; white-space: nowrap;
}
.theme-item:hover, .theme-item:focus-visible { background: var(--surface-2); outline: none; }
.theme-item[aria-checked='true'] { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
/* Swatch: page background with a card and an accent dot. */
.theme-swatch {
  width: 28px; height: 20px; border-radius: 6px; flex: none; position: relative;
  background: var(--sw-bg); box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.45);
}
.theme-swatch::before { content: ''; position: absolute; left: 4px; top: 5px; width: 12px; height: 10px; border-radius: 3px; background: var(--sw-card); }
.theme-swatch::after { content: ''; position: absolute; right: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--sw-accent); }

/* ---------------------------------------------------------------- Layout */

main { max-width: 1320px; margin: 0 auto; padding: 20px 20px 8px; overflow-x: clip; } /* tab slide-in never widens the page */

.panel { display: flex; flex-direction: column; gap: 16px; animation: fade 0.25s ease; }

.panel.slide-next { animation: slideNext 0.24s cubic-bezier(0.2, 0.8, 0.3, 1); }
.panel.slide-prev { animation: slidePrev 0.24s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes slideNext { from { opacity: 0.3; transform: translateX(45%); } to { opacity: 1; transform: none; } }
@keyframes slidePrev { from { opacity: 0.3; transform: translateX(-45%); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel, .panel.slide-next, .panel.slide-prev { animation: none; } }
:root[data-theme='amoled'] .card { background: var(--surface); } /* flat near-black, no sheen */
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, white 2%), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.controls { display: flex; flex-direction: column; gap: 14px; }

.control-row { display: grid; grid-template-columns: 76px 1fr; align-items: start; gap: 12px; }
.control-row > .seg { justify-self: start; }
.control-row > .seg { justify-self: start; }
.row-label {
  padding-top: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.inline { display: flex; align-items: center; gap: 8px; }
.inline.wrap { flex-wrap: wrap; }
.gap-lg { gap: 14px 22px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }

.muted { color: var(--text-2); }
.small { font-size: 13px; }

.hint { margin: 10px 2px 0; font-size: 13px; color: var(--text-3); }
.hint.center { text-align: center; }
.tap-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.tap-row .hint { margin: 0; flex: 1 1 260px; }

.section-title {
  margin: 4px 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.section-title:not(:first-child) { margin-top: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-head .section-title { margin: 4px 0; }

/* ---------------------------------------------------------------- Pills, segments, buttons */

.pills { display: flex; flex-wrap: wrap; gap: 6px; }

.pill {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  min-width: 40px;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.pill:hover { color: var(--text); border-color: var(--border-strong); }
.pill:active { transform: scale(0.96); }
.pill.active {
  color: var(--on-accent);
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  box-shadow: 0 3px 12px color-mix(in srgb, var(--accent) 28%, transparent);
}
.pill.custom { background: var(--surface-3); color: var(--text); box-shadow: none; border: 1px dashed var(--border-strong); }
.root-pills .pill { min-width: 52px; }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex-wrap: wrap;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 12px;
  font-weight: 650;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s, box-shadow 0.2s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  border-color: transparent;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent-2) 28%, transparent);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; }
.btn.round { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 14px; flex: none; }
.btn.round.small { width: 32px; height: 32px; font-size: 16px; }

select, input[type='text'], input[type='number'] {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 7px 10px;
  min-height: 36px;
  color: var(--text);
}
select { padding-right: 28px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
input[type='number'] { width: 76px; }
.scale-select { min-width: 240px; max-width: 100%; }
.tuning-select { max-width: 260px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.field.disabled { opacity: 0.45; }
.switch-field { flex-direction: column; }
.switch-field.compact { flex-direction: row; align-items: center; gap: 10px; margin-left: 8px; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong);
  transition: background 0.2s;
}
.switch .slider::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s;
}
.switch input:checked + .slider { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch input:focus-visible + .slider { box-shadow: var(--focus); }

input[type='range'] {
  -webkit-appearance: none; appearance: none; background: transparent; height: 28px; min-width: 120px; padding: 0;
}
input[type='range']::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--surface-3); }
input[type='range']::-moz-range-track { height: 6px; border-radius: 999px; background: var(--surface-3); }
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; margin-top: -7px;
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
input[type='range']::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
input:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------------------------------------------------------- Hero cards */

.hero { display: flex; flex-direction: column; gap: 14px; }
.hero-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero-title { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 750; }
.accent-text { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--text-2); margin-top: 4px; font-size: 14px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.note-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 52px; padding: 7px 10px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  animation: pop 0.25s ease;
}
.chip-note { font-weight: 750; font-size: 17px; }
.chip-iv { font-size: 12px; color: var(--text-3); font-weight: 600; }
.chip.root { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.chip.root .chip-note { color: var(--accent-text); }
.chip.missing { opacity: 0.4; border-style: dashed; }

@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }

.match { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.match:empty { display: none; }
.match-label { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 2px; }
.match-label:not(:first-child) { margin-left: 10px; }
.chip-btn {
  border: 1px solid var(--border-strong); background: transparent; color: var(--text);
  padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.chip-btn:hover:not(.static) { background: var(--surface-2); }
.chip-btn.static { cursor: default; color: var(--text-2); }
.chip-btn .diff { color: var(--text-3); font-weight: 500; margin-left: 4px; }

.chord-hero { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 20px; }
.hero-main { display: flex; flex-direction: column; gap: 14px; flex: 1; min-width: 0; }
.chord-box svg { display: block; }
.cb-line { stroke: var(--text-3); stroke-width: 1.2; }
.cb-nut { fill: var(--text-2); }
.cb-fr { fill: var(--text-2); font-size: 12px; font-weight: 700; }
.cb-mark { fill: var(--text-2); font-size: 15px; text-anchor: middle; dominant-baseline: middle; }
.cb-open { fill: none; stroke: var(--text-2); stroke-width: 1.6; }
.cb-dot { fill: var(--dot); }

/* ---------------------------------------------------------------- Fretboard */

.board-card { padding-bottom: 14px; }

.fb-controls {
  display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end;
  padding: 14px 4px; border-bottom: 1px solid var(--border);
}


.fretboard-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 6px 0 2px;
  scrollbar-width: thin;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.fretboard { display: block; }
.fretboard-scroll.vertical { overflow-x: hidden; display: flex; justify-content: center; }
.neck-toggle { display: block; margin: 6px auto 0; }
.neck-toggle[hidden] { display: none; }
.mobile-only { display: none !important; }
.fretboard.wood-ebony { --board-1: #121010; --board-2: #1f1b19; --fret: #c9ccd3; --inlay: rgba(235, 230, 220, 0.6); --nut: #efe8da; }
.fretboard.wood-rosewood { --board-1: #2a1d17; --board-2: #3d2a20; --fret: #c9ccd3; --inlay: rgba(240, 232, 220, 0.55); --nut: #efe8da; }
.fretboard.wood-maple { --board-1: #dcb47c; --board-2: #ecca95; --fret: #8f9298; --inlay: rgba(25, 20, 18, 0.8); --nut: #2b2522; }
.fretboard .board { filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35)); }
.fretboard .inlay { fill: var(--inlay); }
.fretboard .fret { stroke: var(--fret); stroke-width: 2.2; opacity: 0.85; }
.fretboard .nut { fill: var(--nut); }
.fretboard.wood-maple .string { stroke: rgba(40, 30, 20, 0.55); stroke-width: 0.6; }
.fretboard .fretnum { fill: var(--fretnum); font-size: 11px; text-anchor: middle; font-weight: 600; }
.fretboard .fretnum.marked { fill: var(--text-2); font-weight: 800; }
.fretboard .cell { cursor: pointer; }
.fretboard .cell rect { fill: transparent; }
.fretboard .cell .ghost { fill: var(--text); opacity: 0; transition: opacity 0.12s; pointer-events: none; }
@media (hover: hover) { .fretboard .cell:hover .ghost { opacity: 0.16; } }
.fretboard .shade { fill: var(--bg); opacity: 0.62; pointer-events: none; }
.fretboard .mute { fill: var(--text-2); font-size: 20px; text-anchor: middle; dominant-baseline: central; pointer-events: none; }

.fretboard .note { pointer-events: none; }
.fretboard .note .dot { fill: var(--dot); stroke: rgba(0, 0, 0, 0.35); stroke-width: 1; }
.fretboard .note text {
  fill: var(--dot-text, #0d1017); font-weight: 800; text-anchor: middle; dominant-baseline: central;
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.fretboard .note .halo { display: none; fill: none; stroke: var(--dot); stroke-width: 2; opacity: 0.55; }
.fretboard .note.root .halo { display: inline; }
.fretboard .note.faint .dot { opacity: 0.28; stroke: none; }
.fretboard .note.faint text { fill: #fff; opacity: 0.6; }
.fretboard.wood-maple .note.faint .dot { opacity: 0.4; }
.fretboard.wood-maple .note.faint text { fill: #1a1410; }
.fretboard .note.enter { animation: dotIn 0.22s ease-out; transform-box: fill-box; }
.fretboard .note.enter .dot { animation: dotScale 0.22s ease-out; transform-origin: center; transform-box: fill-box; }
@keyframes dotIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dotScale { from { transform: scale(0.4); } to { transform: scale(1); } }
.fretboard .note.playing-a .dot, .fretboard .note.playing-b .dot { transform-box: fill-box; transform-origin: center; stroke: #fff; stroke-width: 3; }
.fretboard .note.playing-a .dot { animation: ping 0.32s ease-out; }
.fretboard .note.playing-b .dot { animation: ping2 0.32s ease-out; }
@keyframes ping2 { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes ping { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* ---------------------------------------------------------------- Circle of fifths */

.circle-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.circle-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.circle-card { display: grid; place-items: center; padding: 12px; }
.circle-svg { width: 100%; max-width: 600px; height: auto; display: block; }
.cof-seg { cursor: pointer; outline: none; }
.cof-seg path { transition: fill 0.35s ease, stroke 0.35s ease, opacity 0.35s; stroke: var(--bg); stroke-width: 1.5; }
.cof-ring.major .cof-seg:not(.on) path { fill: var(--surface-3); }
.cof-ring.minor .cof-seg:not(.on) path { fill: var(--surface-2); }
.cof-ring.dim .cof-seg:not(.on) path { fill: color-mix(in srgb, var(--surface-2) 70%, var(--bg)); }
.cof-seg text { fill: var(--text-2); text-anchor: middle; dominant-baseline: central; font-weight: 750; pointer-events: none; transition: fill 0.3s; }
.cof-seg .cof-num { font-size: 11px; font-weight: 700; opacity: 0.85; }
.cof-ring.dim .cof-seg .cof-num { display: none; }
.cof-seg:hover path, .cof-seg:focus-visible path { filter: brightness(1.25); }
/* Diatonic segments wear the app theme's note-dot colours: the tonic in the root colour, the rest in the note colour. */
.cof-seg.on path { fill: var(--dot-note); }
.cof-seg.on text { fill: var(--dot-note-ink); }
.cof-seg.tonic path { fill: var(--dot-root); filter: url(#cofglow); }
.cof-seg.tonic text { fill: var(--dot-root-ink); }
.cof-sig text { fill: var(--text-3); font-size: 11px; font-weight: 700; text-anchor: middle; dominant-baseline: central; transition: fill 0.3s; }
.cof-sig text.on { fill: var(--accent-text); }
.cof-center circle { stroke: var(--border-strong); }
.cof-center text { text-anchor: middle; dominant-baseline: central; }
.cof-key { font-size: 44px; font-weight: 800; fill: var(--text); letter-spacing: -0.02em; }
.cof-mode { font-size: 16px; font-weight: 700; fill: var(--accent-text); }
.cof-sigtext { font-size: 13px; fill: var(--text-3); font-weight: 600; }

.info-card { display: flex; flex-direction: column; gap: 14px; }
.chord-table { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.chord-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 2px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  transition: background 0.15s, transform 0.1s;
  min-width: 0;
}
.chord-cell:hover { background: var(--surface-3); }
.chord-cell:active { transform: scale(0.96); }
.chord-cell.tonic { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); }
.chord-cell .numeral { font-size: 12px; font-weight: 800; color: var(--accent-text); font-family: Georgia, 'Times New Roman', serif; }
.chord-cell .triad { font-size: 15px; font-weight: 750; white-space: nowrap; }
.chord-cell .seventh { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.related { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv span { color: var(--text-3); }
.kv strong { text-align: right; font-weight: 650; }

/* ---------------------------------------------------------------- Metronome */

.met-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.met-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.met-main { display: flex; flex-direction: column; align-items: stretch; gap: 16px; position: sticky; top: 84px; }

.tempo-display { text-align: center; padding-top: 6px; }
.bpm-num {
  font-size: clamp(72px, 14vw, 120px); line-height: 1; font-weight: 800; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--text) 55%, var(--accent-2)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.bpm-unit { font-size: 12px; font-weight: 800; letter-spacing: 0.3em; color: var(--text-3); margin-top: 4px; }
.bpm-mark { font-family: Georgia, 'Times New Roman', serif; font-style: italic; color: var(--accent-text); font-size: 18px; margin-top: 2px; }

.sweep { position: relative; height: 16px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); margin: 0 6px; }
.sweep-ball {
  position: absolute; top: 1px; left: 1px; width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 14px var(--accent);
  will-change: transform;
}
.sweep.silent .sweep-ball { opacity: 0.35; box-shadow: none; }

.beat-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.beat-dot {
  --size: 40px; width: 48px; height: 48px; border: 0; background: transparent; display: grid; place-items: center; padding: 0;
  border-radius: 50%; position: relative;
}
.beat-dot span {
  display: grid; place-items: center; width: var(--size); height: var(--size); border-radius: 50%;
  font-size: 13px; font-weight: 800; color: var(--text-2);
  background: var(--surface-2); border: 2px solid var(--border-strong);
  transition: background 0.08s, width 0.15s, height 0.15s;
}
.beat-dot[data-level='3'] span { --size: 44px; background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); border-color: var(--accent); color: var(--text); }
.beat-dot[data-level='2'] span { --size: 38px; background: color-mix(in srgb, var(--accent-2) 22%, var(--surface-2)); border-color: color-mix(in srgb, var(--accent-2) 60%, transparent); }
.beat-dot[data-level='1'] span { --size: 30px; font-size: 11px; }
.beat-dot[data-level='0'] span { --size: 30px; background: transparent; border-style: dashed; color: var(--text-3); font-size: 11px; }
.beat-dot.on span { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 22px var(--accent); }
.beat-dot.on[data-level='2'] span, .beat-dot.on[data-level='1'] span { background: var(--accent-2); box-shadow: 0 0 22px var(--accent-2); }
.beat-dot.on[data-level='0'] span { background: var(--surface-3); box-shadow: none; }
.beat-dot.hit-a span { animation: hit 0.18s ease-out; }
.beat-dot.hit-b span { animation: hit2 0.18s ease-out; }
@keyframes hit { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes hit2 { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }

.tempo-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.tempo-row .bpm-slider { flex: 1; }
.tempo-row.locked { opacity: 0.6; }
.bpm-input { width: 84px !important; text-align: center; font-weight: 700; font-size: 17px; min-height: 48px !important; }
.tap-btn { min-height: 48px; min-width: 84px; font-size: 16px; }
.tap-btn.flash { animation: tapflash 0.25s ease; }
@keyframes tapflash { 0% { background: var(--accent); color: var(--on-accent); } 100% { } }
.start-btn { min-height: 48px; flex: 1; max-width: 220px; font-size: 17px; }
.start-btn.running { background: linear-gradient(135deg, #ff5c7a, #ff7a59); color: #fff; }
.met-status { text-align: center; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 14px; }
.slash { color: var(--text-3); font-size: 20px; margin: 0 2px; }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper-val { min-width: 24px; text-align: center; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.group-input { width: 120px; }
.trainer-fields { margin-top: 14px; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 16px; border: 1px solid var(--border); }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.3s; }
.trainer-status { margin-top: 8px; }

/* ---------------------------------------------------------------- Tuner */

.tuner-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tn-main {
  --tn-good: #3dd6c3; --tn-band: #ff7a59; --tn-idle: #4a5468; --tn-color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
}
.tn-main[data-state='tuned'] { --tn-color: var(--tn-good); }
.tn-main[data-state='close'] { --tn-color: #f4c95d; }
.tn-main[data-state='off'] { --tn-color: var(--tn-band); }
.tn-head { display: flex; flex-direction: column; align-items: center; min-height: 128px; justify-content: center; }
.tn-note { font-size: clamp(72px, 16vw, 112px); line-height: 1; font-weight: 800; letter-spacing: -0.03em; color: var(--tn-color); transition: color 0.2s; }
.tn-main[data-state='idle'] .tn-note { color: var(--text-3); }
.tn-note sub { font-size: 0.32em; font-weight: 700; vertical-align: baseline; margin-left: 2px; color: var(--text-3); }
.tn-sub { color: var(--text-2); font-weight: 600; font-size: 14px; margin-top: 4px; }
.tn-view { width: 100%; display: flex; justify-content: center; }
.tn-gauge { width: 100%; max-width: 440px; height: auto; display: block; }
.tn-arc { fill: none; stroke: var(--surface-3); stroke-width: 10; stroke-linecap: round; }
.tn-zone { fill: none; stroke: var(--tn-good); stroke-width: 10; stroke-linecap: round; opacity: 0.85; }
.tn-tick { stroke: var(--text-3); stroke-width: 1.5; }
.tn-tick.major { stroke: var(--text-2); stroke-width: 2.5; }
.tn-label { fill: var(--text-3); font-size: 12px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.tn-flat, .tn-sharp { fill: var(--text-3); font-size: 22px; text-anchor: middle; }
.tn-needle { transform-box: view-box; transform-origin: 160px 166px; transition: transform 0.09s linear; }
.tn-needle line { stroke: var(--tn-color); stroke-width: 4; stroke-linecap: round; transition: stroke 0.2s; }
.tn-needle circle { fill: var(--tn-color); transition: fill 0.2s; }
.tn-strobe {
  width: 100%; max-width: 520px; height: 168px; display: block; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  box-shadow: inset 0 0 0 2px var(--tn-color);
}
.tn-readout { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 12px; width: 100%; max-width: 440px; font-variant-numeric: tabular-nums; }
.tn-cents { text-align: left; font-size: 20px; font-weight: 750; color: var(--tn-color); }
.tn-freq { text-align: right; color: var(--text-2); font-size: 15px; }
.tn-status { font-weight: 700; color: var(--tn-color); font-size: 16px; }
.tn-main[data-state='idle'] .tn-status { color: var(--text-3); font-weight: 600; }
.tn-strings { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tn-strings .pill { min-width: 52px; padding: 8px 12px; }
.tn-string sub { font-size: 0.7em; color: inherit; opacity: 0.7; margin-left: 1px; }
.tn-strings .pill.auto-on { border-color: var(--accent-2); color: var(--text); }
.tn-strings .pill.detected { border-color: var(--tn-color); color: var(--text); box-shadow: inset 0 0 0 1px var(--tn-color); }
.tn-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.tn-start { min-width: 170px; min-height: 48px; font-size: 16px; }
.tn-start.running { background: linear-gradient(135deg, #ff5c7a, #ff7a59); color: #fff; }
.tn-msg:empty { display: none; }
.center { text-align: center; }
.stepper-val.wide { min-width: 64px; font-size: 16px; }
.tn-side .seg { margin-bottom: 4px; }

@media (max-width: 1000px) {
  .tuner-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- Now-viewing bar */

/* Pinned to the bottom of the screen on every tab with a play button, so it is always in the same place. */
.now-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 0 max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  pointer-events: none; opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.now-bar.show { opacity: 1; visibility: visible; transform: none; }
.now-bar.show .nb-inner { pointer-events: auto; }
body.has-now-bar { padding-bottom: calc(var(--nowbar-h, 64px) + 8px); } /* the page's end scrolls clear of the bar */
.nb-inner {
  max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 8px 8px 8px 16px; box-shadow: var(--shadow);
}
.nb-text { flex: 1; min-width: 0; }
.nb-title { font-weight: 750; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-notes { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.nb-action { flex: none; }
.nb-up { flex: none; width: 34px; height: 34px; font-size: 16px; font-weight: 700; }

/* ---------------------------------------------------------------- Fretboard trainer */
.tr-score { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tr-stats { display: flex; gap: 10px 28px; flex-wrap: wrap; }
.tr-stat-val { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tr-stat-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.tr-prompt { display: flex; align-items: center; justify-content: center; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 6px; min-height: 34px; }
.tr-prompt-text { font-weight: 700; font-size: 16px; color: var(--text-2); text-align: center; }
.tr-prompt.right .tr-prompt-text { color: var(--good); }
.tr-prompt.wrong .tr-prompt-text { color: var(--danger); }
.tr-prompt-actions { display: flex; gap: 8px; }
.tr-prompt-actions:not(:has(:not([hidden]))) { display: none; }
.tr-answers { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; }
.tr-answer {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 56px; padding: 6px 2px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-weight: 750; font-size: 18px; transition: background 0.12s, transform 0.08s, border-color 0.12s;
}
.tr-answer.acc { font-size: 13px; line-height: 1.15; background: var(--surface-3); }
.tr-answer:hover:not(:disabled) { border-color: var(--accent-2); }
.tr-answer:active:not(:disabled) { transform: scale(0.95); }
.tr-answer:disabled { cursor: default; opacity: 0.55; }
.tr-answer.right { background: var(--good); border-color: var(--good); color: #0b1014; opacity: 1; }
.tr-answer.wrong { background: var(--danger); border-color: var(--danger); color: #fff; opacity: 1; }
.tr-answers.naturals { grid-template-columns: repeat(7, minmax(0, 1fr)); }

.tr-options { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.tr-options .switch-field.compact { margin-left: 0; }
.tr-opt { font-size: 14px; font-weight: 600; color: var(--text-2); }
.tr-string { display: inline-flex; align-items: baseline; gap: 6px; }
.tr-string-num { font-size: 11px; opacity: 0.7; }
.tr-string:not(.active) { opacity: 0.6; text-decoration: line-through; }
.tr-score { flex-direction: column; align-items: stretch; }
.tr-score-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tr-score-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tr-timed { display: flex; align-items: center; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.tr-clock { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 84px; }
.tr-clock.low { color: var(--danger); }
.tr-timed-main { flex: 1; min-width: 0; }
.tr-timed-main .progress { margin-top: 0; }
.tr-timed-info { margin-top: 6px; font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.tr-progress .section-title:first-child { margin-top: 4px; }
.tr-history { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; }
.tr-day { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.tr-day-count { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 16px; }
.tr-day-track { width: 100%; max-width: 36px; height: 90px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--border-strong); }
.tr-day-bar { width: 100%; background: var(--accent-2); border-radius: 4px 4px 0 0; min-height: 0; transition: height 0.3s; }
.tr-day-label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.tr-day-pct { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tr-acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tr-acc { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.tr-acc.weak { border-color: var(--border-strong); }
.tr-acc-head { display: flex; align-items: baseline; gap: 6px; }
.tr-acc-name { font-weight: 750; font-size: 14px; }
.tr-weak { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--text); }
.tr-acc-track { height: 6px; border-radius: 999px; background: var(--surface-3); margin: 6px 0 4px; overflow: hidden; }
.tr-acc-bar { height: 100%; background: var(--accent-2); border-radius: 999px; }
.tr-acc-val { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .tr-answers { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tr-answers.naturals { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .tr-answers.naturals .tr-answer { font-size: 16px; }
  .tr-acc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tr-clock { font-size: 28px; min-width: 70px; }
  .tr-stat-val { font-size: 20px; }
}

/* ---------------------------------------------------------------- Arpeggios: tablature */

.tab-host { overflow-x: auto; }
.tab { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tab-line { stroke: var(--text-3); stroke-width: 1; opacity: 0.7; }
.tab-bar { stroke: var(--text-3); stroke-width: 1.5; }
.tab-str { fill: var(--text-3); font-size: 12px; font-weight: 700; text-anchor: end; dominant-baseline: central; font-family: ui-sans-serif, system-ui, sans-serif; }
.tab-note rect { fill: var(--surface); }
.tab-note text { fill: var(--text); font-size: 15px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.tab-note.root text { fill: var(--accent-text); }
.tab-note.on rect { fill: var(--accent-2); }
.tab-note.on text { fill: #fff; }

/* ---------------------------------------------------------------- Dialog, toast, footer */

dialog {
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(440px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
dialog::backdrop { background: rgba(5, 8, 14, 0.6); backdrop-filter: blur(3px); }
.dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h2 { margin: 0; font-size: 20px; }
.dialog-body p { margin: 0; }
.tuning-rows { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.tuning-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.string-num { color: var(--text-2); font-size: 14px; }
.tuning-preview { font-weight: 700; color: var(--accent-text); letter-spacing: 0.02em; }
.dialog-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }

/* Settings: one dialog, sections one after another; the body scrolls, the heading stays put */
.settings-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; }
.settings-dialog[open] { display: flex; flex-direction: column; }
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border); }
.settings-head h2 { margin: 0; font-size: 20px; }
.settings-body { overflow-y: auto; padding: 0 20px 22px; display: flex; flex-direction: column; }
.settings-section { padding: 18px 0; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: 0; }
.settings-section > .section-title { margin: 0 0 14px; }
.settings-status { margin: 0; min-height: 1em; }

#toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong);
  padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.footer { text-align: center; color: var(--text-3); font-size: 13px; padding: 18px 16px 28px; }
.footer a { color: var(--text-2); }
.noscript { text-align: center; padding: 40px; }

/* ---------------------------------------------------------------- Responsive */

@media (max-width: 1000px) {
  .circle-layout, .met-layout { grid-template-columns: minmax(0, 1fr); }
  .met-main { position: static; }
  .circle-card .circle-svg { max-width: 520px; }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas: 'brand actions' 'tabs tabs';
    gap: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-left: 16px;
    padding-right: 16px;
  }
  .tabs { justify-self: stretch; justify-content: flex-start; }
  .tabs button { padding: 7px 12px; flex: 1 0 auto; }
  .tabs .long { display: none; }
  /* Blur and fixed backgrounds repaint large areas; on phones that can starve audio. */
  body { background-attachment: scroll; }
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .beat-dot.on span, .beat-dot.on[data-level='2'] span, .beat-dot.on[data-level='1'] span { box-shadow: none; }
  .mobile-only { display: flex !important; }
  main { padding: 14px 16px 4px; }
  .card { padding: 14px; border-radius: 14px; }
  .control-row { grid-template-columns: 1fr; gap: 6px; }
  .row-label { padding-top: 0; }
  .root-pills { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .root-pills .pill { min-width: 0; padding: 6px 2px; font-size: 12.5px; }
  .hero-title { font-size: 22px; }
  .scale-select { min-width: 0; width: 100%; }
  .inline.wrap > .seg { width: 100%; }
  .chord-hero { flex-direction: column; }
  .chord-box { align-self: center; }
  .chord-table { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .fb-controls { gap: 12px 16px; }
  .tuning-select { max-width: 200px; }
  .switch-field.compact { margin-left: 0; }
  .kbd-hint { display: none; }
  .tempo-row { flex-wrap: wrap; }
  .tempo-row .bpm-slider { flex-basis: 100%; order: -1; }
  .beat-dot { width: 42px; height: 42px; }
}

/* Metronome visual sync */
.sync-field { margin-top: 14px; }
.sync-row { gap: 8px; align-items: center; }
.sync-row .sync-slider { flex: 1; min-width: 120px; }
.sync-info { gap: 10px; align-items: center; min-height: 30px; }
.sync-val { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; }

/* Trainer daily streak */
.tr-streak { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.tr-streak-main { min-width: 150px; }
.tr-streak-num { font-size: 20px; font-weight: 800; }
.tr-goal { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 6px; }
.tr-goal-track { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.tr-goal-bar { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.3s; }
.tr-goal-text { color: var(--text-2); font-variant-numeric: tabular-nums; }
.tr-streak.done .tr-goal-text { color: var(--good); font-weight: 650; }
.tr-day.goal .tr-day-bar { background: var(--accent); }

/* Colours + style menu: two columns side by side; stacked and scrollable on phones */
.look-menu { flex-direction: row; gap: 6px; max-height: calc(100vh - 90px); overflow-y: auto; }
.menu-group { display: flex; flex-direction: column; gap: 2px; min-width: 190px; }
.menu-group + .menu-group { border-left: 1px solid var(--border); padding-left: 6px; }
.menu-head { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.style-swatch { display: inline-flex; flex: none; width: 40px; }
.style-swatch svg { display: block; overflow: visible; }
@media (max-width: 760px) {
  .look-menu { flex-direction: column; position: fixed; top: 60px; right: 12px; left: auto; max-height: calc(100dvh - 80px); }
  .menu-group + .menu-group { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 4px; }
}

/* Arpeggio speeds: six buttons — two even rows of three on phones */
@media (max-width: 760px) { .speed-seg { display: grid; grid-template-columns: repeat(3, 1fr); } }

/* Chord tablature beside the chord diagram */
.chord-box { display: flex; align-items: flex-start; gap: 18px; }
.cb-tab { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 12px; }
.tab-note.muted text { fill: var(--text-3); }
.cb-short { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-2); }

/* ================================================================ App styles
 * The look of note dots, buttons and tabs, chosen in the palette menu next to the colour theme
 * (FS.STYLES in app.js). Classic (the original look) is the rules above; each style below only
 * overrides them and takes every colour from the theme. Target's dot sizes are set in fretboard.js. */

:root { --ring-fill: #0e1014; } /* dark dot fill for the ring styles, on every theme and wood */

/* Any style: a note being played flashes white. */
:root[data-style] .fretboard .note:is(.playing-a, .playing-b) .dot { stroke: #fff; stroke-width: 3; }

/* Ring and Target keep their shapes but take Classic's accent gradient: a ring drawn by a masked
 * pseudo-element (a gradient border can't be a box-shadow). --ring-w sets its width. */
:root[data-style='ring'] :is(.tabs button[aria-selected='true'], .pill.active, .btn.primary, .seg button.active),
:root[data-style='halo'] :is(.tabs button[aria-selected='true'], .pill.active, .btn.primary) { position: relative; }
:root[data-style='ring'] :is(.tabs button[aria-selected='true'], .pill.active, .btn.primary, .seg button.active)::after,
:root[data-style='halo'] :is(.tabs button[aria-selected='true'], .pill.active, .btn.primary)::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: var(--ring-w, 2px); pointer-events: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

/* ---- Ring: dark dots with a coloured ring and label; active buttons and tabs outlined in the accent gradient */
:root[data-style='ring'] :is(.fretboard .note .dot, .cb-dot) { fill: var(--ring-fill); stroke: var(--dot); stroke-width: 2.5; }
:root[data-style='ring'] :is(.fretboard .note.root .dot, .cb-dot.root) { stroke-width: 3.5; }
:root[data-style='ring'] .fretboard .note text { fill: color-mix(in srgb, var(--dot) 80%, white); }
:root[data-style='ring'] .fretboard .note.faint .dot { opacity: 0.6; stroke-width: 1.5; }
:root[data-style='ring'] :is(.tabs button[aria-selected='true'], .pill.active, .btn.primary) {
  background: var(--bg); color: var(--accent-text); border-color: transparent; box-shadow: none;
}
:root[data-style='ring'] .seg button.active { --ring-w: 1.5px; background: var(--bg); box-shadow: none; }
:root[data-style='ring'] .switch input:checked + .slider {
  border: 2px solid transparent; box-shadow: none;
  background: linear-gradient(var(--bg), var(--bg)) padding-box, linear-gradient(135deg, var(--accent), var(--accent-2)) border-box;
}
:root[data-style='ring'] .switch input:checked + .slider::after { top: 2px; left: 2px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
/* Beat lights: a black centre like the note dots; the coloured ring shows the level, and a lit beat gets a thicker one. */
:root[data-style='ring'] .beat-dot span { background: var(--ring-fill); box-shadow: none; }
:root[data-style='ring'] .beat-dot.on span { color: var(--accent-text); border-color: var(--accent); border-width: 3px; }
:root[data-style='ring'] .beat-dot.on:is([data-level='2'], [data-level='1']) span { color: var(--text); border-color: var(--accent-2); }
/* Circle of fifths: diatonic segments are dark like the dots, each with a ring in its colour. */
:root[data-style='ring'] .cof-seg.on path { fill: var(--ring-fill); stroke: var(--dot-note); stroke-width: 2.5; }
:root[data-style='ring'] .cof-seg.on text { fill: color-mix(in srgb, var(--dot-note) 80%, white); }
:root[data-style='ring'] .cof-seg.tonic path { fill: var(--ring-fill); stroke: var(--dot-root); stroke-width: 3.5; filter: none; }
:root[data-style='ring'] .cof-seg.tonic text { fill: color-mix(in srgb, var(--dot-root) 80%, white); }

/* ---- Target: a solid dot inside a ring of its colour; gradient buttons with a double ring
 * (the gap between the rings is the masked ::after above, filled with the page colour). */
:root[data-style='halo'] :is(.fretboard .note .dot, .cb-dot) { stroke: var(--ring-fill); stroke-width: 1.5; }
:root[data-style='halo'] .fretboard .note:not(.faint) .halo { display: inline; opacity: 0.95; stroke-width: 2; }
:root[data-style='halo'] .fretboard .note.root .halo { stroke-width: 3; }
:root[data-style='halo'] .cb-dot.root { stroke: var(--dot); stroke-width: 2; }
:root[data-style='halo'] :is(.tabs button[aria-selected='true'], .pill.active, .btn.primary) {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); border-color: transparent; box-shadow: none;
}
:root[data-style='halo'] :is(.tabs button[aria-selected='true'], .pill.active, .btn.primary)::after { inset: 2px; background: var(--bg); }
:root[data-style='halo'] .switch input:checked + .slider { background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: inset 0 0 0 2px var(--bg); }
:root[data-style='halo'] .beat-dot.on span { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
:root[data-style='halo'] .beat-dot.on:is([data-level='2'], [data-level='1']) span { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-2); }

/* Phones: no glows on the metronome lights (repaints can starve audio — see CLAUDE.md). */
@media (max-width: 760px) {
  :root[data-style] .beat-dot.on span { text-shadow: none; }
}
