/* J-1005-TYPING-NOW-PLAYING
   Combat line under the helper keyboard, and the pause-screen music menu.
   Header picker styles stay in the music-picker hop. */

#screen-dungeon .stage-keyboard-bl { bottom: 2.65rem; }

/* J-1005-16: song name and note icons only. No pill, border, or fill.
   The dark halo keeps the cream type readable on the dungeon. */
#now-playing {
  position: absolute;
  left: 0.4rem;
  right: auto;
  bottom: 0.16rem;
  top: auto;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: min(42vw, 16rem);
  margin: 0;
  padding: 0.16rem 0.55rem;
  border: 0;
  border-radius: 0;
  background: none;
  appearance: none;
  -webkit-appearance: none;
  color: #fff6d8;
  font: 700 0.74rem/1.2 Georgia, "Palatino Linotype", Palatino, serif;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: none;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.95),
    0 0 6px rgba(0, 0, 0, 0.92),
    0 0 1px #140e06,
    1px 0 0 #140e06,
    -1px 0 0 #140e06,
    0 1px 0 #140e06,
    0 -1px 0 #140e06;
}
#now-playing[hidden] { display: none !important; }
#now-playing.is-silent { opacity: 0.72; }
#now-playing:hover { filter: brightness(1.08); }
#now-playing:focus-visible {
  outline: 2px solid #f5c542;
  outline-offset: 2px;
}

#win-now-playing {
  display: inline-flex;
  margin: 0.35rem auto 0.2rem;
  padding: 0.2rem 0.7rem;
  border: 1px solid rgba(245, 197, 66, 0.72);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(74, 56, 28, 0.94), rgba(28, 20, 10, 0.94));
  color: #f8e7b8;
  font: 700 0.85rem/1.2 Georgia, "Palatino Linotype", Palatino, serif;
}
#win-now-playing[hidden] { display: none !important; }

.pause-audio .pause-toggle {
  grid-template-columns: 1fr auto;
}
#pause-music-picker.bgm-picker {
  display: block;
  position: relative;
  width: 100%;
  max-width: 24rem;
  margin: 0.15rem auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  white-space: normal;
  min-height: 0;
  z-index: 3;
}
/* J-1022-50: shared music volume, first row of the Music dropdown. */
.bgm-menu > .bgm-vol {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.35rem;
  padding: 0.15rem 0.2rem 0.4rem;
  border-bottom: 1px solid rgba(245, 197, 66, 0.4);
}
.bgm-vol-mute {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(245, 197, 66, 0.55);
  border-radius: 50%;
  background: rgba(8, 8, 10, 0.45);
  color: #f5c542;
  cursor: pointer;
}
.bgm-vol-mute.is-muted { opacity: 0.55; }
.bgm-vol-range {
  flex: 1 1 auto;
  min-width: 0;
  height: 4px;
  accent-color: #f5c542;
  cursor: pointer;
}
.bgm-vol-pct {
  flex: 0 0 auto;
  min-width: 2.4rem;
  color: #ffe7a8;
  font: 700 0.72rem/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
  text-align: right;
}
.bgm-src-row.is-zen-blocked {
  opacity: 0.48;
  filter: grayscale(0.85);
  cursor: pointer;
}
.bgm-src-row.is-zen-blocked input,
.bgm-src-row.is-zen-blocked .bgm-src-badge { pointer-events: none; }

#pause-music-picker .bgm-picker-kicker {
  display: block;
  margin: 0 0 0.28rem;
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
#pause-music-picker .bgm-picker-toggle {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid rgba(245, 197, 66, 0.55);
  border-radius: 0.45rem;
  background: rgba(5, 10, 22, 0.72);
  color: #f6e7b2;
  font: 700 0.8rem/1.2 Georgia, "Palatino Linotype", Palatino, serif;
  cursor: pointer;
  text-align: left;
}
#pause-music-picker .bgm-picker-toggle::after {
  content: "▾";
  color: var(--gold);
}
#pause-music-picker.is-open .bgm-picker-toggle::after { content: "▴"; }
#pause-music-picker .bgm-menu {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: calc(100% - 0.15rem) !important;
  width: auto !important;
  z-index: 6;
  max-height: min(46vh, 16rem) !important;
  overflow: auto;
  margin-top: 0.28rem;
  padding: 0.35rem;
  border: 1px solid rgba(245, 197, 66, 0.55);
  border-radius: 0.55rem;
  background: linear-gradient(180deg, rgba(36, 28, 16, 0.98), rgba(14, 12, 10, 0.98));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  text-align: left;
}
#pause-music-picker .bgm-random,
#pause-music-picker .bgm-song {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  margin: 0;
  padding: 0.32rem 0.4rem;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: #f3e6c4;
  font: 700 0.78rem/1.25 Georgia, "Palatino Linotype", Palatino, serif;
  text-align: left;
  cursor: pointer;
}
#pause-music-picker .bgm-random { color: var(--gold); }
#pause-music-picker .bgm-play-random[aria-checked="true"],
#pause-music-picker .bgm-song:has(input:checked) {
  background: rgba(245, 197, 66, 0.14);
}
#pause-music-picker .bgm-song input { accent-color: var(--gold); }

@media (max-height: 850px) {
  #screen-dungeon .stage-keyboard-bl { bottom: 2.45rem; }
  #now-playing { bottom: 0.1rem; max-width: min(36vw, 14rem); font-size: 0.68rem; }
}

/* Narrow combat, including 390: keep the helper keyboard, then the line under it,
   clear of the word box, the loot row, the hit line, and Exit Full Screen. */
@media (max-width: 600px) {
  #screen-dungeon .viewport {
    height: 508px;
    min-height: 508px;
  }
  #screen-dungeon .fighters { height: 118px; transform: none; }
  #screen-dungeon .current-fight-label { top: 108px; }
  #screen-dungeon .stage-bottom-cluster { top: 132px; }
  #screen-dungeon #type-input { height: 34px; min-height: 34px; }
  #screen-dungeon .stage-keyboard-bl {
    display: flex !important;
    flex-direction: column;
    /* J-1006-127: start under the word box (it ends at 237px), not on it. */
    top: 241px;
    bottom: auto;
    left: 0.4rem;
    right: 0.4rem;
    width: auto;
    max-width: none;
    z-index: 22;
    padding-top: 0.08rem;
    padding-bottom: 0.06rem;
  }
  #now-playing {
    top: 352px;
    height: 40px;
    min-height: 0;
    bottom: auto;
    left: 0.45rem;
    right: 0.45rem;
    max-width: none;
    width: auto;
    z-index: 23;
    padding: 0.1rem 0.45rem;
  }
  #screen-dungeon .stage-loot-col {
    top: 392px;
    min-height: 0;
    height: auto;
    padding: 0.16rem 0.35rem;
  }
}

.app.layout-combat:fullscreen #now-playing {
  z-index: 7;
}

/* J-1005-89: song progress. Painted as background layers on the line
   itself (no extra element, nothing over the text, clicks unchanged).
   JS sets --np-p 0..1 every 400 ms; the size slides between ticks.
   Layers: gold edge at the bottom, faint gold wash, dim full-width track. */
#now-playing.has-progress,
.app:has(> #screen-title.land.active) #landing-now-playing.has-progress:not([hidden]) {
  --np-p: 0;
  background-image:
    linear-gradient(rgba(245, 197, 66, 0.85), rgba(245, 197, 66, 0.85)),
    linear-gradient(90deg, rgba(245, 197, 66, 0.05), rgba(245, 197, 66, 0.2)),
    linear-gradient(rgba(255, 246, 216, 0.16), rgba(255, 246, 216, 0.16));
  background-size:
    calc(var(--np-p) * 100%) 2px,
    calc(var(--np-p) * 100%) 100%,
    100% 2px;
  background-position: left bottom, left top, left bottom;
  background-repeat: no-repeat;
  transition: background-size 0.45s linear;
}
/* The combat button is taller than its one text line (button min-height), so
   the wash and the edge hug the text instead of filling the whole box. */
#now-playing.has-progress {
  border-radius: 3px;
  background-size:
    calc(var(--np-p) * 100%) 2px,
    calc(var(--np-p) * 100%) 1.55em,
    100% 2px;
  background-position:
    left top calc(50% + 0.78em),
    left center,
    left top calc(50% + 0.78em);
}
#now-playing.np-jump,
#landing-now-playing.np-jump { transition: none; }
@media (prefers-reduced-motion: reduce) {
  #now-playing.has-progress,
  #landing-now-playing.has-progress { transition: none; }
}

/* J-1022-50 desk #100755: the 2px background wash never read as a bar, and Apple
   Music never supplied a duration. Real track, elapsed, and remaining. */
#now-playing.has-progress {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.04rem;
  max-width: min(48vw, 18.5rem);
  min-height: 0;
  height: auto;
  padding: 0.04rem 0.45rem 0.08rem;
  line-height: 1.15;
  white-space: normal;
  background-image: none;
  border-radius: 0;
}
#now-playing .np-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#now-playing .np-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
#now-playing .np-row[hidden] { display: none !important; }
#now-playing .np-elapsed,
#now-playing .np-remain {
  flex: 0 0 auto;
  color: #ffe7a8;
  font: 600 0.62rem/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.03em;
}
#now-playing .np-track {
  flex: 1 1 auto;
  height: 3px;
  min-width: 2.5rem;
  border-radius: 99px;
  background: rgba(255, 246, 216, 0.28);
  box-shadow: 0 0 0 1px rgba(20, 14, 6, 0.55);
  overflow: hidden;
}
#now-playing .np-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #a87420, #ffe08a 58%, #f5c542);
  box-shadow: 0 0 6px rgba(245, 197, 66, 0.75);
}
@media (prefers-reduced-motion: no-preference) {
  #now-playing .np-fill { transition: width 0.4s linear; }
}
@media (max-width: 600px) {
  #now-playing.has-progress {
    height: auto;
    min-height: 0;
    padding: 0.06rem 0.4rem 0.1rem;
  }
}

/* J-1005-89: Music menu preview button. Sits between the checkbox and the
   song name. The row being previewed gets a thin bar along its bottom. */
.bgm-menu .bgm-song .bgm-preview {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 1.45rem;
  height: 1.45rem;
  min-width: 0;
  min-height: 0;
  margin: -0.05rem 0 0;
  padding: 0;
  border: 1px solid rgba(245, 197, 66, 0.45);
  border-radius: 50%;
  background: rgba(8, 8, 10, 0.45);
  color: #f5c542;
  font: 700 0.62rem/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s, background-color 0.15s, border-color 0.15s;
}
.bgm-song .bgm-preview:hover,
.bgm-song .bgm-preview:focus-visible { opacity: 1; background: rgba(245, 197, 66, 0.18); border-color: #f5c542; }
.bgm-song .bgm-preview:focus-visible { outline: 2px solid #f5c542; outline-offset: 2px; }
.bgm-song .bgm-preview.is-playing {
  opacity: 1;
  background: #f5c542;
  border-color: #f5c542;
  color: #1a1206;
}
/* !important: the checked-row rules use the background shorthand. */
.bgm-song.is-previewing {
  background-image: linear-gradient(rgba(245, 197, 66, 0.8), rgba(245, 197, 66, 0.8)) !important;
  background-size: calc(var(--bgm-preview-p, 0) * 100%) 2px !important;
  background-position: left bottom !important;
  background-repeat: no-repeat !important;
  transition: background-size 0.45s linear;
}
#pause-music-picker .bgm-song .bgm-preview { width: 1.3rem; height: 1.3rem; margin: 0; }

/* J-1018-13: song cover between the preview button and the name. */
.bgm-song { align-items: center; }
.bgm-song .bgm-art {
  flex: 0 0 auto;
  display: block;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(245, 197, 66, 0.45);
  border-radius: 4px;
  object-fit: cover;
  background: rgba(8, 8, 10, 0.45);
}
#pause-music-picker .bgm-song .bgm-art { width: 1.6rem; height: 1.6rem; }
.bgm-song.is-loading .bgm-art { filter: grayscale(1); opacity: 0.5; }

/* Desk #82537: a song still downloading. Green fill behind the row grows
   with the bytes; checkbox and preview stay grey until it lands. */
.bgm-song.is-loading {
  cursor: default;
  background-image: linear-gradient(rgba(64, 196, 92, 0.42), rgba(64, 196, 92, 0.42)) !important;
  background-size: calc(var(--bgm-load-p, 0) * 100%) 100% !important;
  background-position: left center !important;
  background-repeat: no-repeat !important;
  transition: background-size 0.2s linear;
}
.bgm-song.is-loading input,
.bgm-song.is-loading .bgm-preview {
  filter: grayscale(1);
  opacity: 0.35 !important;
  cursor: default;
  pointer-events: none;
}
.bgm-song.is-loading span { opacity: 0.75; }

/* J-1022-39 (desk #100356): Apple Music + Radio Station rows and their compact players. */
.bgm-src-head {
  margin: 0.45rem 0.4rem 0.2rem; padding-top: 0.45rem;
  border-top: 1px solid rgba(245, 197, 66, 0.28);
  color: #f5c542; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
}
.bgm-song.bgm-src-row { align-items: center; }
.bgm-src-icon {
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 2rem; height: 2rem;
  border-radius: 0.4rem; color: #f5c542;
  background: rgba(245, 197, 66, 0.1); border: 1px solid rgba(245, 197, 66, 0.35);
}
.bgm-src-row.is-apple .bgm-src-icon { color: #ff5f7e; background: rgba(255, 95, 126, 0.1); border-color: rgba(255, 95, 126, 0.4); }
.bgm-src-name { flex: 1 1 auto; }
.bgm-src-badge {
  flex: 0 1 auto; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  color: #f5c542; border: 1px solid rgba(245, 197, 66, 0.5); background: transparent; font: inherit;
}
.bgm-src-row.is-apple .bgm-src-badge { cursor: pointer; }
.bgm-src-row.is-apple .bgm-src-badge.is-in { color: #7fe0a0; border-color: rgba(127, 224, 160, 0.55); }
.bgm-src-row.is-radio .bgm-src-badge { color: #c9cde0; border-color: rgba(201, 205, 224, 0.35); }
.bgm-src-panel {
  margin: 0.15rem 0.2rem 0.45rem; padding: 0.55rem;
  border: 1px solid rgba(245, 197, 66, 0.45); border-radius: 10px;
  background: linear-gradient(180deg, rgba(36, 28, 16, 0.92), rgba(14, 12, 10, 0.95));
  color: #f3e6c4; font-size: 0.85rem;
}
.bgm-src-panel[hidden] { display: none; }
.bgm-src-signin { display: grid; gap: 0.45rem; justify-items: start; }
.bgm-src-lede, .bgm-src-note, .bgm-src-fine { margin: 0; line-height: 1.35; }
.bgm-src-fine { color: #a99c7c; font-size: 0.72rem; }
.bgm-src-note { color: #d8cdb0; font-size: 0.78rem; }
.bgm-src-note.is-warn { color: #ffb36b; }
.bgm-src-btn {
  min-height: 34px; padding: 0.3rem 0.85rem; border-radius: 999px; cursor: pointer;
  border: 1px solid #f5c542; background: rgba(245, 197, 66, 0.16); color: #ffe7a3;
  font: inherit; font-weight: 800;
}
.bgm-src-btn.is-apple { background: linear-gradient(180deg, #fa5a78, #d8324f); border-color: #ff8aa0; color: #fff; }
.bgm-src-btn:disabled { opacity: 0.6; cursor: progress; }
.bgm-src-btn:hover, .bgm-src-btn:focus-visible { filter: brightness(1.12); outline: 2px solid #f5c542; outline-offset: 2px; }
.bgm-src-now { display: flex; align-items: center; gap: 0.55rem; }
.bgm-src-art {
  flex: 0 0 auto; width: 2rem; height: 2rem; overflow: hidden; border-radius: 0.35rem;
  background: rgba(245, 197, 66, 0.12); border: 1px solid rgba(245, 197, 66, 0.3);
}
.bgm-src-art.is-now { width: 2.75rem; height: 2.75rem; }
.bgm-src-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bgm-src-nowtext, .bgm-src-itemtext { display: grid; min-width: 0; text-align: left; }
.bgm-src-nowtext strong, .bgm-src-itemtext strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff3cf; }
.bgm-src-nowtext small, .bgm-src-itemtext small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #b9ab86; font-weight: 600; font-size: 0.72rem; }
.bgm-src-transport { display: flex; justify-content: center; align-items: center; gap: 0.35rem; margin: 0.5rem 0 0.35rem; }
.bgm-src-ctl {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; padding: 0; cursor: pointer;
  border-radius: 999px; border: 1px solid rgba(245, 197, 66, 0.4); background: transparent;
  color: #f3e6c4; font: 700 0.9rem/1 system-ui, sans-serif;
}
.bgm-src-ctl.is-main { width: 2.5rem; height: 2.5rem; background: #f5c542; border-color: #f5c542; color: #1b1408; font-size: 1rem; }
.bgm-src-ctl.is-on { color: #f5c542; background: rgba(245, 197, 66, 0.18); border-color: #f5c542; }
.bgm-src-ctl:hover, .bgm-src-ctl:focus-visible { outline: 2px solid #f5c542; outline-offset: 1px; }
.bgm-src-tabs { display: flex; gap: 0.25rem; margin: 0.25rem 0 0.35rem; padding: 0.15rem; border-radius: 999px; background: rgba(0, 0, 0, 0.35); }
.bgm-src-tab {
  flex: 1 1 0; min-height: 28px; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: #cdbf98; font: inherit; font-size: 0.75rem; font-weight: 800;
}
.bgm-src-tab.is-on { background: rgba(245, 197, 66, 0.22); color: #ffe7a3; }
.bgm-src-list { display: grid; gap: 0.15rem; max-height: 11.5rem; overflow: auto; }
.bgm-src-item {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; min-height: 40px; padding: 0.25rem 0.35rem;
  border: 1px solid transparent; border-radius: 0.45rem; background: transparent; cursor: pointer;
  color: inherit; font: inherit;
}
.bgm-src-item:hover, .bgm-src-item:focus-visible { background: rgba(245, 197, 66, 0.1); outline: none; border-color: rgba(245, 197, 66, 0.4); }
.bgm-src-item.is-on { background: rgba(245, 197, 66, 0.16); border-color: rgba(245, 197, 66, 0.65); }
.bgm-src-search { display: flex; gap: 0.35rem; margin: 0.15rem 0 0.4rem; }
.bgm-src-search input {
  flex: 1 1 auto; min-width: 0; min-height: 32px; padding: 0.2rem 0.6rem; border-radius: 999px;
  border: 1px solid rgba(245, 197, 66, 0.45); background: rgba(0, 0, 0, 0.4); color: #fff3cf; font: inherit;
}
.bgm-src-search .bgm-src-btn { min-height: 32px; padding: 0.2rem 0.7rem; }
.bgm-src-link {
  display: block; margin: 0.45rem auto 0; border: 0; background: transparent; cursor: pointer;
  color: #a99c7c; font: inherit; font-size: 0.72rem; text-decoration: underline;
}
#pause-music-picker .bgm-src-panel { font-size: 0.78rem; }
/* J-1022-39 desk #100442: Apple Music search results (signed out, 30 s previews). */
.bgm-src-panel.is-apple .bgm-src-search { margin-top: 0.55rem; }
.bgm-src-panel.is-apple .bgm-src-now { margin-top: 0.5rem; }
.bgm-src-panel.is-apple .bgm-src-now .bgm-src-nowtext { flex: 1 1 auto; }
.bgm-src-item .bgm-src-itemtext { flex: 1 1 auto; }
.bgm-src-pv {
  flex: 0 0 auto; display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem;
  border-radius: 999px; border: 1px solid rgba(245, 197, 66, 0.5); color: #f5c542; font-size: 0.7rem;
}
.bgm-src-item.is-on .bgm-src-pv { background: #f5c542; color: #1b1408; }
.typing-music-toast { position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200; max-width: min(32rem, calc(100vw - 2rem)); padding: .65rem .9rem; border: 1px solid rgba(255,179,107,.8); border-radius: .6rem; background: #24180f; color: #ffe1bd; box-shadow: 0 .5rem 2rem rgba(0,0,0,.45); font: 700 .82rem/1.35 system-ui,sans-serif; }
.bgm-radio-genres { display: flex; flex-wrap: wrap; gap: .35rem; margin: .2rem 0 .45rem; }.bgm-radio-genres .bgm-src-btn { min-height: 28px; padding: .18rem .58rem; font-size: .75rem; }
.bgm-src-panel.is-radio { position: fixed; inset: 4vh max(1rem, calc((100vw - 58rem)/2)) 4vh; z-index: 95; display: flex; flex-direction: column; margin: 0; padding: clamp(.8rem, 2vw, 1.25rem); border-radius: 1rem; box-shadow: 0 1rem 4rem rgba(0,0,0,.65); }.bgm-src-panel.is-radio .bgm-src-list { max-height: none; flex: 1 1 auto; grid-auto-rows: min-content; }.bgm-src-panel.is-radio::before { content: "Radio Station"; color: #f5c542; font-size: .72rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; margin-bottom: .4rem; }@media (max-width: 620px) { .bgm-src-panel.is-radio { inset: .5rem; } .bgm-radio-tabs { overflow-x: auto; } }
.bgm-src-panel.is-radio[hidden] { display: none; }
/* J-1022-39 (desk #100611): the radio panel is now a page-level overlay (not inside the
   dropdown), so it paints wide and near full height on its own. */
.bgm-src-panel.is-radio { z-index: 300; font: 600 .9rem/1.3 system-ui, sans-serif; box-sizing: border-box; overflow: hidden;
  background: linear-gradient(180deg, #2a2113, #110e0a); box-shadow: 0 1rem 4rem rgba(0,0,0,.65), 0 0 0 100vmax rgba(4,3,2,.6); }
.bgm-src-panel.is-radio .bgm-src-now .bgm-src-nowtext { flex: 1 1 auto; }
.bgm-src-panel.is-radio .bgm-radio-close { flex: 0 0 auto; margin-left: auto; }
.bgm-src-panel.is-radio .bgm-src-list { min-height: 0; }

/* J-1022-39 addendum 6: a compact shared picker keeps Streaming and the
   full song catalog comfortably usable in both the header and pause menus. */
/* J-1023-1: Apple Music enable / sign-in warning. */
.drm-warn {
  position: fixed; inset: 0; z-index: 500; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.55); font: 600 0.9rem/1.4 Georgia, "Palatino Linotype", Palatino, serif;
}
.drm-warn section {
  width: min(22rem, calc(100vw - 2rem)); padding: 0.9rem 0.95rem 0.8rem;
  border-radius: 0.7rem; border: 1px solid #f5c542;
  background: linear-gradient(180deg, #2a2113, #110e0a); color: #f6e7b2;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.55);
}
.drm-warn p { margin: 0 0 0.7rem; }
.drm-warn label { display: flex; align-items: center; gap: 0.45rem; margin: 0 0 0.8rem; color: #ffe7a3; font-size: 0.82rem; }
.drm-warn-row { display: flex; justify-content: flex-end; gap: 0.45rem; }
.drm-warn button {
  min-height: 30px; padding: 0 0.75rem; border-radius: 0.45rem; cursor: pointer;
  border: 1px solid rgba(245, 197, 66, 0.7); background: transparent; color: #f6e7b2;
  font: 700 0.8rem/1 inherit;
}
.drm-warn button.is-go { background: #f5c542; border-color: #f5c542; color: #1b1408; }

/* J-1023-1: Play random is a real checkbox, not a blank square. */
.bgm-play-random {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  margin: 0 0 0.15rem;
  padding: 0.28rem 0.4rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(245, 197, 66, 0.35);
  background: rgba(0, 0, 0, 0.28);
  color: #f6e7b2;
  font: 700 0.78rem/1.2 Georgia, "Palatino Linotype", Palatino, serif;
  cursor: pointer;
}
.bgm-play-random input {
  appearance: none;
  -webkit-appearance: none;
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  flex: none;
  border: 1.5px solid rgba(245, 197, 66, 0.85);
  border-radius: 0.2rem;
  background: rgba(8, 6, 4, 0.8);
  display: grid;
  place-items: center;
}
.bgm-play-random input:checked {
  background: #f5c542;
  border-color: #ffe7a3;
}
.bgm-play-random input:checked::after {
  content: "";
  width: 0.28rem;
  height: 0.5rem;
  border: solid #1b1408;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-0.5px, -1px);
}
.bgm-play-random input:focus-visible { outline: 2px solid #f5c542; outline-offset: 2px; }
.bgm-play-random .bgm-shuf { display: grid; color: #f5c542; flex: none; }
.bgm-play-random .bgm-shuf svg { display: block; }
.bgm-play-random[aria-checked="true"] {
  background: rgba(245, 197, 66, 0.16);
  border-color: #f5c542;
  color: #ffe7a3;
}
.bgm-menu .bgm-random,
.bgm-menu .bgm-song {
  gap: 0.34rem;
  min-height: 0;
  padding: 0.18rem 0.3rem;
  font-size: 0.72rem;
  line-height: 1.15;
}
.bgm-menu .bgm-song .bgm-preview {
  width: 1.18rem;
  height: 1.18rem;
  margin: 0;
  font-size: 0.54rem;
}
.bgm-menu .bgm-song .bgm-art {
  width: 1.32rem;
  height: 1.32rem;
  border-radius: 3px;
}
.bgm-menu .bgm-src-head {
  margin: 0.26rem 0.34rem 0.12rem;
  padding-top: 0.3rem;
  font-size: 0.6rem;
  letter-spacing: 0.13em;
}
.bgm-menu .bgm-src-icon {
  width: 1.32rem;
  height: 1.32rem;
  border-radius: 0.32rem;
}
.bgm-menu .bgm-src-badge {
  max-width: 7.5rem;
  padding: 0.06rem 0.36rem;
  font-size: 0.64rem;
}
.bgm-menu .bgm-src-panel {
  margin: 0.1rem 0.15rem 0.28rem;
  padding: 0.42rem;
  font-size: 0.76rem;
}
.bgm-menu .bgm-src-item {
  gap: 0.36rem;
  min-height: 34px;
  padding: 0.18rem 0.26rem;
  font-size: 0.76rem;
}
.bgm-menu .bgm-src-art { width: 1.58rem; height: 1.58rem; }
.bgm-menu .bgm-src-art.is-now { width: 2.15rem; height: 2.15rem; }
#pause-music-picker .bgm-random,
#pause-music-picker .bgm-song { gap: 0.34rem; padding: 0.24rem 0.34rem; font-size: 0.72rem; line-height: 1.15; }
#pause-music-picker .bgm-song .bgm-preview { width: 1.18rem; height: 1.18rem; }
#pause-music-picker .bgm-song .bgm-art { width: 1.32rem; height: 1.32rem; }

/* J-1022-39 desk #100636: while the boss theme / ending song overrides Apple Music or radio,
   the bottom-left label shows the game track with a small note that the player's music comes back. */
html[data-stream-yield] #now-playing,
html[data-stream-yield] #win-now-playing { flex-direction: column; line-height: 1.15; }
html[data-stream-yield] #now-playing::after,
html[data-stream-yield] #win-now-playing::after {
  content: "your music resumes after"; display: block; font: italic 600 0.6rem/1.1 system-ui, sans-serif;
  letter-spacing: 0.02em; color: #e8d9ae; opacity: 0.85;
}

/* J-1022-50 stage 5 (desk #100728): opened from the Pause screen, the Music menu was a small clipped popover
   with a nested scroll (Apple playlists showed ~5 rows). It is now a tall centred sheet using most of the
   viewport, with ONE scroll area (the sheet); lists inside it no longer scroll on their own.
   Outside click (the dimmed backdrop) or Esc closes it, as before. */
/* music-picker.js moves an open menu to <body>, so the pause menu carries .bgm-sheet instead of living
   under #pause-music-picker. */
.bgm-menu.bgm-sheet:not([hidden]) {
  position: fixed !important;
  top: max(2.5vh, 10px) !important;
  bottom: max(2.5vh, 10px) !important;
  left: 50% !important;
  right: auto !important;
  width: min(32rem, calc(100vw - 20px)) !important;
  max-height: none !important;
  transform: translateX(-50%);
  margin: 0 !important;
  padding: 0.55rem 0.6rem 0.8rem !important;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 197, 66, 0.55) transparent;
  z-index: 400 !important;
  border-radius: 0.85rem !important;
  box-shadow: 0 1.2rem 4rem rgba(0, 0, 0, 0.7), 0 0 0 100vmax rgba(4, 3, 2, 0.6) !important;
}
.bgm-menu.bgm-sheet:not([hidden])::before {
  content: "Music · Esc to close";
  position: sticky; top: -0.55rem; z-index: 2; display: block;
  margin: -0.55rem -0.6rem 0.35rem; padding: 0.5rem 0.75rem 0.4rem;
  background: linear-gradient(180deg, rgba(40, 31, 17, 0.99), rgba(28, 22, 13, 0.97));
  border-bottom: 1px solid rgba(245, 197, 66, 0.3);
  color: #f5c542; font: 900 0.66rem/1 system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase;
}
.bgm-sheet .bgm-src-list { max-height: none; overflow: visible; }
.bgm-sheet .bgm-src-panel { font-size: 0.82rem; }
.bgm-sheet .bgm-random, .bgm-sheet .bgm-song { font-size: 0.78rem; padding: 0.26rem 0.4rem; }
.bgm-menu:focus, .bgm-src-panel:focus, .zmpf-wrap:focus { outline: none; }
@media (max-height: 560px) {
  .bgm-menu.bgm-sheet:not([hidden]) { top: 6px !important; bottom: 6px !important; }
}
