/* Compact sheets retain the player; expanded sheets use the full viewport. */
html[data-player-panel-open="true"] .player-screen main>.device-bar,
html[data-player-panel-open="true"] .player-screen .music-card>.cardhead{display:none}
html[data-player-panel-open="true"] .player-screen .layout{display:block;overflow:hidden}
html[data-player-panel-open="true"] .player-screen .music-card{width:100%;max-width:520px;max-height:none;margin:0 auto;overflow:hidden}
html[data-player-panel-open="true"] .player-screen .video{height:26vh;height:26dvh;min-height:200px;max-height:240px;padding-bottom:0}
html[data-player-panel-open="true"] .player-screen .layout>aside{visibility:hidden;pointer-events:none}
html[data-player-panel-open="true"] .player-screen main{overflow:hidden;min-height:0}
.player-screen dialog.piplo-bottom-panel[open],
.player-screen #exploreDistrictsDialog.piplo-bottom-panel[open],
html[data-native-settings-open="true"] .player-screen #setupDialog.piplo-bottom-panel[open]{
  position:fixed;inset:var(--piplo-panel-top,320px) 0 var(--piplo-panel-bottom,0px);margin:0 auto;
  width:100%;max-width:960px;height:auto;max-height:var(--piplo-panel-max-height,calc(100dvh - var(--piplo-panel-top,320px) - var(--piplo-panel-bottom,0px)));box-sizing:border-box;
  display:flex;flex-direction:column;overflow:hidden;transform:none;
  border:1px solid var(--line);border-bottom:0;border-radius:20px 20px 0 0;
  background:var(--panel);box-shadow:0 -5px 28px #0004;
}
.player-screen dialog.piplo-bottom-panel[open][data-piplo-panel-covered="true"]{display:none!important}
/* Keep Explore on its own paint layer while iOS changes the WebView viewport
   for keyboard entry. Its scroll body can repaint without a manual page swipe. */
.player-screen #exploreDistrictsDialog.piplo-bottom-panel[open]{transform:translate3d(0,0,0);backface-visibility:hidden}
.player-screen .piplo-bottom-panel::backdrop{background:transparent;pointer-events:none}
.player-screen .piplo-bottom-panel>.dialogtop,
html[data-native-settings-open="true"] #setupDialog.piplo-bottom-panel>.dialogtop{display:flex;position:relative;flex:none;padding:9px 12px 3px;min-height:50px;box-sizing:border-box}
.player-screen .piplo-bottom-panel>.dialogtop h2{font-size:18px;line-height:1.3}
.player-screen .piplo-bottom-panel>.dialogtop button{min-height:38px;padding:5px 10px}
/* Match Explore's underlined Done in every panel, even without keyboard focus.
   Retain the full touch target without a button fill, border or pill. */
.player-screen .dialogtop>button[id^="close"],
.player-screen .dialogtop>button.player-card-done{min-width:44px;min-height:44px;border:0;border-radius:0;background:transparent;box-shadow:none;outline:0;appearance:none;color:var(--ink);font-size:13px;font-weight:650;text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:4px}
.player-screen .dialogtop>button[id^="close"]:focus-visible,
.player-screen .dialogtop>button.player-card-done:focus-visible{outline:0;box-shadow:none;text-decoration-thickness:3px}
.player-screen .piplo-bottom-panel>.dialogbody,
.player-screen #setupDialog.piplo-bottom-panel>.dialogbody,
.player-screen #devicesDialog.piplo-bottom-panel>.dialogbody{flex:1;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:8px 12px max(12px,env(safe-area-inset-bottom));scroll-padding-block:8px 16px}
.player-screen #privacyConsentDialog.piplo-bottom-panel>.dialogbody{flex:none;overflow:auto}
.player-screen #privacyConsentDialog.piplo-bottom-panel{overflow:auto}
/* Keep Skip metadata and actions together directly below the visible player. */
.player-screen #removeGenreDialog.piplo-bottom-panel[open]{
  inset:var(--piplo-panel-top,320px) 0 auto;height:auto;border-bottom:1px solid var(--line);border-radius:16px;
  max-height:var(--piplo-panel-max-height,calc(100dvh - var(--piplo-panel-top,320px)));
}
.player-screen #removeGenreDialog.piplo-bottom-panel>.dialogbody{flex:0 1 auto;padding:12px 12px max(12px,env(safe-area-inset-bottom))}
/* Pairing starts expanded before input focus and keeps the form in flow. */
.player-screen #devicesDialog.piplo-bottom-panel[open]{max-width:620px}
.player-screen #devicesDialog.piplo-bottom-panel>.dialogbody{flex:1;overflow-anchor:none}
.player-screen #devicesDialog .settings-section{margin-bottom:10px;padding-bottom:10px}
.player-screen #devicesDialog .settings-section h3{margin:0 0 6px;font-size:15px}
.player-screen #devicesDialog .help{margin:6px 0;font-size:12px;line-height:1.4}
.player-screen #devicesDialog #pairDeviceForm .row{gap:8px;margin-top:6px}
.player-screen #devicesDialog #pairDeviceCode{margin-top:0}
.player-screen #devicesDialog .pair-code{padding:8px 0;font-size:26px}
.player-screen #interactiveMapDialog.piplo-bottom-panel>.dialogbody{display:flex;padding:0;overflow:hidden}
.player-screen #interactiveMapDialog.piplo-bottom-panel>.interactive-map-footer{flex:none;padding:6px 12px max(6px,env(safe-area-inset-bottom));border-top:1px solid var(--line)}
.player-screen #interactiveMapDialog .interactive-map-footer .web-directory-link{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;margin:0;border:1px solid var(--line);border-radius:12px;font-size:14px;font-weight:600;text-decoration:none}
#interactiveMapFrame{display:block;width:100%;height:100%;flex:1;min-height:0;border:0;background:var(--panel)}
/* Expand the map into the workspace and keep the same live player at its side.
   Positioning existing nodes avoids detaching or reloading the YouTube iframe. */
html[data-player-map-layout="side"] .player-screen .music-card{
  position:fixed;top:var(--piplo-map-top,72px);right:12px;
  width:var(--piplo-map-side-width,340px);max-width:none;max-height:none;margin:0;z-index:1090;
}
html[data-player-map-layout="side"] .player-screen .video{
  height:var(--piplo-map-video-height,200px);min-height:200px;max-height:none;padding-bottom:0;
}
html[data-player-map-layout="side"] .player-screen .layout>aside{
  position:fixed;top:var(--piplo-map-controls-top,310px);right:12px;
  bottom:calc(var(--piplo-panel-bottom,0px) + 8px);width:var(--piplo-map-side-width,340px);
  visibility:visible;pointer-events:auto;overflow:auto;z-index:1090;
}
html[data-player-map-layout="side"] .player-screen .layout>aside>.queue-card{display:none}
html[data-player-map-layout="side"] .player-screen dialog.piplo-bottom-panel[open],
html[data-player-map-layout="side"] .player-screen #getAppDialog.piplo-bottom-panel[open],
html[data-player-map-layout="side"] .player-screen #exploreDistrictsDialog.piplo-bottom-panel[open],
html[data-player-map-layout="side"] .player-screen #removeGenreDialog.piplo-bottom-panel[open]{
  inset:var(--piplo-map-top,72px) var(--piplo-map-right,364px) calc(var(--piplo-panel-bottom,0px) + 8px) 12px;
  width:auto;max-width:none;margin:0;border-bottom:1px solid var(--line);border-radius:18px;
}
html[data-player-map-layout="side"] .player-screen #removeGenreDialog.piplo-bottom-panel[open]{
  top:auto;max-height:var(--piplo-panel-max-height,calc(100dvh - 80px));
}
html[data-player-map-layout="side"] .player-screen #devicesDialog.piplo-bottom-panel[open]{
  inset:auto var(--piplo-map-right,364px) calc(var(--piplo-panel-bottom,0px) + 8px) 12px;
  width:auto;max-width:620px;margin:0;
}
html[data-player-map-layout="stacked"] .player-screen .video{height:200px;min-height:200px;max-height:200px}
html[data-player-map-layout="stacked"] .player-screen #interactiveMapDialog.piplo-bottom-panel[open]{max-width:none}
.player-screen .piplo-bottom-panel .settings-title .piplo-wordmark{width:64px;height:28px}
.player-screen .piplo-bottom-panel .settings-section{margin-bottom:10px;padding-bottom:10px}
.player-screen .piplo-bottom-panel .settings-section h3{font-size:16px}
.player-screen #playlistsDialog.piplo-bottom-panel .playlist-songs{max-height:260px;overflow:auto}
/* The short app invitation fits its content beneath the retained player. */
.player-screen #getAppDialog.piplo-bottom-panel[open]{bottom:auto;max-height:var(--piplo-panel-max-height,calc(100dvh - var(--piplo-panel-top,320px)));border-bottom:1px solid var(--line);border-radius:20px}
.player-screen #getAppDialog.piplo-bottom-panel>.dialogbody{flex:0 1 auto}
html[data-player-map-layout="side"] .player-screen #getAppDialog.piplo-bottom-panel[open]{bottom:auto;max-height:calc(100dvh - var(--piplo-map-top,72px) - var(--piplo-panel-bottom,0px) - 8px)}
@media(max-height:540px){
  html[data-player-panel-open="true"].player-root{height:100%;overflow:hidden}
  html[data-player-panel-open="true"] body.player-screen{height:var(--player-viewport,100vh);height:100dvh;min-height:0;overflow:hidden}
  html[data-player-panel-open="true"] .player-screen .top{min-height:44px;padding-top:0;padding-bottom:0}
  html[data-player-panel-open="true"] .player-screen .brand .pip-mascot{height:38px;width:38px}
  html[data-player-panel-open="true"] .player-screen main{flex:1}
  html[data-player-panel-open="true"] .player-screen .video{height:200px;min-height:200px}
}
/* Search and Done share a row above the keyboard; the results scroll in the
   remaining space. Keep the same video mounted at its full 200px minimum. */
.player-screen #exploreDistrictsDialog.piplo-bottom-panel>.dialogtop{gap:10px}
.player-screen #exploreDistrictsDialog.piplo-bottom-panel>.dialogtop>#exploreDistrictSearch{position:static;flex:1;min-width:0;width:auto;margin:0}
.player-screen #exploreDistrictsDialog.piplo-bottom-panel>.dialogtop>button{flex:none}
html[data-player-explore-compact="true"] .player-screen .top{min-height:44px;padding-top:0;padding-bottom:0;flex-wrap:nowrap}
html[data-player-explore-compact="true"] .player-screen .brand .pip-mascot{height:38px;width:38px}
html[data-player-explore-compact="true"] .player-screen main{padding-top:4px}
html[data-player-explore-compact="true"] .player-screen .video{height:200px;min-height:200px;max-height:200px}
html[data-player-explore-compact="true"] #exploreDistrictsDialog.piplo-bottom-panel>.dialogtop{min-height:58px;justify-content:flex-end;padding:12px 12px 6px}
html[data-player-explore-compact="true"] #exploreDistrictsTitle{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
html[data-player-explore-compact="true"] #exploreDistrictSearch{min-height:40px;height:40px;padding:6px 10px}
html[data-player-search-compact="true"] #exploreDistrictsDialog.piplo-bottom-panel>.dialogbody{padding:4px 12px 6px}
html[data-player-search-compact="true"] #exploreSelectedPanel,
html[data-player-search-compact="true"] #exploreDistrictsDialog>.explore-map-footer{display:none}
html[data-player-search-compact="true"] #exploreDistrictList{min-height:0}
/* iPhone keyboards usually leave more than 390px, but the player header
   still consumes the district results. Reclaim it for every compact Search
   session while keeping the same full-size video and Done button visible. */
html[data-player-search-compact="true"] .player-screen>header,
html[data-player-search-compact="true"] #exploreDistrictCount{display:none}
/* The same Settings sheet contains native account/device actions only when
   the current host advertises the supported bridge. Its body remains the
   sole scroller below the retained video. */
html[data-native-settings-unified="true"] .player-screen #setupDialog.piplo-bottom-panel[open]{max-width:620px}
.player-screen #setupDialog .native-settings-section{padding:0 0 12px;margin:0 0 12px}
.player-screen #setupDialog .native-settings-section h3{margin:0 0 8px;font-size:15px}
.player-screen #setupDialog .native-settings-scope-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.player-screen #setupDialog .native-settings-scope-row>div{min-width:0;flex:1}
.player-screen #setupDialog .native-settings-scope-row>button{flex:none;min-height:44px}
.player-screen #setupDialog .native-settings-locations{list-style:none;margin:0;padding:0;font-size:15px;font-weight:600;line-height:1.5;overflow-wrap:anywhere}
.player-screen #setupDialog #nativeSettingsScopeStatus{margin:4px 0 0;font-size:12px}
.player-screen #setupDialog .native-settings-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:10px 0}
.player-screen #setupDialog .native-settings-actions>button{min-width:0;min-height:44px;margin:0;padding:8px 10px;font-size:13px;line-height:1.35;white-space:normal;overflow-wrap:anywhere}
.player-screen #setupDialog .native-settings-actions[hidden],
.player-screen #setupDialog .native-settings-section[hidden],
.player-screen #setupDialog .native-settings-about[hidden]{display:none!important}
.player-screen #setupDialog #nativeBuySeasonPass{grid-column:1 / -1}
.player-screen #setupDialog #nativeSeasonPassMessage:empty{display:none}
.player-screen #setupDialog .native-settings-toggle{display:flex;align-items:center;gap:10px;min-height:44px;margin:0;font-size:14px}
.player-screen #setupDialog .native-settings-toggle input{flex:none;width:20px;height:20px;margin:0}
html[data-native-settings-unified="true"] .player-screen #nativeScreenSettings>h3{display:none}
html[data-native-settings-unified="true"] .player-screen #resetLocalPlayer{display:none}
.player-screen #setupDialog .native-settings-about{margin-top:14px;border-top:1px solid var(--line);padding-top:12px}
.player-screen #setupDialog .native-settings-about summary{min-height:44px;cursor:pointer}

.player-screen .skip-track-summary{padding:0 2px 10px;min-width:0}
.player-screen .skip-track-summary p{margin:2px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.player-screen .skip-track-summary strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.player-screen .skip-track-summary .eyebrow{font-size:11px;color:var(--muted)}

/* The interactive map alone has a drag/keyboard expansion control. Other
   sheets keep their chosen height while their content scrolls normally. */
.player-screen #interactiveMapDialog.piplo-bottom-panel>.piplo-panel-handle{display:block;flex:none;width:100%;height:18px;min-height:18px;margin:0;padding:0;border:0;border-radius:20px 20px 0 0;background:transparent;touch-action:none;cursor:ns-resize;box-shadow:none}
.player-screen #interactiveMapDialog.piplo-bottom-panel>.piplo-panel-handle::before{content:"";display:block;width:36px;height:4px;margin:6px auto 8px;border-radius:4px;background:var(--muted);opacity:.6}
.player-screen #interactiveMapDialog.piplo-bottom-panel>.piplo-panel-handle:focus-visible{outline-offset:-4px}
.player-screen #interactiveMapDialog.piplo-bottom-panel>.dialogtop{touch-action:none;cursor:ns-resize}
.player-screen #interactiveMapDialog.piplo-bottom-panel>.dialogtop button{cursor:pointer}
html[data-player-panel-expanded="true"] .player-screen :is(dialog,#devicesDialog,#removeGenreDialog,#getAppDialog,#interactiveMapDialog,#exploreDistrictsDialog,#setupDialog).piplo-bottom-panel[open][data-piplo-panel-expanded="true"]{inset:var(--piplo-panel-top,6px) 0 var(--piplo-panel-bottom,0px);width:100%;height:auto;max-width:960px;max-height:var(--piplo-panel-max-height,calc(100dvh - 6px));margin:0 auto;border-radius:16px 16px 0 0}
html[data-player-panel-expanded="true"] .player-screen #devicesDialog.piplo-bottom-panel>.dialogbody{flex:1;min-height:0;overflow:auto}
.player-screen #exploreDistrictsDialog.piplo-bottom-panel>.explore-map-footer{padding:6px 12px max(10px,env(safe-area-inset-bottom))}
.player-screen .piplo-bottom-panel .help{line-height:1.4;margin:6px 0}
.player-screen .piplo-bottom-panel .dialogactions{gap:8px;margin-top:10px}
.player-screen .piplo-bottom-panel .profile-card-description{line-height:1.45}

/* A single app panel column, shared with the native Mac overlays. Keep the
   website's map and its desktop layout independent from store-app screens. */
html[data-player-experience="native"]{--piplo-app-panel-width:760px}
html[data-player-experience="native"][data-player-panel-expanded="true"] .player-screen :is(dialog,#devicesDialog).piplo-bottom-panel[open][data-piplo-panel-expanded="true"],
html[data-player-experience="native"] .player-screen :is(dialog,#setupDialog,#devicesDialog,#exploreDistrictsDialog,#playerProfileDialog,#playlistsDialog,#getAppDialog,#removeGenreDialog).piplo-bottom-panel[open],
html[data-player-experience="native"] .player-screen #welcomeDialog[open]{
  width:calc(100% - 32px);max-width:var(--piplo-app-panel-width);margin-inline:auto;
}
html[data-player-experience="native"] .player-screen .explore-map-footer,
html[data-player-experience="native"] .player-screen .player-card-map-links,
html[data-player-experience="native"] .player-screen #interactiveMapDialog{display:none!important}
@media(max-width:600px){
  html[data-player-experience="native"][data-player-panel-expanded="true"] .player-screen :is(dialog,#devicesDialog).piplo-bottom-panel[open][data-piplo-panel-expanded="true"],
  html[data-player-experience="native"] .player-screen :is(dialog,#setupDialog,#devicesDialog,#exploreDistrictsDialog,#playerProfileDialog,#playlistsDialog,#getAppDialog,#removeGenreDialog).piplo-bottom-panel[open],
  html[data-player-experience="native"] .player-screen #welcomeDialog[open]{width:100%}
}
