/* osuFM additions (Home page, radio in the listener, downloads, playlists,
   queue) drawn in the existing osuFM visual language. Panorama is the only layout. */

/* ---------- player: Download button, DJ caption, repeat modes ---------- */
.download-map { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border: 1px solid var(--pink); border-radius: 20px; color: var(--pink); font-size: 11px; background: #f3a2c912; white-space: nowrap; vertical-align: middle; }
.download-map:hover { background: var(--pink); color: #251b2b !important; }
.now #now-art-button { display: inline-flex; vertical-align: middle; }
.dj-caption { max-width: 640px; margin: 8px 0 0; padding-left: 12px; border-left: 2px solid var(--pink); font-size: 13px; line-height: 1.6; color: #efe4f5; text-shadow: 0 2px 12px #0008; }
body[data-listening=false] .dj-caption { display: none; }
#repeat { position: relative; }
#repeat[data-mode=one]::after { content: "1"; position: absolute; top: 2px; right: 0; font-size: 9px; color: var(--pink); font-weight: 700; }
#repeat[data-mode=all], #repeat[data-mode=one] { color: var(--pink) !important; }

/* ---------- shelf tiles ---------- */
.row-actions .more-choice { font-size: 18px; letter-spacing: -1px; }
.track-meta .owned { color: #c9f0a7; }
.track-meta .preview { color: #ffe08a; }
.song-card.queue-card .track-meta { color: #fad4e9; }
.song-card.channel-card { border-color: color-mix(in srgb, var(--ch) 60%, transparent); }
.song-card.channel-card.is-current { border: 2px solid var(--ch); box-shadow: 0 0 18px color-mix(in srgb, var(--ch) 35%, transparent); }
.song-card .live-label { color: var(--ch, var(--pink)) !important; letter-spacing: 1.5px; font-weight: 600; }
.channel-card .song-copy { gap: 4px; }
#songs { cursor: grab; }
#songs.dragging { cursor: grabbing; user-select: none; }
#songs.dragging .song-card { pointer-events: none; }
.empty-library #empty-action { margin-top: 14px; }

/* ---------- the row above the shelf: title, status and actions ---------- */
#songs, .song-card { scroll-snap-type: none !important; scroll-snap-align: none !important; }
#songs { scroll-behavior: auto; }
body[data-theme=panorama][data-listening=true] main { height: 300px; }
body[data-theme=panorama][data-listening=true]:not([data-page=player]) .player { bottom: 318px; }
body[data-theme=panorama][data-listening=true] .section-heading { display: flex !important; align-items: center; gap: 14px; min-height: 34px; margin: 0 14px 6px; }
.section-heading > div:first-child { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
#section-kicker { display: none !important; }
#section-title { font-size: 15px; white-space: nowrap; }
#section-sub { font-size: 11px; color: #b6acc5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.section-actions button { padding: 7px 15px; font-size: 11px; border-radius: 16px; white-space: nowrap; }
.section-actions .quiet { border: 1px solid #ffffff38; background: #151a2b99; }
.section-actions .quiet:hover { border-color: var(--pink); color: var(--pink); }
.section-actions .primary { padding: 7px 17px; }
.section-actions .back-button { order: -1; border-color: var(--pink); color: var(--pink); }
body[data-page=playlist] .section-heading > div:first-child { order: 0; }
body[data-page=playlist] .section-actions { margin-left: 0; flex: 1; }
body[data-page=playlist] .section-actions .back-button { margin-right: 6px; }
#count { white-space: nowrap; }
#more { display: none !important; }
.library-tabs { flex-wrap: wrap; }
#scene { transition: none !important; }
@media (max-width: 760px) {
  body[data-theme=panorama][data-listening=true] .section-heading { flex-wrap: wrap; gap: 6px 10px; }
  .section-actions { margin-left: 0; }
  #section-sub { display: none; }
}

/* ---------- full-screen player: Browse songs sits at the bottom centre ---------- */
@media (min-width: 761px) {
  body[data-page=player] #browse-toggle { top: auto; bottom: 34px; left: 50%; transform: translateX(-50%); }
}

/* ---------- menus + small dialogs ---------- */
.menu { position: fixed; z-index: 40; min-width: 210px; max-width: 320px; max-height: 70vh; overflow-y: auto; padding: 6px; border: 1px solid #cfbed64d; border-radius: 12px; background: #151825f2; backdrop-filter: blur(25px); box-shadow: 0 16px 60px #0006; }
.menu button, .menu a { display: block; width: 100%; padding: 8px 11px; border-radius: 7px; text-align: left; font-size: 12px; color: #eee7f5; }
.menu button:hover, .menu a:hover, .menu button:focus-visible, .menu a:focus-visible { background: #f3a2c91a; color: #fff; outline: none; }
.menu hr { border: 0; border-top: 1px solid #ffffff1c; margin: 4px 6px; }
.menu .menu-label { padding: 8px 11px 4px; font-size: 9px; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; }
.account-dialog .dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.account-dialog .dialog-heading button { font-size: 17px; padding: 4px; }
.collection-list { display: grid; gap: 6px; max-height: 45vh; overflow-y: auto; margin: 14px 0; scrollbar-width: thin; }
.collection-list label { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid #ffffff1f; border-radius: 8px; cursor: pointer; }
.collection-list label:has(input:checked) { border-color: var(--pink); background: #f3a2c912; }
.collection-list input { accent-color: var(--pink); width: 16px; height: 16px; flex: none; }
.collection-list span { display: grid; gap: 2px; }
.collection-list strong { font-weight: 500; font-size: 14px; }
.collection-list small { font-size: 10px; color: #bbaac7; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
#ask-input { width: 100%; margin-top: 14px; padding: 12px; border: 1px solid #ffffff25; border-radius: 6px; background: #ffffff06; outline: 0; }
#ask-input:focus { border-color: var(--pink); }

/* ---------- Home (landing page) ---------- */
#welcome { padding: 10px 0 20px; }
.welcome-hero { max-width: 760px; padding: 40px 0 44px; border-bottom: 1px solid #ffffff20; }
.welcome-hero h1 { margin: 14px 0 18px; font-size: clamp(44px, 6vw, 82px); font-weight: 600; line-height: 1; letter-spacing: -2.5px; text-shadow: 0 4px 30px #0006; }
.welcome-hero h1 em { font-style: normal; color: var(--pink); }
.welcome-hero p { max-width: 560px; margin: 0; font-size: 15px; line-height: 1.75; color: #ddd6e8; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.welcome-actions button { padding: 13px 24px; font-size: 13px; }
.welcome-actions .quiet:hover { border-color: var(--pink); color: var(--pink); }
.welcome-section { padding: 30px 0; border-bottom: 1px solid #ffffff14; }
.welcome-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.welcome-heading h2 { font-size: 20px; font-weight: 500; }
.welcome-channels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 0 10px; }
.welcome-channel { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; min-height: 130px; padding: 18px 22px; border: 1px solid color-mix(in srgb, var(--ch) 60%, transparent); background: #20253c; text-align: left; transform: skew(-10deg); transition: border-color 0.18s, translate 0.18s; }
.welcome-channel > * { transform: skew(10deg); }
.welcome-channel:hover { border-color: var(--ch); translate: -3px 0; }
.welcome-channel img { position: absolute; inset: -10% -8%; width: 116%; height: 120%; object-fit: cover; z-index: -2; opacity: 0; transition: opacity 0.3s; }
.welcome-channel img.art-ready { opacity: 0.75; }
.welcome-channel::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #111527d8, #15162a40 80%), linear-gradient(0deg, #12131ed0, transparent 70%); }
.welcome-channel .live-label { font-size: 9px; letter-spacing: 2px; color: var(--ch); font-weight: 600; }
.welcome-channel strong { font-size: 21px; font-weight: 500; letter-spacing: -0.4px; }
.welcome-channel span:last-child { font-size: 10px; color: #d6c9df; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.welcome-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.welcome-features strong { display: block; margin-bottom: 8px; font-size: 16px; font-weight: 500; color: var(--pink); }
.welcome-features p { margin: 0; font-size: 12px; line-height: 1.7; color: #c9bed3; }
body[data-page=welcome] .page-footer { margin-top: 20px; }

@media (max-width: 1100px) {
  .welcome-channels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .welcome-hero { padding: 20px 0 30px; }
  .welcome-channels, .welcome-features { grid-template-columns: 1fr; }
  .welcome-heading { display: block; }
  body[data-theme=panorama][data-listening=true] #notice[data-status=info] { position: static; max-width: none; justify-content: flex-start; margin: 4px 0 8px; }
}

/* A visible shelf scrollbar (the old one was 15% white on transparent). */
#songs { scrollbar-width: thin; scrollbar-color: #f49bc6aa #ffffff14; padding-bottom: 12px !important; }
#songs::-webkit-scrollbar { height: 8px; }
#songs::-webkit-scrollbar-track { background: #ffffff14; border-radius: 8px; }
#songs::-webkit-scrollbar-thumb { background: #f49bc6aa; border-radius: 8px; }
#songs::-webkit-scrollbar-thumb:hover { background: var(--pink); }
body[data-theme=panorama][data-listening=true] .song-grid { height: 184px !important; }

/* Heart the song that's playing (also from the radio: it feeds osuFM Favourites). */
.now-heart { margin-right: 6px !important; padding: 4px 10px; font-size: 13px; line-height: 1; }
.now-heart[aria-pressed=true] { background: var(--pink); color: #251b2b !important; }

@media (max-width: 760px) {
  #section-title { white-space: normal; font-size: 14px; }
  .song-card .live-label { letter-spacing: 1px; }
}

/* ---------- account + settings ---------- */
.account { display: flex; align-items: center; }
.account-button { display: inline-flex; align-items: center; gap: 9px; padding: 4px 12px 4px 4px; border: 1px solid #dad2ec45; border-radius: 22px; font-size: 12px; color: #eee7f5; }
.account-button:hover { border-color: var(--pink); }
.account-button img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #20253c; }
.account-button span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Signed out: a person silhouette in the same round spot as the avatar. */
.account-icon { position: relative; width: 28px; height: 28px; border-radius: 50%; background: #2a2f47; overflow: hidden; flex: none; }
.account-icon::before { content: ""; position: absolute; left: 50%; top: 6px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #c8c0d5; }
.account-icon::after { content: ""; position: absolute; left: 50%; top: 18px; width: 20px; height: 14px; margin-left: -10px; border-radius: 10px 10px 0 0; background: #c8c0d5; }
.settings-dialog { width: min(520px, calc(100vw - 32px)); }
#settings-body { display: grid; gap: 22px; margin-top: 12px; max-height: 70vh; overflow-y: auto; padding-right: 4px; }
.settings-section { display: grid; gap: 10px; }
.settings-section h3 { margin: 0; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--pink); font-weight: 600; }
.settings-section > p { margin: 0; font-size: 12px; line-height: 1.6; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px; border: 1px solid #ffffff1c; border-radius: 10px; cursor: pointer; }
.setting-copy { display: grid; gap: 2px; min-width: 0; }
.setting-copy strong { font-size: 14px; font-weight: 500; }
.setting-copy small { font-size: 11px; color: #bbaac7; line-height: 1.5; }
.setting-copy small:empty { display: none; }
.setting-input { width: 180px; padding: 8px 10px; border: 1px solid #ffffff25; border-radius: 8px; background: #ffffff08; color: inherit; outline: 0; }
.setting-input:focus { border-color: var(--pink); }
.switch { appearance: none; flex: none; width: 40px; height: 22px; border-radius: 11px; background: #ffffff25; position: relative; cursor: pointer; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch:checked { background: var(--pink); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.settings-save { justify-self: end; padding: 9px 22px; }
@media (max-width: 760px) {
  .account-button span { display: none; }
  .account-button { padding: 3px; }
  .setting.setting-field { flex-wrap: wrap; }
  .setting-field .setting-input { width: 100%; }
}

/* No accidental text highlighting from double-clicks and drags (typing still works). */
body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }

/* ---------- tidy alignment ----------
   One line for the song: title, then map version · heart · download, all centred
   on each other. Everything on the page lines up on the same 36 px margins. */
.now-copy { width: 100%; }
.now-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px; min-width: 0; max-width: 100%; }
.now-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.now-actions #now-art-button { margin: 0 !important; min-height: 0; }
.now-actions .download-map { margin: 0 !important; height: 26px; }
.now-actions .now-heart { width: 30px; justify-content: center; padding: 0; margin-right: 0 !important; }
body[data-listening=false] .now-line { gap: 4px 12px; }
body[data-listening=false] .now-actions .download-map { height: 20px; padding: 0 9px; font-size: 9px; }
body[data-listening=false] .now-actions .now-heart { width: 22px; }
@media (min-width: 761px) {
  .topbar { padding: 0 36px !important; }
  body[data-theme=panorama] .player { left: 36px !important; right: 36px !important; width: auto !important; }
  body[data-theme=panorama][data-listening=true]:not([data-page=player]) main { padding-left: 36px !important; padding-right: 36px !important; }
  body[data-theme=panorama][data-listening=true] main header,
  body[data-theme=panorama][data-listening=true] .library-tabs,
  body[data-theme=panorama][data-listening=true] .section-heading { margin-left: 0 !important; margin-right: 0 !important; }
  body[data-theme=panorama][data-listening=true] .section-heading { padding: 0 !important; }
  /* The tiles are slanted: give the slant room so the first tile's corner lines up with the margin. */
  body[data-theme=panorama][data-listening=true] #songs { margin-left: -16px !important; margin-right: -16px !important; padding-left: 32px !important; padding-right: 32px !important; }
}
@media (max-width: 760px) {
  /* One scrollable row of tabs instead of wrapping onto two lines. */
  .library-tabs { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; gap: 18px !important; }
  .library-tabs::-webkit-scrollbar { display: none; }
  .library-tabs > button { flex: none; }
  #focus-mode { display: none !important; }
  .now-line { gap: 8px 12px; }
  body[data-listening=true] .now-actions { margin-bottom: 12px; }
  /* Same left edge as the search box and tabs. */
  body[data-theme=panorama][data-listening=true] .section-heading { margin: 4px 0 8px !important; padding: 0 !important; }
}

/* ---------- transport row: buttons, seek bar, time and volume on one centre line ---------- */
.transport .volume { opacity: 0.85; }
@media (min-width: 761px) {
  body[data-theme=panorama][data-listening=true] .transport { padding-right: 0 !important; display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important; gap: 26px !important; }
  body[data-theme=panorama][data-listening=true] .transport-buttons { margin: 0 !important; flex: none; align-items: center; }
  body[data-theme=panorama][data-listening=true] .seek { flex: 1; display: grid !important; grid-template-columns: 44px 1fr 44px !important; align-items: center !important; gap: 12px !important; }
  body[data-theme=panorama][data-listening=true] .seek time { line-height: 1; }
  body[data-theme=panorama][data-listening=true] .transport .volume { display: flex !important; position: static !important; align-items: center; gap: 10px; }
  body[data-theme=panorama][data-listening=true] .volume button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0 !important; line-height: 1; }
  body[data-theme=panorama][data-listening=true] .volume input { width: 80px; margin: 0; }
  body[data-listening=false] .transport { grid-template-columns: auto 1fr auto !important; align-items: center !important; column-gap: 22px !important; }
  /* Home bar: equal space on both sides (the volume now lives in the transport). */
  body[data-listening=false] .player { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) !important; padding-left: 64px !important; padding-right: 64px !important; column-gap: 40px !important; }
  /* Home bar: times sit either side of the seek bar, on its centre line. */
  body[data-listening=false] .seek { display: grid !important; grid-template-columns: 40px 1fr 40px !important; grid-template-rows: auto !important; align-items: center !important; gap: 10px !important; }
  body[data-listening=false] .seek input { grid-column: 2 !important; grid-row: 1 !important; }
  body[data-listening=false] .seek #elapsed { grid-column: 1 !important; grid-row: 1 !important; text-align: right; }
  body[data-listening=false] .seek #duration { grid-column: 3 !important; grid-row: 1 !important; text-align: left; }
  body[data-listening=false] .transport-buttons { align-items: center; }
  body[data-listening=false] .transport .volume button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0 !important; line-height: 1; }
  body[data-listening=false] .transport .volume { position: static !important; grid-column: 3; grid-row: 1; }
}
/* Chevrons drawn as shapes so they sit exactly on the text's centre line. */
.chev { display: inline-block; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); margin-left: 7px; }
#now-art-button .chevron { font-size: 0 !important; display: inline-block; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-top: 1.5px solid currentColor; transform: rotate(45deg); margin: 0 4px 0 2px; }
.now-actions { gap: 10px; }
.now-actions #now-art-button { margin-right: 10px !important; }

.link-step { display: grid; gap: 8px; }
.link-step p { margin: 0; font-size: 12px; line-height: 1.6; }
.link-code { display: block; padding: 10px 12px; border-radius: 8px; background: #0f1220; border: 1px solid #f49bc655; color: #fff; font-size: 14px; user-select: all; -webkit-user-select: all; }
.settings-section > button { justify-self: start; }

/* ---------- short or tiny windows ----------
   When there isn't room for the big layered layout, the page becomes one simple
   scrolling column instead: top bar, the player, then the song shelf. Nothing overlaps. */
@media (max-height: 719px), (max-width: 760px) {
  body[data-listening=true]:not([data-page=player]) { height: auto; min-height: 100dvh; overflow: visible; overflow-x: clip; display: flex; flex-direction: column; }
  body[data-listening=true]:not([data-page=player]) > .topbar { order: 0; }
  body[data-listening=true]:not([data-page=player]) > .player { order: 1; }
  body[data-listening=true]:not([data-page=player]) > main { order: 2; flex: 1; }
  body[data-listening=true]:not([data-page=player]) .topbar { position: sticky !important; top: 0; background: linear-gradient(#141726e6, #14172600); }
  body[data-listening=true]:not([data-page=player]) .player {
    position: relative !important; inset: auto !important; left: auto !important; right: auto !important; bottom: auto !important; top: auto !important; transform: none !important;
    width: auto !important; height: auto !important; margin: 58px 20px 18px !important; visibility: visible !important;
    display: flex !important; flex-direction: column !important; align-items: stretch !important; gap: 14px !important; padding: 16px 18px !important; border-radius: 14px; background: #121626cc !important; }
  body[data-listening=true]:not([data-page=player]) .player > .now,
  body[data-listening=true]:not([data-page=player]) .player > .transport { width: 100% !important; margin: 0 !important; }
  body[data-listening=true]:not([data-page=player]) main {
    position: relative !important; inset: auto !important; display: block !important; width: auto !important; height: auto !important; min-height: 0;
    margin: 0 !important; padding: 12px 20px 20px !important; border: 0 !important; border-top: 1px solid #ffffff13 !important; border-radius: 0 !important; overflow: visible !important;
    background: #11192ad9 !important; box-shadow: none !important; }
  body[data-listening=true]:not([data-page=player]) #browse-toggle { display: none !important; }
  body[data-listening=true] #now-title { font-size: clamp(24px, 6vw, 34px) !important; }
  body[data-listening=true] .song-grid { height: auto !important; }
  /* Transport: buttons, then a full-width seek bar. */
  body[data-listening=true]:not([data-page=player]) .transport { display: flex !important; flex-direction: row !important; flex-wrap: wrap !important; justify-content: space-between; align-items: center !important; gap: 10px 20px !important; padding: 0 !important; height: auto !important; }
  body[data-listening=true]:not([data-page=player]) .transport-buttons { order: 0; margin: 0 !important; gap: 14px !important; }
  body[data-listening=true]:not([data-page=player]) .seek { order: 2; flex: 1 1 100%; height: auto !important; display: grid !important; grid-template-columns: 40px 1fr 40px !important; grid-template-rows: auto !important; align-items: center !important; gap: 10px !important; }
  body[data-listening=true]:not([data-page=player]) .seek input { grid-column: 2 !important; grid-row: 1 !important; height: 6px; }
  body[data-listening=true]:not([data-page=player]) .seek #elapsed { grid-column: 1 !important; grid-row: 1 !important; }
  body[data-listening=true]:not([data-page=player]) .seek #duration { grid-column: 3 !important; grid-row: 1 !important; text-align: right; }
  body[data-listening=true]:not([data-page=player]) .transport .volume { order: 1; }
  body[data-listening=true]:not([data-page=player]) .transport .volume { position: static !important; display: flex !important; align-items: center; gap: 10px; }
}
@media (max-width: 760px) {
  /* Phones: one sticky header (logo, radio, account, then Home / Listen) with a solid,
     blurred background, so the page scrolling underneath never shows through. */
  body[data-listening=true]:not([data-page=player]) .topbar {
    height: auto !important; flex-wrap: wrap; row-gap: 0; padding: 10px 16px 0 !important; padding-top: max(10px, env(safe-area-inset-top)) !important;
    background: #141726e8 !important; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid #ffffff10; z-index: 30 !important; }
  body[data-listening=true]:not([data-page=player]) nav { position: static !important; transform: none !important; order: 3; width: 100%; gap: 24px !important; }
  body[data-listening=true]:not([data-page=player]) nav button { padding: 10px 0 !important; }
  body[data-listening=true]:not([data-page=player]) .player { margin: 14px 12px 14px !important; padding: 16px !important; }
  body[data-listening=true]:not([data-page=player]) main { padding: 12px 12px calc(20px + env(safe-area-inset-bottom)) !important; }
  /* Bigger touch targets on the controls. */
  body[data-listening=true]:not([data-page=player]) .transport-buttons { width: 100%; justify-content: space-between; }
  body[data-listening=true]:not([data-page=player]) .transport-buttons > button { min-width: 40px; min-height: 40px; }
  body[data-listening=true]:not([data-page=player]) .transport-buttons .play-main { width: 52px !important; height: 52px !important; }
  body[data-listening=true]:not([data-page=player]) .transport .volume input { width: 120px; }
  .song-card .row-select { touch-action: pan-x pan-y; }
}
/* Phone browsers grow and shrink the screen as the address bar hides: keep the
   background the same size (the large viewport) so it doesn't jump while scrolling. */
#scene, #scene-next, body::before { bottom: auto !important; height: 100lvh !important; }

.keys-grid { display: grid; grid-template-columns: minmax(0, 1fr) 130px 130px; gap: 8px 10px; align-items: center; }
.keys-head { font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: #bbaac7; }
.keys-label { font-size: 13px; }
.key-button { padding: 7px 10px; border: 1px solid #ffffff25; border-radius: 8px; background: #ffffff08; font-size: 12px; font-family: inherit; color: #eee7f5; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-button:hover { border-color: var(--pink); }
.key-button.recording { border-color: var(--pink); color: var(--pink); background: #f3a2c912; }

.speed-button { min-width: 30px; font-size: 12px !important; font-weight: 600; letter-spacing: 0.5px; color: #c8c0d5; }
.speed-button[data-mode=dt], .speed-button[data-mode=nc], .speed-button[data-mode=ht] { color: var(--pink) !important; }
.track-meta .requested { color: #b9a5ff; }
.confirm-dialog { width: min(420px, calc(100vw - 32px)); }
.confirm-dialog h2 { margin: 0 0 8px; font-size: 20px; font-weight: 500; }
.confirm-dialog p { margin: 0; color: #c9bed3; font-size: 13px; line-height: 1.6; }

/* ---------- settings tabs ---------- */
.settings-tabs { position: sticky; top: 0; z-index: 1; display: flex; gap: 4px; padding: 4px; margin-bottom: 4px; border-radius: 12px; background: #0f1220; }
.settings-tab { flex: 1; padding: 8px 10px; border-radius: 9px; font-size: 12px; color: #c8c0d5; white-space: nowrap; }
.settings-tab:hover { color: #fff; }
.settings-tab[aria-selected=true] { background: #f3a2c91f; color: var(--pink); }
.settings-section[hidden] { display: none !important; }
.settings-section.is-disabled .setting, .settings-section.is-disabled > button, .keys-grid .key-button:disabled { opacity: 0.45; cursor: not-allowed; }
.desktop-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; border: 1px dashed #f49bc655; color: #f3d9e7; font-size: 12px; line-height: 1.6; }
.speed-picker { display: flex; gap: 4px; padding: 3px; border-radius: 9px; background: #0f1220; flex: none; }
.speed-choice { min-width: 38px; padding: 6px 8px; border-radius: 7px; font-size: 12px; font-weight: 600; color: #c8c0d5; }
.speed-choice[aria-pressed=true] { background: var(--pink); color: #251b2b; }
@media (max-width: 520px) { .settings-tab { font-size: 11px; padding: 8px 6px; } .keys-grid { grid-template-columns: minmax(0, 1fr) 84px 84px !important; } .key-button { min-width: 0; overflow: hidden; text-overflow: ellipsis; } }

/* Browse songs: roomier, with a centred chevron */
body[data-theme] #browse-toggle { gap: 10px; padding: 12px 24px; font-size: 13px; line-height: 1; align-items: center; }
#browse-toggle .browse-chevron { width: 12px; height: 12px; flex: none; transition: transform .2s ease; }
#browse-toggle .browse-chevron.is-open { transform: rotate(180deg); }

/* Home bar: room for all six controls; the play button stays a circle. */
body[data-listening=false] .transport-buttons { gap: 16px !important; flex-wrap: nowrap; }
body[data-listening=false] .transport-buttons button { flex: none; }
body[data-listening=false] .transport-buttons .play-main { width: 42px !important; height: 42px !important; min-width: 42px; aspect-ratio: 1; }
/* Full-screen player: a clear gap between the seek bar and Browse songs. */
@media (min-width: 761px) {
  body[data-theme][data-page=player] .player { bottom: 96px !important; }
  body[data-theme][data-page=player] #browse-toggle { top: auto !important; bottom: 28px !important; }
}

/* Previous / next are drawn icons (Windows showed ⏮ ⏭ as blue emoji). */
.transport-buttons .icon { width: 1em; height: 1em; display: block; }
#previous, #next { display: inline-grid; place-items: center; }

/* Every scrollbar looks like the song shelf's (thin, pink thumb). */
* { scrollbar-width: thin; scrollbar-color: #f49bc6aa #ffffff14; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #ffffff14; border-radius: 8px; }
::-webkit-scrollbar-thumb { background: #f49bc6aa; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--pink); }
::-webkit-scrollbar-corner { background: transparent; }

/* Desktop app: the top bar is the window's title bar (drag it to move the window). */
/* Only the top bar drags; everything else is explicitly clickable (on Windows a stray
   drag region otherwise swallowed clicks on the song list). */
html[data-desktop] body > *:not(.topbar), html[data-desktop] main, html[data-desktop] main *, html[data-desktop] .player, html[data-desktop] .player *, html[data-desktop] dialog { -webkit-app-region: no-drag; }
html[data-desktop] .topbar { -webkit-app-region: drag; height: 78px; max-height: 78px; overflow: visible; }
html[data-desktop] .topbar :is(button, a, input, nav, .top-actions > *) { -webkit-app-region: no-drag; }
html[data-desktop=win] .topbar { padding-right: 150px !important; }
html[data-desktop=mac] .topbar { padding-left: 92px !important; }
@media (max-width: 760px) {
  /* Section heading: title and count on one line, the buttons in a row underneath. */
  body[data-theme=panorama][data-listening=true] .section-heading { display: flex !important; flex-wrap: wrap; align-items: baseline; }
  body[data-theme=panorama][data-listening=true] .section-heading > div:first-child { flex: 1 1 auto; min-width: 0; }
  body[data-theme=panorama][data-listening=true] #count { order: 1; margin-left: auto; }
  body[data-theme=panorama][data-listening=true] .section-actions { order: 2; flex: 1 1 100%; display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  body[data-theme=panorama][data-listening=true] .section-actions:empty { display: none; }
  body[data-theme=panorama][data-listening=true] .section-actions > * { flex: none; }
}

/* ---------- phones: one thing at a time ----------
   The song lists get the whole screen, with a small "now playing" bar at the bottom.
   Tap the bar for the full player; "Browse songs" there brings the list back. */
@media (max-width: 760px) {
  html body[data-listening=true]:not([data-page=player]) > .player {
    position: fixed !important; left: 8px !important; right: 8px !important; bottom: calc(8px + env(safe-area-inset-bottom)) !important; top: auto !important;
    margin: 0 !important; z-index: 20; order: 9;
    display: flex !important; flex-direction: row !important; align-items: center !important; gap: 10px !important;
    padding: 10px 12px 12px !important; border-radius: 14px; overflow: hidden; cursor: pointer;
    background: #1a1f33f2 !important; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid #ffffff14; box-shadow: 0 8px 30px #0008;
  }
  html body[data-listening=true]:not([data-page=player]) > .player > .now { flex: 1 1 auto !important; width: auto !important; min-width: 0; }
  html body[data-listening=true]:not([data-page=player]) .player .now-actions,
  html body[data-listening=true]:not([data-page=player]) .player .dj-caption,
  html body[data-listening=true]:not([data-page=player]) .player .volume,
  html body[data-listening=true]:not([data-page=player]) .player #playback-label,
  html body[data-listening=true]:not([data-page=player]) .player .seek time,
  html body[data-listening=true]:not([data-page=player]) .player :is(#shuffle, #repeat, #speed) { display: none !important; }
  html body[data-listening=true]:not([data-page=player]) .player .now-copy { display: flex; flex-direction: column-reverse; min-width: 0; }
  html body[data-listening=true]:not([data-page=player]) .player #now-artist { font-size: 12px !important; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 !important; }
  html body[data-listening=true]:not([data-page=player]) .player .now-line { display: block !important; min-width: 0; }
  html body[data-listening=true]:not([data-page=player]) .player #now-title { display: block; max-width: 100%; font-size: 16px !important; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
  html body[data-listening=true]:not([data-page=player]) .player > .transport { flex: none !important; width: auto !important; display: flex !important; flex-wrap: nowrap !important; gap: 0 !important; }
  html body[data-listening=true]:not([data-page=player]) .player .transport-buttons { width: auto !important; gap: 4px !important; justify-content: flex-end; }
  html body[data-listening=true]:not([data-page=player]) .player .transport-buttons > button { min-width: 40px; min-height: 40px; font-size: 16px !important; }
  html body[data-listening=true]:not([data-page=player]) .player .transport-buttons .play-main { width: 42px !important; height: 42px !important; font-size: 16px !important; }
  /* A thin progress line along the bottom edge (still draggable). */
  html body[data-listening=true]:not([data-page=player]) .player .seek { position: absolute !important; left: 12px; right: 12px; bottom: 3px; display: block !important; height: 6px !important; margin: 0 !important; }
  html body[data-listening=true]:not([data-page=player]) .player .seek input { width: 100%; height: 3px !important; margin: 0; display: block; }
  /* Room under the list for the bar. */
  html body[data-listening=true]:not([data-page=player]) main { padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important; }
  html body[data-listening=true][data-idle=true]:not([data-page=player]) > .player { display: none !important; }
}

/* Phones: songs are a vertical list (like osu!'s song select) instead of a sideways shelf. */
@media (max-width: 760px) {
  html body[data-theme=panorama][data-listening=true]:not([data-page=player]) #songs {
    display: flex !important; flex-direction: column !important; gap: 10px !important; height: auto !important; min-height: 0 !important;
    overflow: visible !important; margin: 0 !important; padding: 4px 10px 0 !important; }
  html body[data-theme=panorama][data-listening=true]:not([data-page=player]) #songs .song-card { flex: none !important; width: auto !important; height: 88px !important; min-height: 88px !important; transform: skew(-6deg); }
  html body[data-theme=panorama][data-listening=true]:not([data-page=player]) #songs .row-select { min-height: 88px !important; height: 88px; padding: 14px 76px 12px 22px !important; transform: skew(6deg); }
  html body[data-theme=panorama][data-listening=true]:not([data-page=player]) #songs .row-actions { flex-direction: row !important; top: 50% !important; bottom: auto !important; right: 12px !important; transform: translateY(-50%) skew(6deg) !important; gap: 2px; align-items: center; }
  html body[data-theme=panorama][data-listening=true]:not([data-page=player]) #songs .row-select { padding-right: 120px !important; }
  html body[data-theme=panorama][data-listening=true]:not([data-page=player]) #songs .song-title { font-size: 18px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* The phone "now playing" bar says what tapping it does: cover + an up arrow = open the player. */
.open-player { display: none; }
@media (max-width: 760px) {
  html body[data-listening=true]:not([data-page=player]) .player .open-player {
    display: grid; place-items: center; position: relative; flex: none; width: 46px; height: 46px; border-radius: 10px; overflow: hidden; background: #2a3150; }
  .open-player img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
  .open-player img:not([src]), .open-player img[src=""] { display: none; }
  .open-player svg { position: relative; width: 20px; height: 20px; color: #fff; filter: drop-shadow(0 1px 3px #0009); }
  html body[data-listening=true]:not([data-page=player]) .player #now-artist::after { content: " · tap to open"; opacity: .7; }
  html body[data-listening=true]:not([data-page=player]) > .player:active { transform: scale(.985); }
  /* Full player on phones: "Browse songs" is a full-width bar along the bottom. */
  html body[data-theme][data-page=player] #browse-toggle {
    display: flex !important; left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important; transform: none !important; width: auto !important;
    justify-content: center; gap: 10px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)) !important; font-size: 15px !important;
    border: 0 !important; border-top: 1px solid #ffffff1c !important; border-radius: 0 !important; background: #161a2bee !important; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
  html body[data-theme][data-page=player] .player { bottom: calc(86px + env(safe-area-inset-bottom)) !important; }
}


/* Phones: the full player keeps exactly the same header as the song list, so switching
   between them doesn't make the header jump. */
@media (max-width: 760px) {
  html body[data-theme][data-page=player] .topbar {
    position: fixed !important; inset: 0 0 auto !important; height: auto !important; flex-wrap: wrap; row-gap: 0;
    padding: 10px 16px 0 !important; padding-top: max(10px, env(safe-area-inset-top)) !important;
    background: #141726e8 !important; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid #ffffff10; z-index: 30 !important; }
  html body[data-theme][data-page=player] nav { position: static !important; transform: none !important; order: 3; width: 100%; gap: 24px !important; }
  html body[data-theme][data-page=player] nav button { padding: 10px 0 !important; }
  html body[data-listening=true]:not([data-page=player]) .player .open-player svg { transform: rotate(180deg); }
  html body[data-listening=true]:not([data-page=player]) .player #now-artist::after { content: " · tap to close"; }
}

.obs-size { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; font-size: 12px; color: #c9bed3; }
.obs-size b { padding: 4px 10px; border-radius: 8px; background: #ffffff10; border: 1px solid #ffffff1c; color: #f8f4ff; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Home: get the desktop app / install on your phone ---------- */
.get-app { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.get-card { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px; border: 1px solid #ffffff1f; border-radius: 16px; background: linear-gradient(160deg, #262b46cc, #171a2ccc); }
.get-card h3 { margin: 0; font-size: 20px; font-weight: 500; }
.get-card p { margin: 0; font-size: 13px; line-height: 1.7; color: #d6cfe2; }
.get-kicker { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--pink); font-weight: 600; }
.get-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 6px; }
.get-actions .muted { font-size: 12px; }
.get-button { display: inline-flex; align-items: center; justify-content: center; padding: 12px 22px; border-radius: 24px; font-size: 13px; text-decoration: none; }
a.get-button.primary { background: var(--pink); color: #251b2b; font-weight: 600; }
a.get-button[aria-disabled=true] { opacity: .45; pointer-events: none; }
.get-steps { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; line-height: 1.6; color: #e6dff0; }
.get-steps b { color: #fff; font-weight: 600; }
.get-done { color: #9be3b4 !important; }
@media (max-width: 760px) { .get-app { grid-template-columns: 1fr; } }
.get-actions:not(:has(> :not([hidden]))) { display: none; }
/* Phone bar: long song / station names end in "…" instead of running under the buttons. */
@media (max-width: 760px) {
  html body[data-listening=true]:not([data-page=player]) > .player > .now { overflow: hidden; }
  html body[data-listening=true]:not([data-page=player]) .player .now-copy { width: 100%; max-width: 100%; overflow: hidden; }
  html body[data-listening=true]:not([data-page=player]) .player #now-artist { display: block !important; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html body[data-listening=true]:not([data-page=player]) .player #now-title { width: 100%; }
}
/* Phones, full player: controls on one centre line, and the play button stays a circle. */
@media (max-width: 760px) {
  html body[data-theme][data-page=player] .transport-buttons { display: flex !important; flex-wrap: nowrap !important; align-items: center !important; justify-content: space-between !important; gap: 0 !important; width: 100%; margin-top: 18px !important; }
  html body[data-theme][data-page=player] .transport-buttons > button { flex: none; display: grid !important; place-items: center; min-width: 44px; height: 44px; padding: 0 !important; margin: 0 !important; line-height: 1 !important; vertical-align: middle; }
  html body[data-theme][data-page=player] .transport-buttons .play-main { width: 66px !important; height: 66px !important; min-width: 66px; aspect-ratio: 1; border-radius: 50%; font-size: 22px !important; }
  html body[data-theme][data-page=player] .transport-buttons :is(#shuffle, #repeat) { font-size: 22px !important; }
  html body[data-theme][data-page=player] .transport-buttons #speed { font-size: 14px !important; }
}
/* Phones, full player: play sits exactly in the middle, with shuffle/prev and next/repeat
   mirrored on either side (the speed button takes the far right). */
@media (max-width: 760px) {
  html body[data-theme][data-page=player] .transport-buttons { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) auto repeat(3, minmax(0, 1fr)); justify-items: center; }
  html body[data-theme][data-page=player] .transport-buttons #shuffle { grid-column: 2; }
  html body[data-theme][data-page=player] .transport-buttons #previous { grid-column: 3; }
  html body[data-theme][data-page=player] .transport-buttons #toggle { grid-column: 4; }
  html body[data-theme][data-page=player] .transport-buttons #next { grid-column: 5; }
  html body[data-theme][data-page=player] .transport-buttons #repeat { grid-column: 6; }
  html body[data-theme][data-page=player] .transport-buttons #speed { grid-column: 7; }
}
.get-note { font-size: 12px !important; color: #b9aec8 !important; }
.get-note b { color: #f8f4ff; font-weight: 600; }
