:root {
  --bg: #000;
  --panel: #121212;
  --card: rgba(255,255,255,0.04);
  --card-hover: rgba(255,255,255,0.10);
  --text: #fff;
  --muted: #b3b3b3;
  --accent: #1db954;
  --accent-2: #1ed760;
  --danger: #e6584f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

.app { display: flex; height: 100vh; }

/* sidebar */
.sidebar {
  width: 240px; flex: none; background: #000; padding: 22px 14px;
  display: flex; flex-direction: column; gap: 18px;
}
.logo { font-weight: 800; font-size: 22px; letter-spacing: -0.5px; padding: 0 8px; }
.logo span { color: var(--accent); }
.nav {
  display: block; padding: 10px 12px; border-radius: 8px; color: var(--muted);
  font-weight: 700; cursor: pointer;
}
.nav:hover { color: #fff; background: #1a1a1a; }
.nav.active { color: #fff; }
.sidebar-note { margin-top: auto; color: #6a6a6a; font-size: 11px; line-height: 1.5; padding: 0 10px; }

/* main */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 16px 24px;
  background: linear-gradient(180deg, #2a2a32, #161616);
}
.topbar input {
  flex: 1; padding: 12px 16px; border-radius: 999px; border: none; outline: none;
  background: #fff; color: #111; font-size: 15px;
}
.topbar input::placeholder { color: #555; }
button { cursor: pointer; font: inherit; }
button.ghost {
  background: transparent; color: #fff; border: 1px solid #555; border-radius: 999px; padding: 9px 14px;
}
button.ghost:hover { border-color: #fff; }
button.primary { background: var(--accent); color: #04140a; border: none; border-radius: 999px; padding: 10px 18px; font-weight: 800; }
button.primary:hover { background: var(--accent-2); }
button.icon { background: transparent; border: none; color: #fff; font-size: 18px; }

.view { flex: 1; overflow-y: auto; padding: 26px 24px 40px; }
.hero { margin-top: 4vh; }
.hero h1 { font-size: 44px; margin: 0 0 12px; }
.hero p { color: var(--muted); font-size: 15px; line-height: 1.6; max-width: 560px; }
.hero .hint { color: var(--accent); margin-top: 14px; }

/* section heading */
.section-title { font-size: 22px; font-weight: 800; margin: 6px 0 16px; }

/* grid of cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.card {
  position: relative; background: var(--card); border-radius: 10px; padding: 14px;
  cursor: pointer; transition: background .15s ease;
}
.card:hover { background: var(--card-hover); }
.card img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #202020;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}
.card .t { font-weight: 700; margin-top: 10px; font-size: 15px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .s { color: var(--muted); font-size: 13px; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .play-fab {
  position: absolute; right: 22px; bottom: 86px; width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: #000; border: none; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(10px); transition: .18s ease;
  box-shadow: 0 8px 18px rgba(0,0,0,.5);
}
.card:hover .play-fab { opacity: 1; transform: translateY(0); }
.card .play-fab:hover { transform: scale(1.06); background: var(--accent-2); }

/* queue */
.queue {
  position: fixed; top: 0; right: 0; height: 100%; width: 330px; background: #121212;
  border-left: 1px solid #232323; padding: 18px; overflow-y: auto; z-index: 40;
}
.queue-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; margin-bottom: 14px; }
.queue ol { list-style: none; margin: 0; padding: 0; }
.queue li { padding: 9px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 8px; color: var(--muted); }
.queue li:hover { background: #1c1c1c; color: #fff; }
.queue li.active { color: var(--accent); }

/* player */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; height: 90px; z-index: 50;
  display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: 18px;
  padding: 0 18px; background: #181818; border-top: 1px solid #282828;
}
.now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.np-cover { width: 56px; height: 56px; border-radius: 6px; background: #222; flex: none; }
.np-meta { min-width: 0; }
.np-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-artist { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.controls { display: flex; align-items: center; justify-content: center; gap: 18px; }
.controls .play { font-size: 24px; background: #fff; color: #000; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.controls .play:hover { transform: scale(1.05); }
.seek { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 460px; }
.seek span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.vol { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
input[type="range"] { accent-color: var(--accent); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal-card { background: #282828; padding: 24px; border-radius: 14px; width: min(460px, 92vw); }
.modal-card h3 { margin: 0 0 6px; }
.modal-card textarea { width: 100%; background: #121212; color: #fff; border: 1px solid #444; border-radius: 8px; padding: 10px; resize: vertical; font-family: ui-monospace, monospace; font-size: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.status { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 18px; }
.status.err { color: var(--danger); }
.status.ok { color: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 8vh 0; }
.toast {
  position: fixed; top: 78px; left: 50%; transform: translateX(-50%);
  background: #282828; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 70;
  box-shadow: 0 8px 20px rgba(0,0,0,.4); max-width: 80vw;
}
.hidden { display: none !important; }

@media (max-width: 720px) {
  .sidebar { display: none; }
  .player { grid-template-columns: 1fr 1.4fr; }
  .vol { display: none; }
}
