:root {
  color-scheme: dark;
  --bg: #161618;
  --sidebar: #121214;
  --panel: #202023;
  --line: #2d2d32;
  --text: #f8f6f3;
  --muted: #adabb1;
  --accent: #ff6747;
  --accent-ink: #21100b;
  --side-width: 224px;
  --player-height: 88px;
  --mobile-nav-height: 66px;
  --bottom-safe: max(env(safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  font-family: 'Manrope', 'Segoe UI', Arial, sans-serif;
  font-synthesis: none;
  background: var(--bg);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; min-height: 100vh; }
body:has(dialog[open]) { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; border: 0; padding: 0; background: none; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, a, input { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; object-fit: cover; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon-definitions { display: block; width: 0; height: 0; position: absolute; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-button { width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 9px; color: var(--muted); flex: none; }
.icon-button:hover:not(:disabled) { background: #ffffff0d; color: var(--text); }
.icon-button[aria-pressed=true] { color: var(--accent); }
.icon-button[aria-pressed=true] .icon { fill: currentColor; }
.eyebrow { color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.sidebar { position: fixed; inset: 0 auto var(--player-height) 0; width: var(--side-width); padding: 28px 16px 18px; background: var(--sidebar); border-right: 1px solid var(--line); overflow: auto; }
.brand { display: inline-flex; align-items: center; gap: 11px; margin: 0 0 34px 10px; font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -.075em; white-space: nowrap; }
.brand-mark { width: 37px; height: 37px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand-mark .icon { stroke-width: 2.5; }
.brand-period { color: var(--accent); }
.side-nav, .side-collection { display: grid; gap: 3px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 47px; text-align: left; border-radius: 9px; padding: 0 12px; font-size: .91rem; font-weight: 700; color: var(--muted); }
.nav-link .icon { width: 20px; height: 20px; }
.nav-link:hover { color: var(--text); background: #ffffff08; }
.nav-link[aria-current] { color: var(--text); background: #292629; }
.nav-link[aria-current] .icon { color: var(--accent); }
.side-collection { margin-top: 25px; padding-top: 24px; border-top: 1px solid var(--line); }
.side-collection .eyebrow { padding: 0 12px 8px; }

.workspace { margin-left: var(--side-width); max-width: 1720px; padding: 0 clamp(24px, 3vw, 52px) calc(var(--player-height) + 36px); }
.topbar { height: 85px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.top-actions { display: flex; gap: 12px; align-items: center; }
.mobile-brand, .mobile-nav { display: none; }
.search-form { display: flex; align-items: center; gap: 10px; background: #222225; border: 1px solid #323236; border-radius: 11px; width: min(100%, 345px); padding: 0 13px; color: var(--muted); }
.search-form:focus-within { border-color: var(--accent); }
.search-form .icon { width: 19px; height: 19px; }
.search-form input { width: 100%; border: 0; background: transparent; color: var(--text); min-width: 0; height: 43px; outline: none; }
.search-form input::placeholder { color: var(--muted); font-size: .9rem; }
.search-form input::-webkit-search-cancel-button { display: none; }
.search-clear { width: 30px; height: 30px; margin: 0 -5px 0 -5px; }
.catalog-label { color: #d3c4bf; font-size: .78rem; font-weight: 750; white-space: nowrap; padding: 6px 9px; }
.top-queue { display: flex; align-items: center; gap: 8px; min-height: 43px; padding: 0 11px; border: 1px solid #38363b; border-radius: 10px; font-size: .85rem; font-weight: 700; }
.top-queue .icon { width: 19px; height: 19px; color: var(--accent); }
.top-queue:hover { background: var(--panel); }
main:focus { outline: none; }

.hero { position: relative; isolation: isolate; overflow: hidden; display: flex; min-height: 318px; align-items: center; border-radius: 18px; border: 1px solid #3e2827; background: #201615; }
.hero-image { width: 100%; height: 100%; position: absolute; inset: 0; z-index: -2; object-position: 66% 52%; }
.hero::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #1b1315 0%, #1b1315eb 18%, #1b131592 43%, #1b131500 72%); }
.hero-content { padding: 30px clamp(25px, 4vw, 54px); }
.hero .eyebrow { color: #ff9b86; }
.hero h1 { font-size: clamp(2.85rem, 4.6vw, 4.6rem); font-weight: 800; line-height: .98; letter-spacing: -.062em; margin: 12px 0 14px; }
.hero h1 span { color: #ff835f; }
.hero-description { color: #efded9; font-weight: 550; font-size: .91rem; line-height: 1.5; }
.action-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .9rem; white-space: nowrap; }
.action-button:hover { background: #ff8469; }
.hero .action-button { margin-top: 22px; }
.action-button .icon { width: 22px; height: 22px; }

.section { margin-top: 31px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading h2 { font-size: clamp(1.45rem, 2.2vw, 1.9rem); letter-spacing: -.045em; font-weight: 800; }
.text-button { color: var(--muted); font-weight: 750; font-size: .85rem; padding: 7px 0 7px 6px; white-space: nowrap; }
.text-button:hover { color: var(--text); }
.collection-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.collection-card { min-width: 0; padding: 9px; text-align: left; display: block; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); transition: background .18s, border-color .18s; }
.collection-card:hover { border-color: #4a4349; background: #27272b; }
.collection-image { position: relative; aspect-ratio: 1.68; border-radius: 8px; overflow: hidden; display: block; background: var(--cover-color, #25252c); }
.collection-image img { width: 100%; height: 100%; transition: transform .3s; }
.collection-card:hover img { transform: scale(1.045); }
.collection-copy { display: block; padding: 10px 3px 4px; }
.collection-copy strong, .collection-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-copy strong { font-weight: 800; font-size: .97rem; }
.collection-copy span { color: var(--muted); font-size: .79rem; line-height: 1.5; margin-top: 2px; }

.track-list { margin: 0; padding: 0; list-style: none; }
.track-row { display: flex; gap: 3px; align-items: center; min-width: 0; border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.track-row:hover, .track-row:focus-within { background: #ffffff06; }
.track-row:last-child { border-bottom-color: transparent; }
.track-open { display: flex; align-items: center; flex: 1; gap: 11px; min-width: 0; padding: 8px; text-align: left; border-radius: 8px; }
.track-open[data-current] strong { color: var(--accent); }
.row-index { display: grid; place-items: center; width: 25px; font-size: .81rem; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.row-index .icon { width: 18px; height: 18px; color: var(--accent); }
.row-art { width: 42px; height: 42px; border-radius: 6px; flex: none; background: #25252c; }
.track-meta { display: grid; gap: 3px; min-width: 0; }
.track-meta strong, .track-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-meta strong { font-size: .93rem; font-weight: 800; }
.track-meta span { color: var(--muted); font-size: .79rem; font-weight: 600; }
.track-time { color: var(--muted); font-size: .8rem; width: 45px; text-align: right; margin: 0 9px 0 0; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 2px; }
.row-actions .icon-button { width: 38px; height: 40px; }
.row-actions .icon { width: 18px; height: 18px; }

.page-title { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.07; letter-spacing: -.065em; font-weight: 800; margin: 4px 0 21px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 20px; }
.filter { min-height: 37px; border: 1px solid #38363b; border-radius: 8px; padding: 0 12px; font-size: .85rem; color: var(--muted); font-weight: 750; }
.filter:hover { background: var(--panel); color: var(--text); }
.filter[aria-pressed=true] { background: #ff674719; border-color: #ff674754; color: #ff9b86; }
.empty { display: grid; justify-items: start; gap: 10px; padding: clamp(16px, 3vw, 30px); border: 1px dashed #3d3b42; border-radius: 12px; }
.empty strong { font-size: 1rem; }
.empty p, .queue-empty { color: var(--muted); line-height: 1.55; font-size: .93rem; }
.empty .action-button { margin-top: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-weight: 700; margin-bottom: 13px; padding: 6px 3px 6px 0; font-size: .87rem; border-radius: 5px; }
.back-link:hover { color: var(--text); }
.back-link .icon { width: 18px; height: 18px; }
.collection-hero { background: linear-gradient(125deg, var(--cover-color) 0%, var(--panel) 86%); display: flex; align-items: end; gap: clamp(16px, 3vw, 32px); border-radius: 14px; padding: clamp(14px, 3vw, 28px); }
.collection-hero img { width: clamp(124px, 23%, 218px); height: auto; aspect-ratio: 1; border-radius: 9px; box-shadow: 0 8px 21px #0004; }
.collection-hero h1 { margin: 7px 0 8px; }
.collection-hero p:not(.eyebrow) { color: #eeecec; font-size: .91rem; line-height: 1.4; }
.collection-hero .action-button { margin-top: 18px; }

.player-bar { position: fixed; z-index: 4; inset: auto 0 0; min-height: var(--player-height); display: grid; grid-template-columns: 1fr min(36vw, 485px) 1fr; align-items: center; gap: 19px; padding: 9px 24px; border-top: 1px solid #343237; background: #19191c; }
.player-track, .playing-link, .player-extras, .transport, .timeline { display: flex; align-items: center; }
.player-track { gap: 7px; min-width: 0; }
.playing-link { gap: 11px; min-width: 0; text-align: left; border-radius: 8px; }
.playing-link:hover strong { color: #ff9b86; }
.player-art { width: 48px; height: 48px; border-radius: 7px; flex: none; background: #363039; }
.player-center { min-width: 0; }
.transport { gap: 11px; justify-content: center; }
.transport .icon-button { width: 38px; height: 35px; }
.transport .icon { width: 20px; height: 20px; }
.play-button { width: 37px; height: 37px; display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); border-radius: 50%; flex: none; }
.play-button:hover { background: #ff8469; }
.play-button .icon { width: 22px; height: 22px; }
.timeline { gap: 9px; margin-top: 2px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .74rem; }
.timeline span { width: 29px; flex: none; }
.timeline .elapsed { text-align: right; }
input[type=range] { --fill: 0%; appearance: none; height: 22px; display: block; min-width: 0; margin: 0; cursor: pointer; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(to right, var(--accent) 0 var(--fill), #48464d var(--fill) 100%); }
input[type=range]::-webkit-slider-thumb { appearance: none; background: var(--text); width: 12px; height: 12px; border-radius: 50%; margin-top: -4px; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 99px; background: #48464d; }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--accent); }
input[type=range]::-moz-range-thumb { background: var(--text); width: 12px; height: 12px; border: 0; border-radius: 50%; }
.seek { width: 100%; }
.player-extras { justify-content: end; gap: 7px; }
.player-extras .icon { width: 20px; height: 20px; }
.player-extras .volume { width: min(7vw, 100px); }
.mini-progress { display: none; }

.dialog { border: 1px solid #3f3c44; background: #202023; color: var(--text); border-radius: 17px; padding: 20px; width: min(calc(100% - 24px), 440px); max-height: calc(100dvh - 24px); overflow: auto; }
.dialog::backdrop { background: #0c0b0dd1; backdrop-filter: blur(4px); }
.dialog-header { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dialog-header h2 { letter-spacing: -.04em; font-size: 1.7rem; }
.full-art { width: min(100%, 45dvh); height: auto; margin: auto; aspect-ratio: 1; border-radius: 10px; background: #363039; }
.full-track { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 17px 0 9px; }
.full-track h2 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.04em; }
.full-track p { margin-top: 3px; color: var(--muted); font-size: .91rem; }
.full-timeline { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.full-timeline input { grid-column: 1 / -1; }
.full-timeline .elapsed { text-align: left; }
.full-timeline .total { justify-self: end; text-align: right; }
.full-transport { position: relative; margin-top: 13px; }
.full-transport .transport { gap: 20px; }
.full-transport .play-button { width: 56px; height: 56px; }
.full-transport .play-button .icon { width: 29px; height: 29px; }
.full-queue { position: absolute; right: 0; top: 7px; }
.queue-dialog { inset: 0 0 var(--player-height) auto; margin: 8px; width: min(calc(100% - 16px), 410px); max-height: none; }
.queue-dialog h3 { font-size: .91rem; margin: 15px 0 5px; }
.queue-dialog .row-index { display: none; }
.queue-empty { padding: 6px 8px 15px; }
.toast { pointer-events: none; position: fixed; z-index: 10; left: 50%; bottom: calc(var(--player-height) + 13px); transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); background: #332826; border: 1px solid #77483b; color: var(--text); border-radius: 9px; padding: 10px 13px; text-align: center; font-size: .87rem; font-weight: 750; opacity: 0; transition: opacity .18s; }
.toast.show { opacity: 1; }

@media (max-width: 1000px) {
  :root { --side-width: 182px; }
  .workspace { padding-inline: 23px; }
  .collection-grid { gap: 10px; }
}

@media (max-width: 740px) {
  :root { --player-height: 59px; }
  .sidebar { display: none; }
  .workspace { margin: 0; padding: 0 15px calc(var(--bottom-safe) + var(--mobile-nav-height) + var(--player-height) + 27px); }
  .topbar { min-height: 68px; height: auto; flex-wrap: wrap; position: relative; padding-top: max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px)); gap: 0 9px; }
  .mobile-brand { display: inline-flex; margin: 0; font-size: 1.76rem; gap: 8px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
  .brand-mark .icon { width: 19px; height: 19px; }
  .catalog-label { padding: 6px 0; font-size: .73rem; }
  .top-actions { gap: 9px; }
  .top-queue { width: 40px; min-height: 40px; justify-content: center; padding: 0; }
  .top-queue span { display: none; }
  .search-form { display: none; order: 3; flex-basis: 100%; width: auto; margin: 0 0 11px; }
  .search-form input { height: 43px; }
  body[data-view=search] .topbar { min-height: 120px; }
  body[data-view=search] .search-form { display: flex; }
  .hero { min-height: 288px; border-radius: 13px; }
  .hero-content { padding: 21px 17px; }
  .hero-image { object-position: 70% center; }
  .hero::before { background: linear-gradient(90deg, #1b1315fa 0%, #1b1315c5 33%, #1b13153b 76%); }
  .hero h1 { font-size: clamp(2.55rem, 9vw, 4rem); }
  .hero-description { max-width: 230px; font-size: .85rem; }
  .section { margin-top: 24px; }
  .section-heading { margin-bottom: 11px; }
  .collection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-card { padding: 7px; border-radius: 11px; }
  .collection-copy { padding-top: 8px; }
  .collection-image { aspect-ratio: 1.47; }
  .row-index { display: none; }
  .track-open { padding-inline: 2px; gap: 8px; }
  .row-actions .icon-button { width: 34px; }
  .track-time { margin-inline: 0 3px; width: 31px; }
  .track-meta strong { font-size: .89rem; }
  .collection-hero { flex-direction: column; align-items: start; }
  .collection-hero img { width: min(40%, 155px); }
  .player-bar { inset: auto 8px calc(var(--bottom-safe) + var(--mobile-nav-height) + 5px); grid-template-columns: minmax(0, 1fr) auto; min-height: var(--player-height); padding: 5px 8px; gap: 3px; border: 1px solid #503a3a; border-radius: 10px; background: #292326; overflow: hidden; }
  .player-art { height: 41px; width: 41px; }
  .playing-link { gap: 8px; }
  .player-track { gap: 2px; }
  .mini-heart { height: 34px; width: 34px; margin-left: auto; }
  .mini-heart .icon { width: 19px; height: 19px; }
  .player-center .prev, .player-center .timeline, .player-extras { display: none; }
  .player-center .transport { gap: 2px; }
  .player-center .next { width: 33px; }
  .player-center .play-button { height: 35px; width: 35px; }
  .mini-progress { position: absolute; inset: auto auto 0 0; display: block; height: 2px; width: var(--fill, 0%); background: var(--accent); }
  .mobile-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); position: fixed; z-index: 4; inset: auto 0 0; height: calc(var(--mobile-nav-height) + var(--bottom-safe)); padding: 5px 8px calc(5px + var(--bottom-safe)); background: #141416; border-top: 1px solid var(--line); }
  .mobile-nav .nav-link { flex-direction: column; justify-content: center; gap: 4px; padding: 0; font-size: .75rem; }
  .mobile-nav .nav-link[aria-current] { background: none; }
  .mobile-nav .nav-link .icon { height: 22px; width: 22px; }
  .queue-dialog { inset: auto 0 0; margin: 0; width: 100%; max-width: none; max-height: calc(100dvh - 40px); border-radius: 16px 16px 0 0; padding-bottom: calc(14px + var(--bottom-safe)); }
  .toast { bottom: calc(var(--bottom-safe) + var(--mobile-nav-height) + var(--player-height) + 13px); }
}

@media (max-width: 360px) {
  .workspace { padding-inline: 11px; }
  .hero h1 { font-size: 2.38rem; }
  .collection-copy strong { font-size: .88rem; }
  .mini-heart { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
