:root {
  --bg0: #080d0b;
  --bg1: #101816;
  --ink: #e8f0ea;
  --muted: #8fa396;
  --line: #24332c;
  --accent: #90b8a0;
  --accent-dim: rgba(144, 184, 160, 0.14);
  --danger: #e8a0a0;
  --player-h: 5.5rem;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Sora", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at 8% -12%, #1a2c24 0%, transparent 55%),
    radial-gradient(800px 480px at 100% 0%, #142018 0%, transparent 45%),
    linear-gradient(165deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
}

button, input { font: inherit; color: inherit; }
button {
  background: none;
  border: 0;
  cursor: pointer;
}
img { display: block; max-width: 100%; }

#app { min-height: 100%; }

/* —— Login —— */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem calc(2rem + var(--safe-b));
  animation: rise 0.7s ease both;
}
.login-panel { width: min(100%, 22rem); }
.login .brand {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}
.login .slogan {
  margin-top: 0.55rem;
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0.02em;
}
.login .lede {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.login form {
  margin-top: 2rem;
  display: grid;
  gap: 0.75rem;
}
.login label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.login input {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: rgba(255,255,255,0.03);
  outline: none;
}
.login input:focus { border-color: var(--accent); }
.login .cta {
  margin-top: 0.35rem;
  padding: 0.9rem 1rem;
  border-radius: 0.65rem;
  background: var(--accent);
  color: #0b1210;
  font-weight: 600;
}
.login .cta:disabled { opacity: 0.55; cursor: wait; }
.login .err {
  min-height: 1.25rem;
  color: #e8a0a0;
  font-size: 0.85rem;
}
.login .hint {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

/* —— Shell —— */
.shell {
  min-height: 100dvh;
  padding-bottom: calc(var(--player-h) + var(--safe-b) + 1rem);
  animation: rise 0.45s ease both;
}
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  backdrop-filter: blur(12px);
  background: rgba(8, 13, 11, 0.72);
  border-bottom: 1px solid transparent;
}
.top .brand {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.top .slogan {
  color: var(--accent);
  font-size: 0.8rem;
}
.top .spacer { flex: 1; }
.top .ghost {
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.35rem 0.55rem;
}
.top .ghost:hover { color: var(--ink); }

.tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.75rem 1.25rem 0;
}
.tabs button {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
}
.tabs button.active {
  color: var(--ink);
  background: var(--accent-dim);
}

.main { padding: 1rem 1.25rem 1.5rem; }

.empty {
  padding: 3rem 0.5rem;
  text-align: center;
  color: var(--muted);
}
.empty h2 {
  font-family: "Fraunces", Georgia, serif;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}
.empty code {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  font-size: 0.72rem;
  color: var(--accent);
  text-align: left;
  max-width: 100%;
  overflow-x: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 1.1rem 0.85rem;
}
.album {
  text-align: left;
  width: 100%;
}
.album .art {
  aspect-ratio: 1;
  border-radius: 0.55rem;
  background:
    linear-gradient(145deg, #1c2a24, #0f1613);
  overflow: hidden;
  position: relative;
}
.album .art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}
.album:hover .art img { transform: scale(1.04); }
.album .name {
  margin-top: 0.55rem;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.25;
}
.album .artist {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.tracks { display: grid; gap: 0.2rem; }
.track {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.45rem;
  border-radius: 0.5rem;
}
.track:hover, .track.active { background: var(--accent-dim); }
.track .n { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.track .t { font-size: 0.9rem; }
.track .a { color: var(--muted); font-size: 0.75rem; margin-top: 0.1rem; }
.track .d { color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }

.detail-head {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: end;
}
.detail-head .art {
  aspect-ratio: 1;
  border-radius: 0.65rem;
  overflow: hidden;
  background: #15201b;
}
.detail-head .art img { width: 100%; height: 100%; object-fit: cover; }
.detail-head h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 650;
  letter-spacing: -0.02em;
}
.detail-head p { color: var(--muted); margin-top: 0.35rem; font-size: 0.9rem; }
.back {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.back:hover { color: var(--accent); }

/* —— Player —— */
.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  min-height: var(--player-h);
  padding: 0.65rem 1rem calc(0.65rem + var(--safe-b));
  background: rgba(10, 16, 14, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
}
.player .meta { min-width: 0; }
.player .title {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player .sub {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player .controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.player .controls button {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  color: var(--ink);
  display: grid;
  place-items: center;
}
.player .controls .play {
  width: 2.75rem;
  height: 2.75rem;
  background: var(--accent);
  color: #0b1210;
}
.player .seek {
  grid-column: 1 / -1;
  appearance: none;
  width: 100%;
  height: 0.28rem;
  border-radius: 999px;
  background: var(--line);
  outline: none;
}
.player .seek::-webkit-slider-thumb {
  appearance: none;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--accent);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 720px) {
  .player {
    grid-template-columns: 1.2fr auto 1fr;
    padding-inline: 1.5rem;
  }
  .player .seek {
    grid-column: auto;
    order: 2;
  }
  .player .controls { order: 3; justify-self: end; }
}
