/* Karaoke widget styles.
 *
 * All rules scoped under .vj-modal--karaoke so the existing modal layout
 * is untouched unless the karaoke class is active. The class is toggled
 * on/off by karaoke.js + the index.html state-machine glue.
 *
 * Brand tokens (--crimson*, --gold*, --text-muted, --border-medium) come
 * from the existing manifesto CSS — we just reuse them.
 */

/* ─── Mount slot lives inside .vj-stage-area; hidden by default ─── */
#karaoke-mount {
  display: none;
  width: 100%;
  height: 100%;
}

.karaoke-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.karaoke-score {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--gold-light, #ffe6b4);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
  background: rgba(0, 0, 0, 0.42);
  border-radius: 8px;
  pointer-events: none;
}
/* Restore [hidden] semantics: our display:flex above has equal specificity to
 * the UA's [hidden]{display:none}, so without this explicit rule the element
 * stays visible when JS sets el.hidden = true. */
.karaoke-score[hidden] { display: none; }

/* ─── Count-in overlay (visible only during the song's intro_sec window) ─── */
.karaoke-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 4, 6, 0.62);
  border-radius: 8px;
  pointer-events: none;
  z-index: 2;
}
/* Same [hidden] fix as .karaoke-score — display:flex above has equal
 * specificity to the UA's [hidden]{display:none} and would otherwise win. */
.karaoke-overlay[hidden] { display: none; }
.karaoke-countdown {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 5.2rem;
  line-height: 1;
  color: var(--gold-light, #ffe6b4);
  text-shadow: 0 6px 32px rgba(0, 0, 0, 0.7);
  font-variant-numeric: tabular-nums;
  /* Per-beat pulse animation is fired by the renderer via Web Animations API
   * each time the visible number changes — no CSS keyframes needed. */
}
@media (max-width: 600px) {
  .karaoke-countdown { font-size: 3.6rem; }
}

/* ─── Karaoke mode: expand modal, swap stage area for the canvas ─── */
.vj-modal--karaoke {
  max-width: 760px;
}

.vj-modal--karaoke .vj-stage-area {
  position: relative;
  width: 100%;
  height: 220px;
  margin-bottom: 1.4rem;
}

/* Hide the built-in centerpiece sublayers and the seconds counter while
 * karaoke is mounted — the canvas + score readout fully replace them. */
.vj-modal--karaoke .vj-sa-halo,
.vj-modal--karaoke .vj-sa-rings,
.vj-modal--karaoke .vj-sa-bars,
.vj-modal--karaoke .vj-sa-dots,
.vj-modal--karaoke .vj-sa-core,
.vj-modal--karaoke .vj-sa-counter {
  display: none;
}

.vj-modal--karaoke #karaoke-mount {
  /* Override the existing `.vj-stage-area > *` rule, which sets
   * absolute-fill + opacity:0 + pointer-events:none on every direct child
   * of the stage area. We want the karaoke canvas visible and interactive. */
  display: block;
  position: relative;
  inset: auto;
  opacity: 1;
  pointer-events: auto;
}

/* Smaller-screen tweaks: the canvas remains usable down to ~360 px wide. */
@media (max-width: 600px) {
  .vj-modal--karaoke {
    max-width: 100%;
  }
  .vj-modal--karaoke .vj-stage-area {
    height: 180px;
  }
  .karaoke-score {
    font-size: 1.8rem;
  }
}

/* ─── Action row: preview + primary side-by-side in idle, primary alone otherwise ─── */
.vj-action-row {
  display: flex;
  gap: 0.7rem;
  align-items: stretch;
}
.vj-action-row > button { flex: 1; }
/* When primary is alone in the row (preview hidden), it still takes full width thanks to flex:1. */

/* ─── Preview button — matches primary visually, gold accent instead of crimson ─── */
.vj-preview-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  margin: 0;
  padding: 1rem 1rem; min-height: 56px;
  background: transparent;
  color: var(--gold-light, #ffe6b4);
  border: 1px solid var(--gold-muted, rgba(212,168,67,0.45));
  border-radius: 12px;
  font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  cursor: pointer; user-select: none;
  transition: all 0.2s ease;
}
.vj-preview-btn:hover,
.vj-preview-btn:focus-visible {
  background: rgba(212, 168, 67, 0.08);
  border-color: var(--gold-light, #ffe6b4);
  transform: translateY(-1px);
  outline: none;
}
.vj-preview-btn:active { transform: translateY(0) scale(0.99); }
.vj-preview-btn[data-playing="true"] {
  background: rgba(212, 168, 67, 0.14);
  border-color: var(--gold-light, #ffe6b4);
}
.vj-preview-btn[data-playing="true"] .vj-preview-icon-play  { display: none; }
.vj-preview-btn[data-playing="false"] .vj-preview-icon-stop { display: none; }
.vj-preview-icon-play, .vj-preview-icon-stop { width: 12px; height: 12px; fill: currentColor; flex-shrink: 0; }

/* Hide preview anywhere except idle — primary then takes full width via flex:1 */
.vj-modal:not([data-state="idle"]) .vj-preview-btn { display: none; }

/* On narrow screens, stack the action-row vertically so labels still fit */
@media (max-width: 600px) {
  .vj-action-row { flex-direction: column; }
}

/* ─── Reviewing state: score + Submit / Re-record buttons ─── */

/* Primary button restyled for "Submit" — gold accent like complete */
.vj-modal[data-state="reviewing"] .vj-primary {
  background: linear-gradient(180deg, rgba(255, 215, 130, 0.18), rgba(255, 215, 130, 0.04));
  border-color: rgba(255, 215, 130, 0.55);
  color: var(--gold-light, #ffe6b4);
}

/* Secondary "Re-record" button — visible only in reviewing */
.vj-secondary-btn {
  display: none;
  margin: 0.6rem auto 0;
  padding: 0.5rem 1.1rem;
  background: transparent;
  border: 1px solid var(--border-medium, rgba(255,255,255,0.18));
  border-radius: 8px;
  color: var(--text-muted, rgba(255,255,255,0.65));
  font-family: inherit;
  font-size: 0.86rem;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.vj-secondary-btn:hover,
.vj-secondary-btn:focus-visible {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.32);
  outline: none;
}
.vj-modal[data-state="reviewing"] .vj-secondary-btn { display: inline-block; }

/* Status line in reviewing state — match brand gold */
.vj-modal[data-state="reviewing"] .vj-status-line {
  color: var(--gold-light, #ffe6b4);
}

/* Hide headphones hint while reviewing — score block already explains */
.vj-modal[data-state="reviewing"] .vj-headphones-hint { display: none; }
