/* Mélodies, bibliothèque et commandes flottantes */
.deluxe-player {
  background:
    linear-gradient(90deg, #120b1a19, #110a1d75 50%, #100a19d8),
    url("assets/correction/marche-barde.jpg") left center / cover no-repeat,
    #10091a;
  border-color: #a5814875;
  box-shadow: inset 0 0 0 5px #d3b8750c, 0 16px 45px #0005;
}
.deluxe-player .vinyl-stage { filter: drop-shadow(0 5px 24px #c07aff46); }
.royal-track-credits { margin-top: .75rem; color: #d5bee4; font-size: .8rem; }
.royal-track-credits summary { cursor: pointer; width: fit-content; color: #e8ca92; }
.royal-track-credits p { margin: .4rem 0 0; }

.royal-compact-library #musicTracks {
  max-height: min(58vh, 470px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #755184 #170e22;
  border: 1px solid #ab804c59;
  background: #0e0917e8;
}
.royal-compact-library .track-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) max-content 36px 36px;
  align-items: center;
  gap: 9px;
  min-height: 49px;
  padding: 5px 10px;
  border-left: 2px solid transparent;
}
.royal-compact-library .track-row[hidden] { display: none; }
.royal-compact-library .track-row > div { min-width: 0; }
.royal-compact-library .track-row :is(h3, p) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
}
.royal-compact-library .track-row h3 { font: 600 .91rem/1.3 Georgia, serif; }
.royal-compact-library .track-row p { font-size: .69rem; }
.royal-compact-library .track-row > small { margin: 0; font-size: .68rem; }
.royal-compact-library .track-row > :is(img, .track-cover) {
  width: 34px;
  height: 34px;
  border-radius: 3px;
  font-size: 17px;
}
.royal-compact-library .track-row .btn {
  min-width: 34px;
  min-height: 34px;
  justify-content: center;
  margin: 0;
  padding: 4px !important;
}
.royal-compact-library .track-row.track-current {
  border-left-color: #e8bb65 !important;
  background: linear-gradient(90deg, #5a2b62aa, #201326);
}
.royal-compact-library [data-final="music-favorite"][aria-pressed="true"] { color: #ffe4a5; }
.royal-compact-library .final-filter { margin-block: .55rem; }
.royal-compact-library > p { margin-block: .6rem; font-size: .82rem; }
.royal-compact-library #musicTracks:focus-visible { outline: 2px solid #dcb878; outline-offset: 3px; }

.royal-widget-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid #a47d5d;
  border-radius: 5px;
  background: #291632;
  color: #f9dfa9;
  min-width: 34px;
  min-height: 34px;
  font: 600 1rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.royal-widget-button:hover { background: #492951; }
.royal-widget-button:focus-visible { outline: 2px solid #f2d59a; outline-offset: 3px; }
.royal-widget-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.music-dock:has(.dock-mini-cover) {
  box-sizing: border-box;
  width: min(880px, calc(100vw - 24px));
  min-height: 66px;
  left: max(12px, calc((100vw - 880px) / 2));
  right: auto;
  bottom: max(6px, env(safe-area-inset-bottom));
  transform: none;
  backdrop-filter: none;
  display: grid;
  grid-template-columns: 38px minmax(90px, 1fr) auto minmax(80px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  background: linear-gradient(115deg,#21112dfb,#0e0917fb);
  border-radius: 8px;
}
.music-dock:has(.dock-mini-cover)[hidden] { display: none; }
.music-dock .dock-mini-cover {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border: 1px solid #b58a5c7a;
  border-radius: 4px;
  background: #0a0710;
}
.music-dock .dock-mini-copy { min-width: 0; }
.music-dock .dock-mini-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-dock .dock-progress { display: flex; width: 100%; min-width: 0; }
.music-dock .dock-progress input { min-width: 0; width: 100%; margin: 0; }
.music-dock .dock-buttons .btn { min-height: 34px; padding: 6px; }
.music-dock #musicClock { white-space: nowrap; font-variant-numeric: tabular-nums; }
.music-dock .dock-extra {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(570px, calc(100vw - 390px));
  max-height: min(260px, 35dvh);
  overflow: auto;
  align-items: flex-start;
  box-sizing: border-box;
  overscroll-behavior: contain;
  bottom: calc(100% + 5px);
  left: 0;
  padding: 10px;
  border: 1px solid #b68e55;
  border-radius: 8px;
  background: #170e22f9;
  box-shadow: 0 7px 24px #0009;
}
.music-dock .dock-extra[hidden] { display: none; }
.music-dock .dock-extra .dock-vinyl { width: 58px; flex-basis: 58px; }
.dock-expanded-copy { flex: 1; min-width: 0; }
.dock-expanded-copy :is(strong, small) { display: block; white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
.dock-extra-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.dock-extra-controls label { font-size: .7rem; }
.dock-extra-controls input { width: 64px; }
body.has-music-dock { padding-bottom: calc(var(--royal-dock-clearance, 82px) + 14px + env(safe-area-inset-bottom)); }

.royal-chat, body.has-music-dock .royal-chat {
  position: fixed;
  inset: auto 12px calc(12px + var(--royal-dock-clearance, 0px) + env(safe-area-inset-bottom)) auto;
  width: max-content;
  height: max-content;
  pointer-events: none;
}
.royal-chat .chat-toggle {
  display: block;
  min-height: 43px;
  padding: 7px 11px;
  border-radius: 999px;
  pointer-events: auto;
}
.royal-chat[hidden], .royal-chat #chatWindow[hidden] { display: none; }
.royal-chat #chatWindow {
  position: fixed;
  left: var(--chat-x, auto);
  right: max(12px,env(safe-area-inset-right));
  top: var(--chat-y, auto);
  bottom: calc(65px + var(--royal-dock-clearance,0px) + env(safe-area-inset-bottom));
  box-sizing: border-box;
  width: min(355px, calc(100vw - 24px));
  height: max-content;
  max-height: calc(100dvh - 170px);
  margin: 0;
  padding: 10px;
  overflow: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
}
.royal-chat #chatMessages { height: min(225px, 30dvh); }
.royal-chat .chat-heading {
  position: sticky;
  top: 0;
  min-height: 43px;
  padding-right: 141px;
  background: #171023;
  z-index: 1;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.royal-chat .chat-heading.chat-dragging { cursor: grabbing; }
.chat-window-actions { position: absolute; right: 0; top: 0; display: flex; gap: 3px; }
.chat-window-actions button { min-width: 30px; min-height: 30px; }
.royal-chat #sendChat[hidden] { display: none; }
body.has-music-dock .royal-news-dock { --royal-float-bottom: var(--royal-dock-clearance, 82px); }

@media (max-width: 860px) {
  .music-dock:has(.dock-mini-cover) { grid-template-columns: 34px minmax(32px, 1fr) auto auto auto; gap: 4px 6px; }
  .music-dock .dock-mini-cover { width: 34px; height: 34px; }
  .music-dock .dock-progress { grid-column: 1 / 5; grid-row: 2; }
  .music-dock #musicClock { grid-column: 5; grid-row: 2; text-align: right; }
  .music-dock .dock-buttons .btn { min-width: 29px; }
  .music-dock .dock-extra {
    position: absolute;
    inset: auto 0 calc(100% + 5px) 0;
    width: auto;
    max-height: min(135px, 22dvh);
  }
  .royal-chat #chatWindow {
    bottom: calc(65px + var(--royal-dock-clearance,0px) + var(--royal-details-clearance,0px) + env(safe-area-inset-bottom));
    max-height: min(43dvh, calc(100dvh - 135px - var(--royal-dock-clearance,0px) - var(--royal-details-clearance,0px)));
  }
  .chat-window-actions :is(.chat-keyboard-move,.chat-position-reset) { display: none; }
  .royal-chat .chat-heading { padding-right: 70px; cursor: auto; touch-action: auto; }
  .royal-compact-library .track-row { gap: 6px; padding-inline: 5px; }
  body.has-music-dock .royal-news-dock {
    --royal-float-bottom: calc(var(--royal-dock-clearance,82px) + var(--royal-details-clearance,0px));
  }
  body.has-music-dock .royal-chat {
    bottom: calc(12px + var(--royal-dock-clearance,0px) + var(--royal-details-clearance,0px) + env(safe-area-inset-bottom));
  }
}
@media (max-width: 375px) {
  .royal-compact-library .track-row { grid-template-columns: 27px minmax(0, 1fr) max-content 34px 34px; }
  .royal-compact-library .track-row > :is(img, .track-cover) { width: 27px; height: 27px; }
  .music-dock .dock-extra-controls { max-width: 72px; }
}
@media (pointer: coarse) { .chat-window-actions :is(.chat-keyboard-move,.chat-position-reset) { display:none; } .royal-chat .chat-heading { cursor:auto; padding-right:70px; touch-action:auto; } }
@media (prefers-reduced-motion: reduce) {
  .royal-compact-library .track-row { transition: none; }
}



@media (max-width: 620px) {
  body:has(.royal-news-panel:not([hidden])) .royal-chat #chatWindow {
    max-height: min(29dvh, calc(100dvh - 155px - var(--royal-dock-clearance,0px) - var(--royal-details-clearance,0px)));
  }
}
@media (max-width: 860px) and (max-height: 450px) {
  .music-dock .dock-extra { max-height: 65px; }
  .royal-chat #chatWindow { max-height: min(37dvh, calc(100dvh - 115px - var(--royal-dock-clearance,0px) - var(--royal-details-clearance,0px))); }
}
.chat-launcher-closed .chat-toggle { min-width: 43px; min-height: 43px; padding: 8px 10px; }

@media (max-width: 500px) {
  .royal-compact-library .track-row { grid-template-columns: 29px minmax(0, 1fr) 42px 34px 34px; }
  .royal-compact-library .track-row > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .royal-compact-library .track-row > :is(img, .track-cover) { width: 29px; height: 29px; }
}

@media (min-width: 621px) and (max-width: 860px), (min-width: 500px) and (max-width: 860px) and (max-height: 450px) {
  .royal-chat #chatWindow, body .royal-news-panel { width: calc(50vw - 20px); }
  body:has(#chatWindow:not([hidden])) .royal-news-dock .royal-news-panel { bottom: calc(100% + .5rem); max-height: 34dvh; }
}

/* Le panneau développé fait partie de la barre mesurée, y compris sur mobile. */
.music-dock .dock-extra {
 position:relative;inset:auto;grid-column:1/-1;grid-row:3;width:100%;
 max-height:min(142px,23dvh);padding:6px 9px;box-shadow:none;
}
body.has-music-dock {padding-bottom:calc(var(--royal-dock-clearance,82px) + 18px + env(safe-area-inset-bottom))}
@media(max-width:620px){.music-dock .dock-extra .dock-vinyl{width:38px;flex-basis:38px}.dock-expanded-copy{font-size:.78rem}}

body.has-music-dock[data-room=musique] .royal-compact-library #musicTracks {
 max-height:clamp(130px,calc(62dvh - var(--royal-dock-clearance,82px)),470px);
 scroll-padding-bottom:12px;
}
html:has(body.has-music-dock) {scroll-padding-bottom:calc(var(--royal-dock-clearance,82px) + 12px)}
