/* Application shell: navigation, library, and a persistent playback dock. */
:root {
  --bg: #0c0c0e;
  --panel: #111113;
  --panel-raised: #19191c;
  --surface: #232326;
  --surface-hover: #303034;
  --line: #29292d;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #f4f4f5;
  --accent-strong: #fff;
  --radius: 10px;
}
body { min-height: 100dvh; height: 100dvh; overflow: hidden; background: var(--bg); }
.app { width: 100%; max-width: none; height: 100dvh; padding: 0; gap: 0; grid-template-columns: 224px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
.panel { border: 0; border-radius: 0; box-shadow: none; }
.sidebar { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-height: 0; padding: 30px 16px 22px; border-right: 1px solid var(--line); background: #101012; overflow: auto; }
.player-head { gap: 5px 10px; padding: 0 8px; }
.brand { font-size: 21px; white-space: nowrap; }
.brand-mark { border-radius: 8px; }
.brand-mark span { background: #111; }
.app-version { display: block; margin: 2px 0 0; font-size: 9px; font-weight: 500; }
.brand-caption { margin-top: 6px; font-size: 10px; }
.nav-caption { margin: 42px 12px 14px; font-size: 9px; font-weight: 700; letter-spacing: .15em; color: #75757f; }
.tabs { flex-direction: column; flex-shrink: 0; gap: 6px; width: 100%; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.tab { justify-content: flex-start; width: 100%; min-height: 46px; padding: 11px 14px; gap: 13px; border-radius: 7px; font-weight: 600; font-size: 13px; }
.tab.active, .tab.active:hover:not(:disabled) { color: #fff; border-color: #333338; background: #27272b; box-shadow: none; }
.tab-radio { margin-left: 0; background: none; }
.tab-radio::before { display: none; }
.tab-radio:not(.active) { border-color: transparent; }
.sidebar-footer { margin-top: auto; padding: 24px 10px 0; }
.sidebar-footer > p { margin-top: 20px; font-size: 10px; color: #707078; }
.player-settings { margin: 0; }
.player-settings summary { min-height: 36px; padding-block: 10px; font-weight: 500; }
.metadata-setting { font-size: 11px; }
.metadata-setting input { min-height: auto; width: 16px; height: 16px; }
.workbench { grid-column: 2; grid-row: 1; background: var(--bg); overflow: auto; scrollbar-width: thin; scrollbar-color: #3a3a40 transparent; }
.workspace-head { flex-shrink: 0; padding: 42px 40px 30px; border-bottom: 1px solid var(--line); background: linear-gradient(120deg, #1c1c20, #111113 80%); }
.workspace-head .eyebrow { color: var(--muted); font-size: 10px; margin-bottom: 12px; }
h1 { font-size: clamp(30px, 3.4vw, 48px); font-weight: 750; letter-spacing: -.045em; }
.workspace-description { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.tab-panel { flex: 1 0 auto; padding: 28px 40px 40px; }
#musicPanel { overflow: visible; }
.subpanel, .playlist { min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; }
.section-head { min-height: 35px; margin-bottom: 22px; }
.section-head .eyebrow { display: none; }
h2 { font-size: 21px; letter-spacing: -.025em; }
.list, .library-view, .online-results { overflow: visible; padding: 0; }
.library-nav { gap: 8px; margin: 0 0 22px; padding-bottom: 5px; }
.library-tab, .provider-tab { min-height: 38px; padding: 8px 15px; border-radius: 6px; font-weight: 600; }
.library-tab.active, .library-tab.active:hover:not(:disabled), .provider-tab.active, .provider-tab.active:hover:not(:disabled) { color: #161618; background: var(--accent); border-color: var(--accent); }
button, input, select { border-radius: 7px; }
input, select { background: #18181b; }
input:focus, select:focus { border-color: #777780; box-shadow: 0 0 0 3px #ffffff0c; }
button:focus-visible, a:focus-visible, summary:focus-visible, .tab:focus-visible { outline: 2px solid #ddd; outline-offset: 3px; }
.browser-tools { gap: 12px; margin-bottom: 20px; }
.searchbar { grid-template-columns: minmax(0, 1fr) auto 42px; }
.searchbar input, .searchbar .primary { grid-column: auto; }
.searchbar input, .online-search input { min-height: 46px; }
.pathbar { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.path { border: 0; background: none; }
.pathbar .icon-button, #clearSearch { background: transparent; }
.item { min-height: 64px; border-radius: 6px; border-bottom: 1px solid #ffffff05; padding: 9px 12px; }
.item-title { font-weight: 550; }
.radio-add-details { margin-bottom: 18px; }
.radio-add-details summary { width: fit-content; padding: 10px 0; color: var(--muted); font-size: 12px; cursor: pointer; }
.radio-add-details summary:hover { color: var(--text); }
.radio-add-details .add-radio { margin-top: 8px; margin-bottom: 0; }
#addRadio { background: transparent; color: var(--muted); border: 1px solid var(--line); }
#addRadio:hover { background: var(--surface); color: var(--text); }
#radios .delete { background: transparent !important; color: var(--muted); }
#radios .radio-status { color: var(--muted); }
#radios .radio-status.active { color: #1ed760; }
#radios .delete:hover, #radios .delete:focus-visible { background: rgba(255,102,120,.1) !important; color: #ff9baa; }
.item-sub { margin-top: 5px; font-size: 12px; }
.item.playing, .playlist-item.drag-over { background: #ffffff0c; border-color: #ffffff14; }
.library-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.library-card { padding: 10px; background: #151517; border-radius: 9px; }
.library-cover, .cover { background: linear-gradient(140deg, #41414b, #1b1b20 70%); }
.library-cover { border-radius: 6px; box-shadow: none; }
.library-card strong { font-size: 14px; }
.library-card small { font-size: 12px; }
.online-results { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.online-track { padding: 12px; border-radius: 8px; }
.online-note { line-height: 1.7; }
.library-empty { border: 1px dashed var(--line); border-radius: 8px; padding: 24px; width: 100%; grid-column: 1 / -1; }
.list-more { border-color: #45454d; background: #ffffff05; }
.source-badge, .lyrics-source { border-color: var(--line); background: #ffffff06; }
.source-badge:hover { border-color: #666; background: #ffffff0c; }
.playlist-tools { gap: 12px; }
.lyrics-dialog-head { background: #ffffff04; }
.lyrics-heading-icon { color: #151515; box-shadow: none; }
.info-dialog { background: #18181b; }
.lyrics-heading > div { min-width: 0; }
.lyrics-heading h2, .lyrics-dialog-subtitle { max-width: 100%; }
.info-body, .lyrics-body { min-height: 0; }

/* The dock keeps every existing player control in reach. */
.player { grid-column: 1 / -1; grid-row: 2; z-index: 5; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(300px, 440px) minmax(240px, 1fr); grid-template-rows: 52px 20px; align-items: center; gap: 0 28px; min-height: 106px; padding: 14px 24px; border-top: 1px solid #333338; background: #161618; overflow: visible; }
.now-playing { grid-column: 1; grid-row: 1 / 3; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; min-width: 0; padding: 0; }
.cover { flex: 0 0 62px; width: 62px; height: 62px; margin: 0; border-radius: 6px; box-shadow: none; }
.cover-note { font-size: 28px; }
.cover-glow { display: none; }
.track-copy { min-width: 0; text-align: left; }
#mode { margin-bottom: 5px; color: var(--muted); font-size: 9px; letter-spacing: .1em; }
#title { min-height: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 1.5; letter-spacing: 0; font-weight: 600; }
#time { margin-top: 4px; font-size: 10px; }
.controls { grid-column: 2; grid-row: 1; display: flex; justify-content: center; gap: 14px; margin: 0; }
.control { min-width: 38px; width: 38px; height: 38px; min-height: 38px; margin: 0; }
.play-control { width: 44px; height: 44px; background: #f4f4f5; color: #111; box-shadow: none; }
.play-control:hover:not(:disabled) { background: #fff; }
.control.active { color: #fff; background: #ffffff1c; }
.progress-wrap { grid-column: 2; grid-row: 2; display: flex; align-items: center; padding: 0; }
.progress-wrap input { min-height: 20px; padding: 0; box-shadow: none; }
.player-footer { grid-column: 3; grid-row: 1 / 3; display: flex; justify-content: flex-end; align-items: center; gap: 18px; padding: 0; border: 0; }
.player-actions { display: flex; gap: 2px; }
.player-actions button { min-width: 38px; min-height: 42px; padding: 8px; font-size: 12px; background: none; border: 0; color: var(--muted); }
.player-actions button span { display: inline; }
.volume { width: 110px; min-width: 80px; max-width: 130px; gap: 8px; }
.volume input[type="range"] { min-width: 40px; min-height: 32px; padding: 0; border: 0; background: transparent; }
.volume input[type="range"]::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -5px; }
.volume input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 184px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .brand { font-size: 18px; }
  .brand-caption { font-size: 9px; }
  .workspace-head { padding: 32px 26px 26px; }
  .tab-panel { padding: 24px 26px 32px; }
  .player { grid-template-columns: minmax(150px, 1fr) minmax(280px, 1.2fr) minmax(180px, 1fr); gap: 0 18px; padding-inline: 18px; }
  .controls { gap: 8px; }
  .player-footer { gap: 8px; }
  .player-actions button span { display: none; }
  .add-radio { grid-template-columns: minmax(0, .7fr) minmax(0, 1fr) 44px; }
}

@media (max-width: 760px) {
  .app { display: grid; height: 100dvh; min-height: 0; grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; }
  .sidebar { grid-column: 1; grid-row: 1; display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 16px 10px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .player-head { display: flex; padding: 0; margin: 0; gap: 9px; }
  .brand { font-size: 18px; }
  .app-version { display: inline; margin-left: 4px; }
  .brand-mark { width: 26px; height: 26px; }
  .brand-caption, .nav-caption, .sidebar-footer > p { display: none; }
  .sidebar-footer { grid-column: 2; grid-row: 1; margin: 0; padding: 0; position: relative; }
  .player-settings summary { font-size: 11px; padding: 6px 0; min-height: 30px; }
  .player-settings[open] .metadata-setting { position: absolute; right: 0; top: 30px; z-index: 9; width: 215px; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-raised); box-shadow: 0 12px 32px #0008; }
  .tabs { grid-column: 1 / -1; flex-direction: row; gap: 6px; padding: 0; }
  .tab { flex: 1; min-width: 0; min-height: 44px; padding: 9px 6px; gap: 7px; justify-content: center; font-size: 12px; }
  .tab-icon { display: grid; width: 18px; height: 18px; }
  .tab-icon svg { width: 18px; height: 18px; }
  .workbench { grid-column: 1; grid-row: 2; }
  .workspace-head { padding: 26px 20px 24px; }
  h1 { font-size: 32px; }
  .workspace-description { font-size: 12px; margin-top: 8px; }
  .tab-panel { padding: 22px 20px 28px; }
  .subpanel, .playlist { min-height: 0; padding: 0; }
  .section-head { margin-bottom: 18px; flex-wrap: wrap; }
  h2 { font-size: 19px; }
  .library-nav { margin-bottom: 15px; gap: 6px; }
  .library-tab { padding-inline: 12px; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 12px; }
  .online-results { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .online-search { grid-template-columns: minmax(0, 1fr) auto; }
  .add-radio { grid-template-columns: minmax(0, 1fr) 44px; }
  #radioName { grid-column: 1 / -1; }
  .playlist-manager-body { grid-template-columns: minmax(0, 1fr) auto; }
  #playlistName { grid-column: 1 / -1; }
  .item { padding-inline: 5px; }
  .item-actions button, .item > button { min-width: 44px; min-height: 44px; }
  .player { grid-column: 1; grid-row: 3; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 20px 50px 38px; gap: 0 10px; min-height: 0; padding: 0 16px max(8px, env(safe-area-inset-bottom)); }
  .progress-wrap { grid-column: 1 / -1; grid-row: 1; }
  .now-playing { grid-column: 1; grid-row: 2; gap: 10px; padding: 0; }
  .cover { width: 42px; height: 42px; flex-basis: 42px; margin: 0; }
  .cover-note { font-size: 22px; }
  #mode { margin-bottom: 2px; font-size: 8px; }
  #title { font-size: 12px; }
  #time { font-size: 9px; margin-top: 1px; }
  .controls { grid-column: 2; grid-row: 2; gap: 2px; margin: 0; }
  .control { width: 32px; min-width: 32px; height: 44px; min-height: 44px; font-size: 13px; }
  .play-control { width: 38px; min-width: 38px; height: 38px; min-height: 38px; }
  .player-footer { grid-column: 1 / -1; grid-row: 3; justify-content: space-between; gap: 12px; padding: 0; }
  .player-actions button { min-height: 36px; padding: 6px 8px; font-size: 11px; }
  .player-actions button span { display: inline; }
  .volume { width: 120px; max-width: 150px; }
  .lyrics-retry, .lyrics-locations dl, .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .sidebar { padding-inline: 10px; }
  .tab { gap: 4px; font-size: 11px; }
  .workspace-head { padding-inline: 16px; }
  .tab-panel { padding-inline: 12px; }
  .player { padding-inline: 10px; }
  .now-playing .cover { display: none; }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-height: 500px) and (max-width: 760px) and (orientation: landscape) {
  .sidebar { padding-block: 6px; gap: 0; }
  .sidebar .player-head { display: none; }
  .sidebar-footer { display: block; padding-left: 12px; align-self: center; }
  .tabs { grid-column: 1; grid-row: 1; }
  .player { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-rows: 16px 50px; padding-bottom: 4px; }
  .progress-wrap { grid-column: 1 / -1; }
  .player-footer { grid-column: 3; grid-row: 2; }
  .player-actions button span { display: none; }
  .volume { width: 80px; }
}

@media (max-height: 600px) {
  .info-dialog { overflow-y: auto; }
  .info-body, .lyrics-body { overflow: visible; flex-shrink: 0; }
  .lyrics-loading { min-height: 100px; }
}

/* Settings and per-track repeat. */
.tab-settings { margin-top: 12px; border-top: 1px solid var(--line); }
.settings-content { display: grid; align-content: start; gap: 22px; max-width: 820px; }
.settings-card { min-width: 0; padding: 26px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.settings-card > p { margin: 10px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.settings-toggle { display: flex; align-items: center; justify-content: space-between; gap: 20px; cursor: pointer; }
.settings-toggle strong, .settings-toggle small { display: block; }
.settings-toggle strong { font-size: 14px; font-weight: 600; }
.settings-toggle small { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.settings-toggle input { width: 20px; height: 20px; min-height: 20px; flex-shrink: 0; accent-color: var(--accent); }
.settings-card .spotify-session { flex-wrap: wrap; padding: 16px; margin: 0; gap: 16px; }
.settings-card .spotify-session small { overflow-wrap: anywhere; line-height: 1.6; }
#repeat { position: relative; display: grid; place-items: center; }
#repeat svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.repeat-one { display: none; position: absolute; inset: 0; place-items: center; font-size: 8px; }
#repeat.active .repeat-one { display: grid; }
@media (max-width: 760px) {
  .sidebar-footer { display: none; }
  .sidebar .player-head { grid-column: 1 / -1; }
  .tabs { gap: 3px; grid-column: 1 / -1; }
  .tab { gap: 5px; padding-inline: 4px; }
  .tab-settings { flex: 0 0 42px; margin-top: 0; border-top-color: transparent; }
  .tab-settings > span:last-child { display: none; }
  .settings-card { padding: 20px; }
  .settings-card .spotify-session { align-items: stretch; }
}
@media (max-width: 380px) {
  .tab:not(.tab-settings) .tab-icon { display: none; }
  .tab-settings { flex-basis: 38px; }
  .settings-card { padding: 16px; }
}

/* Search remains at the top of the independently scrolling content area. */
.global-search { position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; flex-shrink: 0; padding: 18px 40px; border-bottom: 1px solid var(--line); background: var(--panel); }
.global-search-field { position: relative; min-width: 0; }
.global-search .search-icon { left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); pointer-events: none; }
.global-search input { width: 100%; min-height: 46px; padding-left: 40px; padding-right: 46px; }
.global-search #clearSearch { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 40px; min-width: 40px; min-height: 40px; padding: 0; color: var(--muted); }
.global-search #clearSearch:hover { color: var(--text); }
.global-search .primary { min-height: 46px; }
.global-search-results { display: grid; gap: 34px; min-width: 0; }
.search-result-section { min-width: 0; }
.search-result-section h2 { margin-bottom: 14px; }
.search-message { grid-column: 1 / -1; margin: 0 0 12px; padding: 10px 0; color: var(--muted); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.search-error { color: #ff9baa; }
.search-result-icon { color: var(--muted); text-align: center; font-size: 20px; }
.global-search-results .list-more { grid-column: 1 / -1; }
.search-playlist > button { border-radius: 7px; padding-inline: 12px; background: var(--surface); font-size: 12px; }
@media (max-width: 1100px) {
  .global-search { padding-inline: 26px; }
}
@media (max-width: 760px) {
  .global-search { padding: 10px 16px; gap: 6px; }
  .global-search .search-icon { left: 10px; }
  .global-search input { padding-left: 32px; font-size: 16px; }
  .global-search .primary { padding-inline: 10px; font-size: 12px; }
  .global-search-results { gap: 26px; }
}
@media (max-height: 500px) and (max-width: 760px) and (orientation: landscape) {
  .global-search { padding-block: 5px; }
}

.global-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.online-track img:not([src]) { visibility: hidden; }

/* Search categories mix sources; each result carries its own source label. */
#searchPanel { align-content: start; }
.search-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 18px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.search-tab { display: inline-flex; align-items: center; gap: 10px; background: transparent; color: var(--muted); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.search-tab.active, .search-tab.active:hover { background: var(--accent); color: #161618; border-color: var(--accent); }
.search-count { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }
.search-category { display: grid; align-content: start; gap: 20px; min-width: 0; }
.result-source { display: inline-flex; align-items: center; width: fit-content; gap: 5px; margin-top: 8px; padding: 3px 7px; border: 1px solid #ffffff20; border-radius: 4px; color: var(--muted); font-size: 10px; font-weight: 650; line-height: 1.3; }
.result-source::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.result-source-spotify { color: #84d9a0; border-color: #84d9a030; }
.search-entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; }
.search-entity { display: flex; flex-direction: column; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #151517; }
.search-entity-cover { position: relative; display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: linear-gradient(140deg, #41414b, #1b1b20 70%); color: #a1a1aa; font-size: 38px; }
.search-entity-cover img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.search-entity-Artists .search-entity-cover { border-radius: 50%; }
.search-entity h3 { margin: 12px 0 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.search-entity > p { margin: 5px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.search-entity-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: auto; }
.search-entity-actions a { color: var(--text); font-size: 11px; line-height: 1.6; padding: 8px 0; text-decoration: none; }
.search-entity-actions a:hover { text-decoration: underline; }
.search-entity-actions button { font-size: 12px; }
@media (max-width: 760px) {
  .search-tabs { gap: 5px; margin-bottom: 18px; padding-bottom: 14px; }
  .search-tab { flex: 1; justify-content: center; flex-wrap: wrap; gap: 4px 7px; min-width: 0; padding: 8px 4px; font-size: 12px; }
  .search-entity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 380px) {
  .search-tab { flex-direction: column; font-size: 11px; }
  .search-entity { padding: 9px; }
}

#searchResultsAlbums, #searchResultsArtists, #searchResultsPlaylists { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; }
#searchResultsAlbums > div, #searchResultsArtists > div, #searchResultsPlaylists > div { display: contents; }
.search-playlist > div { margin-top: 12px; margin-bottom: 16px; min-width: 0; }
.search-playlist .item-title { white-space: normal; overflow-wrap: anywhere; }
.search-playlist .item-sub { white-space: normal; line-height: 1.6; }
.search-playlist > button { margin-top: auto; font-size: 12px; }
#globalSpotifyResults { grid-template-columns: 1fr; }
.search-track { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 12px; }
.search-track-cover { position: relative; display: grid; place-items: center; width: 58px; height: 58px; overflow: hidden; border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 24px; }
.search-track-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#searchResultsTracks, #localSearchResults, #globalSpotifyResults { gap: 0; }
@media (max-width: 760px) {
  .search-track { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; padding-inline: 4px; }
  .search-track-cover { width: 44px; height: 44px; }
}
@media (max-width: 760px) {
  #searchResultsAlbums, #searchResultsArtists, #searchResultsPlaylists { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
