/* Player layout shared with the catalogue's blue navigation and quiet surfaces. */
body.player-page {
  --player-blue: #175997;
  --player-blue-dark: #124b80;
  --player-ink: #183047;
  --player-line: #d7e1eb;
  margin: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden !important;
  background: #f7f9fc;
  color: var(--player-ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
.player-page *, .player-page *::before, .player-page *::after { box-sizing: border-box; }
.player-page :is(a, button, select):focus-visible {
  outline: 3px solid #acd6fa;
  outline-offset: 2px;
}

/* Navigation */
.player-page .banner {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 224px;
  height: 100vh;
  padding: 0;
  background: var(--player-blue);
  border-right: 1px solid var(--player-blue-dark);
}
.player-page .logo {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  height: 84px;
  padding: 0 23px;
  border-bottom: 1px solid rgba(255,255,255,.23);
}
.player-page .logo a { display: flex; align-items: center; height: 100%; }
.player-page .logo a img {
  display: block;
  width: 160px;
  height: auto;
  max-height: 42px;
  object-fit: contain;
  transform: none;
}
.player-page .logo a img:hover { transform: none; }
.player-page .banner-right-buttons {
  position: static;
  z-index: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  padding: 18px 13px;
}
.player-page .banner-right-buttons a {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 7px;
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
}
.player-page .banner-right-buttons a:hover { background: rgba(255,255,255,.16); }
.player-page .banner-right-buttons img {
  display: block;
  flex: none;
  position: static !important;
  width: 24px;
  height: 24px;
  padding: 0;
  object-fit: contain;
  transform: none;
}
.player-page .banner-right-buttons img:hover { transform: none; }
.player-page .back-button { display: none; }
.player-page .tab-help-fab {
  position: fixed;
  inset: auto auto 18px 13px;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 198px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.23);
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  color: #fff;
  font: 600 15px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
.player-page .tab-help-fab:hover { background: rgba(255,255,255,.16); transform: none; }
.player-page .help-mark { display: inline-flex; justify-content: center; min-width: 24px; font-size: 20px; }
.player-page .help-label { white-space: nowrap; }

/* The notation keeps the available space; controls sit above its scroll end. */
.player-page .at-wrap {
  position: relative;
  top: 0;
  left: 224px;
  width: calc(100% - 224px);
  height: 100vh;
  margin: 0;
  border: 0;
  background: #fff;
}
.player-page .at-content { min-height: 0; overflow: hidden; }
.player-page .at-viewport {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 0 24px;
  background: #fff;
}
.player-page .at-main { max-width: 1120px; min-height: 100%; margin: 0 auto; }
.player-page .at-main::after { height: 132px; }
.player-page .at-overlay { background: rgba(24,48,71,.24); backdrop-filter: none; }
.player-page .at-overlay-content {
  margin-top: 24px;
  padding: 12px 16px;
  border: 1px solid var(--player-line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(24,48,71,.10);
  color: var(--player-ink);
  font-size: 14px;
}

/* Playback and practice controls */
.player-page .at-controls {
  position: fixed;
  inset: auto 20px 18px 244px;
  z-index: 1003;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(380px, 52%);
  align-items: center;
  gap: 12px;
  width: auto;
  min-width: 0;
  height: 70px;
  padding: 8px 12px;
  transform: none;
  border: 1px solid var(--player-blue-dark);
  border-radius: 10px;
  background: var(--player-blue);
  box-shadow: 0 6px 18px rgba(22,43,62,.15);
  color: #fff;
}
.player-page .at-controls > div { min-width: 0; }
.player-page .at-controls-left,
.player-page .at-controls-right {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
}
.player-page .at-controls-left { justify-content: flex-start; overflow: hidden; }
.player-page .at-controls-right { justify-content: space-between; }
.player-page .at-controls > div > * { flex: none; margin: 0; padding: 0; }
.player-page .at-controls .btn,
.player-page .at-controls .btn:not(.disabled):not(.visually-disabled),
.player-page .dropdown-toggle,
.player-page .at-zoom,
.player-page .at-speed,
.player-page .at-audio-source,
.player-page .at-zoom:not(.visually-disabled),
.player-page .at-speed:not(.visually-disabled),
.player-page .at-audio-source:not(.visually-disabled) {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  min-width: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background-color: transparent;
  box-shadow: none;
  color: #fff;
  transform: none;
}
.player-page .at-controls .btn:not(.disabled):not(.visually-disabled):hover,
.player-page .dropdown-toggle:hover,
.player-page .at-zoom:not(.visually-disabled):hover,
.player-page .at-speed:not(.visually-disabled):hover,
.player-page .at-audio-source:not(.visually-disabled):hover { background-color: rgba(255,255,255,.14); box-shadow: none; transform: none; }
.player-page .at-controls .btn.active:not(.disabled):not(.visually-disabled) { background-color: rgba(255,255,255,.2); box-shadow: none; transform: none; }
.player-page .at-player-play-pause { background-color: rgba(255,255,255,.16) !important; }
.player-page .at-controls .btn img { display: block; width: 26px; height: 26px; object-fit: contain; }
.player-page .instrument-dropdown { position: relative; display: flex; flex: none; margin: 0; }
.player-page .dropdown-toggle { cursor: pointer; }
.player-page .dropdown-icon { width: 27px; height: 27px; object-fit: contain; transform: none; }
.player-page .dropdown-toggle:hover .dropdown-icon { transform: none; }
.player-page .at-speed > img { width: 27px !important; height: 27px !important; object-fit: contain; }
.player-page .at-speed select { inset: 0; width: 100%; height: 100%; }
.player-page .at-zoom {
  background-image: url('screensize.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 27px;
}
.player-page .at-zoom select { inset: 0; width: 100%; height: 100%; }
.player-page #audioSourceSelect {
  display: block;
  width: 44px;
  height: 44px;
  padding: 0;
  background-color: transparent;
  background-size: 28px;
  cursor: pointer;
}
.player-page .at-song-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  flex: 0 1 300px;
  min-width: 0;
  margin-left: 12px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0;
  text-align: left;
}
.player-page .at-song-title,
.player-page .at-song-artist {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
  text-align: left;
}
.player-page .at-song-title { font-size: 15px; font-weight: 700; }
.player-page .at-song-artist { margin-top: 2px; color: #d7e7f5; font-size: 13px; }
.player-page .at-player-progress { flex: none; margin-left: auto; color: #d7e7f5; font-size: 12px; }
.player-page .at-song-position { display: none !important; }
.player-page .dropdown-menu {
  bottom: 52px;
  left: 0;
  width: 220px;
  max-height: min(45vh, 360px);
  overflow: auto;
  border: 1px solid var(--player-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(22,43,62,.16);
  color: var(--player-ink);
}
.player-page .dropdown-item {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  text-align: left;
}
.player-page .dropdown-item:hover { background: #edf4fb; }
.player-page .dropdown-item img {
  width: 28px;
  height: 28px;
  padding: 4px;
  border-radius: 5px;
  background: var(--player-blue);
  object-fit: contain;
}
.player-page #youtubePlayerContainer { bottom: 82px; right: 12px; width: 180px; height: 102px; }

/* Dialogs use the same restrained type and borders as the page. */
.player-page #premiumPopup .popup-content {
  width: min(92vw, 430px);
  max-width: 430px;
  padding: 42px 28px 28px;
  border: 1px solid var(--player-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(22,43,62,.2);
  animation: none;
  color: var(--player-ink);
  font-family: inherit;
}
.player-page #premiumPopup .popup-content::before { display: none; }
.player-page #premiumPopup .popup-content p { margin: 0 0 16px; color: var(--player-ink); font-size: 20px; line-height: 1.3; }
.player-page #premiumPopup .popup-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.player-page .premium-features { margin: 0 0 22px; color: #3d4f61; font-size: 15px; line-height: 1.5; }
.player-page .premiumbutton.glow,
.player-page .premiumbutton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 7px;
  background: var(--player-blue);
  box-shadow: none;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  transform: none;
}
.player-page .premiumbutton.glow:hover,
.player-page .premiumbutton:hover { background: var(--player-blue-dark); box-shadow: none; transform: none; }
.player-page #tabHelp { border: 1px solid var(--player-line); border-radius: 10px; }
.player-page .img-frame { border-radius: 10px; }
.player-page .img-frame figcaption { color: #3d4f61; font-size: 15px; }

/* Premium settings retain their original selects as the source of truth. */
.player-page .has-pro-menu { position: relative; }
.player-page .has-pro-menu > select,
.player-page .has-pro-menu > select:focus {
  display: none !important;
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.player-page .pro-menu-trigger {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.player-page .has-pro-menu > img {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.player-page .has-pro-menu > i { display: none; }
.player-page .pro-menu-trigger:hover,
.player-page .pro-menu-trigger[aria-expanded="true"] { background: rgba(255,255,255,.17); }
.player-page .pro-menu-trigger--audio[data-value="soundfont"]::before { content: "♫"; font-size: 25px; line-height: 1; }
.player-page .pro-menu-trigger--audio[data-value="youtube"] {
  background-image: url('youtube-logo.png');
  background-position: center;
  background-repeat: no-repeat;
  background-size: 28px;
}
.player-page .pro-menu {
  position: fixed;
  z-index: 2400;
  width: min(292px, calc(100vw - 20px));
  padding: 12px;
  border: 1px solid var(--player-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(22,43,62,.18);
  color: var(--player-ink);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
.player-page .pro-menu[hidden] { display: none; }
.player-page .pro-menu--audio { width: min(236px, calc(100vw - 20px)); }
.player-page .pro-menu-heading {
  padding: 1px 4px 10px;
  color: #263d52;
  font-size: 15px;
  font-weight: 700;
}
.player-page .pro-menu-options {
  display: grid;
  grid-template-columns: repeat(var(--menu-columns), minmax(0,1fr));
  gap: 6px;
}
.player-page .pro-menu-option {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #e0e7ef;
  border-radius: 7px;
  background: #fff;
  color: var(--player-ink);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}
.player-page .pro-menu-option:hover { background: #f1f6fb; border-color: #b8ccde; }
.player-page .pro-menu-option.is-selected {
  border-color: var(--player-blue);
  background: #e8f2fb;
  color: #104a7d;
}
.player-page .pro-menu-option:focus-visible { outline: 3px solid #acd6fa; outline-offset: 1px; }
.player-page .pro-menu--audio .pro-menu-option { text-align: left; padding-left: 14px; }
.player-page .pro-menu--audio .pro-menu-option.is-selected::after {
  content: "✓";
  float: right;
  font-weight: 700;
}

/* Keep the video recognisable and separate from the playback bar. */
.player-page #youtubePlayerContainer {
  position: fixed;
  bottom: 100px;
  right: 32px;
  width: 248px;
  height: 172px;
  overflow: hidden;
  border: 1px solid #cbd9e6;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(22,43,62,.17);
}
.player-page #youtubePlayerContainer::before {
  content: "YouTube";
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-bottom: 1px solid #e5ebf1;
  color: #263d52;
  font-size: 13px;
  font-weight: 700;
}
.player-page #youtubePlayerContainer #youtubePlayer {
  display: block;
  width: 100% !important;
  height: calc(100% - 32px) !important;
  border: 0;
}
.player-page.has-open-pro-menu #youtubePlayerContainer { visibility: hidden; }
.player-page #premiumPopup .popup-content { text-align: left; }
.player-page #premiumPopup .popup-content p { max-width: 330px; margin-bottom: 18px; font-size: 21px; font-weight: 700; }
.player-page #premiumPopup .premium-features { padding-left: 0; }
.player-page #premiumPopup .premium-features li { margin: 0 0 9px; }
.player-page #premiumPopup .popup-close:hover { color: var(--player-blue); }
.player-page #tabHelp .close-btn:focus-visible { outline: 3px solid #acd6fa !important; outline-offset: 1px; }

@media (max-width: 1024px) {
  .player-page .banner {
    inset: 0 0 auto 0;
    z-index: 1900;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: 60px;
    border-right: 0;
    border-bottom: 1px solid var(--player-blue-dark);
  }
  .player-page .logo {
    justify-content: flex-start;
    width: auto;
    height: 60px;
    margin: 0 0 0 58px;
    padding: 0;
    border: 0;
  }
  .player-page .logo a img { width: 134px; height: auto; max-height: 34px; }
  .player-page .banner-right-buttons { display: none !important; }
  .player-page .back-button {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 2100;
    display: block;
  }
  .player-page .back-button a { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; }
  .player-page .back-button img { display: block; width: 25px; height: 25px; filter: brightness(0) invert(1); }
  .player-page .tab-help-fab {
    inset: 10px 12px auto auto;
    z-index: 2100;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
  }
  .player-page .help-mark { font-size: 19px; }
  .player-page .help-label { display: none; }
  .player-page .at-wrap {
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
  }
  .player-page .at-viewport { inset: 0; padding: 0 14px; }
  .player-page .at-main::before { height: 0; }
  .player-page .at-main::after { height: 166px; }
  .player-page .at-controls {
    inset: auto 0 0 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    height: auto;
    min-width: 0;
    padding: 10px 14px calc(8px + env(safe-area-inset-bottom));
    border-radius: 0;
    border-right: 0;
    border-left: 0;
    border-bottom: 0;
    box-shadow: 0 -4px 14px rgba(22,43,62,.12);
  }
  .player-page .at-controls-left { width: 100%; min-height: 44px; }
  .player-page .at-controls-right {
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    padding-top: 7px;
    overflow-x: auto;
    border-top: 1px solid rgba(255,255,255,.25);
    scrollbar-width: none;
  }
  .player-page .at-controls-right::-webkit-scrollbar { display: none; }
  .player-page .at-song-info { flex: 1 1 auto; margin-left: 5px; }
  .player-page .at-player-progress { margin-left: 3px; }
  .player-page .dropdown-menu {
    position: fixed;
    bottom: calc(132px + env(safe-area-inset-bottom));
    left: 12px;
    max-height: min(45vh, 320px);
  }
  .player-page #youtubePlayerContainer { bottom: calc(100% + 10px); right: 12px; width: 210px; height: 151px; }
}

@media (max-width: 420px) {
  .player-page .at-viewport { padding: 0 8px; }
  .player-page .at-controls { padding-right: 12px; padding-left: 12px; }
  .player-page .at-controls-left,
  .player-page .at-controls-right { gap: 4px; }
  .player-page .at-controls .btn,
  .player-page .dropdown-toggle,
  .player-page .at-zoom,
  .player-page .at-speed,
  .player-page .at-audio-source { flex-basis: 42px; width: 42px; min-width: 42px; height: 42px; }
  .player-page .at-song-title { font-size: 14px; }
  .player-page .at-song-artist { font-size: 12px; }
}

@media (max-width: 340px) {
  .player-page .at-controls-right { gap: 2px; overflow: visible; }
  .player-page .at-controls-right > * {
    flex: 0 0 40px !important;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
  }
  .player-page .dropdown-toggle { width: 40px; min-width: 40px; height: 40px; }
  .player-page #audioSourceSelect { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .player-page *, .player-page *::before, .player-page *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Safari needs a directly tappable YouTube frame for playback with sound. */
.player-page.safari-youtube-enabled #youtubePlayerContainer {
  width: 248px;
  height: 236px;
  overflow: visible;
}
.player-page.safari-youtube-enabled #youtubePlayer { border-radius: 0 0 9px 9px; }
.player-page .safari-youtube-hint {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  max-width: min(280px, calc(100vw - 24px));
  padding: 9px 12px;
  border: 1px solid #b8cde0;
  border-radius: 7px;
  background: #fff;
  color: #263d52;
  box-shadow: 0 5px 16px rgba(22,43,62,.12);
  font-size: 13px;
  line-height: 1.35;
}
.player-page .safari-youtube-hint[hidden] { display: none; }
@media (max-width: 1024px) {
  .player-page.safari-youtube-enabled #youtubePlayerContainer {
    width: 224px;
    height: 236px;
  }
}

/* The mobile video floats above the controls without reducing the notation area. */
.player-page .youtube-drag-handle { display: none; }
@media (max-width: 1024px) {
  .player-page.has-youtube-media #youtubePlayerContainer {
    position: fixed;
    inset: auto 10px max(8px, min(calc(var(--player-toolbar-height, 124px) + 8px), calc(100dvh - 210px))) auto;
    width: 224px;
    height: 224px;
    overflow: visible;
    border: 1px solid #cbd9e6;
    border-radius: 8px;
    background: #111;
    box-shadow: 0 3px 12px rgba(22,43,62,.14);
  }
  .player-page.has-youtube-media #youtubePlayerContainer::before { display: none; }
  .player-page.has-youtube-media #youtubePlayerContainer #youtubePlayer {
    height: 100% !important;
    border-radius: 7px;
  }
  .player-page.has-youtube-media .safari-youtube-hint {
    top: 8px;
    bottom: auto;
    left: 8px;
    right: 8px;
    z-index: 5;
    max-width: none;
  }
  .player-page.has-youtube-media .youtube-drag-handle {
    position: absolute;
    top: 8px;
    right: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 44px;
    padding: 0;
    border: 1px solid #cbd9e6;
    border-right: 0;
    border-radius: 7px 0 0 7px;
    background: #fff;
    color: #52697e;
    cursor: grab;
    touch-action: none;
    user-select: none;
  }
  .player-page .youtube-drag-handle svg { width: 16px; height: 20px; pointer-events: none; }
  .player-page .youtube-drag-handle:active { cursor: grabbing; }
  .player-page .youtube-drag-handle:focus-visible { outline-offset: -3px; }
}
