/* Shared spacing, surfaces and accessibility for the independent purple interface. */
:root {
  color-scheme: dark;
  --text: #eee9f7;
  --bg: #100b1c;
  --panel: #171122;
  --surface: #1b1428;
  --surface-raised: #251c34;
  --surface-hover: #332545;
  --line: #342945;
  --muted: #a59ab8;
  --accent: #bd94ff;
  --accent-soft: #af79ff16;
  --accent-dark: #352149;
  --control: #23182f;
  --text-strong: #faf5ff;
  --page-gap: 28px;
  background: var(--bg);
  color: var(--text);
}
:root[data-theme="light"] {
  color-scheme: light;
  --text: #2b233a;
  --text-strong: #20152f;
  --bg: #f5f2fb;
  --panel: #fbf9ff;
  --surface: #fff;
  --surface-raised: #f1eaf9;
  --surface-hover: #e9def6;
  --line: #e0d7eb;
  --muted: #7b6d8b;
  --accent: #7d48bd;
  --accent-soft: #9865d411;
  --accent-dark: #e8daf8;
  --control: #f4edf9;
}
body { color: var(--text); background: radial-gradient(ellipse at 55% 0, #66398c12, transparent 48%), var(--bg); line-height: 1.5; }
button { touch-action: manipulation; }
input, select { accent-color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
main { min-width: 0; }
.app-shell { max-width: 1600px; }
.sidebar { background: var(--panel); border-color: var(--line); padding-top: 34px; }
.brand { color: var(--text-strong); }
.brand small, .nav-caption { color: var(--muted); }
.brand img { box-shadow: 0 3px 20px #9c62ed14; }
.nav-item { min-height: 44px; color: var(--muted); border-radius: 9px; font-size: 13px; }
.nav-item:hover { color: var(--text); background: var(--surface-hover); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 2px 0 var(--accent); }
.nav-count { color: var(--muted); background: var(--surface-raised); }
.topbar { height: 86px; }
.breadcrumb, .breadcrumb b { color: var(--muted); font-size: 12px; }
.breadcrumb span { color: var(--muted); opacity: .5; }
.top-actions { gap: 12px; }
.mode-badge { background: var(--accent-soft); border-color: var(--line); color: var(--muted); }
.avatar { color: var(--accent); background: var(--accent-dark); border-color: var(--line); }
.heading-row { gap: 22px; margin: 14px 0 var(--page-gap); }
.heading-row h1, .authors-heading h1, .feature-heading h1, .profile h1 { font-size: 29px; letter-spacing: .02em; line-height: 1.3; font-weight: 650; color: var(--text-strong); }
.search-box { height: 44px; border-radius: 11px; color: var(--muted); background: var(--surface); border-color: var(--line); }
.search-box input { color: var(--text); font-size: 13px; }
.search-box input::placeholder { color: var(--muted); }
.search-box kbd { border-color: var(--line); color: var(--muted); }
.section-heading { align-items: center; gap: 14px; }
.section-heading h2 { font-size: 14px; color: var(--text); font-weight: 550; }
.section-heading .muted { font-size: 11px; }
.section-actions { gap: 14px; flex-wrap: wrap; }
.section-actions .text-button, .filter-reset { min-height: 38px; font-size: 12px; color: var(--muted); }
.text-button:hover, .filter-reset:hover { color: var(--accent); }
.filter-row { gap: 12px; margin: 17px 0 24px; }
.author-filter { min-height: 39px; max-width: 230px; padding-left: 12px; border-radius: 9px; color: var(--text); border-color: var(--line); background: var(--surface); font-size: 12px; }
.author-filter option { color: var(--text); background: var(--surface); }
.filter-row > .author-filter { flex: 1 1 150px; min-width: 0; max-width: none; }
.filter-row > .categories { order: 1; flex: 1 0 100%; }
.filter-row > .filter-reset { order: 2; }
.feature-tag-filter { flex: 1 1 145px; min-width: 145px; max-width: 260px; min-height: 41px; padding: 9px 28px 9px 12px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 12px; text-overflow: ellipsis; }
.feature-tag-filter option { color: var(--text); background: var(--surface); }
.author-letters { display: flex; flex-wrap: wrap; gap: 7px; margin: -5px 0 22px; }
.author-letters button { display: grid; place-items: center; min-width: 35px; min-height: 35px; padding: 6px 10px; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.author-letters button:hover, .author-letters button.active, .author-letters button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.categories { gap: 7px; }
.category-button { min-height: 35px; padding: 7px 13px; font-size: 11px; line-height: 1.4; border-radius: 8px; color: var(--muted); border-color: transparent; }
.category-button:hover { background: var(--surface-hover); }
.category-button.active { background: var(--accent-soft); border-color: var(--line); color: var(--accent); box-shadow: none; }
.media-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 24px 19px; }
.media-card { min-width: 0; }
.cover-button { border-radius: 12px; border-color: var(--line); box-shadow: 0 5px 18px #00000012; aspect-ratio: 1.22; }
.cover-button:after { box-shadow: none; }
.card-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; min-width: 0; width: 100%; padding: 0; font-size: 14px; line-height: 1.5; color: var(--text); font-weight: 550; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.card-artist { margin-top: 5px; padding: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; }
.card-meta > div:first-child { flex: 1 0 100%; min-width: 0; margin-bottom: 1px; }
.card-meta > div:first-child + .icon-button { margin-left: auto; }
.card-meta > .icon-button { display: grid; place-items: center; width: 35px; height: 35px; flex: 0 0 35px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); }
.card-meta > .icon-button:hover, .card-meta > .icon-button.is-favorite, .card-meta > .icon-button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.card-meta > .icon-button .icon { width: 17px; height: 17px; }
.card-play { width: 36px; height: 36px; right: 11px; bottom: 11px; }
.card-kind { font-size: 9px; padding: 4px 7px; }
.card-duration { font-size: 10px; padding: 3px 6px; }
.video-grid .cover-button { aspect-ratio: 1.6; }
.back-link { min-height: 40px; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.authors-heading { margin: 14px 0 25px; }
.authors-toolbar { gap: 15px; }
.author-sort { background: var(--surface); border-color: var(--line); }
.author-sort button { color: var(--muted); font-size: 12px; min-height: 36px; }
.author-sort button.active { background: var(--surface-hover); color: var(--text); box-shadow: none; }
.authors-list { gap: 14px; }
.author-row { background: var(--surface); border-color: var(--line); padding: 19px 16px; box-shadow: none; }
.author-row:hover { background: var(--surface-hover); border-color: var(--line); }
.author-initial { color: var(--accent); background: var(--accent-soft); }
.author-row-name { font-size: 14px; color: var(--text); }
.author-row-count { font-size: 11px; color: var(--muted); }
.author-row-arrow { color: var(--muted); }
#features-panel { padding-top: 14px; }
.feature-heading { margin-bottom: 25px; }
.feature-kind-tabs { display: inline-flex; padding: 4px; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 21px; }
.feature-kind-tabs .feature-button { min-width: 82px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; min-height: 37px; }
.feature-kind-tabs .feature-button.is-active { background: var(--surface-hover); color: var(--text); }
.feature-button { background: var(--surface); border-color: var(--line); color: var(--text); min-height: 41px; border-radius: 10px; font-size: 12px; }
.feature-button:hover { background: var(--surface-hover); color: var(--text); border-color: var(--accent); }
.feature-button.is-active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.feature-button.feature-primary { background: linear-gradient(120deg, #d0a6ff, #ab79f2); color: #25103b; border-color: #bf94fb; box-shadow: 0 4px 18px #9c62ed20; }
[data-theme="light"] .feature-button.feature-danger { color: #a2385c; border-color: #dfb4c4; }
.feature-section { margin-bottom: 31px; }
.feature-section-heading { margin-bottom: 16px; }
.feature-section-heading h2 { font-size: 16px; font-weight: 600; }
.feature-section-heading > span { color: var(--muted); font-size: 11px; }
.feature-tracks { gap: 9px; }
.feature-track { background: var(--surface); border-color: var(--line); gap: 14px; padding: 13px; }
.feature-cover { width: 60px; height: 60px; border-radius: 9px; }
.feature-track-title { font-size: 14px; font-weight: 500; color: var(--text); }
.feature-track-author { color: var(--muted); font-size: 11px; }
.feature-track-info > small { color: var(--muted); font-size: 10px; }
.feature-track-actions { gap: 7px; }
.feature-icon-button { width: 38px; min-width: 38px; min-height: 38px; padding: 8px; }
.feature-track-actions .feature-button { background: transparent; border-color: transparent; color: var(--muted); }
.feature-track-actions .feature-button:hover, .feature-track-actions .feature-button.is-active { color: var(--accent); background: var(--accent-soft); }
.feature-rank { color: var(--accent); font-size: 19px; }
.feature-empty, .empty-state { background: var(--surface); border-color: var(--line); color: var(--muted); border-radius: 13px; }
.feature-empty h2, .empty-state h3 { color: var(--text); }
.feature-empty p, .empty-state p, .feature-loading { color: var(--muted); font-size: 12px; }
.feature-playlist-card { background: var(--surface); border-color: var(--line); padding: 21px; }
.feature-playlist-mark { color: var(--accent); background: var(--accent-soft); box-shadow: none; margin-bottom: 18px; }
.feature-playlist-card h2 { font-weight: 550; font-size: 15px; }
.feature-playlist-card p { color: var(--muted); font-size: 11px; }
.feature-following article { background: var(--surface); border-color: var(--line); }
.feature-follow-name span { color: var(--muted); }
.profile h1 { margin: 14px 0 25px; }
.profile-user { padding: 23px; gap: 17px; color: var(--text); background: linear-gradient(115deg, var(--accent-soft), transparent), var(--surface); border-color: var(--line); border-radius: 14px; box-shadow: none; }
.profile-user > div:nth-child(2) { flex: 1; min-width: 0; }
.profile-user h2 { font-size: 19px; font-weight: 550; overflow-wrap: anywhere; }
.profile-user p { color: var(--muted); font-size: 11px; }
.profile-avatar { width: 55px; height: 55px; border-radius: 17px; box-shadow: none; font-size: 23px; }
.profile-status { color: var(--accent); background: var(--accent-soft); border-color: var(--line); }
.profile-quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 17px; }
.profile-quick-grid button { display: flex; align-items: flex-start; justify-content: center; flex-direction: column; gap: 9px; padding: 17px 15px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-align: left; }
.profile-quick-grid button:hover { background: var(--surface-hover); }
.profile-quick-grid button > span:first-child { color: var(--accent); }
.profile-quick-grid button > span:nth-child(2) { font-size: 12px; color: var(--muted); }
.profile-quick-grid button b { font-size: 22px; font-weight: 550; line-height: 1.2; color: var(--text); font-variant-numeric: tabular-nums; }
.profile-quick-grid button > span:last-child:not(:nth-child(2)) { display: none; }
.profile-group { margin-top: 28px; }
.profile-group > h2 { font-size: 13px; font-weight: 550; margin: 0 0 12px; color: var(--muted); }
.profile-links { margin-top: 18px; background: var(--surface); border-color: var(--line); border-radius: 12px; }
.profile-group .profile-links { margin-top: 0; }
.profile-links button { min-height: 59px; padding: 16px 19px; gap: 14px; color: var(--text); border-color: var(--line); }
.profile-links button:hover { background: var(--surface-hover); }
.profile-links button > span:first-child { color: var(--accent); }
.profile-links button > span:nth-child(2) { font-size: 13px; }
.profile-links button b, .profile-links button > span:last-child { color: var(--muted); }
.profile-links button > span:last-child > .icon { width: 16px; height: 16px; }
.profile-links .icon { width: 19px; height: 19px; }
.player-panel { background: var(--panel); border-color: var(--line); }
.player-heading { color: var(--muted); }
.player-artwork { border-color: var(--line); box-shadow: 0 8px 30px #00000015; }
.now-playing-title h2 { color: var(--text); font-size: 21px; line-height: 1.4; }
.now-playing-title p, .player-options .option-button, .queue-item small, .queue-item time, .queue-heading > span, .volume-control { color: var(--muted); }
.now-playing-title .icon-button { min-width: 34px; }
.queue-item:hover { background: var(--accent-soft); }
.queue-item b { color: var(--text); }
.time-labels { color: var(--muted); }
.volume-control { border-color: var(--line); }
.mini-player { background: color-mix(in srgb, var(--surface) 94%, transparent); border-color: var(--line); box-shadow: 0 4px 24px #00000018; }
.mini-info b { font-size: 12px; color: var(--text); }
.mini-info small { font-size: 10px; color: var(--muted); }
.mobile-nav { background: color-mix(in srgb, var(--panel) 96%, transparent); border-color: var(--line); }
.mobile-nav button { color: var(--muted); min-height: 44px; }
.mobile-nav button.active { color: var(--accent); }
.mobile-nav button.active > .icon, .mobile-nav button.active > span { filter: none; }
.outline-button { color: var(--text); border-color: var(--line); font-size: 12px; min-height: 39px; }
.notice { color: var(--text); background: var(--accent-soft); border-color: var(--line); font-size: 12px; }
.toast { font-size: 13px; border-radius: 10px; }
.cache-row { display: flex; align-items: center; gap: 13px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.cache-row > div { flex: 1; min-width: 0; }
.cache-row b { display: block; font-size: 13px; font-weight: 550; overflow-wrap: anywhere; }
.cache-row small { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }
.cache-row > button { flex-shrink: 0; font-size: 12px; min-height: 40px; }
#account-panel > h1 { font-size: 28px; margin: 0 0 16px; }
#account-panel > .muted { font-size: 12px; margin-bottom: 24px; line-height: 1.8; }
dialog, .feature-dialog, .player-tools-dialog { color: var(--text); background: var(--surface); border-color: var(--line); }
.feature-dialog-heading h2, .tools-heading h2 { color: var(--text-strong); }
.feature-field, .feature-form-note, .feature-dialog-subtitle, .tools-note, .tools-heading p, .tools-section-title > span, .tools-ab label, .tools-slider { color: var(--muted); }
.feature-field input, .tools-ab input { background: var(--bg); border-color: var(--line); color: var(--text); }
.feature-checklist label { background: var(--surface-raised); border-color: var(--line); }
.feature-checklist small { color: var(--muted); }
.tools-heading { background: color-mix(in srgb, var(--surface) 95%, transparent); border-color: var(--line); }
.tools-section { border-color: var(--line); }
.player-tools-dialog button { color: var(--text); background: var(--surface-raised); border-color: var(--line); }
.player-tools-dialog button:hover { color: var(--text); background: var(--surface-hover); }
.player-tools-dialog button[aria-pressed="true"], .player-tools-dialog .tools-primary { color: #25103b; background: #c39aef; border-color: #c39aef; }
.player-tools-dialog .tools-close { background: transparent; }
.player-tools-dialog .tools-link { color: var(--accent); background: transparent; }
.timer-choices button { background: var(--surface-raised); border-color: var(--line); color: var(--accent); }
.timer-dialog > p, .timer-dialog p.dialog-note, .video-heading, .video-details p { color: var(--muted); }

@media (min-width: 1001px) {
  .app-shell { grid-template-columns: 188px minmax(0, 1fr) 296px; }
  main { padding-left: 32px; padding-right: 32px; }
  .sidebar { padding-left: 15px; padding-right: 15px; }
  .brand { padding-left: 8px; }
  .nav-item { padding-left: 11px; padding-right: 11px; }
  .player-panel { padding: 33px 23px; }
  .player-artwork { margin-top: 30px; }
  .heading-row { flex-wrap: wrap; }
  .heading-row .search-box { width: 220px; }
  .profile-group .profile-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-group .profile-links button { border-bottom: 0; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heading-row { flex-wrap: wrap; }
  .heading-row .search-box { width: 210px; }
  .profile-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  main { padding-left: 20px; padding-right: 20px; }
  .topbar { height: 66px; }
  .breadcrumb:before { color: var(--text-strong); font-size: 19px; letter-spacing: 2px; }
  .top-actions { gap: 8px; }
  .top-actions .icon-button { width: 37px; height: 37px; }
  .mode-badge { font-size: 9px; }
  .heading-row { margin: 14px 0 24px; gap: 20px; }
  .heading-row h1, .authors-heading h1, .feature-heading h1, .profile h1 { font-size: 27px; }
  .search-box { height: 45px; }
  .search-box input { font-size: 14px; }
  .section-heading > div { gap: 8px; }
  .section-heading h2 { font-size: 14px; }
  .section-actions { gap: 12px; }
  .section-actions .text-button { font-size: 11px; }
  .filter-row { margin: 14px 0 22px; gap: 11px; }
  .category-button { font-size: 11px; min-height: 36px; }
  .author-filter { min-height: 41px; font-size: 12px; }
  .filter-row > #author-filter, .filter-row > #tag-filter { flex: 1 1 calc(50% - 6px); min-width: 0; max-width: calc(50% - 6px); }
  .filter-row > #sort-filter { flex: 1 1 100%; max-width: none; }
  .author-letters { gap: 6px; margin-bottom: 20px; }
  .author-letters button { min-width: 37px; min-height: 37px; }
  .feature-tag-filter { max-width: none; flex-basis: 100%; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 23px 14px; }
  .cover-button { aspect-ratio: 1.1; border-radius: 10px; }
  .card-meta { gap: 6px; margin-top: 11px; }
  .card-title { font-size: 13px; line-height: 1.55; }
  .card-artist { font-size: 11px; }
  .card-meta > .icon-button { width: 39px; height: 39px; flex-basis: 39px; border-radius: 10px; }
  .card-meta > .icon-button .icon { width: 17px; height: 17px; }
  .card-play { width: 33px; height: 33px; }
  .card-kind { font-size: 8px; }
  .card-duration { font-size: 9px; }
  .video-grid .cover-button { aspect-ratio: 1.5; }
  .authors-list { grid-template-columns: 1fr; gap: 11px; }
  .author-row { min-height: 76px; padding: 16px; }
  .author-sort button { min-height: 37px; }
  .feature-kind-tabs { margin-bottom: 20px; }
  .feature-kind-tabs .feature-button { min-height: 39px; }
  .feature-heading { gap: 12px; }
  .feature-heading > .feature-button { max-width: 50%; }
  .feature-track { padding: 11px; gap: 10px; }
  .feature-cover { width: 50px; height: 53px; }
  .feature-track-title { font-size: 13px; line-height: 1.6; }
  .feature-track-author { font-size: 11px; }
  .feature-track-actions { gap: 2px; }
  .feature-icon-button { width: 37px; min-width: 37px; min-height: 42px; padding: 8px; }
  .feature-track-actions .feature-small { min-height: 42px; padding: 6px; font-size: 11px; }
  .feature-rank { font-size: 16px; min-width: 18px; }
  .feature-playlist-card { padding: 18px 15px; }
  .feature-playlist-card h2 { font-size: 14px; }
  .feature-playlist-mark { margin-bottom: 17px; }
  .feature-toolbar .feature-button { min-height: 42px; font-size: 12px; }
  .profile-user { padding: 20px 17px; gap: 13px; }
  .profile-user h2 { font-size: 18px; }
  .profile-avatar { width: 51px; height: 51px; border-radius: 16px; }
  .profile-status { font-size: 9px; }
  .profile-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 14px; }
  .profile-quick-grid button { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 9px 7px; padding: 16px; }
  .profile-quick-grid button > span:first-child { grid-column: 1; grid-row: 1; }
  .profile-quick-grid button > span:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12px; white-space: nowrap; }
  .profile-quick-grid button b { grid-column: 2; grid-row: 1 / 3; font-size: 24px; }
  .profile-group { margin-top: 25px; }
  .profile-links button { min-height: 57px; padding: 15px 17px; }
  .mobile-nav { padding-top: 8px; }
  .mobile-nav button { font-size: 10px; gap: 4px; }
  .mobile-nav .icon { width: 20px; height: 20px; }
  .mini-player { border-radius: 12px; }
  .mini-info b { font-size: 12px; }
  .mini-info small { font-size: 10px; }
  .player-options .option-button { min-height: 36px; font-size: 11px; }
  .toast { font-size: 12px; }
}
@media (max-width: 350px) {
  main { padding-left: 15px; padding-right: 15px; }
  .media-grid { gap: 20px 11px; }
  .card-meta > .icon-button { width: 35px; height: 38px; flex-basis: 35px; }
  .feature-track { gap: 7px; padding: 9px; }
  .feature-cover { width: 44px; height: 49px; }
  .feature-icon-button { width: 32px; min-width: 32px; }
}
:root[data-density="compact"] { --page-gap: 20px; }
[data-density="compact"] .media-grid { gap: 17px 14px; }
[data-density="compact"] .card-meta { margin-top: 8px; }
[data-density="compact"] .feature-section { margin-bottom: 22px; }
[data-density="compact"] .feature-tracks { gap: 6px; }
[data-density="compact"] .feature-track { padding-top: 8px; padding-bottom: 8px; }
[data-density="compact"] .feature-cover { height: 46px; width: 46px; }
[data-density="compact"] .profile-links button { min-height: 51px; padding-top: 11px; padding-bottom: 11px; }
[data-density="compact"] .profile-group { margin-top: 20px; }
[data-density="compact"] .account-setting { padding-top: 19px; padding-bottom: 19px; }
[data-density="compact"] .account-ledger-row { padding-top: 14px; padding-bottom: 14px; }
[data-reduced-motion="true"] *, [data-reduced-motion="true"] *::before, [data-reduced-motion="true"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
