*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0f1114;
  --surface: #1a1d23;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #8ab4f8;
  --accent-dim: #5f8de0;
  --radius: 10px;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --chrome-control-bg: #2a2e36;
  --chrome-control-bg-hover: #383d47;
  --chrome-control-border: rgba(255, 255, 255, 0.14);
  --chrome-track: #454a56;
  /* Default chrome sizing; `.player` overrides with container-relative values */
  --chrome-control-height: 2.5rem;
  /* Match progress-to-bar spacing with `.player__bar` inter-control gap */
  --chrome-gap: 0.45rem;
  /* Unified size for labels, time, speed dropdown, and bar buttons */
  --chrome-font-size: 0.875rem;
}

html {
  height: 100%;
  overflow-x: hidden;
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  margin: 0;
  min-height: 100%;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

body.page--embed-host {
  margin: 0;
  overflow: hidden;
}

.page.page--embed {
  max-width: none;
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
}

.page.page--embed .upload-row,
.page.page--embed .url-row,
.page.page--embed .commands {
  display: none !important;
}

.page.page--embed .player {
  width: 100%;
  height: 100%;
  border-radius: 0;
  aspect-ratio: auto;
}

.commands {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.commands__title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.commands__list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.65;
  display: grid;
  gap: 0.35rem;
}

.commands__hint--touch {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .commands__hint--desktop {
    display: none;
  }
  .commands__hint--touch {
    display: list-item;
  }
}

.commands kbd {
  display: inline-block;
  min-width: 1.35em;
  margin-right: 0.15rem;
  padding: 0.1em 0.4em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--chrome-control-border);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.upload-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.upload-row__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-row__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.upload-row__btn:hover {
  background: var(--accent-dim);
}

.upload-row__btn:focus-visible {
  box-shadow: var(--focus);
}

.upload-row__name {
  font-size: 0.8125rem;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.url-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.url-row__input {
  flex: 1;
  min-width: 12rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--chrome-control-border);
  border-radius: 8px;
  outline: none;
}

.url-row__input::placeholder {
  color: var(--muted);
}

.url-row__input:focus-visible {
  box-shadow: var(--focus);
}

.url-row__btn {
  flex-shrink: 0;
}

.player {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  /* Scale controls with the player width (avoids clipping under overflow:hidden) */
  container-type: inline-size;
  container-name: player;
  -webkit-touch-callout: none;
  /* All chrome scales with player width (cqw); one row, no breakpoint wrap */
  --chrome-control-height: clamp(0.98rem, 0.06rem + 8.8cqw, 2.5rem);
  --chrome-font-size: clamp(0.4rem, 0.05rem + 3.35cqw, 0.875rem);
  --chrome-gap: clamp(0.04rem, 0.006rem + 1.55cqw, 0.45rem);
  /* Volume rail width (scales with player width via cqw) */
  --vol-rail-expanded: min(14rem, max(3.5rem, 34cqw));
}

/* Root is focusable (tabIndex); kill UA / :focus-visible rings on the shell */
.player:focus,
.player:focus-visible,
.player:focus-within {
  outline: none;
}

.player:focus-visible {
  box-shadow: none;
}

.player__viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  /* Tap-to-play and sliders work reliably; avoids double-tap zoom on the page when not panning. */
  touch-action: manipulation;
}

.player__viewport[data-can-pan="true"] {
  cursor: grab;
  touch-action: none;
}

.player__viewport[data-panning="true"] {
  cursor: grabbing;
}

/* Two-finger pinch zoom: take over touch so the page does not steal the gesture. */
.player__viewport.player__viewport--pinch {
  touch-action: none;
}

.player__zoom-layer {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transform: translateZ(0);
  backface-visibility: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.player__yt-mount {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.player__yt-mount[hidden] {
  display: none !important;
}

.player__yt-mount iframe,
.player__youtube-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.player--youtube-only .player__hud,
.player--youtube-only .player__chrome {
  display: none !important;
}

.player__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  vertical-align: middle;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.player__preview-src {
  position: absolute;
  width: 160px;
  height: 90px;
  opacity: 0;
  pointer-events: none;
  left: -9999px;
  top: 0;
  z-index: 1;
}

.player__hud {
  opacity: 0;
  transition: opacity 0.2s ease;
}

/*
 * iOS Safari: long-press on controls otherwise shows the link/image callout, text loupe,
 * and selection handles. Range inputs keep their existing touch-action for scrubbing.
 */
.player__hud button,
.player__hud .player__rate-select,
.player__hud .player__time,
.player__hud input[type="range"] {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.player__hud button,
.player__hud .player__rate-select {
  touch-action: manipulation;
}

.player:hover .player__hud,
.player[data-scrubbing="true"] .player__hud,
.player .player__hud:focus-within,
.player:not(.player--idle):focus-within .player__hud {
  opacity: 1;
}

/* Touch / pen-primary devices: no :hover; keep chrome visible whenever not in idle auto-hide. */
@media (hover: none) {
  .player:not(.player--idle) .player__hud {
    opacity: 1;
  }
}

/* Touch + coarse pointer: no fade when hiding chrome (outside tap or idle). */
@media (hover: none) and (pointer: coarse) {
  .player.player--idle .player__hud {
    transition: none !important;
  }
}

.player__corner-tools {
  position: absolute;
  top: clamp(0.3rem, 0.08rem + 1.2cqw, 0.75rem);
  right: clamp(0.28rem, 0.04rem + 1.6cqw, 0.75rem);
  z-index: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--chrome-gap);
  max-width: calc(100% - 1.5rem);
}

.player__corner-volume {
  position: absolute;
  top: clamp(0.3rem, 0.08rem + 1.2cqw, 0.75rem);
  left: clamp(0.28rem, 0.04rem + 1.6cqw, 0.75rem);
  z-index: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  max-width: calc(100% - 1.5rem);
  min-width: 0;
}

.player__chrome {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  /* Shared with `.player__bar-tools` so the PiP/fullscreen cluster lines up with other chrome pills. */
  --chrome-pad-x: clamp(0.22rem, 0.03rem + 1.8cqw, 0.75rem);
  --chrome-pad-b: clamp(0.32rem, 0.1rem + 1.35cqw, 0.6rem);
  padding: clamp(0.42rem, 0.18rem + 2.4cqw, 0.95rem) var(--chrome-pad-x) var(--chrome-pad-b);
  background: transparent;
  /* Do not set overflow-x on this ancestor: it clips the scrub preview (above the seek bar). */
  overflow: visible;
}

/*
 * No focus ring on player chrome. After a mouse click, the next keypress can
 * promote :focus-visible in Chromium; outline + box-shadow must both be cleared.
 * Universal descendant covers any future control types.
 */
.player__hud *:focus,
.player__hud *:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.player__hud button::-moz-focus-inner {
  border: 0;
}

/* Firefox: range inputs use ::-moz-focus-outer instead of outline on the host */
.player__progress::-moz-focus-outer,
.player__volume-slider::-moz-focus-outer {
  border: 0;
}

/*
 * WebKit/Blink: focused range thumbs can still show a focus ring; keep the same
 * thumb treatment as unfocused (progress already uses a subtle shadow on the thumb).
 */
.player__progress:focus::-webkit-slider-thumb,
.player__progress:focus-visible::-webkit-slider-thumb {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.player__volume-slider:focus::-webkit-slider-thumb,
.player__volume-slider:focus-visible::-webkit-slider-thumb {
  outline: none;
  box-shadow: none;
}

/*
 * Idle hides chrome even while :hover on the frame (Netflix-style). Does not apply when a
 * control inside a HUD surface still has focus — JS blurs those on idle; :has() is a fallback.
 */
.player.player--idle:not(:has(.player__hud:focus-within)):not([data-scrubbing="true"]) .player__hud {
  opacity: 0 !important;
  pointer-events: none;
}

.player.player--idle:not(:has(.player__hud:focus-within)):not([data-scrubbing="true"]) {
  cursor: none;
}

.player.player--idle:not(:has(.player__hud:focus-within)):not([data-scrubbing="true"])
  .player__viewport {
  cursor: none !important;
}

/* Hide HUD immediately when the pointer leaves the player (e.g. after click-to-focus). */
.player.player--pointer-outside:not(:has(.player__hud:focus-within)):not([data-scrubbing="true"])
  .player__hud {
  opacity: 0 !important;
  pointer-events: none;
}

.player__progress-wrap {
  position: relative;
  margin-bottom: var(--chrome-gap);
  display: flex;
  align-items: center;
  /* Let the seek bar own horizontal drags on touch; avoids missing PE moves + UA gesture stealing. */
  touch-action: none;
}

.player__scrub-preview {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.65));
}

/* `display: flex` above wins over the default [hidden] rule; force hide when toggled in JS */
.player__scrub-preview[hidden] {
  display: none !important;
}

.player__scrub-preview-canvas {
  display: block;
  width: var(--scrub-preview-w, 160px);
  height: var(--scrub-preview-h, 90px);
  border-radius: 6px;
  background: #111;
}

.player__scrub-preview-time {
  font-size: var(--chrome-font-size);
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.player__progress {
  --range-thumb: clamp(11px, 0.35rem + 1.8cqw, 14px);
  --range-track-h: clamp(7px, 0.25rem + 1.2cqw, 10px);
  flex: 1;
  width: 100%;
  min-width: 0;
  height: var(--range-thumb);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border-radius: 5px;
  cursor: pointer;
  touch-action: none;
}

.player__progress::-webkit-slider-runnable-track {
  height: var(--range-track-h);
  background: var(--chrome-track);
  border-radius: calc(var(--range-track-h) / 2);
}

.player__progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--range-thumb);
  height: var(--range-thumb);
  border-radius: 50%;
  background: var(--accent);
  margin-top: calc((var(--range-track-h) - var(--range-thumb)) / 2);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.player__progress::-moz-range-thumb {
  width: var(--range-thumb);
  height: var(--range-thumb);
  border: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.player__progress::-moz-range-track {
  height: var(--range-track-h);
  background: var(--chrome-track);
  border-radius: calc(var(--range-track-h) / 2);
}

.player__bar {
  display: flex;
  align-items: center;
  gap: var(--chrome-gap);
  flex-wrap: nowrap;
  min-height: var(--chrome-control-height);
  min-width: 0;
  width: 100%;
  max-width: 100%;
  /* Reserve space for PiP + fullscreen (absolutely positioned). */
  padding-right: calc(2 * var(--chrome-control-height) + var(--chrome-gap));
  overflow: visible;
}

/* Bottom-right cluster: same anchoring idea as `.player__corner-tools` (fixed to frame, not bar flex). */
.player__bar-tools {
  position: absolute;
  right: var(--chrome-pad-x);
  bottom: var(--chrome-pad-b);
  z-index: 9;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--chrome-gap);
  max-width: calc(100% - 1.5rem);
  pointer-events: none;
}

.player__bar-tools > * {
  pointer-events: auto;
}

.player__zoom-group,
.player__windows-group {
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.125rem;
  box-sizing: border-box;
  width: max-content;
  flex-shrink: 0;
  min-width: max-content;
  height: var(--chrome-control-height);
  padding: 0;
  background: var(--chrome-control-bg);
  border: 1px solid var(--chrome-control-border);
  border-radius: 8px;
  overflow: hidden;
}

.player__zoom-group .player__btn,
.player__windows-group .player__btn {
  align-self: stretch;
  height: auto;
  min-height: 0;
  padding: 0 clamp(0.08rem, 0.02rem + 0.7cqw, 0.28rem);
  background: transparent;
  border: none;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.95);
}

.player__windows-group .player__btn.player__btn--square {
  flex: 0 0 var(--chrome-control-height);
  width: var(--chrome-control-height);
  min-width: var(--chrome-control-height);
  padding: 0;
  aspect-ratio: 1;
}

.player__zoom-group .player__btn:hover,
.player__windows-group .player__btn:hover {
  background: var(--chrome-control-bg-hover);
}

.player__btn--zoom-reset {
  min-width: 0;
  max-width: 100%;
  padding: 0 clamp(0.12rem, 0.04rem + 0.9cqw, 0.45rem);
  font-size: var(--chrome-font-size);
  font-variant-numeric: tabular-nums;
}

.player__btn--square {
  width: var(--chrome-control-height);
  min-width: var(--chrome-control-height);
  padding: 0;
  flex-shrink: 0;
  aspect-ratio: 1;
}

.player__btn {
  box-sizing: border-box;
  height: var(--chrome-control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--chrome-control-border);
  background: var(--chrome-control-bg);
  color: #fff;
  padding: 0 clamp(0.18rem, 0.06rem + 1.1cqw, 0.7rem);
  border-radius: 6px;
  cursor: pointer;
  font-size: var(--chrome-font-size);
  font-weight: 600;
  line-height: 1;
}

.player__btn:hover {
  background: var(--chrome-control-bg-hover);
}

.player__btn:active,
.player__zoom-group .player__btn:active,
.player__windows-group .player__btn:active,
.player__volume > .player__volume-mute:active,
.player__rate .player__btn:active {
  background: var(--chrome-control-bg-hover);
}

/* Match `.player__time-group .player__time` (normal weight + muted white) */
.player__btn.player__btn--pip {
  font-size: var(--chrome-font-size);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: -0.03em;
}

.icon-play {
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0.5em 0 0.5em 0.75em;
  border-color: transparent transparent transparent #fff;
  font-size: clamp(9px, 0.22rem + 2.5cqw, 16px);
}

.player[data-state="playing"] .icon-play {
  width: 0.625em;
  height: 0.875em;
  border: none;
  background: linear-gradient(
    90deg,
    #fff 0%,
    #fff 35%,
    transparent 35%,
    transparent 65%,
    #fff 65%,
    #fff 100%
  );
}

.icon-volume {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(12px, 0.35rem + 2.4cqw, 18px);
  height: clamp(12px, 0.35rem + 2.4cqw, 18px);
}

.icon-volume__svg {
  display: block;
  width: 100%;
  height: 100%;
}

.icon-volume__svg--off {
  display: none;
}

.player[data-muted="true"] .icon-volume__svg--on {
  display: none;
}

.player[data-muted="true"] .icon-volume__svg--off {
  display: block;
}

.player__time-group {
  box-sizing: border-box;
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  width: max-content;
  flex-shrink: 0;
  min-width: max-content;
  height: var(--chrome-control-height);
  padding: 0;
  background: var(--chrome-control-bg);
  border: 1px solid var(--chrome-control-border);
  border-radius: 8px;
  overflow: hidden;
}

.player__time-group .player__time {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(0.12rem, 0.12cqw + 0.12rem, 0.5rem);
  text-align: center;
  font-size: var(--chrome-font-size);
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.95);
  white-space: nowrap;
}

.player__btn--frame {
  flex-shrink: 0;
  width: clamp(1rem, 0.55rem + 2.4cqw, 1.55rem);
  min-width: clamp(1rem, 0.55rem + 2.4cqw, 1.55rem);
  align-self: stretch;
  height: auto;
  min-height: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.player__btn--frame:hover {
  background: var(--chrome-control-bg-hover);
}

.icon-frame-arrow {
  display: block;
  width: clamp(8px, 0.18rem + 1.8cqw, 11px);
  height: clamp(8px, 0.18rem + 1.8cqw, 11px);
}

/* Width set in player.js: at least #zoomGroup, never narrower than the speed label needs. */
.player__rate {
  box-sizing: border-box;
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.125rem;
  flex-shrink: 0;
  min-width: 0;
  height: var(--chrome-control-height);
  padding: 0;
  background: var(--chrome-control-bg);
  border: 1px solid var(--chrome-control-border);
  border-radius: 8px;
  overflow: hidden;
}

.player__rate .player__btn {
  flex: 0 0 auto;
  align-self: stretch;
  height: auto;
  min-height: 0;
  padding: 0 clamp(0.08rem, 0.02rem + 0.7cqw, 0.28rem);
  background: transparent;
  border: none;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.95);
}

.player__rate .player__btn:hover {
  background: var(--chrome-control-bg-hover);
}

.player__rate-select-wrap {
  position: relative;
  /* Grow like before when the pill is widened to match zoom, but do not shrink below the label. */
  flex: 1 1 auto;
  min-width: min-content;
  display: flex;
  align-items: stretch;
  align-self: stretch;
  justify-content: center;
}

.player__rate-select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  margin: 0;
  font-size: var(--chrome-font-size);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.95);
  background-color: var(--chrome-control-bg);
  background-image: none;
  border: none;
  box-shadow: none;
  border-radius: 6px;
  padding: 0 clamp(0.12rem, 0.04rem + 0.85cqw, 0.45rem);
  cursor: pointer;
  text-align: center;
  text-align-last: center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.player__rate-select::-ms-expand {
  display: none;
}

.player__rate-select option {
  background: var(--chrome-control-bg);
  color: #fff;
}

/* One pill: mute + horizontal rail (always visible; rail width scales with `--vol-rail-expanded`). */
.player__volume {
  --volume-pill-radius: 8px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: stretch;
  min-width: 0;
  max-width: 100%;
  height: var(--chrome-control-height);
  background: var(--chrome-control-bg);
  border: 1px solid var(--chrome-control-border);
  border-radius: var(--volume-pill-radius);
  /* `hidden` clips the range thumb on touch; thumbs need to extend slightly past the track. */
  overflow: visible;
}

.player__volume > .player__volume-mute {
  flex: 0 0 var(--chrome-control-height);
  width: var(--chrome-control-height);
  min-width: var(--chrome-control-height);
  height: var(--chrome-control-height);
  align-self: center;
  margin: 0;
  padding: 0;
  border: none;
  /* Square inner corners would paint hover past the pill’s rounded outline; match the pill’s left arc. */
  border-radius: var(--volume-pill-radius) 0 0 var(--volume-pill-radius);
  background: transparent;
  box-shadow: none;
  font-size: var(--chrome-font-size);
}

.player__volume > .player__volume-mute:hover {
  background: var(--chrome-control-bg-hover);
}

.player__volume-slider-rail {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  max-width: var(--vol-rail-expanded);
  padding: 0 clamp(0.22rem, 0.06rem + 1cqw, 0.5rem);
  overflow: visible;
}

.player__volume-slider {
  --vol-thumb: clamp(11px, 0.35rem + 1.8cqw, 14px);
  --vol-track-h: clamp(7px, 0.25rem + 1.2cqw, 10px);
  box-sizing: border-box;
  flex: 1 1 auto;
  width: 100%;
  min-width: clamp(1.5rem, 0.75rem + 9cqw, 5rem);
  height: var(--vol-thumb);
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  touch-action: pan-x;
}

.player__volume-slider:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.player__volume-slider::-webkit-slider-runnable-track {
  height: var(--vol-track-h);
  background: var(--chrome-track);
  border-radius: calc(var(--vol-track-h) / 2);
}

.player__volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--vol-thumb);
  height: var(--vol-thumb);
  border-radius: 50%;
  background: var(--accent);
  margin-top: calc((var(--vol-track-h) - var(--vol-thumb)) / 2);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.player__volume-slider::-moz-range-thumb {
  width: var(--vol-thumb);
  height: var(--vol-thumb);
  border: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.player__volume-slider::-moz-range-track {
  height: var(--vol-track-h);
  background: var(--chrome-track);
  border-radius: calc(var(--vol-track-h) / 2);
}

.player__spacer {
  flex: 1 1 0;
  min-width: 0;
}

.icon-fs {
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-fs__svg {
  display: block;
  width: clamp(10px, 0.22rem + 2cqw, 14px);
  height: clamp(10px, 0.22rem + 2cqw, 14px);
}

.tooltip-layer {
  position: fixed;
  z-index: 100000;
  left: 0;
  top: 0;
  margin: 0;
  /* `em` sizes track `font-size` (set in CSS for page chrome; JS syncs from the player when over it). */
  max-width: min(20em, calc(100vw - 16px));
  padding: 0.4em 0.57em;
  font-size: clamp(0.65rem, 0.2rem + 1.1vw, 0.875rem);
  font-weight: 500;
  line-height: 1.35;
  color: #fff;
  background: rgba(26, 29, 35, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.43em;
  box-shadow: 0 0.29em 1.14em rgba(0, 0, 0, 0.45);
  pointer-events: none;
  white-space: normal;
}

.tooltip-layer[hidden] {
  display: none !important;
}

/* Touch: slightly smaller in-player pills than default cqw; URL row stays tappable. */
@media (pointer: coarse) {
  .upload-row__btn,
  .url-row__btn {
    min-height: 44px;
    padding: 0.55rem 1.15rem;
  }

  .url-row__input {
    min-height: 44px;
    font-size: 1rem;
    padding: 0.55rem 0.75rem;
  }

  .player {
    --chrome-control-height: clamp(0.85rem, 0.05rem + 6.8cqw, 2.1rem);
    --chrome-font-size: clamp(0.38rem, 0.042rem + 2.85cqw, 0.78rem);
    --chrome-gap: clamp(0.04rem, 0.005rem + 1.2cqw, 0.38rem);
    --vol-rail-expanded: min(12rem, max(3rem, 26cqw));
  }
}
