:root {
  color-scheme: dark;
  --bg: #07101d;
  --panel: #101a2a;
  --panel-2: #152238;
  --panel-3: #1d2d48;
  --line: #26364f;
  --line-soft: rgba(148, 163, 184, 0.18);
  --text: #edf4ff;
  --muted: #9fb0c9;
  --accent: #67e8f9;
  --accent-2: #a78bfa;
  --warn: #fbbf24;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 1120px;
  background: radial-gradient(circle at 25% 0%, rgba(37, 99, 235, 0.26), transparent 32rem), var(--bg);
  color: var(--text);
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(620px, 1fr) 260px;
  min-height: 100vh;
}

.sidebar,
.queue-panel {
  background: rgba(10, 18, 31, 0.94);
  border-color: var(--line);
  border-style: solid;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar { border-width: 0 1px 0 0; padding: 16px 14px; }
.queue-panel { border-width: 0 0 0 1px; padding: 16px 14px; }

.brand { display: flex; align-items: center; gap: 11px; padding: 8px 4px 18px; }
.brand-mark {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #0891b2, #7c3aed);
  box-shadow: var(--shadow);
  font-weight: 800; letter-spacing: -0.04em;
}
.brand h1 { margin: 0; font-size: 1.32rem; letter-spacing: -0.04em; }
.brand p, .muted, .empty-note { color: var(--muted); }
.brand p { margin: 2px 0 0; font-size: 0.78rem; }

.panel {
  background: linear-gradient(180deg, rgba(21, 34, 56, 0.9), rgba(13, 24, 40, 0.9));
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  padding: 12px;
  margin-bottom: 12px;
}
.panel.compact { padding: 10px 12px; }
.panel h2 { margin: 0 0 9px; font-size: 0.78rem; color: #c9d7ee; text-transform: uppercase; letter-spacing: 0.08em; }
.panel-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-heading-row span { color: var(--muted); font-size: 0.74rem; }

.select-label { display: block; color: var(--muted); font-size: 0.72rem; margin-bottom: 5px; }
select {
  width: 100%; border-radius: 9px; border: 1px solid var(--line);
  background: #0b1423; color: var(--text); padding: 8px;
}

.az-nav { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.az-nav a {
  display: grid; place-items: center; min-height: 25px;
  border-radius: 7px; background: #0b1423; color: var(--accent);
  font-weight: 700; font-size: 0.76rem;
}
.az-nav a:hover { background: var(--panel-3); }

.artist-index { max-height: 50vh; overflow: auto; }
.artist-group { border-top: 1px solid var(--line-soft); padding-top: 8px; margin-top: 8px; }
.artist-group h3 { margin: 0 0 6px; color: var(--accent); font-size: 0.78rem; }
.artist-group ul { list-style: none; padding: 0; margin: 0; }
.artist-group li a { display: block; padding: 4px 3px; border-radius: 6px; color: #d9e5f8; }
.artist-group li a:hover { background: rgba(103, 232, 249, 0.09); }

.content-column { min-width: 0; }
.top-nav {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 6px; align-items: center;
  height: 58px; padding: 0 24px;
  background: rgba(7, 16, 29, 0.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.top-nav a {
  padding: 8px 12px; border-radius: 999px;
  color: #cbd7ea; font-weight: 650;
}
.top-nav a.active, .top-nav a:hover {
  background: rgba(103, 232, 249, 0.12); color: var(--accent);
}
.logout-form { margin-left: auto; }
.logout-form button,
.login-form button,
.button-link {
  border: 1px solid rgba(103, 232, 249, 0.42);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(103, 232, 249, 0.12);
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}
.logout-form button:hover,
.login-form button:hover,
.button-link:hover { background: rgba(103, 232, 249, 0.2); color: white; }

.login-page {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(21, 34, 56, 0.96), rgba(13, 24, 40, 0.96));
  box-shadow: var(--shadow);
}
.login-brand { padding: 0 0 18px; }
.login-form { display: grid; gap: 9px; }
.login-form label { color: var(--muted); font-weight: 750; font-size: 0.78rem; }
.login-form input {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(7,16,29,0.72);
  color: var(--text);
  padding: 0 12px;
}
.login-form button { margin-top: 6px; width: 100%; }
.button-link { display: inline-flex; align-items: center; justify-content: center; }

.main-panel { padding: 24px 24px 84px; padding-bottom: 84px; }
.hero-card {
  display: flex; justify-content: space-between; gap: 24px; align-items: end;
  padding: 22px;
  border: 1px solid var(--line-soft); border-radius: 18px;
  background: linear-gradient(135deg, rgba(21, 34, 56, 0.96), rgba(31, 41, 80, 0.78));
  box-shadow: var(--shadow);
}
.eyebrow { margin: 0 0 6px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.74rem; }
.hero-card h2 { margin: 0; font-size: 2rem; letter-spacing: -0.05em; }
.hero-card p { margin-bottom: 0; }
.stat-strip { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stat-strip span { background: rgba(6, 13, 25, 0.62); border: 1px solid var(--line-soft); border-radius: 11px; padding: 9px 11px; color: var(--muted); }
.stat-strip strong { display: block; color: var(--text); font-size: 1.08rem; }
.scan-form {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}
.scan-form p { margin: 0; max-width: 360px; text-align: right; }
.primary-button {
  border: 1px solid rgba(103, 232, 249, 0.42);
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.85), rgba(124, 58, 237, 0.85));
  color: var(--text);
  font-weight: 850;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.primary-button:hover { border-color: var(--accent); color: white; }
.primary-button:disabled { cursor: wait; opacity: 0.66; }
.notice {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid var(--line-soft);
  background: rgba(16, 26, 42, 0.86);
  color: var(--text);
}
.notice.success { border-color: rgba(74, 222, 128, 0.35); color: #bbf7d0; }
.notice.warning { border-color: rgba(251, 191, 36, 0.35); color: #fde68a; }
.notice.error { border-color: rgba(248, 113, 113, 0.35); color: #fecaca; }
.scan-status-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: rgba(16, 26, 42, 0.76);
}
.scan-status-card h2 { margin: 0 0 6px; font-size: 1rem; }
.scan-status-card p { margin: 0; }
.scan-status-card .eyebrow { margin-bottom: 6px; }
.scan-status-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}
.status-running { background: var(--warn); }
.status-idle { background: #86efac; }
.scan-notes {
  grid-column: 1 / -1;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.section-heading { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 14px; }
.section-heading h2 { margin: 0; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; color: #c9d7ee; }
.section-heading a { color: var(--accent); font-weight: 700; font-size: 0.82rem; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  gap: 14px;
  align-items: start;
}
.album-card {
  min-width: 0; padding: 10px; border-radius: 14px;
  background: rgba(16, 26, 42, 0.86); border: 1px solid var(--line-soft);
  align-self: start;
}
.album-cover-wrap { position: relative; }
.album-cover-wrap .album-cover { display: grid; }
.album-hover-play {
  position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(7,16,29,0.78); color: white;
  font-size: 1.05rem; cursor: pointer;
  opacity: 0; transition: opacity 0.16s ease, transform 0.16s ease;
}
.album-cover-wrap:hover .album-hover-play,
.album-hover-play:focus { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
.album-card h3 { margin: 9px 0 3px; font-size: 0.92rem; line-height: 1.2; }
.album-card p { margin: 0; color: var(--muted); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-cover, .mini-cover {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #0e7490, #4338ca 55%, #7c2d12);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.album-cover img, .mini-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.album-cover span { font-size: 2rem; font-weight: 900; opacity: 0.72; }
.pill { display: inline-flex; margin-top: 8px; padding: 3px 7px; border-radius: 999px; color: #111827; background: var(--warn); font-size: 0.68rem; font-weight: 800; }

.artist-hero, .album-hero { align-items: center; }
.album-hero { justify-content: flex-start; }
.album-cover.large { width: 132px; flex: none; }
.album-summary { min-width: 0; }
.folder-path {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 58vw;
}
.playlist-create-form,
.playlist-add-form,
.playlist-rename-form,
.track-playlist-add-form {
  display: flex; flex-wrap: wrap; align-items: end; gap: 8px;
}
.playlist-create-form label,
.playlist-add-form label,
.playlist-rename-form label,
.track-playlist-add-form label {
  flex-basis: 100%; color: var(--muted); font-size: 0.76rem; font-weight: 700;
}
.playlist-create-form input,
.playlist-add-form select,
.playlist-rename-form input,
.track-playlist-add-form select {
  min-height: 36px; border-radius: 10px; border: 1px solid var(--line-soft);
  background: rgba(7,16,29,0.72); color: var(--text); padding: 0 10px;
}
.playlist-list { display: grid; gap: 12px; }
.playlist-card {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px; border-radius: 14px; background: rgba(16,26,42,0.78);
  border: 1px solid var(--line-soft);
}
.playlist-card h3, .playlist-card p { margin: 0; }
.playlist-card p { color: var(--muted); }
.playlist-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.playlist-edit-panel {
  display: grid; grid-template-columns: minmax(240px, 1fr) minmax(220px, 0.7fr); gap: 12px;
  margin: 16px 0 20px;
}
.playlist-rename-form,
.playlist-delete-form {
  padding: 14px; border-radius: 14px; background: rgba(16,26,42,0.78); border: 1px solid var(--line-soft);
}
.playlist-delete-form { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.playlist-delete-form p { margin: 0; }
.danger-button,
.danger-link {
  border: 1px solid rgba(248,113,113,0.35); background: rgba(127,29,29,0.26); color: #fecaca;
  border-radius: 999px; padding: 8px 12px; cursor: pointer; font-weight: 750;
}
.danger-link { padding: 6px 10px; font-size: 0.78rem; }
.inline-delete-form { margin: 0; }
.track-playlist-add-form { justify-content: flex-end; flex-wrap: nowrap; }
.track-playlist-add-form label.sr-only { flex-basis: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.sidebar-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; }
.sidebar-list li { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.78rem; }
.sidebar-list a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.ghost-button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line-soft); color: var(--accent);
  background: rgba(6, 13, 25, 0.38); font-weight: 750;
}
.track-list {
  list-style: none; margin: 0; padding: 0;
  border: 1px solid var(--line-soft); border-radius: 14px;
  overflow: hidden; background: rgba(16, 26, 42, 0.72);
}
.track-list li {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center; gap: 10px;
  min-height: 42px; padding: 8px 12px;
  border-top: 1px solid var(--line-soft);
}
.track-list li:first-child { border-top: 0; }
.album-tracks li { grid-template-columns: 32px 44px minmax(0, 1.2fr) minmax(110px, 0.8fr) auto; }
.track-number, .track-meta, .track-artist { color: var(--muted); font-size: 0.78rem; }
.track-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.track-artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-button {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 999px;
  background: rgba(103, 232, 249, 0.12); color: var(--accent);
  border: 1px solid rgba(103, 232, 249, 0.24); font-size: 0.72rem;
}
.play-button:hover, .play-button.is-playing { background: rgba(103, 232, 249, 0.2); }
.album-player {
  position: fixed;
  left: 310px;
  right: 284px;
  bottom: 8px;
  height: 72px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(140px, 0.34fr) minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(103, 232, 249, 0.28);
  border-radius: 16px;
  background: rgba(7, 16, 29, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.album-player.is-visible { display: grid; }
.album-player-transport { min-width: 0; }
.transport-left { display: flex; align-items: center; min-width: 0; }
.transport-right { display: flex; justify-content: flex-end; gap: 8px; }
.transport-button {
  display: inline-grid; place-items: center;
  width: 30px; height: 28px; border-radius: 999px;
  border: 1px solid rgba(103, 232, 249, 0.28);
  background: rgba(103, 232, 249, 0.10);
  color: var(--text); cursor: pointer;
}
.transport-button:hover, .transport-button.is-active { background: rgba(103, 232, 249, 0.22); color: var(--accent); }
.album-player audio { width: 100%; height: 34px; }
.album-player-meta { min-width: 0; }
.album-player-meta .eyebrow { margin-bottom: 2px; }
.album-player-meta strong,
.album-player-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.album-player-meta span { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }

.empty-state {
  display: flex; gap: 18px; align-items: center;
  padding: 18px; border-radius: 16px;
  background: rgba(16, 26, 42, 0.72); border: 1px dashed var(--line);
}
.empty-state .album-cover { width: 96px; flex: none; }
.empty-state h3 { margin: 0 0 5px; }
.empty-state p { margin: 0; color: var(--muted); }

.now-playing { text-align: center; }
.now-playing .mini-cover { width: 150px; margin: 12px auto; }
.now-playing strong,
.now-playing span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.now-playing span { color: var(--muted); font-size: 0.82rem; margin-top: 5px; }
.now-playing.has-track .empty-note { color: var(--accent); }
.fake-controls { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.fake-controls span { width: 11px; height: 11px; border-radius: 999px; background: var(--accent); opacity: 0.72; }

@media (max-width: 1180px) {
  body { min-width: 0; }
  .app-shell { grid-template-columns: 260px 1fr; }
  .queue-panel { display: none; }
  .album-player { left: 284px; right: 24px; }
}
