:root {
  --bg: #0b0b0c;
  --panel: #141416;
  --panel-2: #1c1c1f;
  --hover: #26262a;
  --line: #2b2b30;
  --text: #f2f2f2;
  --muted: #a3a3aa;
  --accent: #ff6a3d;
  --accent-2: #ffb03d;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }

.app {
  display: grid;
  grid-template-columns: 260px 1fr 360px;
  gap: 8px;
  padding: 8px;
  height: calc(100vh - 88px);
}
.app.panel-hidden { grid-template-columns: 260px 1fr 0; }
.app.panel-hidden .nowpanel { visibility: hidden; padding: 0; }

/* Sidebar */
.sidebar { background: var(--panel); border-radius: var(--radius); padding: 18px 10px; display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 10px 18px; }
.brand-mark { width: 44px; height: 44px; display: block; flex-shrink: 0; filter: drop-shadow(0 4px 12px rgba(255,106,61,.35)); }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.3px; }
.brand-sub { color: var(--muted); font-size: 11px; }
.nav a { display: flex; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); background: var(--panel-2); }
.lib-head { margin: 18px 12px 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.playlists { overflow-y: auto; flex: 1; }
.pl-item { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; }
.pl-item:hover, .pl-item.active { background: var(--panel-2); }
.pl-thumb { width: 40px; height: 40px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 13px; flex-shrink: 0; }
.pl-item .n { font-weight: 600; }
.pl-item .c { color: var(--muted); font-size: 12px; }

/* Main */
.main { background: var(--panel); border-radius: var(--radius); overflow-y: auto; min-width: 0; position: relative; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 24px;
  background: rgba(20,20,22,.85); backdrop-filter: blur(12px); }
.search-wrap { display: flex; align-items: center; gap: 8px; background: var(--panel-2); border-radius: 999px; padding: 0 14px; width: min(420px, 100%); color: var(--muted); }
.search-wrap:focus-within { outline: 2px solid var(--text); }
#search { flex: 1; background: none; border: 0; color: var(--text); padding: 11px 0; font: inherit; outline: none; }
.source-link { color: var(--text); font-size: 13px; font-weight: 700; white-space: nowrap; padding: 8px 14px; border: 1px solid var(--line); border-radius: 99px; }
.source-link:hover { border-color: var(--accent); color: var(--accent); }
.source-link { flex-shrink: 0; }
.source-link .short { display: none; }
.search-wrap { flex: 0 1 420px; }
.kfmw-link { display: block; margin: 10px 4px 0; padding: 12px; border-radius: 8px; background: var(--panel-2); font-size: 12px; line-height: 1.4; }
.kfmw-link span { display: block; color: var(--muted); }
.kfmw-link strong { color: var(--accent); }
.kfmw-link:hover { background: var(--hover); }
#view { padding: 0 24px 40px; }

.hero { margin: 0 -24px 24px; padding: 40px 24px 28px; background: linear-gradient(180deg, rgba(255,106,61,.35), transparent); display: flex; gap: 24px; align-items: flex-end; }
.hero-art { width: 200px; height: 200px; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); object-fit: cover; flex-shrink: 0; display: grid; place-items: center; font-size: 56px; font-weight: 800; }
.hero-art.logo-art { box-shadow: none; border-radius: 0; filter: drop-shadow(0 16px 40px rgba(255,106,61,.4)); }
.hero .kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.hero h1 { font-size: clamp(32px, 5vw, 72px); margin: 6px 0 10px; letter-spacing: -2px; line-height: 1; }
.hero p { color: var(--muted); margin: 0; max-width: 640px; }

.shelf { margin-bottom: 32px; }
.shelf-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.shelf-head h2 { margin: 0; font-size: 22px; letter-spacing: -.5px; }
.shelf-head a { color: var(--muted); font-size: 13px; font-weight: 700; }
.shelf-head a:hover { text-decoration: underline; color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.shelf .grid { grid-auto-rows: 1fr; grid-template-rows: auto; }

.card { background: transparent; padding: 12px; border-radius: 8px; transition: background .15s; cursor: pointer; position: relative; min-width: 0; }
.card:hover { background: var(--panel-2); }
.card-art { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--hover); margin-bottom: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.card-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-play { position: absolute; right: 8px; bottom: 8px; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #111; display: grid; place-items: center;
  opacity: 0; transform: translateY(8px); transition: all .2s; box-shadow: 0 8px 16px rgba(0,0,0,.4); }
.card:hover .card-play, .card.playing .card-play { opacity: 1; transform: none; }
.badge { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.7); font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 99px; text-transform: uppercase; letter-spacing: .5px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip { padding: 7px 14px; border-radius: 99px; background: var(--panel-2); font-weight: 600; font-size: 13px; cursor: pointer; }
.chip:hover { background: var(--hover); }
.chip.on { background: var(--text); color: #111; }

.genre-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.genre-tile { aspect-ratio: 1.6; border-radius: 8px; padding: 16px; font-weight: 800; font-size: 20px; overflow: hidden; position: relative; cursor: pointer; }
.genre-tile small { display: block; font-weight: 600; font-size: 12px; opacity: .8; }

/* Track list */
.actions { display: flex; align-items: center; gap: 18px; margin: 0 0 18px; }
.big-play { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #111; display: grid; place-items: center; }
.big-play svg { width: 28px; height: 28px; }
.big-play:hover { transform: scale(1.05); }
.tracks { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tracks th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--line); padding: 8px; }
.tracks td { padding: 8px; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tracks tr.row { cursor: pointer; }
.tracks tr.row:hover td { background: var(--hover); }
.tracks tr.row td:first-child { border-radius: 6px 0 0 6px; }
.tracks tr.row td:last-child { border-radius: 0 6px 6px 0; }
.tracks .num { width: 44px; color: var(--muted); text-align: right; }
.tracks .when { width: 110px; color: var(--muted); }
.tracks .src { width: 100px; color: var(--muted); }
.tracks .like-col { width: 44px; }
.tracks .len { width: 72px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.tracks th.len svg { vertical-align: middle; }
tr.row.gone td, .card.gone { opacity: .45; }
.q-item { position: relative; }

/* Track pages & sharing */
a.card-title, a.pl-title, .tr-title a.t { display: block; }
a.card-title:hover, a.pl-title:hover, .tr-title a.t:hover, .np-meta h3 a:hover { text-decoration: underline; }
.track-title { font-size: clamp(28px, 4vw, 56px) !important; letter-spacing: -1.2px !important; }
.track-about { max-width: 760px; }
.track-about p { color: var(--muted); line-height: 1.6; margin: 0 0 14px; }
.track-about .chips { margin-bottom: 14px; }
.track-about .blog-link, .np-meta .blog-link { display: inline-flex; gap: 6px; font-weight: 700; font-size: 13px; color: var(--accent); }
.start-hint { color: var(--muted); font-size: 13px; font-weight: 600; }
.share-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 99px; font-weight: 700; font-size: 13px; color: var(--text); }
.share-btn svg { width: 16px; height: 16px; }
.share-btn:hover { border-color: var(--accent); color: var(--accent); }
.np-meta .share-btn { margin: 4px 0 10px; }
.cue { position: relative; width: 100%; height: 100%; padding: 0; display: grid; place-items: center; overflow: hidden; }
.cue img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.55); }
.cue-btn { position: relative; width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: #111; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.5); transition: transform .15s; }
.cue-btn svg { width: 30px; height: 30px; }
.cue:hover .cue-btn { transform: scale(1.07); }
.cue-label { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; font-weight: 700; font-size: 13px; text-shadow: 0 1px 6px rgba(0,0,0,.8); }
#toast { position: fixed; left: 50%; bottom: 100px; transform: translate(-50%, 20px); background: var(--text); color: #111; font-weight: 700; padding: 10px 18px; border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#share-box { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); width: min(520px, calc(100vw - 32px)); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; z-index: 60; box-shadow: 0 20px 50px rgba(0,0,0,.6); }
#share-box .sb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#share-box .sb-head span { color: var(--muted); font-size: 12px; }
#share-box .sb-head .icon-btn { margin-left: auto; }
#share-box input { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: inherit; font-size: 13px; }
#share-box .sb-hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
@media (max-width: 720px) { #toast, #share-box { bottom: 144px; } }
.q-dur { margin-left: auto; padding-left: 8px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tracks .tagcol { color: var(--muted); }
.tr-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tr-title img, .tr-title .ph { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.tr-title .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.tr-title .a { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.tr-title > div { min-width: 0; }
tr.row.playing .t, tr.row.playing .num { color: var(--accent); }
.heart { color: var(--muted); opacity: 0; }
tr.row:hover .heart, .heart.on { opacity: 1; }
.heart.on { color: var(--accent); }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }
.more-btn { margin: 20px auto 0; display: block; padding: 10px 22px; border: 1px solid var(--line); border-radius: 99px; font-weight: 700; }
.more-btn:hover { border-color: var(--text); }

/* Now playing panel */
.nowpanel { background: var(--panel); border-radius: var(--radius); padding: 16px; overflow-y: auto; min-width: 0; }
.np-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 12px; }
.np-stage { aspect-ratio: 16/9; background: #000; border-radius: 8px; overflow: hidden; position: relative; }
.np-stage.tall { aspect-ratio: auto; height: 360px; }
.np-stage iframe, .np-stage > div { width: 100%; height: 100%; border: 0; display: block; }
.np-empty { display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; height: 100%; }
.np-meta { padding: 14px 2px; }
.np-meta h3 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.3px; }
.np-meta .a { color: var(--muted); margin-bottom: 10px; }
.np-meta p { color: var(--muted); line-height: 1.5; font-size: 13px; }
.np-meta .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.np-meta .tags a { font-size: 12px; padding: 3px 9px; background: var(--panel-2); border-radius: 99px; color: var(--muted); }
.np-meta .tags a:hover { color: var(--text); }
.np-meta .blog-link { display: inline-flex; gap: 6px; font-weight: 700; font-size: 13px; color: var(--accent); }
.np-meta .note { font-size: 12px; color: var(--accent-2); margin-top: 8px; }
.np-queue-head { font-weight: 700; margin: 6px 0 8px; }
.q-item { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 6px; cursor: pointer; }
.q-item:hover { background: var(--panel-2); }
.q-item img, .q-item .ph { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.q-item .t { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item .a { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item > div { min-width: 0; }

/* Player bar */
.player { position: fixed; left: 0; right: 0; bottom: 0; height: 80px; display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; padding: 0 16px; background: var(--bg); gap: 16px; }
.pl-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pl-cover { width: 56px; height: 56px; border-radius: 4px; background: var(--panel-2) center/cover; flex-shrink: 0; }
.pl-text { min-width: 0; }
.pl-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-artist { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pl-buttons { display: flex; align-items: center; gap: 18px; }
.icon-btn { color: var(--muted); display: grid; place-items: center; position: relative; }
.icon-btn:hover { color: var(--text); }
.icon-btn.on { color: var(--accent); }
.repeat-one { display: none; position: absolute; font-size: 8px; font-weight: 800; top: -2px; right: -4px; }
.icon-btn.one .repeat-one { display: block; }
.play-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--text); color: #111; display: grid; place-items: center; }
.play-btn:hover { transform: scale(1.06); }
.pl-progress { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 620px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.pl-progress span { width: 40px; text-align: center; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 4px; border-radius: 4px; background: linear-gradient(var(--text), var(--text)) 0/var(--p, 0%) 100% no-repeat, #4d4d52; cursor: pointer; }
input[type=range]:hover { background: linear-gradient(var(--accent), var(--accent)) 0/var(--p, 0%) 100% no-repeat, #4d4d52; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text); opacity: 0; }
input[type=range]:hover::-webkit-slider-thumb { opacity: 1; }
input[type=range]:disabled { opacity: .4; cursor: default; }
.pl-right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; color: var(--muted); }
#volume { max-width: 110px; }
.vol-icon { width: 18px; }

.ph { display: grid; place-items: center; font-weight: 800; color: #fff; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 220px 1fr; }
  .nowpanel { position: fixed; right: 8px; top: 8px; bottom: 96px; width: 340px; z-index: 20; box-shadow: -10px 0 40px rgba(0,0,0,.6); }
  .app.panel-hidden { grid-template-columns: 220px 1fr; }
  .app.panel-hidden .nowpanel { display: block; visibility: hidden; }
  .tracks .tagcol, .tracks .src { display: none; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; padding: 0; height: calc(100vh - 128px); }
  .app.panel-hidden { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { border-radius: 0; }
  .topbar, #view { padding-left: 16px; padding-right: 16px; }
  .hero { margin: 0 -16px 20px; flex-direction: column; align-items: flex-start; }
  .hero-art { width: 140px; height: 140px; }
  .nowpanel { left: 8px; width: auto; bottom: 136px; }
  .player { height: 128px; grid-template-columns: 1fr auto; grid-template-rows: auto auto; padding: 8px 16px; }
  .pl-center { grid-column: 1 / -1; grid-row: 2; }
  .pl-right #volume, .pl-right .vol-icon { display: none; }
  .tracks .when { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .source-link { font-size: 12px; padding: 7px 10px; }
  .source-link .long { display: none; }
  .source-link .short { display: inline; }
  .search-wrap { min-width: 0; }
}
