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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 20px 60px;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f5c842;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 1rem;
  color: #888;
  margin-bottom: 36px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Key selector ── */
.key-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
}

.key-btn {
  padding: 6px 13px;
  border: 1.5px solid #555;
  background: transparent;
  color: #aaa;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  min-width: 42px;
}

.key-btn:hover  { border-color: #f5c842; color: #f5c842; background: rgba(245,200,66,.1); }
.key-btn.active { border-color: #f5c842; background: #f5c842; color: #0f0f1a; }

/* ── Scale type toggle ── */
.scale-buttons {
  display: flex;
  gap: 0;
  justify-content: center;
  margin-bottom: 20px;
}

.scale-btn {
  padding: 7px 28px;
  border: 1.5px solid #444;
  background: transparent;
  color: #999;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.scale-btn:first-child { border-radius: 8px 0 0 8px; }
.scale-btn:last-child  { border-radius: 0 8px 8px 0; border-left: none; }

.scale-btn:hover  { color: #ddd; border-color: #888; }
.scale-btn.active {
  background: #7b5ea7;
  border-color: #7b5ea7;
  color: #fff;
}

/* ── Position buttons ── */
.position-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 32px;
}

.pos-btn {
  padding: 10px 18px;
  border: 2px solid #f5c842;
  background: transparent;
  color: #f5c842;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.18s, color 0.18s, transform 0.1s;
}

.pos-btn:hover  { background: rgba(245,200,66,.18); transform: translateY(-1px); }
.pos-btn.active { background: #f5c842; color: #0f0f1a; }

/* ── Display mode toggle ── */
.display-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
}

.display-btn {
  padding: 6px 16px;
  border: 1.5px solid #444;
  background: transparent;
  color: #999;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.display-btn:hover  { border-color: #aaa; color: #ddd; }
.display-btn.active { border-color: #e0e0e0; background: #e0e0e0; color: #0f0f1a; }

/* ── Pentatonic toggle ── */
.penta-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
}

.penta-btn {
  padding: 7px 20px;
  border: 1.5px solid #2ecc71;
  background: transparent;
  color: #2ecc71;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: background 0.15s, color 0.15s;
}

.penta-btn:hover  { background: rgba(46,204,113,0.15); }
.penta-btn.active { background: #2ecc71; color: #0f0f1a; }

/* ── Fretboard wrapper ── */
.fretboard-wrap {
  background: #1c1c2e;
  border: 1px solid #2e2e44;
  border-radius: 14px;
  padding: 24px 28px;
  overflow-x: auto;
  max-width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}

svg#fretboard { display: block; }

/* ── Legend ── */
.legend {
  display: flex;
  gap: 28px;
  margin-top: 22px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #aaa;
}

.legend-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.legend-dot.root  { background: #c0392b; border: 2px solid #e74c3c; }
.legend-dot.scale { background: #1a6eb5; border: 2px solid #3498db; }
.legend-dot.penta      { background: #1a5c3a; border: 2px solid #2ecc71; }
.legend-dot.penta-root { background: #2ecc71; border: 2px solid #ffffff; }

/* ── Position info card ── */
.pos-info {
  margin-top: 30px;
  background: #1c1c2e;
  border: 1px solid #2e2e44;
  border-radius: 10px;
  padding: 18px 28px;
  max-width: 620px;
  width: 100%;
  text-align: center;
}

.pos-info h2 {
  color: #f5c842;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.pos-info p {
  color: #bbb;
  font-size: 0.9rem;
  line-height: 1.6;
}

.pos-info .roots {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.pos-hint {
  color: #777;
  font-size: 0.85rem;
  font-style: italic;
}

.pos-divider {
  border: none;
  border-top: 1px solid #2e2e44;
  margin: 14px 0;
}

.root-tag {
  background: rgba(192,57,43,.25);
  border: 1px solid #e74c3c;
  color: #e74c3c;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
