/* Tema "tech minimalista": escuro por padrão, superfícies limpas, bordas finas,
   um único destaque (verde-elétrico) só para o que está ativo, tocando ou em progresso. */

@font-face { font-family: "Geist"; src: url("/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

/* Escuro: o visual principal. */
:root {
  --bg: #0a0a0c;
  --surface: #111114;      /* cartões e listas */
  --card: var(--surface);
  --elevated: #17171b;     /* player completo, menus */
  --fg: #ededef;
  --muted: #8d8d96;        /* 6,3:1 sobre --bg */
  --faint: #5c5c66;        /* só para detalhes não essenciais */
  --line: #1f1f24;
  --line-strong: #2e2e35;
  --soft: #18181c;         /* hover, fundo de imagem */
  --accent: #3be3a0;       /* o único destaque */
  --accent-fg: #04140d;
  --accent-dim: rgba(59, 227, 160, .14);
  --primary: #ededef;      /* botão principal: claro sobre escuro */
  --primary-fg: #0a0a0c;
  --primary-hover: #ffffff;
  --danger: #f2766b;
  --danger-line: #4a2421;
  --danger-soft: #1f1312;
  --live: var(--accent);
  --ring: rgba(59, 227, 160, .35);
  --glass: rgba(17, 17, 20, .72);
  --glass-line: rgba(255, 255, 255, .07);
  --shadow: 0 0 0 1px rgba(255, 255, 255, .04), 0 12px 32px rgba(0, 0, 0, .55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .6);
  --r-sm: 6px;             /* capas pequenas */
  --r: 10px;               /* botões, campos, capas médias */
  --r-lg: 14px;            /* cartões, player */
  --fast: 150ms;
  --med: 220ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
/* Claro: guardado para o futuro. Para voltar a usar, ponha data-theme="light" no <html>. */
:root[data-theme="light"] {
  --bg: #f7f7f8; --surface: #ffffff; --card: var(--surface); --elevated: #ffffff;
  --fg: #111113; --muted: #62626b; --faint: #a1a1aa;
  --line: #e7e7ea; --line-strong: #d4d4d9; --soft: #f0f0f2;
  --accent: #0e9f6e; --accent-fg: #ffffff; --accent-dim: rgba(14, 159, 110, .12);
  --primary: #111113; --primary-fg: #ffffff; --primary-hover: #2a2a2e;
  --danger: #c2392f; --danger-line: #f0cfcb; --danger-soft: #fdf2f1;
  --ring: rgba(14, 159, 110, .35);
  --glass: rgba(255, 255, 255, .75); --glass-line: rgba(0, 0, 0, .06);
  --shadow: 0 0 0 1px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 0, 0, .08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 15px/1.5 var(--font); letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--accent-dim); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
h1, h2 { margin: 0 0 12px; font-weight: 600; letter-spacing: -.03em; line-height: 1.2; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1rem; letter-spacing: -.015em; }
a { color: var(--fg); text-underline-offset: 3px; }
img { display: block; }
.container { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-bottom: 24px; }
.muted { color: var(--muted); font-size: .85rem; }
.error { color: var(--danger); font-size: .875rem; min-height: 1.2em; }
.hidden { display: none !important; }

/* ícones (sprite em index.html) */
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ic.solid { fill: currentColor; stroke: none; }

/* botões e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 500; font-size: .9rem; padding: 10px 16px; min-height: 44px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); cursor: pointer; text-decoration: none;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:hover { background: var(--soft); border-color: #3a3a42; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: transparent; border-color: var(--danger-line); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.input {
  display: block; width: 100%; font: inherit; padding: 10px 14px; min-height: 44px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); color: var(--fg); margin: 6px 0 14px;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: #3a3a42; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
label { font-weight: 500; font-size: .8rem; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--soft); flex: none; }

/* barras de progresso: trilho fino, preenchimento no destaque */
progress { appearance: none; -webkit-appearance: none; height: 4px; border: 0; border-radius: 99px; background: var(--line-strong); overflow: hidden; color: var(--accent); }
progress::-webkit-progress-bar { background: var(--line-strong); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; transition: width var(--med) linear; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.progress { width: 100%; }

/* app */
.app-body { padding-bottom: calc(176px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  max-width: 760px; margin: 0 auto; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(var(--bg) 55%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1rem; letter-spacing: -.02em; }
.brand .ic { width: 22px; height: 22px; color: var(--accent); }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--fg); font: 500 .85rem var(--mono); cursor: pointer; display: grid; place-items: center; text-transform: uppercase;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
  position: relative;
}
.avatar-btn::after { content: ""; position: absolute; inset: -5px; } /* alvo de toque de 46px sem aumentar o círculo */
.avatar-btn:hover { border-color: var(--accent); background: var(--soft); }

/* linhas de set */
.list > li + li { border-top: 1px solid var(--line); }
.set-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; min-height: 64px;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: var(--r);
  transition: background var(--fast) var(--ease);
}
.set-row:hover { background: var(--soft); }
.set-row:active { background: var(--line); }
.set-row .cover { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; background: var(--soft); flex: none; box-shadow: inset 0 0 0 1px var(--glass-line); }
.set-row .meta { flex: 1; min-width: 0; }
.set-row .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color var(--fast) var(--ease); }
.set-row .meta .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-row > .muted { font: 400 .8rem var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.set-row.playing .title { color: var(--accent); }
.set-row.playing .title::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--live);
  margin-right: 8px; vertical-align: middle; box-shadow: 0 0 0 3px var(--accent-dim); animation: pulse 1.6s var(--ease) infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 5px transparent; } }
.card:has(> .list) { padding: 4px; }

/* artistas */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 20px 12px; list-style: none; margin: 0 0 24px; padding: 0; }
.artist-card { display: block; text-align: center; text-decoration: none; color: var(--fg); border-radius: var(--r-lg); padding: 6px; transition: background var(--fast) var(--ease); }
.artist-card:hover { background: var(--surface); }
.artist-card img {
  width: 100%; aspect-ratio: 1; height: auto; border-radius: 50%; object-fit: cover; background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--glass-line), 0 0 0 1px var(--line); transition: box-shadow var(--med) var(--ease);
}
.artist-card:hover img { box-shadow: 0 0 0 1px var(--line-strong), 0 0 0 4px var(--soft); }
.artist-card span { display: block; font-weight: 500; font-size: .85rem; margin-top: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artist-head { display: flex; align-items: center; gap: 16px; margin: 8px 0 24px; }
.artist-head img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; background: var(--soft); box-shadow: 0 0 0 1px var(--line-strong); }
.artist-head h1 { margin: 0; }

/* rodapé fixo: mini player + navegação, em vidro */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; }
.mini {
  position: relative; display: flex; align-items: center; gap: 8px; max-width: 728px; margin: 0 8px 8px; padding: 8px 8px 10px;
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
}
@media (min-width: 760px) { .mini { margin: 0 auto 8px; } }
.mini-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; padding: 0; min-height: 44px; border-radius: var(--r); }
.mini-open img { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; background: var(--soft); flex: none; }
.mini-open .meta { min-width: 0; }
.mini-open .title { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-open .sub { display: block; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-progress { position: absolute; left: 12px; right: 12px; bottom: 4px; width: auto; height: 2px; }

.round {
  position: relative; width: 44px; height: 44px; border-radius: 50%; border: 0; background: none;
  display: grid; place-items: center; cursor: pointer; color: var(--fg); flex: none;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease), color var(--fast) var(--ease);
}
.round:hover { background: var(--soft); }
.round:active { transform: scale(.92); }
.round.big { width: 68px; height: 68px; background: var(--primary); color: var(--primary-fg); }
.round.big:hover { background: var(--primary-hover); }
.round.big .ic { width: 26px; height: 26px; }
.round.skip { width: 52px; height: 52px; }
.round.skip .ic { width: 30px; height: 30px; }
.round.skip .n { position: absolute; font: 600 .58rem var(--mono); top: 50%; left: 50%; transform: translate(-50%, -38%); }

.nav {
  display: flex; background: var(--glass); border-top: 1px solid var(--glass-line); padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
}
.nav a {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 8px; min-height: 56px;
  color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 500; letter-spacing: .01em; transition: color var(--fast) var(--ease);
}
.nav a:hover { color: var(--fg); }
@media (min-width: 760px) { .nav { justify-content: center; } .nav a { flex: 0 1 220px; } }
.nav a[aria-current="page"] { color: var(--fg); }
.nav a[aria-current="page"] .ic { color: var(--accent); stroke-width: 2; }
.nav a[aria-current="page"]::before { /* traço fino de destaque no topo do item ativo */
  content: ""; position: absolute; top: -1px; left: 50%; width: 20px; height: 2px; margin-left: -10px; border-radius: 0 0 2px 2px; background: var(--accent);
}

/* player completo */
.sheet {
  position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto;
  padding: 12px 20px 32px; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(32px, env(safe-area-inset-bottom));
  animation: up var(--med) var(--ease);
}
/* só deslize, sem opacidade: se a animação travar, o player nunca fica transparente por cima da lista */
@keyframes up { from { transform: translateY(16px); } to { transform: none; } }
.sheet-inner { max-width: 400px; margin: 0 auto; text-align: center; }
.sheet .sheet-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet .sheet-top .muted { font-weight: 500; font-size: .8rem; }
.sheet .cover-big {
  width: min(78vw, 340px); height: min(78vw, 340px); margin: 20px auto 32px; border-radius: var(--r-lg); object-fit: cover;
  background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong), 0 24px 60px rgba(0, 0, 0, .5);
}
.sheet h2 { font-size: 1.35rem; margin: 0 0 4px; letter-spacing: -.03em; }
.sheet .seek { width: 100%; accent-color: var(--accent); margin: 28px 0 6px; height: 24px; cursor: pointer; }
.sheet .times { display: flex; justify-content: space-between; color: var(--muted); font: 400 .75rem var(--mono); font-variant-numeric: tabular-nums; }
.sheet .controls { display: flex; justify-content: center; align-items: center; gap: clamp(4px, 3vw, 24px); margin: 24px 0; }
/* celular estreito (320 px): botões laterais menores para os 5 controles caberem */
@media (max-width: 359px) {
  .sheet { padding-left: 14px; padding-right: 14px; }
  .sheet .controls .round:not(.big) { width: 40px; height: 40px; }
  .sheet .controls .skip .ic { width: 26px; height: 26px; }
}

/* login */
.narrow { max-width: 380px; padding-top: max(64px, 14vh); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.15rem; letter-spacing: -.02em; margin: 0 0 28px 2px; }
.auth-brand .ic { width: 26px; height: 26px; color: var(--accent); }
.narrow .card { padding: 24px; background: var(--surface); }
.narrow .btn-primary { width: 100%; margin-top: 4px; }
.narrow h1 { font-size: 1.35rem; margin-bottom: 20px; }

/* movimento reduzido: sem animações nem transições */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* tracklist no player: tocar numa faixa pula para o momento dela */
.sheet .tracks { list-style: none; margin: 8px 0 0; padding: 4px 0 0; border-top: 1px solid var(--line); text-align: left; }
.sheet .track {
  display: flex; gap: 14px; width: 100%; padding: 10px 8px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer; transition: background var(--fast) var(--ease);
}
.sheet .track:hover { background: var(--soft); }
.sheet .track .muted { flex: none; min-width: 7ch; font: 400 .8rem/1.5rem var(--mono); font-variant-numeric: tabular-nums; }
.sheet .track[aria-current] { color: var(--accent); }
.sheet .track[aria-current] .muted { color: var(--accent); }

/* fila: o que toca depois */
.sheet .up-next {
  display: flex; align-items: center; justify-content: center; gap: 8px; max-width: 100%; margin: -8px auto 16px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.sheet .up-next:hover:not(:disabled) { background: var(--soft); color: var(--fg); }
.sheet .up-next .ic { width: 16px; height: 16px; flex: none; }
.sheet .up-next span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-next:disabled, .round:disabled { opacity: .4; cursor: default; }

/* ---------- perfil ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .8rem; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover; background: var(--soft);
  display: grid; place-items: center; font: 500 .8rem var(--mono); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.avatar.big { width: 72px; height: 72px; font-size: 1.5rem; }
.avatar-in { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: grid; place-items: center; }
.avatar-btn { overflow: hidden; padding: 0; }
.profile-top { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.profile-top strong { display: block; font-size: 1.05rem; }
.profile-top p { margin: 2px 0 10px; }
.profile-top label.btn { display: inline-flex; align-items: center; cursor: pointer; margin: 0; }
.profile-pic { flex: none; }

.profile-top div:has(#pf-file:focus-visible) label.btn { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- baixados (ouvir sem internet) ---------- */
.round.dl { position: relative; }
.round.dl.saved { color: var(--accent); }
.round.dl .pct { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font: 500 .62rem var(--mono); color: var(--accent); white-space: nowrap; }
.set-row.saved .meta .muted::after { content: " · baixado"; color: var(--accent); }
.dl-row { display: flex; align-items: center; gap: 8px; }
.dl-row .set-row { flex: 1; min-width: 0; }
.dl-row > .btn { flex: none; margin-right: 8px; }
.empty-state { text-align: center; padding: 28px 20px; }
.empty-state p { margin: 0 0 8px; }
.empty-state .btn { margin-top: 8px; }
