/* ==========================================================================
   Tuner & Metronome — dedicated styles for the two precision-audio tools.
   ========================================================================== */

/* ---------- Shared tool-stage shell ---------- */
.tuner-stage, .metronome-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.5rem;
  min-height: 420px;
  justify-content: center;
  transition: box-shadow .4s ease, border-color .4s ease;
}

/* ---------- Tuner: start / permission / error state ---------- */
.tuner-start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 380px;
}
.tuner-mic-icon {
  width: 84px; height: 84px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--accent), #7a0f18);
  color: #fff;
  box-shadow: 0 0 32px -4px var(--accent-soft), inset 0 1px 0 rgba(255,255,255,.25);
}
.tuner-mic-icon.tuner-mic-error {
  background: linear-gradient(145deg, #4a4a52, #26262c);
  box-shadow: none;
  color: #d8d8dd;
}

/* ---------- Tuner: gauge ---------- */
.tuner-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.tuner-gauge-svg {
  width: 100%;
  max-width: 300px;
  height: auto;
  overflow: visible;
}
.tuner-arc-track {
  stroke: rgba(255,255,255,.1);
}
.tuner-arc-zone {
  stroke: var(--success);
  opacity: .35;
}
.tuner-tick {
  stroke: rgba(255,255,255,.28);
}
.tuner-needle {
  stroke: var(--accent);
  transition: transform .18s cubic-bezier(.2,.8,.2,1), stroke .3s ease;
  filter: drop-shadow(0 0 6px var(--accent-soft));
}
.tuner-needle-hub {
  fill: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-soft));
}

.tuner-readout {
  text-align: center;
  margin-top: -.5rem;
}
.tuner-note {
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
  transition: color .3s ease;
}
.tuner-freq {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-size: .95rem;
  margin-top: .5rem;
}

/* ---------- Tuner: pitch-accuracy states ---------- */
.tuner-stage.tuner-off {
  box-shadow: 0 0 0 1px rgba(225,29,46,.35), 0 0 40px -12px rgba(225,29,46,.5);
}
.tuner-stage.tuner-off .tuner-needle,
.tuner-stage.tuner-off .tuner-needle-hub {
  stroke: var(--accent);
  fill: var(--accent);
}

.tuner-stage.tuner-close {
  box-shadow: 0 0 0 1px rgba(234,179,8,.35), 0 0 40px -12px rgba(234,179,8,.45);
}
.tuner-stage.tuner-close .tuner-needle,
.tuner-stage.tuner-close .tuner-needle-hub {
  stroke: var(--warning);
  fill: var(--warning);
  filter: drop-shadow(0 0 6px rgba(234,179,8,.5));
}
.tuner-stage.tuner-close .tuner-note { color: var(--warning); }

.tuner-stage.tuner-in-tune {
  box-shadow: 0 0 0 1px rgba(34,197,94,.45), 0 0 50px -10px rgba(34,197,94,.55);
  animation: tunerLockPulse 1.4s ease-in-out infinite;
}
.tuner-stage.tuner-in-tune .tuner-needle,
.tuner-stage.tuner-in-tune .tuner-needle-hub {
  stroke: var(--success);
  fill: var(--success);
  filter: drop-shadow(0 0 8px rgba(34,197,94,.6));
}
.tuner-stage.tuner-in-tune .tuner-note { color: var(--success); }

@keyframes tunerLockPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(34,197,94,.45), 0 0 50px -10px rgba(34,197,94,.55); }
  50% { box-shadow: 0 0 0 1px rgba(34,197,94,.65), 0 0 70px -8px rgba(34,197,94,.75); }
}

/* ---------- Tuner: string quick-select row ---------- */
.tuner-string-pill.active {
  background: linear-gradient(135deg, var(--success), #12793c);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 18px -2px rgba(34,197,94,.5);
}

/* ---------- Metronome ---------- */
.metronome-bpm-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.metronome-bpm-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 140px;
}
.metronome-bpm-number {
  font-size: 3.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.metronome-bpm-label {
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: .2rem;
}

.metronome-slider {
  width: 100%;
  max-width: 320px;
  margin: 1.5rem 0 .5rem;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 4px;
  background: var(--surface-elevated);
  outline: none;
}
.metronome-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #9d1420);
  box-shadow: 0 0 14px -2px var(--accent-soft), 0 0 0 4px rgba(225,29,46,.15);
  cursor: pointer;
  border: 2px solid #fff;
}
.metronome-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #9d1420);
  box-shadow: 0 0 14px -2px var(--accent-soft), 0 0 0 4px rgba(225,29,46,.15);
  cursor: pointer;
  border: 2px solid #fff;
}

.metronome-beat-dots {
  display: flex;
  gap: .9rem;
  margin: 1.25rem 0;
  flex-wrap: wrap;
  justify-content: center;
}
.metronome-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  transition: transform .08s ease, background .08s ease, box-shadow .08s ease;
}
.metronome-dot.accent {
  width: 20px; height: 20px;
  border-color: rgba(225,29,46,.4);
}
.metronome-dot.active-beat {
  background: var(--accent);
  border-color: transparent;
  transform: scale(1.35);
  box-shadow: 0 0 16px -1px var(--accent-soft);
}

.metronome-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
}
.metronome-play-btn {
  min-width: 140px;
  font-size: 1rem;
}

.metronome-stage.metronome-running {
  box-shadow: 0 0 0 1px rgba(225,29,46,.35), 0 0 44px -12px rgba(225,29,46,.5);
}

@media (prefers-reduced-motion: reduce) {
  .tuner-stage.tuner-in-tune { animation: none; }
  .tuner-needle { transition: none; }
}
