/* ---- Harmony Training ---- */

/* Prevent training pages from stretching to fill viewport */
.tool-page:has(.et-exercise-box) { min-height: auto; }

/* Unified control row */
.ph-controls-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
  align-items: center;
}

/* Mode pills — use cof-pill base, override active color to blue */
.ph-mode-pill.cof-pill.active { background: #2a2d3a; color: #ccc; }

/* Audio icon button wave animations */
.ph-audio-btn .ph-audio-wave1,
.ph-audio-btn .ph-audio-wave2 { opacity: 0.3; }
.ph-audio-btn.active .ph-audio-wave1,
.ph-audio-btn.active .ph-audio-wave2 { opacity: 1; }
/* Hint "i" button — same toggled state as volume button */
.ph-hint-btn { color: #555; }
.ph-hint-btn.active { background: #1e2030 !important; border-color: #3a3d4a !important; color: #ccc !important; }

/* Controls & selects */
.ph-select {
  padding: 8px 32px 8px 12px;
  border: 1.5px solid #2a2d3a;
  border-radius: 10px;
  background: #1a1d27;
  color: #ccc;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
}
.ph-select:hover, .ph-select:focus { border-color: #3a3d4a; color: #fff; }
.ph-select option { background: #1a1d27; color: #ccc; }
.ph-select-wrap {
  position: relative;
}

/* ---- Dial Area: main circle centered, next circle floats beside ---- */
.ph-dial-area {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* Main circle — matches metronome dial */
.ph-dial {
  position: relative;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #1a1d27, #12141c);
  border: 3px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  margin: 20px auto 0;
  width: 350px;
  height: 350px;
}

/* Arc SVG overlays the circle edge */
.ph-arcs {
  position: absolute;
  top: -5px; left: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  pointer-events: none;
  transform: rotate(-90deg);
}
.ph-arc {
  fill: none;
  stroke: #2a2d3a;
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke 0.06s;
}
.ph-arc.active {
  stroke: #2a6cb0;
  stroke-width: 6;
}
.ph-arc.accent.active {
  stroke: #c04040;
  stroke-width: 6;
}

/* Big note/chord display inside dial */
.ph-display-wrap {
  position: absolute;
  left: 50%;
  top: 17%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ph-display-big {
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  text-align: center;
  transition: opacity 0.15s;
}

/* Countdown styling */
.ph-display-big.countdown {
  color: #fff;
}

/* Hint text above main display — fixed height so main doesn't shift */
.ph-display-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: #7cb8ff;
  text-align: center;
  letter-spacing: 0.02em;
  order: -1;
  min-height: 1.2em;
  line-height: 1.2;
}

/* Mode toggles inside dial */
.ph-dial-top { display: none; }
.ph-dial-toggles { display: flex; gap: 6px; align-items: center; z-index: 2;
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; }
.ph-dial-toggles .cof-pill { white-space: nowrap; font-size: 0.7rem; padding: 6px 10px; }
.ph-dial-bottom { display: contents; }

/* BPM slider: below pills */
.ph-dial-controls {
  position: absolute;
  top: 62%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 6px;
  width: 80%;
}

/* BPM value + label hidden (BPM shown in main display instead) */
.ph-bpm-val, .ph-bpm-label { display: none; }

/* BPM +/- buttons (same as metronome) */
.ph-dial .met-bpm-adj {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid #2a2d3a;
  background: transparent;
  color: #666;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  flex-shrink: 0;
}
.ph-dial .met-bpm-adj:hover { border-color: #555; color: #fff; background: rgba(255,255,255,0.05); }
.ph-dial .met-bpm-adj:active { border-color: #555; color: #fff; }

/* Slider inside dial (same as metronome) */
.ph-dial .met-slider-inline {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  border-radius: 10px;
  background: #2a2d3a;
  outline: none;
}
.ph-dial .met-slider-inline::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2a6cb0;
  cursor: pointer;
  border: 2px solid #4a8cd0;
}
.ph-dial .met-slider-inline::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2a6cb0;
  cursor: pointer;
  border: 2px solid #4a8cd0;
}

/* Play button inside dial (same as metronome) */
/* Play button: centered between slider and bottom */
.ph-dial .met-play-btn {
  position: absolute;
  top: 79%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #2a6cb0;
  border: 2px solid #4a8cd0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.ph-dial .met-play-btn:hover { background: #3580cc; }
.ph-dial .met-play-btn:active { transform: translate(-50%, -50%) scale(0.93); }
.ph-dial .met-play-btn svg { width: 22px; height: 22px; fill: #fff; }

/* Flash effect on new note */
.ph-dial.flash {
  /* arcs already show the beat — no circle border flash needed */
}

/* ---- Next Item Circle (absolutely positioned so main stays centered) ---- */
.ph-next-circle-wrap {
  position: absolute;
  left: calc(100% + 40px);
  top: calc(50% - 45px); /* overridden by JS alignNextToDisplay */
  display: none;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.2s;
}
.ph-next-circle-wrap.visible {
  display: flex;
  opacity: 1;
}
.ph-next-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #444;
  margin-top: 8px;
  line-height: 1;
}
.ph-next-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #1a1d27, #12141c);
  border: 1.5px solid #2a2d3a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ph-display-next {
  font-size: 1.3rem;
  font-weight: 700;
  color: #6a7090;
  line-height: 1.2;
  min-height: 1.2em;
  text-align: center;
}
.ph-next-sub {
  font-size: 0.55rem;
  font-weight: 600;
  color: #3a4a6a;
  text-align: center;
  order: -1;
  line-height: 1;
}
.ph-next-sub:empty { display: none; }

/* Responsive */
@media (max-width: 600px) {
  .ph-controls-row { gap: 4px; margin-top: -3px; margin-bottom: 21px; min-height: 40px; flex-wrap: nowrap; }
  .ph-select { font-size: 0.75rem; padding: 6px 26px 6px 8px; flex: 1; min-width: 0; }
  .ph-dial-area { gap: 12px; flex-direction: column; align-items: center; }
  /* Next on mobile: no circle, no label, aligned with main display */
  .ph-next-circle-wrap { position: absolute; right: auto; left: 70%; top: 28%; transform: translateY(-50%); } /* top overridden by JS */
  .ph-next-circle { width: auto; height: auto; border-radius: 0; background: none; border: none; }
  .ph-display-next { font-size: 0.8rem; }
  .ph-next-sub { font-size: 0.5rem; }
  .ph-next-label { display: none; }
  .ph-display-wrap { flex-direction: column; align-items: center; gap: 2px; }
  .tool-page:has(.ph-dial) { padding-left: 0; padding-right: 0; }
  .ph-dial { width: calc(100vw - 16px); height: calc(100vw - 16px); }
}
@media (max-width: 400px) {
  .ph-controls-row { gap: 4px; margin-top: -3px; margin-bottom: 21px; min-height: 40px; flex-wrap: nowrap; }
  .ph-select { font-size: 0.75rem; padding: 6px 26px 6px 8px; }
  .tool-page:has(.ph-dial) { padding-left: 0; padding-right: 0; }
  .ph-dial { width: calc(100vw - 16px); height: calc(100vw - 16px); }
  .ph-display-big { font-size: 2rem; }
}
