/* ===========================================================================
   theme.css — design tokens and shared components
   ---------------------------------------------------------------------------
   The brief: simple, not over the top. So:
     · one accent colour for interactive things
     · colour elsewhere only where it identifies something (a string, an octave)
     · no gradients, no glows, no drop shadows on content
     · 4px spacing grid, two font sizes for body text, one for headings
   =========================================================================== */

:root {
  /* surfaces */
  --bg:        #0c0d10;
  --surface:   #141619;
  --surface-2: #1b1e23;
  --surface-3: #23272d;

  /* lines */
  --line:      #262a31;
  --line-soft: #1e2127;

  /* text */
  --text:      #e7e9ec;
  --dim:       #8a9099;
  --dimmer:    #5b626b;

  /* semantic */
  --accent:    #6f9ee8;
  --accent-dim:#2b3d59;
  --good:      #5eab84;
  --warn:      #c9a24a;
  --bad:       #c9695f;

  /* guitar strings, 1 = high e */
  --s1: #cf6f68;
  --s2: #c19a4c;
  --s3: #5fa478;
  --s4: #5d8cc4;
  --s5: #c08551;
  --s6: #8a80c0;

  /* geometry */
  --r:      6px;
  --r-lg:   10px;
  --gap:    16px;
  --pad:    20px;
  --maxw:   1180px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

::selection { background: var(--accent-dim); }

/* ── Scrollbars ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #30353c; }

/* ── Shell ──────────────────────────────────────────────────────────── */

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.topbar {
  height: 52px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--gap);
}

.brand {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .mark {
  width: 18px; height: 18px;
  border-radius: 4px;
  background: var(--accent);
  display: grid;
  place-items: center;
}
.brand .mark::after {
  content: '';
  width: 2px; height: 9px;
  background: var(--bg);
  border-radius: 1px;
  box-shadow: 4px 0 0 var(--bg), -4px 0 0 var(--bg);
}

.spacer { flex: 1; }

/* ── Buttons ────────────────────────────────────────────────────────── */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: var(--r);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--surface-3); }
.btn:active:not(:disabled) { background: var(--surface-3); }
.btn:disabled { opacity: .4; cursor: default; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0d10;
  font-weight: 600;
}
.btn.primary:hover:not(:disabled) { background: #82adee; border-color: #82adee; }

.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { background: var(--surface); color: var(--text); }

.btn.on { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* A warning-coloured button: something is off and one click fixes it. */
.btn.warn {
  border-color: var(--warn, #d8a24a);
  color: var(--warn, #d8a24a);
  background: rgba(216, 162, 74, .12);
  animation: warn-pulse 1.8s ease-in-out infinite;
}
.btn.warn:hover:not(:disabled) { background: rgba(216, 162, 74, .22); }
@keyframes warn-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .62; } }

.btn svg { flex: none; }

/* ── Segmented control (instrument switch) ──────────────────────────── */

.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 2px;
  gap: 2px;
}

.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .12s ease, color .12s ease;
}
.seg button:hover { color: var(--text); }
.seg button[aria-selected="true"] {
  background: var(--surface-3);
  color: var(--text);
}

/* ── Inputs ─────────────────────────────────────────────────────────── */

select, input[type="text"], input[type="number"] {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 6px 26px 6px 10px;
  border-radius: var(--r);
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238a9099' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
  max-width: 220px;
  text-overflow: ellipsis;
}
input[type="text"], input[type="number"] { background-image: none; padding-right: 10px; cursor: text; }
select:focus, input:focus { outline: none; border-color: var(--accent); }

input[type="range"] {
  appearance: none;
  width: 88px;
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border: 0;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
}

/* ── Small pieces ───────────────────────────────────────────────────── */

.label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dimmer);
}

.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--dim);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.guitar { color: var(--s3); border-color: #23392e; background: #16211b; }
.badge.piano  { color: var(--s4); border-color: #223349; background: #141d27; }

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--dimmer);
  flex: none;
}
.dot.active { background: var(--good); }
.dot.error  { background: var(--bad); }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--warn);
  background: var(--surface);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--dim);
  line-height: 1.55;
}
.notice strong { color: var(--text); font-weight: 600; }
.notice .close {
  margin-left: auto;
  color: var(--dimmer);
  cursor: pointer;
  background: none; border: 0; font: inherit;
  padding: 0 2px;
}
.notice .close:hover { color: var(--text); }

.hidden { display: none !important; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 40px 0 14px;
}
.section-head h2 { font-size: 15px; }
.section-head .hint { font-size: 13px; color: var(--dimmer); }

/* ── Panel ──────────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--pad);
}

/* index-app.js toggles `.active` on its panel buttons */
.btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* compact variant of the segmented control, for toolbars */
.seg.small button { padding: 4px 10px; font-size: 12px; }
