/* player: the music player (js/player.js) and its play buttons on every screen. Loaded after app.css.
   The bar is the control room's second tally: black like the top bar, red for what is playing. */

@keyframes plPop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes plCount { 0% { opacity: 0; transform: scale(1.6); } 30% { opacity: 1; transform: scale(1); } 100% { opacity: .85; transform: scale(.94); } }
@keyframes plEq { 0% { transform: scaleY(.25); } 100% { transform: scaleY(1); } }
@keyframes plSpin { to { transform: rotate(360deg); } }
@keyframes plGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(227, 38, 43, .55); } 50% { box-shadow: 0 0 0 4px rgba(227, 38, 43, 0); } }

/* ---------- the play button that sits in rows, panels and blocks */
.pb { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 32px; height: 32px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--line2); background: var(--paper); color: var(--ink); cursor: pointer;
  transition: background var(--fast), color var(--fast), border-color var(--fast), transform var(--fast), width var(--mid) var(--ease); }
.pb.sm { width: 26px; height: 26px; }
.pb.wl { width: auto; border-radius: 16px; padding: 0 12px 0 10px; font-weight: 500; font-size: 13px; }
@media (hover: hover) { .pb:hover { background: var(--ink); color: #fff; border-color: var(--ink); } }
.pb:active { transform: scale(.92); }
.pb.pb-cur { border-color: var(--red); color: var(--red); }
.pb.pb-play { background: var(--red); border-color: var(--red); color: #fff; }
.pb-ic { display: inline-flex; animation: plPop var(--fast) var(--ease); }
.pb .ic { margin-inline-start: 1px; }
.pb.pb-play .pb-ic { display: none; }
.pb.pb-play:hover .pb-ic, .pb.pb-play:focus-visible .pb-ic { display: inline-flex; }
.pb.pb-play:hover .pl-eq, .pb.pb-play:focus-visible .pl-eq { display: none; }
.pb-count { font-family: var(--head); font-weight: 400; font-size: 14px; line-height: 1; animation: plCount .5s var(--ease); }
.pb.none { opacity: .2; border-style: dashed; cursor: default; background: transparent; }
.pb.none:hover { background: transparent; color: var(--ink); border-color: var(--line2); }

/* three bars that move while something plays */
.pl-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.pl-eq i { width: 3px; height: 100%; background: currentColor; border-radius: 1px; transform-origin: bottom; animation: plEq .5s ease-in-out infinite alternate; }
.pl-eq i:nth-child(2) { animation-duration: .38s; animation-delay: -.2s; }
.pl-eq i:nth-child(3) { animation-duration: .62s; animation-delay: -.4s; }

/* the lineup row of what plays: a red edge on the start side, and the song now playing under its title */
.nrow-play { display: flex; align-items: center; padding-inline: 6px 2px; }
.nrow:has(.pb.pb-cur) { box-shadow: inset -3px 0 0 var(--red); }
[dir=ltr] .nrow:has(.pb.pb-cur) { box-shadow: inset 3px 0 0 var(--red); }
.nrow:has(.pb.pb-cur) .nrow-main { background: var(--red-soft); }
.pl-now { display: flex; align-items: center; gap: 6px; color: var(--red); font-size: 12.5px; font-weight: 500; margin-top: 2px; animation: rise var(--mid) var(--ease) backwards; min-width: 0; }
.pl-now span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-now:not(.on) .pl-eq i { animation-play-state: paused; transform: scaleY(.35); }

/* the number panel's head and its songs, the music screen, the artist's path, the timeline's blocks */
.np-head .pb { width: 38px; height: 38px; }
@media (max-width: 760px) { .np-head .pb { width: 30px; height: 30px; } }
.song-line .pb.none { opacity: .14; }
.mnum-head .pb { width: 34px; height: 34px; }
.path .on:has(> .pb) { grid-template-columns: 40px 34px minmax(0, 1fr) auto auto 60px; }
.tl-play { position: absolute; top: 27px; z-index: 2; }
.tl-play .pb { width: 22px; height: 22px; }
.tl-play .pb { border-color: transparent; background: rgba(255, 255, 255, .92); }
.tl-play .pb.pb-play { background: var(--red); }
.tl-play .pb.none { display: none; }
.tl-playhead { position: absolute; top: 2px; bottom: 2px; width: 2px; margin-inline-start: -1px; background: var(--red); border-radius: 1px; z-index: 3; pointer-events: none; animation: fade var(--mid); }
.tl-playhead::before { content: ''; position: absolute; top: -3px; inset-inline-start: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.tl-playhead.on::before { animation: plGlow 1.4s infinite; }

/* ---------- the bar */
.player { position: fixed; z-index: 75; color: #fff; background: #0b0b0b; font-variant-numeric: tabular-nums; }
.player button { font: inherit; color: inherit; }
.pl-b { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 2px; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: #d6d6d6; cursor: pointer; flex: none;
  transition: background var(--fast), color var(--fast), transform var(--fast), opacity var(--fast); }
.pl-b:hover { background: #222; color: #fff; }
.pl-b:active { transform: scale(.92); }
.pl-b.on { color: var(--red); background: #2a1214; }
.pl-b:disabled { opacity: .3; pointer-events: none; }
.pl-b sup { position: absolute; top: 3px; inset-inline-end: 3px; font-size: 10px; font-weight: 700; line-height: 1; color: var(--red); }
.pl-play { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--red); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; position: relative;
  transition: transform var(--fast), background var(--fast); }
.pl-play:hover { background: #ff3338; }
.pl-play:active { transform: scale(.92); }
.pl-play .ic { animation: plPop var(--fast) var(--ease); }
.pl-play.loading::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid transparent; border-top-color: #fff; animation: plSpin .8s linear infinite; }
.pl-count { font-family: var(--head); font-weight: 400; font-size: 24px; line-height: 1; animation: plCount .5s var(--ease); }
.pl-transport { display: flex; align-items: center; gap: 2px; }
.pl-idx { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; margin-inline-end: 7px; border-radius: 4px; background: var(--red); color: #fff; font-family: var(--body); font-size: 12px; font-weight: 600; vertical-align: 2px; }
.pl-idx.big { min-width: 44px; height: 44px; font-size: 20px; margin: 0; border-radius: 6px; }

.pl-head-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pl-who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; border: 0; background: none; padding: 4px; border-radius: 8px; cursor: pointer; text-align: start; transition: background var(--fast); }
.pl-who:hover { background: #1c1c1c; }
.pl-who .face { flex: none; box-shadow: none; }
.pl-names { display: grid; min-width: 0; }
.pl-names b { font-family: var(--head); font-weight: 400; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-names small { color: #b5b5b5; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: rise var(--mid) var(--ease) backwards; }
.pl-head-a { display: flex; gap: 2px; }

/* the line of the song: the sound's shape when known, otherwise a fine line; marks of where each song starts; the loop in red */
.pl-scrub { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pl-t { font-size: 12px; color: #a8a8a8; min-width: 36px; text-align: center; }
.pl-bar { position: relative; flex: 1; height: 34px; cursor: pointer; touch-action: none; outline: none; border-radius: 4px; }
.pl-bar:focus-visible { box-shadow: 0 0 0 2px #555; }
.pl-line { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; background: #333; border-radius: 2px; transition: height var(--fast), margin var(--fast); }
.pl-fill { position: absolute; left: 0; top: 50%; height: 4px; margin-top: -2px; background: var(--red); border-radius: 2px; }
.pl-bar:hover .pl-line, .pl-bar:hover .pl-fill, .pl-scrub.dragging .pl-line, .pl-scrub.dragging .pl-fill { height: 6px; margin-top: -3px; }
.pl-wave { position: absolute; inset: 0; width: 100%; height: 100%; animation: fade var(--mid); }
.pl-wave path { stroke: #4a4a4a; stroke-width: 1.3; fill: none; }
.pl-wave.played path { stroke: var(--red); }
.pl-mark { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .55); pointer-events: auto; }
.pl-mark em { position: absolute; top: -2px; left: 3px; font-style: normal; font-size: 9.5px; line-height: 1; color: #ddd; }
.pl-loop { position: absolute; top: 0; bottom: 0; background: rgba(227, 38, 43, .2); border-left: 1.5px solid var(--red); border-right: 1.5px solid var(--red); transition: left var(--fast), width var(--fast); animation: fade var(--fast); pointer-events: none; }
.pl-flag { position: absolute; bottom: -1px; left: -1.5px; font-size: 9px; line-height: 11px; padding: 0 3px; background: var(--red); color: #fff; border-radius: 0 3px 0 0; font-weight: 700; }
.pl-flag.b { left: auto; right: -1.5px; border-radius: 3px 0 0 0; }
.pl-head { position: absolute; top: 3px; bottom: 3px; width: 2px; margin-left: -1px; background: #fff; border-radius: 1px; pointer-events: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); }
.pl-scrub:not(.has-wave) .pl-head { top: 50%; bottom: auto; height: 12px; width: 12px; margin: -6px 0 0 -6px; border-radius: 50%; transform: scale(0); transition: transform var(--fast); }
.pl-bar:hover .pl-head, .pl-scrub.dragging .pl-head, .pl-scrub.big .pl-head { transform: none; }
.pl-tip { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: #fff; color: #111; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 5px; white-space: nowrap; animation: plPop var(--fast) var(--ease); }
.pl-tip small { color: var(--red); font-weight: 700; }

/* laptop: docked along the bottom of the window */
.player.dock { inset-inline: 0; bottom: 0; height: 74px; padding: 0 12px var(--safe-b); display: grid; grid-template-columns: minmax(170px, 270px) auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  border-top: 1px solid #262626; box-shadow: 0 -10px 30px rgba(0, 0, 0, .18); transform: translateY(110%); transition: transform .34s var(--ease); }
.player.dock.in { transform: none; }
.player.dock.playing { border-top-color: var(--red); }
.pl-center { display: grid; gap: 1px; min-width: 0; }
.pl-status { display: flex; align-items: center; gap: 12px; font-size: 12px; color: #ccc; height: 16px; padding-inline: 46px; animation: fade var(--fast); }
.pl-count-line { font-family: var(--head); font-weight: 400; color: var(--red); font-size: 16px; animation: plCount .5s var(--ease); }
.pl-err-t { color: #ffb4b4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-side { display: flex; align-items: center; gap: 2px; }
.pl-group { display: inline-flex; align-items: center; gap: 1px; }
.pl-ratebtn { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 9px; border: 1px solid #333; border-radius: 15px; background: none; cursor: pointer; font-size: 12.5px; color: #cfcfcf; transition: all var(--fast); margin-inline: 4px; }
.pl-ratebtn:hover { border-color: #666; color: #fff; }
.pl-ratebtn.on { border-color: var(--red); color: #fff; background: #2a1214; }
.pl-slide { display: inline-flex; align-items: center; gap: 6px; max-width: 0; opacity: 0; overflow: hidden; transition: max-width var(--mid) var(--ease), max-height var(--mid) var(--ease), opacity var(--mid); }
.pl-slide:not(.in) { max-height: 0; }
.pl-slide.in { max-width: 420px; max-height: 80px; opacity: 1; }
.pl-clock { display: inline-flex; align-items: center; gap: 12px; color: var(--red); font-size: 13px; font-weight: 600; }
.pl-clock > span { display: inline-flex; align-items: center; gap: 4px; }
.pl-clock .muted-d { color: #9a9a9a; font-weight: 500; }
.pl-wait { display: inline-flex; align-items: center; gap: 6px; color: #f1f1f1; animation: rise var(--fast) var(--ease); }
.pl-wait .pl-idx { margin: 0; }
.pl-wait b { color: var(--red); font-size: 15px; min-width: 18px; text-align: center; }
.pl-skip { color: #9a9a9a; font-size: 11.5px; }

/* everything else the player can do: a window above the bar on a laptop, a sheet on a phone */
.pl-sheet { background: #111; color: #fff; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; font-variant-numeric: tabular-nums; }
.pl-sheet.pop { position: absolute; bottom: calc(100% + 10px); inset-inline-end: 12px; width: min(420px, calc(100vw - 24px)); max-height: calc(100vh - 170px); overflow-y: auto; padding: 12px 14px 14px; border-radius: 14px;
  border: 1px solid #262626; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); opacity: 0; transform: translateY(12px) scale(.98); transform-origin: bottom; pointer-events: none; visibility: hidden;
  transition: opacity var(--mid), transform var(--mid) var(--ease), visibility 0s linear var(--mid); }
.pl-sheet.pop.in { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity var(--mid), transform var(--mid) var(--ease), visibility 0s; }
.pl-sheet .pl-head-row { padding-bottom: 8px; border-bottom: 1px solid #242424; }
.pl-songs { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pl-songs li { display: flex; align-items: center; gap: 2px; border-radius: 8px; transition: background var(--fast); animation: rise var(--mid) var(--ease) backwards; animation-delay: calc(min(var(--i, 0), 12) * 20ms); }
.pl-songs li:hover { background: #1b1b1b; }
.pl-songs li.cur { background: #231314; }
.pl-song { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; border: 0; background: none; padding: 8px; cursor: pointer; text-align: start; }
.pl-sk { width: 20px; display: inline-flex; justify-content: center; color: #8a8a8a; font-size: 12.5px; }
.pl-songs li.cur .pl-sk, .pl-songs li.cur .pl-st { color: var(--red); }
.pl-st { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.pl-sat { color: #8a8a8a; font-size: 12px; }
.pl-tools { display: grid; gap: 10px; padding-top: 8px; border-top: 1px solid #242424; }
.pl-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 36px; }
.pl-row.center { justify-content: center; }
.pl-k { display: inline-flex; width: 36px; justify-content: center; color: #8f8f8f; flex: none; }
.pl-range { flex: 1 1 120px; min-width: 100px; height: 24px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.pl-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--red) var(--p, 50%), #383838 var(--p, 50%)); }
.pl-range::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--red) var(--p, 50%), #383838 var(--p, 50%)); }
.pl-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; border: 0; transition: transform var(--fast); }
.pl-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; }
.pl-range:active::-webkit-slider-thumb { transform: scale(1.2); }
.pl-v { min-width: 42px; font-size: 13px; color: #ddd; text-align: center; }
.pl-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.pl-chip { height: 28px; min-width: 34px; padding: 0 8px; border: 0; border-radius: 14px; background: #1f1f1f; color: #d7d7d7; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background var(--fast), color var(--fast); }
.pl-chip:hover { background: #2c2c2c; }
.pl-chip.on { background: var(--red); color: #fff; }
.pl-bpm { display: inline-flex; align-items: center; gap: 5px; }
.pl-bpm b { font-size: 15px; min-width: 30px; text-align: center; }
.pl-bpm small { color: #8a8a8a; font-size: 10.5px; }
.pl-heavy { display: flex; align-items: center; gap: 10px; background: #2b1d05; color: #ffd28e; border-radius: 10px; padding: 9px 10px; font-size: 13px; line-height: 1.4; animation: rise var(--mid) var(--ease) backwards; }
.pl-heavy > span { flex: 1; }
.pl-heavy .pl-b { color: #ffd28e; }
.pl-err { display: flex; align-items: center; gap: 8px; margin: 0; color: #ffb4b4; font-size: 13px; animation: rise var(--fast) var(--ease); }

/* the page makes room for the bar */
@media (min-width: 761px) {
  html.pl-on .screen { padding-bottom: 110px; }
  html.pl-on .npanel { bottom: 74px; transition: transform var(--mid) var(--ease), bottom var(--mid) var(--ease); }
  html.pl-on .toasts { bottom: calc(92px + var(--safe-b)); }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .player.dock { grid-template-columns: minmax(130px, 200px) auto minmax(0, 1fr) auto; gap: 10px; }
  .pl-hide-m { display: none; }
  .pl-who .face { display: none; }
}
@media (min-width: 761px) and (max-width: 900px) {
  .pl-side .pl-group, .pl-ratebtn { display: none; }
}

/* ---------- phone: a small bar above the tabs, opening into a full sheet */
.player.mini { inset-inline: 8px; bottom: calc(64px + var(--safe-b)); height: 58px; border-radius: 14px; padding: 0 6px 0 8px; display: flex; align-items: center; gap: 4px; overflow: hidden;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .32); transform: translateY(calc(100% + 90px)); transition: transform .34s var(--ease), bottom var(--mid) var(--ease), opacity var(--mid); }
.player.mini.in { transform: none; }
.player.mini .pl-play { width: 42px; height: 42px; }
.pl-mid { flex: 1; min-width: 0; display: grid; border: 0; background: none; padding: 4px 6px; text-align: start; cursor: pointer; }
.pl-mid b { font-family: var(--head); font-weight: 400; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-mid small { display: flex; align-items: center; gap: 6px; color: #b5b5b5; font-size: 12px; white-space: nowrap; overflow: hidden; animation: rise var(--mid) var(--ease) backwards; }
.pl-mid .pl-idx { min-width: 18px; height: 17px; font-size: 11px; margin-inline-end: 5px; }
.pl-wavtag, .pl-ratetag { flex: none; font-size: 10.5px; font-weight: 600; padding: 0 5px; border-radius: 4px; line-height: 16px; }
.pl-wavtag { background: #4a3205; color: #ffd28e; }
.pl-ratetag { background: #2a1214; color: #ff8e91; }
.pl-miniline { position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: #2c2c2c; border-radius: 1px; overflow: hidden; }
.pl-miniline i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--red); }
.pl-scrim { position: fixed; inset: 0; z-index: 76; background: rgba(0, 0, 0, 0); pointer-events: none; transition: background var(--mid); }
.pl-scrim.in { background: rgba(0, 0, 0, .5); pointer-events: auto; }
.pl-sheet.phone { position: fixed; z-index: 77; inset-inline: 0; bottom: 0; max-height: 94vh; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(22px + var(--safe-b)); border-radius: 18px 18px 0 0; background: #0b0b0b;
  transform: translateY(105%); visibility: hidden; transition: transform .34s var(--ease), visibility 0s linear .34s; }
.pl-sheet.phone.in { transform: none; visibility: visible; transition: transform .34s var(--ease), visibility 0s; }
.pl-grab { display: grid; place-items: center; height: 22px; cursor: grab; touch-action: none; position: sticky; top: 0; background: #0b0b0b; z-index: 1; }
.pl-grab i { width: 40px; height: 4px; border-radius: 2px; background: #3a3a3a; }
.pl-sheet.phone .pl-names b { font-size: 19px; }
.pl-count-big { display: grid; place-items: center; min-height: 0; }
.pl-count-big b { font-family: var(--head); font-weight: 400; font-size: 110px; line-height: 1; color: var(--red); animation: plCount .5s var(--ease); }
.pl-scrub.big { gap: 8px; }
.pl-scrub.big .pl-bar { height: 64px; }
.pl-scrub.big .pl-t { font-size: 13px; color: #cfcfcf; }
.pl-transport.big { justify-content: space-between; }
.pl-transport.big .pl-b { flex: 0 1 44px; min-width: 30px; width: auto; height: 44px; }
.pl-transport.big .pl-play { width: 64px; height: 64px; margin-inline: 4px; }
.pl-transport.big .pl-count { font-size: 32px; }

@media (max-width: 760px) {
  html.pl-on .screen { padding-bottom: 200px; }
  html.pl-on .np-body { padding-bottom: 86px; }
  html.pl-on .toasts { bottom: calc(132px + var(--safe-b)); }
  /* over the number panel the tabs are covered, so the small bar goes down to the edge; while "more" is open it steps aside */
  body:has(.npanel.in) .player.mini { bottom: calc(8px + var(--safe-b)); }
  body:has(.more-sheet.in) .player.mini { opacity: 0; transform: translateY(calc(100% + 90px)); pointer-events: none; }
  .path .on:has(> .pb) { grid-template-columns: 32px 34px minmax(0, 1fr) auto; grid-template-areas: 'idx play title dur' 'idx play role dur'; }
  .path .on > .pb { grid-area: play; }
  .nrow-play { padding-inline: 2px 0; }
  .nrow-play .pb { width: 30px; height: 30px; }
}

/* the presentation covers the page; the player stays reachable over it */
body:has(.present) .player { z-index: 210; }
body:has(.present) .pl-scrim, body:has(.present) .pl-sheet.phone { z-index: 211; }
@media print { .player, .pl-sheet, .pl-scrim, .pb { display: none !important; } }
