:root {
  --bg: #121212;
  --bg-elevated: #181818;
  --bg-highlight: #282828;
  --green: #1ed760;
  --text: #ffffff;
  --text-muted: #b3b3b3;
  --nav-h: 58px;
  --mini-h: 58px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

.ico { width: 24px; height: 24px; fill: currentColor; display: block; }
.hidden { display: none !important; }

/* ---------------- VIEWS ---------------- */
.view {
  position: absolute;
  inset: 0;
  bottom: calc(var(--nav-h) + var(--mini-h));
  overflow-y: auto;
  padding: 0 16px;
  display: none;
  -webkit-overflow-scrolling: touch;
}
.view.active { display: block; }

.topbar {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
  padding: 18px 0 10px;
  z-index: 5;
}
.topbar h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }

/* ---------------- SEARCH ---------------- */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 14px;
}
.search-box .ico { fill: #121212; flex-shrink: 0; }
.search-box input {
  border: 0;
  outline: 0;
  width: 100%;
  font-size: 15px;
  font-weight: 600;
  color: #121212;
  background: transparent;
}
.search-box input::placeholder { color: #6a6a6a; }

/* ---------------- RESULTS ---------------- */
.results { padding: 12px 0 24px; }
.hint { color: var(--text-muted); text-align: center; margin-top: 40px; font-size: 15px; }

.track {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.track:active { background: var(--bg-highlight); }
.track img {
  width: 52px; height: 52px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-highlight);
  flex-shrink: 0;
}
.track-info { display: flex; flex-direction: column; min-width: 0; }
.track-title {
  font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track.playing .track-title { color: var(--green); }
.track-artist {
  font-size: 13px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------------- MINI PLAYER ---------------- */
.mini-player {
  position: fixed;
  left: 8px; right: 8px;
  bottom: calc(var(--nav-h) + 6px);
  height: var(--mini-h);
  background: var(--bg-highlight);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  z-index: 20;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.mini-cover { width: 42px; height: 42px; border-radius: 4px; object-fit: cover; background: #000; }
.mini-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mini-title { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-artist { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-btn { background: none; border: 0; color: var(--text); padding: 8px; cursor: pointer; }

/* ---------------- BOTTOM NAV ---------------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-h);
  background: #101010;
  display: flex;
  border-top: 1px solid #0a0a0a;
  z-index: 15;
}
.nav-item {
  flex: 1;
  background: none; border: 0;
  color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  font-size: 10px; font-weight: 600;
  cursor: pointer;
}
.nav-item.active { color: var(--text); }

/* ---------------- NOW PLAYING ---------------- */
.now-playing {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #3a3a3a 0%, var(--bg) 55%);
  z-index: 50;
  padding: 18px 24px 40px;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
}
.now-playing.open { transform: translateY(0); }

.np-header { display: flex; align-items: center; justify-content: space-between; }
.np-close { background: none; border: 0; color: var(--text); cursor: pointer; }
.np-close .ico { width: 30px; height: 30px; }
.np-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1px; }

.np-art {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 0;
}
.np-art img {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  background: var(--bg-highlight);
}

.np-meta { margin-bottom: 18px; }
.np-meta h2 { font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-meta p { font-size: 15px; color: var(--text-muted); margin-top: 4px; }

/* Progress bar */
.np-progress { margin-bottom: 14px; }
.seek {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  border-radius: 2px;
  background: #5e5e5e;
  outline: none;
  cursor: pointer;
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff;
}
.seek::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; }
.np-times { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* Controls */
.np-controls { display: flex; align-items: center; justify-content: center; gap: 28px; }
.ctrl { background: none; border: 0; color: var(--text); cursor: pointer; }
.ctrl .ico { width: 34px; height: 34px; }
.ctrl.main {
  background: #fff;
  color: #000;
  width: 66px; height: 66px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.ctrl.main .ico { width: 30px; height: 30px; }

.np-loading {
  text-align: center;
  color: var(--green);
  font-size: 13px;
  margin-top: 18px;
}

/* ================= COMPONENTI AGGIUNTIVI ================= */
.section-title { font-size: 18px; font-weight: 800; margin: 18px 0 10px; }

/* --- Strip artisti --- */
.artist-strip { padding: 0; }
.strip-row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.strip-row::-webkit-scrollbar { display: none; }
.artist-chip {
  background: none; border: 0; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: 84px; flex-shrink: 0;
}
.artist-avatar {
  width: 76px; height: 76px; border-radius: 50%;
  background: linear-gradient(135deg, #2a2a2a, #3f3f3f);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: var(--green);
}
.artist-avatar.has-img { background-size: cover; background-position: center; }
.artist-name { font-size: 12px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 84px; }

/* --- like / more nelle righe --- */
.track-info { flex: 1; }
.like-btn, .more-btn {
  background: none; border: 0; cursor: pointer; padding: 8px; flex-shrink: 0;
  color: var(--text-muted);
}
.like-btn .ico { fill: none; stroke: currentColor; stroke-width: 2; width: 20px; height: 20px; }
.like-btn.liked { color: var(--green); }
.like-btn.liked .ico { fill: var(--green); stroke: var(--green); }
.more-btn .ico { width: 20px; height: 20px; }

/* --- Dettaglio --- */
.view.detail { padding: 0 16px; }
.detail-back {
  position: sticky; top: 10px; z-index: 6;
  background: rgba(0,0,0,.55); border: 0; color: #fff; cursor: pointer;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 10px 0;
}
.detail-hero { margin-bottom: 8px; }
.artist-hero {
  min-height: 220px; border-radius: 10px;
  background: linear-gradient(135deg, #333, #1e1e1e);
  background-size: cover !important; background-position: center !important;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 18px; margin-bottom: 6px;
}
.album-hero, .list-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 4px; }
.hero-cover, .list-cover {
  width: 200px; height: 200px; border-radius: 8px; object-fit: cover;
  box-shadow: 0 10px 34px rgba(0,0,0,.55); margin-bottom: 14px; background: var(--bg-highlight);
}
.list-cover {
  display: flex; align-items: center; justify-content: center; font-size: 72px; color: #fff;
  background: linear-gradient(135deg, #1ed760, #0a7d3b);
}
.hero-title { font-size: 24px; font-weight: 800; line-height: 1.15; }
.hero-sub { color: var(--text-muted); font-size: 13px; margin-top: 6px; }
.play-all {
  margin-top: 14px; background: var(--green); color: #000; border: 0; cursor: pointer;
  font-weight: 800; font-size: 15px; padding: 12px 30px; border-radius: 999px;
}
.hero-actions { display: flex; align-items: center; gap: 10px; }
.hero-actions .play-all { margin-top: 14px; }
.album-like { margin-top: 14px; background: none; border: 1px solid #4d4d4d; border-radius: 50%; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); padding: 0; }
.album-like .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.album-like.liked { color: var(--green); border-color: var(--green); }
.album-like.liked .ico { fill: var(--green); stroke: var(--green); }

/* --- Griglia album --- */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 14px 12px; padding-bottom: 20px; }
.album-card { background: none; border: 0; cursor: pointer; color: var(--text); text-align: left; display: flex; flex-direction: column; }
.album-card img { width: 100%; aspect-ratio: 1; border-radius: 6px; object-fit: cover; background: var(--bg-highlight); }
.album-title { font-size: 13px; font-weight: 600; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-year { font-size: 12px; color: var(--text-muted); }
.track-list { padding-bottom: 20px; }

/* --- Now playing: riga meta + cuore --- */
.np-meta-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.np-meta { flex: 1; min-width: 0; margin-bottom: 0; }
.np-add, .np-like { background: none; border: 0; cursor: pointer; color: var(--text); padding: 6px; }
.np-like .ico { fill: none; stroke: currentColor; stroke-width: 2; }
.np-like.liked { color: var(--green); }
.np-like.liked .ico { fill: var(--green); stroke: var(--green); }
.np-add .ico, .np-like .ico { width: 26px; height: 26px; }

/* --- Libreria --- */
.create-btn { margin-top: 12px; background: none; border: 1px solid #4d4d4d; color: var(--text); font-weight: 700; font-size: 13px; padding: 8px 16px; border-radius: 999px; cursor: pointer; }
.lib-item { display: flex; align-items: center; gap: 12px; padding: 8px 4px; cursor: pointer; border-radius: 6px; }
.lib-item:active { background: var(--bg-highlight); }
.lib-cover { width: 54px; height: 54px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 24px; color: #fff; flex-shrink: 0; background: linear-gradient(135deg, #1ed760, #0a7d3b); }
.lib-cover.pl { background: linear-gradient(135deg, #4d4d4d, #2a2a2a); }
.lib-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lib-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-sub { font-size: 13px; color: var(--text-muted); }
.del-btn { background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 8px; }
.del-btn .ico { width: 20px; height: 20px; }

/* --- Bottom sheet --- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; display: flex; align-items: flex-end; opacity: 0; transition: opacity .25s; }
.sheet-backdrop.open { opacity: 1; }
.sheet { width: 100%; background: #282828; border-radius: 14px 14px 0 0; padding: 10px 18px 28px; transform: translateY(100%); transition: transform .25s ease; max-height: 70vh; overflow-y: auto; }
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: #666; margin: 6px auto 14px; }
.sheet h3 { font-size: 16px; margin-bottom: 12px; }
.sheet-new { width: 100%; text-align: left; background: none; border: 0; color: var(--green); font-weight: 700; font-size: 15px; padding: 12px 4px; cursor: pointer; }
.sheet-item { width: 100%; display: flex; justify-content: space-between; align-items: center; background: none; border: 0; color: var(--text); font-size: 15px; padding: 13px 4px; cursor: pointer; border-top: 1px solid #383838; }
.sheet-item span:last-child { color: var(--green); font-size: 18px; }

/* --- Toast --- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--mini-h) + 16px); transform: translate(-50%, 10px); background: var(--green); color: #000; font-weight: 700; font-size: 13px; padding: 10px 18px; border-radius: 8px; z-index: 70; opacity: 0; transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
