/* ============================================================================
 * Bottom transport controls — play button, scrubbable progress bar, Undo
 * shuffle / Shuffle, fullscreen. Auto-hides during playback (with the
 * header, see app-header.css body.chrome-hidden).
 * ========================================================================== */

#controls {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  /* Slightly taller, slightly deeper gradient — the transport feels anchored
     instead of floating. The 60px top padding keeps the gradient soft. */
  background: linear-gradient(to top,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.65) 45%,
    transparent 100%);
  padding: 72px var(--space-6) var(--space-5);
  /* Landscape phones: clear the notch side and the home indicator. */
  padding-left: max(var(--space-6), env(safe-area-inset-left));
  padding-right: max(var(--space-6), env(safe-area-inset-right));
  padding-bottom: max(var(--space-5), env(safe-area-inset-bottom));
  z-index: 20;
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}
#controls.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.control-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: 1400px;
  margin: 0 auto;
}

/* Primary play affordance. White-on-black is the right call for visual
   weight; we add an accent-tinted halo on hover so it still feels alive. */
.play-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--ink); color: #000;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease-out),
              box-shadow 0.2s var(--ease-out);
  font-size: 20px;
  font-weight: 700;
}
.play-btn:hover  {
  transform: scale(1.06);
  box-shadow: 0 0 0 6px var(--accent-soft);
}
.play-btn:active { transform: scale(0.95); }
.play-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  letter-spacing: 0.02em;
}
.progress {
  flex: 1;
  height: 4px;
  background: var(--surface-5);
  border-radius: var(--radius-1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.progress::after {
  /* Subtle hover lift — the bar grows a hair taller when the user hovers
     to communicate "this is scrubbable". */
  content: '';
  position: absolute; inset: 0;
  border-radius: var(--radius-1);
  transition: box-shadow 0.2s var(--ease-out);
  pointer-events: none;
}
.progress:hover { background: rgba(255, 255, 255, 0.22); }
.progress-fill {
  position: absolute; inset: 0; right: auto;
  /* Vizzy accent: the progress fill is the single most-visible signal of
     liveness, so it earns the accent color. */
  background: linear-gradient(90deg,
    var(--accent) 0%,
    #ff6da0 100%);
  width: 0%;
  transition: width 0.05s linear;
  border-radius: var(--radius-1);
  box-shadow: 0 0 12px var(--accent-glow);
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface-4);
  border: none; color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s var(--ease-out),
              transform 0.1s var(--ease-out);
  font-size: 18px;
}
.icon-btn:hover { background: var(--surface-5); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Phone tuning — keep the play + scrubber row on one line with ≥44px tap
   targets. Shuffle / Undo shuffle stay (also available as swipe left /
   right on the stage). */
@media (max-width: 767px) {
  #controls {
    padding: 28px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .control-row {
    gap: 12px;
  }
  .play-btn {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }
  .icon-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  /* Fullscreen is the iOS Safari fullscreen API and doesn't deliver value
     over a maximized PWA — hide it on phones. */
  #controls #fullscreenBtn {
    display: none;
  }
  .time {
    font-size: 11px;
    min-width: 36px;
  }
}

/* Landscape phones get the desktop transport — keep ≥44px targets and drop
   fullscreen (iPhone Safari has no element fullscreen API). */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
}
@media (pointer: coarse) and (max-height: 500px) {
  #controls { padding-top: 40px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  #controls #fullscreenBtn { display: none; }
  .play-btn { width: 48px; height: 48px; font-size: 18px; }
}
