/* Song player. Host hooks at the bottom are limited to the sound control. */

.jp-root [hidden] {
  display: none !important;
}

.jp-root {
  --jp-bg: var(--color-panel, #141416);
  --jp-ink: #f5f5f6;
  --jp-mute: var(--color-mute, #9c9ca6);
  --jp-line: var(--color-line, #2e2e33);
  --jp-deep: var(--color-panel2, #0e0e10);
  --jp-accent: var(--color-accent, #3b82f6);
  color: var(--jp-ink);
  font-family: Inter, "Inter Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

.jp-root.jp-hold {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.jp-root.jp-dock {
  position: fixed;
  z-index: 200;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--jp-line);
  border-radius: 0 0 12px 12px;
  background: var(--jp-bg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.jp-root.jp-dock.jp-dock-inline {
  border-radius: 0 0 8px 8px;
  background: color-mix(in srgb, var(--color-panel2, #121a32) 60%, transparent);
  box-shadow: none;
}

/* In-flow inside the Game sounds / header sound card: one container, same edges. */
.jp-root.jp-dock.jp-dock-embedded {
  position: relative;
  z-index: auto;
  left: auto;
  top: auto;
  bottom: auto;
  width: auto;
  margin: 10px 0 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--jp-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.jp-root .jp-dock-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.jp-root .jp-dock-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--jp-ink);
  font: 600 13px/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.01em;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.jp-root .jp-dock-btn:active,
.jp-root .jp-pp:active,
.jp-root .jp-dock-btn.jp-pressed,
.jp-root .jp-pp.jp-pressed {
  background: rgba(255, 255, 255, 0.08);
}

@media (hover: hover) and (pointer: fine) {
  .jp-root .jp-dock-btn:hover {
    background: rgba(255, 255, 255, 0.06);
  }

  .jp-root .jp-pp:hover {
    background: #242428;
  }

  .jp-root .jp-x:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
  }

  .jp-root .jp-row:hover {
    background: rgba(255, 255, 255, 0.05);
  }

  .jp-root .jp-chip:hover,
  .jp-root .jp-retry:hover {
    border-color: #4a4a52;
  }
}



.jp-root .jp-dock-kicker {
  margin-left: auto;
  color: var(--jp-mute);
  font: 500 11px/1 Inter, ui-sans-serif, system-ui, sans-serif;
  flex: 0 0 auto;
}

.jp-root .jp-dock-ctrl {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
}

.jp-root .jp-dock-mark,
.jp-root .jp-pp {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--jp-deep);
  color: #f5f5f6;
  flex: 0 0 auto;
  touch-action: manipulation;
}

.jp-root .jp-pp {
  cursor: pointer;
}

.jp-root .jp-dock-ctrl .jp-dock-mark,
.jp-root .jp-dock-ctrl .jp-pp {
  position: absolute;
  inset: 0;
}

.jp-root .jp-now-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.jp-root .jp-now-title,
.jp-root .jp-now-artist,
.jp-root .jp-dock-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jp-root .jp-now-title,
.jp-root .jp-dock-label {
  font: 600 13px/1.25 Inter, ui-sans-serif, system-ui, sans-serif;
}

.jp-root .jp-now-artist {
  color: var(--jp-mute);
  font: 400 11px/1.3 Inter, ui-sans-serif, system-ui, sans-serif;
}

.jp-root .jp-now-time {
  color: var(--jp-mute);
  font: 500 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
  min-width: 3.25em;
  text-align: right;
}

.jp-root .jp-seek-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 16px;
  margin-top: 6px;
}

.jp-root .jp-seek-row.jp-seek-idle {
  visibility: hidden;
  pointer-events: none;
}

.jp-root .jp-seek {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  height: 16px;
  margin: 0;
  cursor: pointer;
  touch-action: none;
}

.jp-root .jp-seek-track {
  position: relative;
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: #2e2e33;
}

.jp-root .jp-seek-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: inherit;
  background: #fff;
}

/* Song volume: same layout as the Game sounds volume row, 44px drag hit. */
.jp-root .jp-vol {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  margin: 0;
  color: var(--color-mute, var(--jp-mute));
  font: 400 14px/1.25 Inter, ui-sans-serif, system-ui, sans-serif;
}

.jp-root .jp-vol-ico {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  flex: 0 0 auto;
  color: inherit;
}

.jp-root .jp-vol-ico.is-muted {
  opacity: 0.55;
}

.jp-root .jp-vol-hit {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
}

.jp-root .jp-vol-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  accent-color: var(--color-accent, #9a9aa6);
}

.jp-root .jp-vol-range:focus {
  outline: none;
}

.jp-root .jp-vol-range:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.jp-root .jp-vol-range::-webkit-slider-runnable-track {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background:
    linear-gradient(var(--color-accent, #9a9aa6), var(--color-accent, #9a9aa6)) 0 / var(--jp-vol-pct, 50%) 100% no-repeat,
    #3a3a40;
}

.jp-root .jp-vol-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border: 0;
  border-radius: 999px;
  background: var(--color-accent-hi, #c8c8d0);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.jp-root .jp-vol-range::-moz-range-track {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: #3a3a40;
}

.jp-root .jp-vol-range::-moz-range-progress {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--color-accent, #9a9aa6);
}

.jp-root .jp-vol-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 999px;
  background: var(--color-accent-hi, #c8c8d0);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.jp-root .jp-vol-pct {
  flex: 0 0 auto;
  width: 2.25rem;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.jp-root.jp-dialog[open] {
  display: flex;
  flex-direction: column;
}

.jp-root.jp-dialog {
  width: min(440px, calc(100vw - 16px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-height: min(680px, calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  margin: auto;
  margin-top: max(8px, env(safe-area-inset-top, 0px));
  margin-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  padding: 0;
  border: 1px solid var(--jp-line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 72px),
    var(--jp-bg);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.jp-root.jp-dialog::backdrop {
  background: rgba(6, 6, 8, 0.72);
}

.jp-root .jp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0;
}

.jp-root .jp-title {
  margin: 0;
  font: 600 16px/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.01em;
}

.jp-root .jp-sub {
  margin: 4px 0 0;
  color: var(--jp-mute);
  font: 400 12px/1.4 Inter, ui-sans-serif, system-ui, sans-serif;
}

.jp-root .jp-x {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--jp-mute);
  font: 500 18px/1 Inter, ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  flex: 0 0 auto;
  touch-action: manipulation;
}

.jp-root .jp-search {
  padding: 12px 16px 8px;
}

.jp-root .jp-input {
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--jp-line);
  border-radius: 10px;
  background: var(--jp-deep);
  color: var(--jp-ink);
  font: 400 16px/1 Inter, ui-sans-serif, system-ui, sans-serif;
  outline: none;
}

.jp-root .jp-input::placeholder {
  color: #6f6f78;
}

.jp-root .jp-results {
  padding: 0 8px;
}

.jp-root .jp-status:empty {
  display: none;
}

.jp-root .jp-status {
  min-height: 0;
  padding: 2px 8px 6px;
  color: var(--jp-mute);
  font: 500 12px/1.4 Inter, ui-sans-serif, system-ui, sans-serif;
}

.jp-root .jp-list {
  max-height: min(42vh, 320px);
  margin: 0;
  padding: 0 0 4px;
  overflow: auto;
}

.jp-root .jp-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 7px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.jp-root .jp-row.jp-on {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 2px 0 0 #fff;
}

.jp-root .jp-cover-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 8px;
  background: #0a0a0b;
}

.jp-root .jp-cover,
.jp-root .jp-cover-fallback {
  position: absolute;
  inset: 0;
  width: 44px;
  height: 44px;
}

.jp-root .jp-cover {
  object-fit: cover;
}

.jp-root .jp-cover-fallback {
  display: grid;
  place-items: center;
  color: var(--jp-mute);
}

.jp-root .jp-meta {
  min-width: 0;
}

.jp-root .jp-name,
.jp-root .jp-artist {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jp-root .jp-name {
  font: 600 13px/1.3 Inter, ui-sans-serif, system-ui, sans-serif;
}

.jp-root .jp-artist {
  color: var(--jp-mute);
  font: 400 12px/1.3 Inter, ui-sans-serif, system-ui, sans-serif;
}

.jp-root .jp-time {
  color: var(--jp-mute);
  font: 500 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.jp-root .jp-player {
  padding: 8px 16px 14px;
  border-top: 1px solid rgba(46, 46, 51, 0.9);
}

.jp-root .jp-audio-slot {
  height: 40px;
  display: flex;
  align-items: center;
}

.jp-root .jp-audio {
  display: block;
  width: 100%;
  height: 36px;
}

.jp-root .jp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.jp-root .jp-chip,
.jp-root .jp-retry {
  margin: 0;
  padding: 0 14px;
  min-height: 44px;
  border: 1px solid var(--jp-line);
  border-radius: 999px;
  background: #0e0e10;
  color: var(--jp-ink);
  font: 600 12px/1 Inter, ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

.jp-root .jp-note,
.jp-root .jp-credit,
.jp-root .jp-license {
  margin: 8px 0 0;
  color: var(--jp-mute);
  font: 400 12px/1.45 Inter, ui-sans-serif, system-ui, sans-serif;
}

.jp-root .jp-credit a,
.jp-root .jp-license a {
  color: #fff;
  text-underline-offset: 2px;
}

.jp-root .jp-err {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.jp-root button:focus-visible,
.jp-root input:focus-visible,
.jp-root a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.jp-root .jp-list::-webkit-scrollbar {
  width: 8px;
}

.jp-root .jp-list::-webkit-scrollbar-thumb {
  background: #2e2e33;
  border-radius: 8px;
}

@media (max-width: 420px) {
  .jp-root.jp-dialog {
    width: calc(100vw - 16px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    border-radius: 16px;
  }

  .jp-root .jp-head,
  .jp-root .jp-search,
  .jp-root .jp-player {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* Host sound control: join the two cards and paint the real audio state. */

.jp-sound-shell {
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-bottom-width: 0 !important;
}

[data-profile-menu] .jp-sound-shell,
[data-mobile-panel] .jp-sound-shell {
  margin-bottom: var(--jp-dock-h, 82px) !important;
}

button[aria-label="Sound"].jp-audio-song,
button[aria-label="Sound"].jp-audio-song .jp-face,
button[aria-label="Sound"].jp-audio-song .jp-eq {
  /* Default theme accent (#9a9aa6) is the same as mute, so ink is used
     when accent is too close to mute. Colorful themes keep --color-accent. */
  color: var(--jp-song-icon, var(--color-accent, #f5f5f6));
}
button[aria-label="Sound"].jp-audio-song .jp-eq i {
  background: currentColor;
}

button[aria-label="Sound"] .jp-face {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  flex: 0 0 auto;
  color: inherit;
}

button[aria-label="Sound"] .jp-host-hid {
  display: none !important;
}

.jp-eq {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 18px;
  height: 16px;
}

.jp-eq i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: currentColor;
  transform-origin: center bottom;
  animation: jp-eq 0.9s ease-in-out infinite;
}

.jp-eq i:nth-child(1) { height: 46%; animation-delay: 0s; }
.jp-eq i:nth-child(2) { height: 100%; animation-delay: -0.28s; }
.jp-eq i:nth-child(3) { height: 64%; animation-delay: -0.52s; }

@keyframes jp-eq {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .jp-eq i {
    animation: none;
    transform: none;
  }
}

@media (max-width: 639px) {
  header button[aria-label="Sound"] {
    min-width: 44px;
    min-height: 44px;
    margin: -4px;
  }
}

.jp-sound-shell [role="switch"] {
  position: relative;
}

.jp-sound-shell [role="switch"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -8px;
  right: -8px;
  height: 44px;
  transform: translateY(-50%);
}
