/* ═══════════════════════════════════════════════════════════════
   GUITAR FRETBOARD VISUALIZER — Tamil Bookshelf MIDI Player
   Replaces all piano-key CSS with guitar fretboard styles
   ═══════════════════════════════════════════════════════════════ */

/* ── VISUALIZER CONTAINER ── */
#staff-visualizer {
  background: linear-gradient(160deg, #0d0a06 0%, #1a1208 60%, #0f0c08 100%);
  border: 1px solid var(--border2);
  border-radius: 14px;
  margin: 14px 0;
  overflow: hidden;
  height: 260px;
  position: relative;
  box-shadow:
    inset 0 2px 8px rgba(0,0,0,0.6),
    0 4px 20px rgba(0,0,0,0.4),
    0 0 0 1px rgba(201,148,58,0.08);
}

#keyboard-container {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ── CANVAS fills the container ── */
#fret-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  border-radius: 13px;
}

/* ── FRETBOARD OVERLAY BADGE ── */
.fret-badge {
  position: absolute;
  top: 10px;
  right: 14px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(201,148,58,0.25);
  border-radius: 20px;
  padding: 4px 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  color: var(--gold);
  letter-spacing: 0.5px;
  backdrop-filter: blur(6px);
  pointer-events: none;
  z-index: 10;
}

/* ── STRING LABEL STRIP (left gutter) ── */
.fret-string-labels {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 54px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 20px 0;
  z-index: 5;
  pointer-events: none;
}
.fret-string-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--cream-dim);
  text-align: center;
  line-height: 1;
  text-shadow: 0 0 8px rgba(201,148,58,0.3);
}
.fret-string-label.treble { color: var(--gold-light); }
.fret-string-label.bass   { color: #c8845a; }

/* ── FRET NUMBER STRIP (bottom) ── */
.fret-numbers {
  position: absolute;
  bottom: 6px;
  left: 54px;
  right: 0;
  display: flex;
  pointer-events: none;
  z-index: 5;
}
.fret-num {
  flex: 1;
  text-align: center;
  font-family: 'Outfit', sans-serif;
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0;
}
.fret-num.marker {
  color: rgba(201,148,58,0.5);
  font-weight: 600;
}

/* ── NOTE POPUP ── */
.note-popup {
  position: absolute;
  background: var(--gold);
  color: #0d0a08;
  font-family: 'Outfit', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 20px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 20;
  animation: notePopIn 0.12s ease-out forwards;
  box-shadow: 0 2px 10px rgba(201,148,58,0.5);
}
@keyframes notePopIn {
  from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

/* ── PULSE RING on active note ── */
@keyframes pulseRing {
  0%   { transform: translate(-50%,-50%) scale(1);   opacity: 0.8; }
  100% { transform: translate(-50%,-50%) scale(2.4); opacity: 0; }
}
.pulse-ring {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  pointer-events: none;
  z-index: 15;
  animation: pulseRing 0.5s ease-out forwards;
}

/* ── GHOST NOTE (upcoming) ── */
@keyframes ghostPulse {
  0%, 100% { opacity: 0.25; }
  50%       { opacity: 0.5;  }
}
.ghost-dot {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 12;
  animation: ghostPulse 1s ease-in-out infinite;
}

/* ── CAPO INDICATOR ── */
.capo-line {
  position: absolute;
  top: 20px;
  bottom: 20px;
  width: 5px;
  background: linear-gradient(180deg, #c8340a, #ff6030);
  border-radius: 3px;
  pointer-events: none;
  z-index: 8;
  box-shadow: 0 0 10px rgba(200,52,10,0.6);
}

/* ── SCROLL TRACK below fretboard for octave navigation ── */
.fret-scroll-hint {
  position: absolute;
  bottom: 26px;
  right: 14px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.6rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.fret-scroll-hint i { font-size: 10px; }

/* ── INSTRUMENT TUNING BADGE ── */
.tuning-badge {
  position: absolute;
  top: 10px;
  left: 60px;
  background: rgba(10,8,5,0.7);
  border: 1px solid rgba(201,148,58,0.2);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.8px;
  pointer-events: none;
  z-index: 10;
  backdrop-filter: blur(4px);
}
.tuning-badge span { color: var(--gold); font-weight: 600; }

/* ── SCALE OVERLAY TOGGLE ── */
.scale-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px 0;
  flex-wrap: wrap;
}
.scale-pill {
  padding: 4px 12px;
  border: 1px solid var(--border2);
  border-radius: 20px;
  background: #0d0a08;
  color: var(--text-dim);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
.scale-pill:hover { border-color: var(--gold); color: var(--gold); }
.scale-pill.active {
  background: var(--gold);
  color: #0d0a08;
  border-color: var(--gold);
  font-weight: 600;
}
.scale-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── NOTE TRAIL canvas layer ── */
#trail-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  opacity: 0.7;
  border-radius: 13px;
}

/* ── STRING VIBRATION overlay ── */
#vibration-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  border-radius: 13px;
}

/* ── ACTIVE NOTE DOTS (HTML fallback) ── */
.active-fret-dot {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: #0d0a08;
  transition: opacity 0.1s;
  box-shadow:
    0 2px 12px rgba(0,0,0,0.5),
    0 0 0 3px rgba(255,255,255,0.2);
}

/* ── OPEN STRING indicator ── */
.open-string-ring {
  position: absolute;
  left: 20px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: rgba(201,148,58,0.12);
  z-index: 15;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: var(--gold);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  #staff-visualizer { height: 200px; border-radius: 10px; }
  .fret-badge { font-size: 0.6rem; padding: 3px 8px; }
  .tuning-badge { display: none; }
  .scale-toggle-row { padding: 6px 14px 0; }
  .scale-pill { font-size: 0.65rem; padding: 3px 8px; }
}

@media (max-width: 480px) {
  #staff-visualizer { height: 170px; }
  .fret-string-labels { width: 38px; }
  .fret-num { font-size: 0.5rem; }
}
