/*
 * recording-player.css — the learner's-recording player inside Speaking feedback.
 * Ported from the guided-review spike (annotated-passage-prototype.html). Scoped
 * under .recording-player so the controls never leak into the rest of the panel.
 */
.recording-player {
  --rp-ink: var(--ink);
  --rp-rubric: var(--rubric); /* faded red = the error/accent colour */
  --rp-track-played: #8a9097;
  --rp-track-unplayed: var(--track-unplayed);
  margin: 18px 0 4px;
}

.recording-player--question {
  --rp-rubric: var(--skill-speaking, #8969a8);
}

.speaking-question-audio {
  grid-column: 1 / -1;
  width: 100%;
  margin-bottom: 28px;
}

.speaking-question-audio .recording-player {
  margin: 0;
}

.recording-player__label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  color: var(--ink-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.recording-player__label::before,
.recording-player__label::after {
  content: "";
  flex: 1;
  border-top: 2px dotted var(--border);
}

.recording-player.is-recording-inert {
  opacity: 0.52;
}

.recording-player.is-recording-inert .controls-row,
.recording-player.is-recording-inert .scrub-wrap {
  pointer-events: none;
}

/* Inside the player card the results slot is a bare mount, not a card of its
   own: drop the .ai-feedback chrome so the Fix panel fills it edge to edge
   (its own background provides the surface). */
.recording-player .ai-feedback {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.recording-player--play-only {
  margin: 0;
}

.recording-orb .recording-player--play-only {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.recording-orb .recording-player--play-only .play-btn {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

/* media controls: play + time on one row, vertically centred */
.recording-player .controls-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0 0 8px;
}

.recording-player--play-only .controls-row {
  width: 100%;
  height: 100%;
  margin: 0;
  justify-content: center;
}

.recording-player .play-btn {
  /* 62px matches the adopted player's settled size and sits just under the
     64px overall score orb, so the scores outrank the player everywhere. */
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2px solid #8a9097;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin: 0; /* the row owns the spacing */
  flex: none;
}

/* Optically centre both right-pointing triangles in the orb. */
.recording-player .pp-play,
.recording-player .play-btn .count {
  transform: translateX(3px);
}

/* play/pause: both icons stacked; CSS cross-fades opacity on the .is-playing class */
.recording-player .pp {
  position: relative;
  width: 36px;
  height: 38px;
}
.recording-player .pp svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.15s ease;
}
.recording-player .pp svg path { fill: var(--rp-rubric); }
.recording-player .pp .pp-pause { opacity: 0; }
.recording-player .pp.is-playing .pp-play { opacity: 0; }
.recording-player .pp.is-playing .pp-pause { opacity: 1; }

/* Get-ready countdown: while counting, the digit replaces the play/pause icon,
   seated inside a solid rubric triangle (the spike's get-ready look). */
.recording-player .play-btn.is-counting .pp { display: none; }
.recording-player .play-btn .count {
  width: 34px;
  height: 36px;
  background: var(--rp-rubric);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 6px; /* seat the number in the triangle's wide left mass */
  color: #fff;
  font-weight: 700;
  font-size: 1.9em;
  box-sizing: border-box;
}

.recording-player .time {
  font-weight: 600;
  color: #6b7280;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  margin-right: auto; /* push the row's trailing controls to the right */
  font-size: 1.05rem;
}

/* the full-width scrubber below the controls */
.recording-player .scrub-wrap { position: relative; margin-top: 6px; }
.recording-player .scrubber {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 4px;
  margin: 0;
  border-radius: 999px;
  background: var(--rp-track-unplayed);
  cursor: pointer;
  transition: background 0.1s linear; /* smooth the played-fill between frames */
}
.recording-player .scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--rp-track-played);
  border: none;
}
.recording-player .scrubber::-moz-range-thumb {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--rp-track-played);
  border: none;
}

.recording-player .speaking-player-status {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  align-self: stretch;
  margin: 8px 10px;
  padding: 6px 16px;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  white-space: nowrap;
  box-sizing: border-box;
}
/* With a pill in the row, .time gives up its auto margin so the pill's flex
   grow (not the margin) claims the row's trailing space. */
.recording-player .controls-row:has(.speaking-player-status:not(:empty)) .time {
  margin-right: 0;
}
.recording-player .speaking-player-status--muted {
  animation: speaking-status-pop 0.8s ease backwards;
}
@keyframes speaking-status-pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .recording-player .pp svg,
  .recording-player .scrubber {
    transition: none;
  }

  .recording-player .speaking-player-status--muted {
    animation: none;
  }
}
/* Gray wash for neutral notices ("Skip"): informational, neither
   pending-green nor error-red. */
.recording-player .speaking-player-status--muted {
  background: rgba(107, 114, 128, 0.10);
  color: var(--ink-secondary);
}
@media (max-width: 768px) {
  /* One row: play, time, Skip. flex-wrap is the escape hatch — on a screen
     too narrow to fit them all, the overflow wraps under the row instead
     of clipping. */
  .recording-player .controls-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
  }

  /* Smaller orb so the whole row fits; icon scales with it. */
  .recording-player .play-btn {
    width: 48px;
    height: 48px;
  }

  .recording-player .pp {
    width: 28px;
    height: 30px;
  }

  .recording-player .play-btn .count {
    width: 28px;
    height: 30px;
    font-size: 1.5em;
  }

  .recording-player .time {
    min-width: 0;
    font-size: 0.9rem;
  }

  .recording-player .scrub-wrap {
    margin-top: 14px;
  }
}
