:root {
  --bg: #0f0f14;
  --panel: #17171f;
  --panel-2: #1f1f2a;
  --line: #2a2a37;
  --text: #f2f2f5;
  --muted: #9a9aab;
  --accent: #e8435a;
  --accent-2: #ff6b5e;
  --ok: #3ccf8e;
  --player-h: 88px;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }

.app {
  display: grid;
  grid-template-columns: 230px 1fr;
  height: calc(100vh - var(--player-h));
}

/* Sidebar */
.sidebar {
  background: #0a0a0e;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  border-right: 1px solid var(--line);
}
.logo { font-weight: 800; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600;
  display: flex; gap: 12px; align-items: center; transition: background .15s, color .15s;
}
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active { color: var(--text); background: var(--panel-2); }
.sidebar-note { font-size: 12px; margin-top: auto; }
.sidebar-note a { text-decoration: underline; }

/* Main view */
.view { overflow-y: auto; padding: 28px 36px 48px; background: linear-gradient(180deg, #1b1424 0, var(--bg) 320px); }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 32px; letter-spacing: -0.02em; }
.page-header p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 32px 0 12px; }
.section-title { margin: 0; font-size: 20px; }
.see-all { color: var(--muted); font-size: 13px; font-weight: 600; }
.see-all:hover { color: var(--text); text-decoration: underline; }
.page-actions.spaced { margin-bottom: 8px; }
.notice .link { color: var(--text); text-decoration: underline; }

.hero { display: flex; gap: 28px; align-items: flex-end; margin-bottom: 24px; }
.hero-art { width: 200px; height: 200px; object-fit: cover; border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.5); background: var(--panel); }
.hero-art.round { border-radius: 50%; }
.hero-text h1 { margin: 4px 0; font-size: 40px; letter-spacing: -0.02em; line-height: 1.1; }
.hero-text .page-actions { margin-top: 16px; }
.kicker { text-transform: uppercase; font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }

.btn {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px;
  padding: 9px 18px; font-weight: 600; transition: transform .1s, background .15s;
}
.btn:hover { background: var(--line); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ok { border-color: rgba(60, 207, 142, .5); color: var(--ok); }
.btn.ok:hover { background: rgba(60, 207, 142, .12); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 6px 14px; font-size: 13px; color: var(--muted);
}
.chip:hover { color: var(--text); border-color: #444; }
.chip.active { background: var(--text); color: #111; border-color: var(--text); font-weight: 600; }

.toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin: 4px 0 16px; cursor: pointer; }
.toggle input { accent-color: var(--accent); }

.search-input {
  width: 100%; max-width: 520px; padding: 12px 18px; border-radius: 999px; margin-bottom: 18px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; outline: none;
}
.search-input:focus { border-color: var(--accent); }

.notice { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; color: var(--muted); font-size: 13px; }

/* Track list */
.track-list { list-style: none; margin: 0; padding: 0; }
.track-row {
  display: grid; grid-template-columns: 36px 48px 1fr auto auto; gap: 14px; align-items: center;
  padding: 8px 10px; border-radius: 10px; transition: background .12s;
}
.track-row:hover { background: var(--panel-2); }
.track-row.current .row-title { color: var(--accent-2); }
.row-play { background: none; border: 0; width: 36px; height: 36px; position: relative; color: var(--muted); }
.row-play .row-icon { display: none; color: var(--text); }
.track-row:hover .row-index { display: none; }
.track-row:hover .row-icon { display: inline; }
.track-row.playing .row-index { font-size: 0; }
.track-row.playing .row-index::after { content: "♫"; font-size: 15px; color: var(--accent-2); }
.row-art { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--panel); }
.row-text { min-width: 0; }
.row-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.row-sub { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link:hover { text-decoration: underline; color: var(--text); }
.row-duration { font-variant-numeric: tabular-nums; font-size: 13px; }
.row-actions { display: flex; gap: 4px; }
.tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-radius: 4px; background: var(--line); color: var(--muted); flex-shrink: 0; }
.tag-ok { background: rgba(60, 207, 142, .15); color: var(--ok); }
.tag-full { background: rgba(232, 67, 90, .15); color: var(--accent-2); }

.icon-btn {
  background: none; border: 0; min-width: 34px; height: 34px; border-radius: 50%; color: var(--muted);
  display: inline-grid; place-items: center; font-size: 15px; transition: background .12s, color .12s;
}
.icon-btn:hover:not(:disabled) { color: var(--text); background: var(--line); }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; }
.icon-btn.on { color: var(--accent-2); }
.download-btn:not(:disabled) { color: var(--ok); }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.card { background: var(--panel); border-radius: var(--radius); padding: 12px; position: relative; transition: background .15s, transform .15s; }
.card:hover { background: var(--panel-2); transform: translateY(-2px); }
.card-art { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--panel-2); display: block; }
.card-art.round { border-radius: 50%; }
.card-badge { position: absolute; top: 18px; left: 18px; font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 3px 7px; border-radius: 4px; background: rgba(0,0,0,.65); }
.artist-card .card-title, .artist-card .card-sub { text-align: center; }
.card-title { font-weight: 600; margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty, .loading { padding: 48px; text-align: center; color: var(--muted); }
.loading { display: flex; gap: 12px; justify-content: center; align-items: center; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Video songs */
.video-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.video-card { text-align: left; border: 0; color: inherit; font: inherit; cursor: pointer; }
.video-thumb { position: relative; }
.card-art.wide { aspect-ratio: 16 / 9; }
.video-thumb .card-badge { top: 8px; left: 8px; }
.video-play {
  position: absolute; inset: 0; margin: auto; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0,0,0,.6); font-size: 16px;
  opacity: 0; transform: scale(.9); transition: opacity .15s, transform .15s;
}
.video-card:hover .video-play, .video-card:focus-visible .video-play { opacity: 1; transform: scale(1); }
.two-lines { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.show-more { display: flex; justify-content: center; margin-top: 16px; }
.small { font-size: 13px; margin: 0 0 12px; }
.setup { margin-bottom: 8px; }
.setup summary { cursor: pointer; color: var(--text); font-weight: 600; }
.setup .search-input { margin: 0; max-width: 380px; }

.video-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.85);
  display: grid; place-items: center; padding: 24px;
}
.video-overlay[hidden] { display: none; }
.video-box { width: min(1100px, 100%); }
.video-toolbar { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 8px; }
.video-toolbar .icon-btn { color: var(--text); }
.video-stage { aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.video-stage iframe, .video-stage video { width: 100%; height: 100%; border: 0; display: block; }
.video-caption { margin-top: 12px; }
.video-title { font-weight: 700; font-size: 17px; margin-bottom: 4px; }
body.no-scroll { overflow: hidden; }

/* Player */
.player {
  position: fixed; inset: auto 0 0 0; height: var(--player-h);
  display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: 16px;
  padding: 0 20px; background: #0a0a0e; border-top: 1px solid var(--line);
}
.np { display: flex; align-items: center; gap: 12px; min-width: 0; }
.np-art { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--panel); }
.np-text { min-width: 0; }
.np-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.buttons { display: flex; align-items: center; gap: 10px; }
.play-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--text); color: #111; font-size: 14px; transition: transform .1s; }
.play-btn:hover { transform: scale(1.06); }
.timeline { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 560px; }
.time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; width: 38px; text-align: center; }
.timeline input { flex: 1; }
.extras { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.extras input { width: 110px; }
input[type="range"] { accent-color: var(--accent); }
.player.idle .controls { opacity: .5; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--player-h) + 16px); transform: translate(-50%, 20px);
  background: var(--text); color: #111; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Small screens */
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { flex-direction: row; align-items: center; padding: 10px 12px; gap: 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; }
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .logo span:not(.logo-mark), .sidebar-note { display: none; }
  .view { padding: 18px 14px 40px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-art { width: 150px; height: 150px; }
  .track-row { grid-template-columns: 28px 44px 1fr auto; }
  .row-duration { display: none; }
  .player { grid-template-columns: 1fr auto; }
  .controls .timeline, .extras input, .extras span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
