/* Galaxy visualizer + pro player. Loaded after style.css. */

/* ---------- Galaxy stage ---------- */
.waveform.is-replaced { display: none; }

.galaxy-stage {
  position: relative;
  height: clamp(200px, 25vw, 260px);
  margin: 14px 0 8px;
  border-radius: 14px;
  overflow: hidden;
  background: #060a17;
  border: 1px solid rgba(139, 157, 209, .16);
  box-shadow: inset 0 0 70px rgba(70, 90, 220, .12);
  transition: border-color .5s ease, box-shadow .5s ease;
}
.galaxy-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.galaxy-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 52%, rgba(4, 7, 16, .78) 100%);
}
.galaxy-meter {
  position: absolute; left: 16px; right: 16px; bottom: 11px; height: 2px;
  border-radius: 2px; background: rgba(157, 177, 220, .12); overflow: hidden; pointer-events: none;
}
.galaxy-meter i {
  display: block; width: 100%; height: 100%;
  background: linear-gradient(90deg, #66e3df, #7c8cff 60%, #ff627c);
  clip-path: inset(0 100% 0 0);
}
.galaxy-stage[data-state="recording"] {
  border-color: rgba(255, 98, 124, .42);
  box-shadow: 0 0 0 1px rgba(255, 98, 124, .1), 0 0 44px rgba(255, 98, 124, .12), inset 0 0 70px rgba(255, 98, 140, .09);
}
.galaxy-stage[data-state="ready"] {
  border-color: rgba(85, 223, 176, .32);
  box-shadow: inset 0 0 70px rgba(85, 223, 176, .07);
}

/* ---------- Pro player ---------- */
audio.pro-hidden { display: none !important; }

.pp {
  --pp-cyan: #66e3df;
  --pp-blue: #7c8cff;
  --pp-violet: #b27eff;
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px 12px;
  border: 1px solid rgba(145, 163, 205, .16);
  border-radius: 14px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(124, 140, 255, .1), transparent 55%),
    radial-gradient(120% 140% at 100% 100%, rgba(102, 227, 223, .07), transparent 55%),
    rgba(5, 9, 20, .62);
  transition: border-color .3s ease, box-shadow .3s ease;
}
.pp.is-playing { border-color: rgba(124, 140, 255, .38); box-shadow: 0 0 36px rgba(102, 227, 223, .07); }
.pp.is-empty { opacity: .5; pointer-events: none; }

.pp-stage {
  position: relative;
  height: 96px;
  border-radius: 9px;
  cursor: pointer;
  touch-action: none;
  outline-offset: 3px;
}
.pp-stage.dragging { cursor: grabbing; }
.pp-wave { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pp-tip {
  position: absolute; top: -9px; transform: translate(-50%, -100%);
  padding: 3px 7px; border-radius: 6px; pointer-events: none;
  background: #1a2542; border: 1px solid rgba(145, 163, 205, .3);
  color: #e6ebff; font: 600 10px "Space Grotesk", sans-serif; font-variant-numeric: tabular-nums;
}
.pp-tip[hidden], .pp-note[hidden] { display: none; }
.pp-note {
  position: absolute; left: 0; right: 0; bottom: 20px; text-align: center; pointer-events: none;
  color: #ff9ba9; font-size: 11px;
}

.pp-bar { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.pp-orb { position: relative; flex: 0 0 76px; width: 76px; height: 76px; margin: -4px 4px -4px -4px; }
.pp-orb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pp-play {
  position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; margin: -21px 0 0 -21px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  color: #fff; background: linear-gradient(135deg, #6578f6, #8a7cf8);
  box-shadow: 0 6px 20px rgba(93, 110, 244, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.pp-play:hover { transform: scale(1.06); box-shadow: 0 8px 26px rgba(120, 130, 255, .5); }
.pp-play:active { transform: scale(.96); }
.pp-play svg { width: 20px; height: 20px; fill: currentColor; }
.pp-play svg:first-child { margin-left: 2px; }
.is-playing .pp-play svg { margin-left: 0; }

.pp-time { display: flex; align-items: baseline; gap: 5px; font: 600 14px "Space Grotesk", monospace; font-variant-numeric: tabular-nums; color: #e9edff; }
.pp-sep { color: #5d6b88; font-weight: 500; }
.pp-dur { color: #8998b5; font-weight: 500; }
.pp-spacer { flex: 1 1 8px; }

.pp-btn {
  display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px;
  border: 1px solid rgba(145, 163, 205, .16); border-radius: 9px; cursor: pointer;
  background: rgba(129, 146, 183, .07); color: #b8c4dc;
  font: 700 11px "DM Sans", sans-serif; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.pp-btn:hover { background: rgba(129, 146, 183, .16); color: #fff; }
.pp-btn svg { width: 18px; height: 18px; fill: currentColor; }
.pp-btn svg.stroke { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pp-btn svg text { fill: currentColor; stroke: none; font: 700 7px "DM Sans", sans-serif; }
.pp-btn.on, .pp-btn[aria-pressed="true"] { color: var(--pp-cyan); border-color: rgba(102, 227, 223, .4); background: rgba(102, 227, 223, .1); }

.pp-vol { display: flex; align-items: center; gap: 4px; }
.pp-range {
  -webkit-appearance: none; appearance: none; width: 78px; height: 4px; border-radius: 4px; cursor: pointer;
  --fill: 100%;
  background: linear-gradient(90deg, var(--pp-cyan), var(--pp-blue)) 0 / var(--fill) 100% no-repeat, rgba(145, 163, 205, .22);
}
.pp-range::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(124, 140, 255, .35); }
.pp-range::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(124, 140, 255, .35); }
.pp-range::-moz-range-track { background: transparent; }

.pp button:focus-visible, .pp-range:focus-visible, .pp-stage:focus-visible { outline: 2px solid var(--cyan, #66e3df); outline-offset: 3px; }

/* the player lives inside existing cards: keep them roomy */
.preview-content .pp, #audio-result .pp { margin-top: 6px; }
#audio-result .pp { margin-bottom: 12px; }

@media (max-width: 540px) {
  .galaxy-stage { height: 190px; }
  .pp { padding: 10px; }
  .pp-stage { height: 80px; }
  .pp-bar { gap: 5px; }
  .pp-time { order: 1; }
  .pp-spacer { display: none; }
  .pp-orb { order: 0; }
  .pp-vol { flex: 1 1 100%; justify-content: flex-end; order: 3; }
  .pp-range { flex: 1; max-width: 160px; }
}
@media (prefers-reduced-motion: reduce) {
  .pp-play, .pp, .galaxy-stage { transition: none; }
}
