/* Load after player.css and qlight.css: one authoritative panel lifecycle. */
html body > .pl .ppanel.ppanel:not(.on) {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
html body > .pl .ppanel.ppanel.on {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
html body > .pl .ppanel.ppanel .vh {
  display: flex !important;
  align-items: center !important;
  flex: 0 0 auto;
  min-height: 48px !important;
  padding-right: 48px;
  position: sticky !important;
  top: 0;
  z-index: 10;
  background: inherit;
}
html body > .pl .ppanel.ppanel .vh .panel-close {
  position: absolute !important;
  left: auto !important;
  right: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
html body > .pl .ppanel.ppanel .panel-close svg { width: 20px; height: 20px; }
html body > .pl .ppanel.ppanel .vh button,
html body > .pl .ppanel.ppanel .qopt,
html body > .pl .ppanel.ppanel .qft,
html body > .pl .ppanel.ppanel .mi,
html body > .pl .ppanel.ppanel .vshow,
html body > .pl .ppanel.ppanel .vrow .vdl {
  min-height: 44px !important;
}
html body > .pl .ppanel.ppanel .vrow .vdl { min-width: 44px !important; }
html body > .pl .ppanel.ppanel .vrow .vdl::after { display: none !important; }
html body > .pl .ppanel.ppanel button:focus-visible {
  outline: 2px solid var(--accent, #ddd) !important;
  outline-offset: -3px !important;
}
/* The historical "Playing" tag shares the root player class; neutralise it. */
html body > .pl .ppanel .vt.pl {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  width: auto !important;
  height: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: none !important;
  transform: none !important;
  isolation: auto !important;
}
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  html body > .pl .ppanel.ppanel {
    position: absolute !important;
    left: max(8px, env(safe-area-inset-left)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    top: auto !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
    margin: 0 !important;
    border-radius: 16px !important;
    box-sizing: border-box;
    overflow: hidden !important;
    z-index: 50 !important;
    transform: translateY(calc(100% + 32px)) !important;
    transition: transform .22s ease, opacity .16s ease !important;
  }
  html body > .pl .ppanel.ppanel.on { transform: none !important; }
  html body > .pl .ppanel.ppanel.dragging { transition: none !important; }
  html body > .pl .ppanel.ppanel .vw {
    height: auto !important;
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
    padding: 10px 12px 16px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }
  html body > .pl .ppanel.ppanel .vw::before { display: none !important; }
  html body > .pl .ppanel.ppanel .vh {
    margin: 0 0 10px !important;
    background: #171719 !important;
    border-bottom: 1px solid rgba(255,255,255,.09);
  }
  html body > .pl .ppanel.ppanel.qwide .qgrid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
    height: auto !important;
    zoom: 1 !important;
  }
  html body > .pl .ppanel.ppanel.qwide .qcol {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-template-rows: none !important;
    gap: 4px !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  html body > .pl .ppanel.ppanel.qwide .qcol > .qopt {
    grid-row: auto !important;
    grid-column: auto !important;
    padding: 10px 4px !important;
    margin: 0 !important;
    min-width: 0;
    align-items: center !important;
  }
  html body > .pl .ppanel.ppanel.qwide .qcol > :not(.qopt) { grid-column: 1 / -1 !important; grid-row: auto !important; }
  html body > .pl .ppanel.ppanel.qwide .qcol .qopt small { display: none !important; }
  html body > .pl .ppanel.ppanel.qwide .vcol {
    max-height: none !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  html body > .pl .ppanel.ppanel.qwide .vnow { position: static !important; margin: 0 !important; }
  html body > .pl .ppanel.ppanel.qwide .vrow {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 44px !important;
    grid-template-areas: "top dl" "mid dl" "sub dl" !important;
    column-gap: 6px !important;
    box-sizing: border-box;
  }
  html body > .pl .ppanel.ppanel.qwide .vrow .vmid,
  html body > .pl .ppanel.ppanel.qwide .vrow .vtop,
  html body > .pl .ppanel.ppanel.qwide .vrow .vsub { min-width: 0 !important; overflow-wrap: anywhere; }
  html body > .pl .ppscrim {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 49 !important;
    background: rgba(0,0,0,.55);
    pointer-events: none;
    opacity: 0;
  }
  html body > .pl.sheeton .ppscrim { pointer-events: auto !important; opacity: 1 !important; }
  html body > .pl:not(.sheeton) .ppscrim { pointer-events: none !important; opacity: 0 !important; }
}
@media (max-height: 500px) and (pointer: coarse) {
  html body > .pl .ppanel.ppanel.qwide .qgrid { grid-template-columns: minmax(160px, 30%) minmax(0, 1fr) !important; }
  html body > .pl .ppanel.ppanel.qwide .qcol { display: flex !important; flex-direction: column !important; }
}
@media (prefers-reduced-motion: reduce) {
  html body > .pl .ppanel.ppanel,
  html body > .pl .ppscrim { transition: none !important; }
}
