body { font-family: Inter, sans-serif; }

.tool-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 3px 12px rgba(0,0,0,.04);
}

/* ── Reverb toggle ── */
.reverb-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 1px;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 3px;
}
.reverb-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.reverb-btn.active {
  background: #fff;
  color: #065f46;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ── Erhu Instrument Frame ── */
.erhu-container {
  display: flex;
  justify-content: center;
  padding: 20px 0;
  user-select: none;
  -webkit-touch-callout: none;
}

.erhu-instrument {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 140px;   /* slimmer neck */
}

/* ── Neck ── */
.erhu-neck {
  width: 100%;
  min-height: 380px;
  background: linear-gradient(90deg, #4a2810 0%, #6b3f20 20%, #4a2810 80%, #311808 100%);
  border-radius: 4px 4px 0 0;
  position: relative;
  display: flex;
  justify-content: space-evenly;
  align-items: stretch;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8), 2px 0 5px rgba(0,0,0,0.3);
  gap: 6px;
  padding: 6px 8px 6px;
}

/* Tuning peg visual at top */
.erhu-neck::before {
  content: '';
  position: absolute;
  top: -20px;
  left: -20px;
  right: -20px;
  height: 20px;
  background: url('data:image/svg+xml;utf8,<svg width="100" height="20" xmlns="http://www.w3.org/2000/svg"><rect x="15" y="5" width="20" height="10" fill="%23d4af37"/><rect x="65" y="5" width="20" height="10" fill="%23d4af37"/></svg>') no-repeat center top;
  pointer-events: none;
}

/* ── Zone columns — one per string ── */
.zone-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  z-index: 2;
}

/* String line down center of column — visual decoration */
.zone-col::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: linear-gradient(180deg, #ccc 0%, #fff 50%, #999 100%);
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 0;
}

/* ── Individual zone button ── */
.erhu-zone {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  flex: 1;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.08s, border-color 0.08s;
  gap: 1px;
}

.erhu-zone:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.22);
}

/* Root note zones — slightly highlighted */
.erhu-zone.root-zone {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.30);
}
.erhu-zone.root-zone:hover {
  background: rgba(16,185,129,0.20);
}

/* Active / pressed zone */
.erhu-zone.active {
  background: rgba(16,185,129,0.35) !important;
  border-color: rgba(16,185,129,0.85) !important;
  box-shadow: 0 0 10px rgba(16,185,129,0.5), inset 0 0 6px rgba(16,185,129,0.2);
}

/* String line brightens when zone is active */
.zone-col:has(.erhu-zone.active)::before {
  background: linear-gradient(180deg, #aaa 0%, #fff 50%, #aaa 100%);
  box-shadow: 0 0 8px rgba(255,255,255,0.8), 0 0 12px rgba(16,185,129,0.6);
  width: 3px;
}

/* ── Zone labels ── */
.zone-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.88);
  line-height: 1;
  pointer-events: none;
}
.erhu-zone.root-zone .zone-label {
  color: rgba(110,235,170,0.95);
}
.erhu-zone.active .zone-label {
  color: #fff;
}

.zone-kb {
  font-size: 7px;
  font-family: monospace;
  color: rgba(255,255,255,0.28);
  line-height: 1;
  pointer-events: none;
}
.erhu-zone.active .zone-kb {
  color: rgba(255,255,255,0.55);
}

/* ── String label at top/bottom of neck (open string names) ── */
.erhu-string-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 3;
}

/* ── Keep original marker and interaction layer for loop playback display ── */
.erhu-markers {
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  pointer-events: none;
  z-index: 0;
}

.erhu-interaction-layer {
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  pointer-events: none;
  z-index: 4;
}

.erhu-touch-indicator { display: none; }
.erhu-pitch-label { display: none; }

/* ── Resonator Body (wider than neck — matches real erhu) ── */
.erhu-resonator {
  width: 200px;
  height: 130px;
  background: linear-gradient(135deg, #3a1c06 0%, #1f0c02 100%);
  border-radius: 8px 8px 28px 28px / 8px 8px 36px 36px;
  position: relative;
  margin-top: -10px;
  z-index: 10;
  box-shadow: inset 0 -4px 10px rgba(0,0,0,0.8), 0 8px 16px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.erhu-resonator::before {
  content: '';
  position: absolute;
  top: 5px; bottom: 5px; left: 5px; right: 5px;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 4px 4px 22px 22px / 4px 4px 28px 28px;
}
.erhu-snakeskin {
  width: 150px;
  height: 100px;
  background:
    repeating-linear-gradient(45deg,
      rgba(200,180,140,0.1) 0px, rgba(200,180,140,0.1) 2px,
      transparent 2px, transparent 4px
    ),
    repeating-linear-gradient(-45deg,
      rgba(200,180,140,0.1) 0px, rgba(200,180,140,0.1) 2px,
      transparent 2px, transparent 4px
    ),
    #c2ab85;
  border-radius: 5px;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.8);
}
.erhu-bridge {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 6px;
  background: #e8dcc8;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

tbody tr:nth-child(even) { background: #f9fafb; }
