:root {
  --bg: #0b0c0f;
  --bg-soft: #12141a;
  --card: #171a21;
  --card-2: #1c2029;
  --line: rgba(240, 228, 210, 0.08);
  --line-strong: rgba(240, 228, 210, 0.16);
  --text: #f3eee6;
  --muted: #9b948a;
  --faint: #6f6a63;
  --amber: #e2b15a;
  --amber-dim: rgba(226, 177, 90, 0.16);
  --copper: #d4785a;
  --copper-dim: rgba(212, 120, 90, 0.16);
  --patina: #7eb8b0;
  --ok: #8fbf7a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 20px;
  --font: "Outfit", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --gutter: clamp(16px, 4vw, 28px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(226, 177, 90, 0.08), transparent 55%),
    radial-gradient(900px 500px at 110% 0%, rgba(212, 120, 90, 0.08), transparent 50%),
    var(--bg);
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
  touch-action: manipulation;
}

img { max-width: 100%; }

.app {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 20px var(--gutter) calc(32px + var(--safe-b));
}

.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
  font-weight: 600;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 560;
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: -0.03em;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 42ch;
}

.composer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.chord-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.chord-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 20px;
  letter-spacing: 0.02em;
  outline: none;
}

.chord-row input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}

.icon-btn {
  width: 52px;
  min-width: 52px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  display: grid;
  place-items: center;
}

.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.is-on { color: var(--amber); background: var(--amber-dim); border-color: transparent; }
.icon-btn:active { transform: scale(0.97); }

.roots, .variations, .fav-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 6px;
  margin-top: 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.roots::-webkit-scrollbar, .variations::-webkit-scrollbar, .fav-row::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.chip.is-on {
  color: var(--bg);
  background: var(--text);
  border-color: transparent;
  font-weight: 600;
}

.chip.var.is-on {
  background: var(--amber);
  color: #1a140c;
}

.section-label {
  margin: 14px 0 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.meta-bar {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  margin: 16px 0;
}

.capo, .toggle-pill {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.capo span, .toggle-pill span { color: var(--muted); font-size: 13px; }
.stepper { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.stepper button {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.stepper strong { min-width: 1.2em; text-align: center; }

.toggle-pill.is-on { border-color: var(--patina); color: var(--patina); }

.panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}

.panel.guitar { --accent: var(--amber); --accent-dim: var(--amber-dim); }
.panel.ronroco { --accent: var(--copper); --accent-dim: var(--copper-dim); }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-kicker {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
    font-weight: 600;
}

.panel-title {
  font-family: var(--display);
  font-size: 28px;
  margin: 2px 0 0;
  letter-spacing: -0.03em;
}

.tab-readout {
  font-family: var(--mono);
  font-size: clamp(18px, 4.4vw, 26px);
  letter-spacing: 0.12em;
  background: var(--bg);
  border-radius: 12px;
  padding: 8px 12px;
  color: var(--accent);
}

.tuning-row, .voicing-row, .fret-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

select.preset, .note-select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}

.string-tuners {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.string-tuners label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  color: var(--faint);
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.note-select { width: 100%; padding: 8px 4px; text-align: center; }

.hint {
  color: var(--faint);
  font-size: 12px;
  margin: 0 0 8px;
}

.fret-nav { justify-content: space-between; }
.fret-nav button, .voicing-row button, .play-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
}

.play-btn {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: transparent;
  font-weight: 600;
}

.voicing-row { justify-content: space-between; }
.notes-line {
  color: var(--muted);
  font-size: 13px;
  min-height: 1.3em;
}

.fb-wrap { margin: 8px 0 4px; }

.fb {
  --strings: 6;
  --frets: 5;
  width: min(100%, 300px);
  margin: 0 auto;
  background: linear-gradient(180deg, #2a241c, #1a1713);
  border-radius: 16px;
  padding: 10px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.fb-head, .fb-fret, .fb-notes {
  display: grid;
  grid-template-columns: repeat(var(--strings), minmax(0, 1fr));
}

.fb-head-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-bottom: 6px;
}

.fb-mute, .fb-open {
  width: 28px;
  height: 26px;
  border-radius: 8px;
  color: var(--faint);
  font-size: 16px;
  line-height: 1;
}

.fb-mute.is-on { color: #e07a6a; }
.fb-open.is-on { color: var(--text); }

.fb-nut {
  height: 10px;
  margin: 0 6px 2px;
  border-radius: 4px;
  background: #f0e6d4;
}

.fb-nut.has-capo {
  height: 20px;
  background: #c45d3e;
  display: grid;
  place-items: center;
}

.fb-capo-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff4ea;
}

.fb-grid { position: relative; }

.fb-position {
  position: absolute;
  left: 0;
  top: 8px;
  font-size: 11px;
  color: var(--amber);
  transform: translateX(calc(-100% - 8px));
}

.fb-fret {
  min-height: 52px;
  border-bottom: 1px solid rgba(232, 214, 180, 0.22);
  position: relative;
}

.fb-fret.has-inlay::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(240, 228, 210, 0.22);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.fb-cell {
  position: relative;
  min-height: 52px;
  width: 100%;
}

.fb-cell::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2.5px;
  background: linear-gradient(#e4d6be, #9a8f7e);
  transform: translateX(-50%);
  pointer-events: none;
}

.is-courses .fb-cell::before {
  width: 6px;
  background: linear-gradient(to right, #e4d6be 0 2px, transparent 2px 4px, #e4d6be 4px 6px);
}

.fb-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: var(--accent, var(--amber));
  color: #1a140c;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  z-index: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.fb-dot.is-interval { font-size: 10px; }

.fb-notes {
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  color: #d7cbb8;
}

.fb-notes .is-muted { color: #8a5b52; }

.fb-mute:disabled,
.fb-open:disabled,
.fb-cell:disabled {
  opacity: 1;
  cursor: default;
}

.is-interactive .fb-cell:enabled:active { background: rgba(255, 255, 255, 0.04); }

.fav-card {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.fav-empty { color: var(--faint); font-size: 13px; margin: 8px 0 0; }

.fav-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
}

.fav-chip button.kill {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--faint);
}

footer.tiny {
  margin-top: 18px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}

@media (min-width: 900px) {
  .panels { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .meta-bar { grid-template-columns: 1fr 1fr; }
  .toggle-pill { grid-column: 1 / -1; }
  .top { flex-direction: column; align-items: flex-start; }
  .tab-readout { letter-spacing: 0.08em; }
  .fb-mute, .fb-open { width: 26px; height: 26px; }
}
