:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-soft: #10141c;
  --surface: #151a24;
  --surface-strong: #1b2230;
  --border: #2a3444;
  --text: #edf1f7;
  --muted: #97a3b6;
  --accent: #62e6c4;
  --accent-strong: #35c7a5;
  --violet: #a78bfa;
  --ok: #62e6c4;
  --player-progress: #ff0033;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="system"] {
  color-scheme: light dark;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(98, 230, 196, 0.14), transparent 60%),
    radial-gradient(800px 500px at 95% 0%, rgba(167, 139, 250, 0.12), transparent 55%),
    var(--bg);
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(42, 52, 68, 0.7);
  background: rgba(11, 13, 18, 0.78);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  color: #06231c;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  font-weight: 900;
  letter-spacing: 0;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.topnav a {
  text-decoration: none;
}

.topnav a:hover {
  color: var(--text);
}

.pill {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page {
  flex: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 4vw, 3rem) 4rem;
}

.hero {
  max-width: 780px;
}

.eyebrow {
  margin: 0 0 0.9rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.7rem, 8vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.lede {
  max-width: 640px;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.7;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: var(--accent-strong);
}

.button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #06231c;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: clamp(3rem, 8vw, 6rem);
}

.card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.card p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--muted);
}

.status.ok {
  color: var(--ok);
}

.status.ok::before {
  background: var(--ok);
  box-shadow: 0 0 12px rgba(98, 230, 196, 0.55);
}

.notice {
  margin-top: 1.5rem;
  padding: 1rem 1.2rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  line-height: 1.6;
}

.notice strong {
  color: var(--text);
}

.error {
  max-width: 680px;
  padding-top: 4rem;
}

.error h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem clamp(1rem, 4vw, 3rem);
  border-top: 1px solid rgba(42, 52, 68, 0.7);
  color: var(--muted);
  font-size: 0.8rem;
}

.mono {
  font-family: var(--mono);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Phase 2: auth, forms, and administration */
.user-chip {
  color: var(--text);
  font-size: 0.85rem;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.link-button:hover {
  color: var(--text);
  text-decoration: underline;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 12rem);
}

.auth-card {
  width: min(30rem, 100%);
  padding: clamp(1.4rem, 4vw, 2.2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.auth-brand {
  margin-bottom: 1.5rem;
}

.auth-card .lede {
  margin-top: 0.8rem;
  font-size: 0.98rem;
}

.form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .check,
.form-grid .button {
  align-self: end;
}

.field {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
}

.input {
  width: 100%;
  min-height: 2.7rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

.input:focus {
  border-color: var(--accent-strong);
  outline: 2px solid rgba(98, 230, 196, 0.25);
  outline-offset: 1px;
}

.input-small {
  width: 10rem;
  min-height: 2rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent-strong);
}

.alert {
  margin-top: 1.2rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  font-size: 0.9rem;
}

.alert.error {
  border-color: rgba(255, 120, 120, 0.45);
  background: rgba(255, 120, 120, 0.08);
  color: #ffb4b4;
}

.alert.ok {
  border-color: rgba(98, 230, 196, 0.4);
  background: rgba(98, 230, 196, 0.08);
  color: var(--accent);
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}

.page-head h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
}

.page-head .lede {
  margin-top: 0.7rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.panel {
  margin-top: 1.5rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel h2 {
  margin: 0;
  font-size: 1.1rem;
}

.panel .form {
  margin-top: 1rem;
}

.table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table tr:last-child td {
  border-bottom: 0;
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.badge {
  display: inline-flex;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge.admin {
  border-color: rgba(167, 139, 250, 0.45);
  color: var(--violet);
}

.badge.ok {
  border-color: rgba(98, 230, 196, 0.45);
  color: var(--accent);
}

.badge.disabled {
  border-color: rgba(255, 120, 120, 0.4);
  color: #ffb4b4;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8rem;
}

button.button {
  cursor: pointer;
  font: inherit;
}

.scan-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 1.25rem 0 0;
}

.scan-summary div {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--bg-soft);
}

.scan-summary dt {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scan-summary dd {
  margin: 0.25rem 0 0;
  font-weight: 650;
}

.error-list {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
  color: #ffb4b4;
  font-size: 0.85rem;
  line-height: 1.5;
}

details summary {
  margin-top: 0.75rem;
  color: var(--accent);
  cursor: pointer;
}

.youtube-link-panel {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--surface);
}

.youtube-link-panel summary {
  margin-top: 0;
}

@media (max-width: 760px) {
  .settings-grid,
  .form-grid,
  .scan-summary {
    grid-template-columns: 1fr;
  }

  .page-head {
    align-items: start;
    flex-direction: column;
  }
}

/* Phase 4: application shell, library browser, and player */
[hidden] {
  display: none !important;
}

.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;
}

.app-body {
  padding-bottom: calc(var(--player-clearance, 5rem) + 0.7rem);
}

.app-shell {
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100vh;
  padding: 1.4rem 1rem;
  border-right: 1px solid var(--border);
  background: rgba(11, 13, 18, 0.82);
  backdrop-filter: blur(18px);
  z-index: 20;
}

.sidebar .brand {
  padding: 0.25rem 0.5rem;
}

.sidebar-nav {
  display: grid;
  gap: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.7rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.nav-link span {
  width: 1.2rem;
  text-align: center;
  color: var(--muted);
}

.nav-link:hover,
.nav-link.active {
  background: var(--surface);
  color: var(--text);
}

.nav-link.active span {
  color: var(--accent);
}

.nav-heading {
  margin: 0.8rem 0.75rem 0.25rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sidebar-admin {
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.sidebar-user strong,
.sidebar-user span {
  display: block;
}

.sidebar-user strong {
  font-size: 0.88rem;
}

.sidebar-user > div > span {
  color: var(--muted);
  font-size: 0.75rem;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(98, 230, 196, 0.25), rgba(167, 139, 250, 0.3));
  color: var(--accent);
  font-weight: 800;
}

.avatar-small {
  width: 1.9rem;
  height: 1.9rem;
  font-size: 0.8rem;
  text-decoration: none;
}

.sidebar-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.78rem;
}

.sidebar-links a {
  color: var(--muted);
  text-decoration: none;
}

.app-content {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4.5rem;
  padding: 0 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 18, 0.65);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 15;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: min(30rem, 100%);
}

.search-input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

.search-input:focus {
  border-color: var(--accent-strong);
  outline: 2px solid rgba(98, 230, 196, 0.2);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.theme-toggle:hover {
  border-color: var(--accent-strong);
  background: var(--surface-strong);
  color: var(--accent);
}

.app-content .page {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 2.2rem 2rem 4rem;
}

.mobile-nav {
  display: none;
}

.section {
  margin-top: 2.5rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.section-link {
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
}

.section-link:hover {
  color: var(--accent);
}

.hero.compact h1 {
  font-size: clamp(2.4rem, 6vw, 4.6rem);
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 1.2rem;
}

.album-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.album-cover {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.85rem;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: transform 140ms ease, border-color 140ms ease;
}

.album-card:hover .album-cover {
  transform: translateY(-3px);
  border-color: var(--accent-strong);
}

.album-name {
  overflow: hidden;
  margin-top: 0.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-artist {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.8rem;
}

.artist-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.artist-card:hover {
  border-color: var(--accent-strong);
}

.artist-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(98, 230, 196, 0.2), rgba(167, 139, 250, 0.25));
  color: var(--accent);
  font-size: 1rem;
  font-weight: 800;
}

.artist-avatar.large {
  width: 7rem;
  height: 7rem;
  font-size: 2.2rem;
}

.artist-card .artist-name {
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artist-card .artist-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artist-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.artist-head h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
}

.album-head {
  display: flex;
  align-items: end;
  gap: 2rem;
  margin-bottom: 1rem;
}

.album-hero-cover {
  width: clamp(10rem, 22vw, 17rem);
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.album-head h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
}

.album-head .lede a {
  color: var(--accent);
  text-decoration: none;
}

.track-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.track-row {
  display: grid;
  grid-template-columns: 2rem 2.6rem minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.track-row:last-child {
  border-bottom: 0;
}

.track-row:hover {
  background: var(--surface-strong);
}

.track-play {
  width: 1.9rem;
  height: 1.9rem;
  color: var(--accent);
}

.track-cover {
  width: 2.4rem;
  height: 2.4rem;
  object-fit: cover;
  border-radius: 0.45rem;
  border: 1px solid var(--border);
}

.track-main {
  min-width: 0;
}

.track-title {
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-meta a {
  color: var(--muted);
  text-decoration: none;
}

.track-meta a:hover {
  color: var(--accent);
}

.track-duration {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.track-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 1.8rem;
  height: 1.8rem;
  padding: 0 0.35rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--border);
  background: var(--bg-soft);
  color: var(--text);
}

.icon-button.active,
.like-button.active,
.dislike-button.active {
  color: var(--accent);
}

.dislike-button.active {
  color: #ffb4b4;
}

.liked-mark {
  color: var(--accent);
}

.player {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(13rem, 1fr) minmax(0, 1.7fr) minmax(12rem, 1fr);
  align-items: center;
  gap: 1.2rem;
  min-height: 4.6rem;
  padding: 0.55rem 1.25rem;
  background: rgba(11, 13, 18, 0.94);
  backdrop-filter: blur(18px);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.25);
}

.player-left,
.player-center,
.player-right {
  display: flex;
  align-items: center;
  min-width: 0;
}

.player-left {
  justify-content: flex-start;
  gap: 0.15rem;
}

.player-center {
  justify-content: center;
  gap: 0.8rem;
}

.player-right {
  justify-content: flex-end;
  gap: 0.35rem;
}

.player-left .icon-button,
.player-right .icon-button {
  width: 2rem;
  height: 2rem;
}

.player-time {
  margin-left: 0.5rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  white-space: nowrap;
}

.player-time-sep {
  margin: 0 0.2rem;
}

.player-cover {
  flex: 0 0 auto;
  width: 2.85rem;
  height: 2.85rem;
  object-fit: cover;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  cursor: pointer;
}

.player-meta {
  min-width: 0;
  text-align: left;
}

.player-title-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.player-title {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.player-artist {
  display: block;
  overflow: hidden;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-track-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.05rem;
  margin-left: 0.2rem;
}

.player-track-actions .icon-button {
  width: 1.9rem;
  height: 1.9rem;
  color: var(--text);
  opacity: 0.72;
}

.player-track-actions .icon-button:hover,
.player-track-actions .icon-button.active {
  opacity: 1;
}

.player-thumb svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
}

.player-thumb.down svg {
  transform: rotate(180deg);
  transform-origin: center;
}

.player-thumb.down.active {
  color: #ff8d8d;
}

.player-play {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 1.2rem;
  box-shadow: none;
}

.player-play:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.player-volume {
  display: flex;
  align-items: center;
}

.volume-popover {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  width: 0;
  overflow: hidden;
  opacity: 0;
  transition: width 160ms ease, opacity 160ms ease;
}

.player-volume:hover .volume-popover,
.player-volume:focus-within .volume-popover {
  width: 7.8rem;
  opacity: 1;
}

.range {
  width: 100%;
  accent-color: var(--accent-strong);
}

.volume {
  width: 5rem;
}

.volume-label {
  min-width: 2.3rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  text-align: right;
}

.volume-label.low {
  color: #e6a23c;
}

.player-expand {
  color: var(--muted);
}

.player-expand:hover,
.player-expand.active {
  color: var(--accent);
}

.player-seek-wrap {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 2;
  height: 14px;
}

.player-seek-track {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  overflow: hidden;
  background: var(--border);
}

.player-seek-fill {
  position: relative;
  width: 0;
  height: 100%;
  background: var(--player-progress, #ff0033);
  transition: width 120ms linear;
}

.player-seek-fill::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--player-progress, #ff0033);
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 120ms ease;
}

.player-seek-wrap:hover .player-seek-fill::after,
.player-seek-wrap:focus-within .player-seek-fill::after {
  opacity: 1;
}

.player-seek {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.player-seek-wrap:focus-within .player-seek-track {
  box-shadow: 0 0 0 2px rgba(255, 0, 51, 0.3);
}

.now-playing {
  position: fixed;
  top: 0;
  right: 0;
  bottom: var(--player-clearance, 5rem);
  left: 0;
  z-index: 46;
  overflow: hidden;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.now-playing::before {
  content: "";
  position: absolute;
  inset: -12%;
  background-image: var(--now-cover, none);
  background-position: center;
  background-size: cover;
  filter: blur(90px) saturate(1.25);
  opacity: 0.2;
  pointer-events: none;
  transform: scale(1.12);
}

.now-playing::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 13, 18, 0.28), rgba(11, 13, 18, 0.88));
  pointer-events: none;
}

body.now-playing-open {
  overflow: hidden;
}

.now-playing-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: clamp(1rem, 2.4vw, 2rem) clamp(1.1rem, 3vw, 3rem);
}

.now-playing-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.now-playing-close {
  flex: 0 0 auto;
  color: var(--muted);
}

.now-playing-kicker {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.now-playing-kicker span {
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.now-playing-kicker strong {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.now-playing-layout {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 24rem);
  gap: clamp(1.5rem, 4vw, 4rem);
  min-height: 0;
  padding-top: 1rem;
}

.now-playing-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  min-width: 0;
}

.now-playing-artwork {
  position: relative;
  width: min(78vh, 60vw, 45rem);
  max-width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.now-playing-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.now-playing-meta {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  max-width: none;
  padding: 3rem 1.5rem 1.3rem;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.82));
  color: #fff;
  text-align: left;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.now-playing-title {
  display: block;
  overflow: hidden;
  color: #fff;
  font-size: clamp(1.35rem, 2.4vw, 2.1rem);
  font-weight: 800;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-playing-artist {
  margin: 0.3rem 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
}

.now-playing-badges {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.now-playing-album {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
  text-decoration: none;
}

.now-playing-album:hover {
  color: #fff;
}

.now-playing-queue {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-left: clamp(1rem, 2vw, 1.5rem);
  border-left: 1px solid var(--border);
}

.now-playing-queue-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.now-playing-queue-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.now-playing-queue-head span {
  color: var(--muted);
  font-size: 0.7rem;
}

.now-playing-queue-tools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.now-playing-queue-tools .queue-autoplay {
  padding: 0;
  font-size: 0.68rem;
}

.queue-list.now-queue-list {
  gap: 1px;
}

.now-queue-list {
  flex: 1;
  align-content: start;
  overflow-y: auto;
  margin-top: 0.25rem;
  padding-right: 0.15rem;
}

.now-queue-list .queue-play {
  gap: 0.5rem;
  padding: 0.3rem 0.45rem;
}

.now-queue-list .queue-cover {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.28rem;
}

.now-queue-list .queue-index {
  font-size: 0.64rem;
}

.now-queue-list .queue-meta strong {
  font-size: 0.8rem;
  line-height: 1.2;
}

.now-queue-list .queue-meta span {
  font-size: 0.66rem;
  line-height: 1.2;
}

.now-queue-list .queue-remove {
  width: 1.8rem;
  height: 1.8rem;
}

.queue-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: var(--player-clearance, 5rem);
  z-index: 45;
  width: min(24rem, 92vw);
  padding: 1rem;
  border-left: 1px solid var(--border);
  background: var(--bg-soft);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.35);
  overflow-y: auto;
}

.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.queue-head h2 {
  margin: 0;
  font-size: 1rem;
}

.queue-head > div {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.queue-list {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 0.6rem;
}

.queue-item.current {
  background: var(--surface-strong);
}

.queue-play {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  padding: 0.55rem 0.6rem;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.queue-index {
  flex: 0 0 1rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  text-align: right;
}

.queue-cover {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: var(--surface-strong);
}

.queue-meta {
  min-width: 0;
}

.queue-meta strong,
.queue-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-meta strong {
  font-size: 0.78rem;
}

.queue-meta span {
  color: var(--muted);
  font-size: 0.7rem;
}

.queue-remove {
  flex: 0 0 auto;
}

.dialog {
  width: min(25rem, 92vw);
  padding: 1.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.dialog h2 {
  margin-top: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 6rem;
  z-index: 70;
  max-width: min(22rem, 90vw);
  padding: 0.7rem 1rem;
  border: 1px solid rgba(98, 230, 196, 0.35);
  border-radius: 0.7rem;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.85rem;
  box-shadow: var(--shadow);
}

.sort-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sort-links a {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  text-decoration: none;
}

.sort-links a.active,
.sort-links a:hover {
  border-color: var(--accent-strong);
  color: var(--accent);
}

.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.8rem;
}

.playlist-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.playlist-card:hover {
  border-color: var(--accent-strong);
}

.playlist-icon {
  color: var(--accent);
  font-size: 1.2rem;
}

.playlist-name {
  font-weight: 700;
}

.playlist-meta,
.playlist-description {
  color: var(--muted);
  font-size: 0.75rem;
}

.playlist-description {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 2rem;
}

.empty-state {
  margin-top: 2rem;
  padding: clamp(2rem, 6vw, 4rem);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.empty-state h2 {
  margin-top: 0;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.empty-state a {
  color: var(--accent);
}

.public-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.public-shell .auth-shell {
  width: 100%;
}

.danger,
.link-button.danger {
  color: #ffb4b4;
}

.search-page-form {
  width: 100%;
  margin-top: 1.5rem;
}

.search-status {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.search-add-list {
  margin-top: 1rem;
}

@media (max-width: 1000px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    padding: 0 1rem;
  }

  .app-content .page {
    padding: 1.4rem 1rem 6.5rem;
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 0.35rem 0.35rem 0.5rem;
    border-top: 1px solid var(--border);
    background: rgba(11, 13, 18, 0.96);
    backdrop-filter: blur(18px);
  }

  .mobile-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.4rem 0.2rem;
    border-radius: 0.5rem;
    color: var(--muted);
    font-size: 0.65rem;
    text-decoration: none;
  }

  .mobile-nav a span {
    font-size: 1rem;
  }

  .mobile-nav a.active {
    color: var(--accent);
    background: var(--surface);
  }

  .player {
    bottom: 4.1rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.35rem;
    min-height: 4.6rem;
    padding: 0.5rem 0.55rem;
  }

  .player-left .icon-button {
    width: 1.8rem;
    height: 1.8rem;
  }

  .player-play {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 1.05rem;
  }

  .player-time,
  .player-track-actions,
  .player-volume,
  #player-repeat,
  #player-shuffle {
    display: none;
  }

  .player-center {
    justify-content: flex-start;
    gap: 0.55rem;
  }

  .player-cover {
    width: 2.45rem;
    height: 2.45rem;
  }

  .player-title {
    font-size: 0.82rem;
  }

  .player-artist {
    font-size: 0.68rem;
  }

  .player-right {
    gap: 0.15rem;
  }

  .queue-drawer {
    bottom: var(--player-clearance, 9.1rem);
  }

  .now-playing {
    bottom: var(--player-clearance, 9.1rem);
  }

  .album-head {
    align-items: start;
    flex-direction: column;
    gap: 1rem;
  }

  .album-hero-cover {
    width: 12rem;
  }

  .track-row {
    grid-template-columns: 1.8rem 2.2rem minmax(0, 1fr) auto;
    gap: 0.4rem;
    padding: 0.5rem;
  }

  .track-duration {
    display: none;
  }

  .track-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-left: 4.4rem;
  }

  .toast {
    bottom: 9.5rem;
  }
}

@media (max-width: 820px) {
  .now-playing {
    overflow-y: auto;
  }

  .now-playing-inner {
    height: auto;
    min-height: 100%;
  }

  .now-playing-layout {
    grid-template-columns: 1fr;
    gap: 1.4rem;
  }

  .now-playing-main {
    justify-content: flex-start;
  }

  .now-playing-artwork {
    width: min(88vw, 24rem);
  }

  .now-playing-queue {
    min-height: 16rem;
    padding-top: 1rem;
    padding-left: 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

@media (max-width: 600px) {
  .now-playing-artwork {
    width: min(92vw, 23rem);
  }

  .now-playing-meta {
    padding: 2rem 1rem 1rem;
  }

  .now-playing-title {
    font-size: 1.3rem;
  }

  .now-playing-artist {
    font-size: 0.82rem;
  }
}

@media (prefers-color-scheme: light) {
  html[data-theme="system"] {
    --bg: #f5f7fb;
    --bg-soft: #eef2f8;
    --surface: #ffffff;
    --surface-strong: #e9eef6;
    --border: #d5dce8;
    --text: #172033;
    --muted: #66738a;
    --accent: #087f68;
    --accent-strong: #0aa184;
    --violet: #6d4fc4;
    --player-progress: #d70022;
    --shadow: 0 18px 50px rgba(20, 32, 55, 0.12);
  }

  html[data-theme="system"] body {
    background:
      radial-gradient(900px 500px at 12% -10%, rgba(98, 230, 196, 0.2), transparent 60%),
      radial-gradient(800px 500px at 95% 0%, rgba(167, 139, 250, 0.14), transparent 55%),
      var(--bg);
  }

  html[data-theme="system"] .sidebar,
  html[data-theme="system"] .topbar,
  html[data-theme="system"] .player,
  html[data-theme="system"] .mobile-nav {
    background: rgba(245, 247, 251, 0.9);
  }

  html[data-theme="system"] .now-playing::after {
    background: linear-gradient(180deg, rgba(245, 247, 251, 0.45), rgba(245, 247, 251, 0.94));
  }
}

html[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-soft: #eef2f8;
  --surface: #ffffff;
  --surface-strong: #e9eef6;
  --border: #d5dce8;
  --text: #172033;
  --muted: #66738a;
  --accent: #087f68;
  --accent-strong: #0aa184;
  --violet: #6d4fc4;
  --player-progress: #d70022;
  --shadow: 0 18px 50px rgba(20, 32, 55, 0.12);
}

html[data-theme="light"] body {
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(98, 230, 196, 0.2), transparent 60%),
    radial-gradient(800px 500px at 95% 0%, rgba(167, 139, 250, 0.14), transparent 55%),
    var(--bg);
}

html[data-theme="light"] .sidebar,
html[data-theme="light"] .topbar,
html[data-theme="light"] .player,
html[data-theme="light"] .mobile-nav {
  background: rgba(245, 247, 251, 0.9);
}

html[data-theme="light"] .now-playing::after {
  background: linear-gradient(180deg, rgba(245, 247, 251, 0.45), rgba(245, 247, 251, 0.94));
}
/* Phase 6: visual polish and YouTube Music surfaces */
:root {
  --accent-soft: rgba(98, 230, 196, 0.14);
  --danger: #ff8d8d;
  --radius-sm: 0.7rem;
}

html[data-theme="light"] {
  --accent-soft: rgba(8, 127, 104, 0.1);
  --danger: #b42318;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
.hero h1 {
  font-size: clamp(2.35rem, 6.4vw, 4.7rem);
}

.hero.compact h1 {
  font-size: clamp(2.1rem, 5vw, 3.8rem);
}

.lede {
  max-width: 58ch;
}

.brand-mark {
  background: linear-gradient(135deg, #7bf3d5, #bda9ff);
  color: #041b17;
  box-shadow: 0 6px 18px rgba(53, 199, 165, 0.28);
}

.sidebar {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface) 72%, transparent),
    color-mix(in srgb, var(--bg) 94%, transparent)
  );
}

.nav-link {
  position: relative;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}

.nav-link:hover {
  transform: translateX(2px);
}

.nav-link.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

html[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #ffffff, #eef2f8);
}

html[data-theme="light"] .button.primary {
  color: #ffffff;
}

@media (prefers-color-scheme: light) {
  html[data-theme="system"] .button.primary {
    color: #ffffff;
  }
}

html[data-theme="light"] .nav-link.active {
  background: #ffffff;
  box-shadow: inset 3px 0 0 var(--accent), 0 8px 22px rgba(20, 32, 55, 0.07);
}

.topbar {
  height: 4.2rem;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
}

.search-input {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.search-input:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--accent));
}

.search-input:focus {
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
  outline: 0;
}

.page-head {
  margin-bottom: 0.4rem;
}

.section {
  margin-top: clamp(2rem, 4vw, 3rem);
}

.section-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.section-head h2::before {
  content: "";
  width: 0.28rem;
  height: 1.05rem;
  border-radius: 999px;
  background: linear-gradient(var(--accent), var(--violet));
}

.album-grid {
  gap: 1.35rem;
}

.album-cover {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.album-card:hover .album-cover {
  transform: translateY(-4px) scale(1.015);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.3);
}

html[data-theme="light"] .album-cover {
  box-shadow: 0 14px 28px rgba(20, 32, 55, 0.12);
}

.artist-card,
.playlist-card {
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.artist-card:hover,
.playlist-card:hover {
  transform: translateY(-2px);
  background: var(--surface-strong);
}

.track-list {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .track-list {
  box-shadow: 0 12px 24px rgba(20, 32, 55, 0.06);
}

.track-row {
  padding: 0.6rem 0.9rem;
  transition: background 100ms ease;
}

.track-actions {
  opacity: 0.72;
  transition: opacity 100ms ease;
}

.track-row:hover .track-actions,
.track-row:focus-within .track-actions {
  opacity: 1;
}

@media (hover: none) {
  .track-actions {
    opacity: 1;
  }
}

.track-row.youtube-row {
  background: linear-gradient(90deg, rgba(255, 0, 0, 0.045), transparent 40%);
}

.source-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.38rem;
  border-radius: 0.35rem;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: middle;
}

.source-badge.yt {
  background: #ff0033;
  color: #fff;
}

.source-badge.auto,
.source-badge.local {
  background: rgba(98, 230, 196, 0.16);
  color: var(--accent);
  border: 1px solid rgba(98, 230, 196, 0.4);
}

.album-card-wrap {
  position: relative;
  display: flex;
  min-width: 0;
}

.album-card-wrap .album-card {
  flex: 1;
}

.album-local {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1;
}

.queue-note {
  margin: -0.2rem 0 0.8rem;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.queue-autoplay {
  min-height: auto;
  padding: 0.25rem 0.5rem;
  border: none;
  background: transparent;
  font-size: 0.72rem;
}

.badge.yt {
  border-color: rgba(255, 0, 51, 0.45);
  color: #ff5c7c;
}

.youtube-section {
  padding: clamp(1rem, 3vw, 1.4rem);
  border: 1px solid color-mix(in srgb, var(--border) 70%, #ff0033);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 0, 51, 0.06), transparent 55%),
    var(--surface);
}

.youtube-section .track-list {
  box-shadow: none;
}

.empty-inline {
  margin: 0.9rem 0 0;
}

.button-row,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.panel-heading h2 {
  margin: 0;
}

.panel-heading {
  margin-bottom: 0.6rem;
}

.button.danger {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
}

.button.danger:hover {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.button-row {
  justify-content: flex-start;
  margin-top: 1rem;
}

.settings-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.settings-form {
  gap: 1.2rem;
}

.check.compact {
  min-height: 2.7rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--bg);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tool-summary .mono {
  font-size: 0.74rem;
  word-break: break-all;
}

.alert {
  animation: alert-in 180ms ease-out;
}

@keyframes alert-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.player {
  border-top-color: color-mix(in srgb, var(--border) 80%, var(--accent));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

html[data-theme="light"] .player {
  background: color-mix(in srgb, #ffffff 90%, transparent);
}

@media (max-width: 760px) {
  .settings-fields {
    grid-template-columns: 1fr;
  }

  .section-head h2::before {
    height: 0.9rem;
  }

  .track-actions {
    opacity: 1;
  }

  .youtube-section .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }
}

.input[type="file"] {
  padding: 0.45rem;
}

.input::file-selector-button {
  margin-right: 0.7rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.input::file-selector-button:hover {
  border-color: var(--accent-strong);
}

@media (prefers-reduced-motion: reduce) {
  .alert {
    animation: none;
  }
}

.cache-table td:first-child {
  min-width: 15rem;
}

.cache-table td:first-child strong,
.cache-table td:first-child .muted,
.cache-table td:first-child .mono {
  display: block;
}

.cache-table td:first-child .mono {
  font-size: 0.72rem;
}

.cache-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.button.small {
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
}

.cache-summary {
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

.source-badge.cached {
  border-color: rgba(98, 230, 196, 0.4);
  color: var(--accent);
}

/* Phase 9: admin dashboard and operations */
.admin-warning-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(230, 162, 60, 0.45);
  border-radius: 0.7rem;
  background: rgba(230, 162, 60, 0.1);
  color: #f0c674;
  font-size: 0.8rem;
}

.admin-warning-banner strong {
  color: #ffd28a;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.8rem;
  margin: 1.5rem 0;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
}

.stat-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.3rem;
  line-height: 1.2;
}

.stat-note {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.stat-link {
  margin-top: 0.3rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
}

.stat-link:hover {
  text-decoration: underline;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.play-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  height: 12rem;
  padding-top: 1rem;
}

.play-bar-wrap {
  display: grid;
  flex: 1;
  grid-template-rows: auto 1fr auto;
  align-items: end;
  gap: 0.3rem;
  height: 100%;
  text-align: center;
}

.play-bar-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.play-bar-track {
  display: flex;
  align-items: flex-end;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 0.35rem 0.35rem 0 0;
  background: color-mix(in srgb, var(--surface-strong) 65%, transparent);
}

.play-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 0.35rem 0.35rem 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.play-bar-label {
  color: var(--muted);
  font-size: 0.62rem;
}

.compact-table td {
  vertical-align: top;
}

.compact-table td .muted {
  display: block;
  font-size: 0.72rem;
}

.warning-panel {
  border-color: rgba(230, 162, 60, 0.4);
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.filter-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.log-view {
  max-height: 28rem;
  overflow: auto;
  margin: 0;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.job-track .muted {
  display: block;
  font-size: 0.72rem;
}

/* Player icon system */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  display: block;
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
  fill: currentColor;
  pointer-events: none;
}

.player-left .icon-button,
.player-right .icon-button {
  width: 2.2rem;
  height: 2.2rem;
}

.player-left .icon-button .icon {
  width: 1.28rem;
  height: 1.28rem;
}

.player-left .player-play {
  width: 2.85rem;
  height: 2.85rem;
}

.player-left .player-play .icon {
  width: 1.62rem;
  height: 1.62rem;
}

.player-right .icon-button .icon {
  width: 1.18rem;
  height: 1.18rem;
}

.player-expand .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.now-playing-close .icon {
  width: 1.2rem;
  height: 1.2rem;
}

.player-thumb svg {
  width: 1.12rem;
  height: 1.12rem;
}

@media (max-width: 1000px) {
  .player-left .player-play {
    width: 2.35rem;
    height: 2.35rem;
  }

  .player-left .player-play .icon {
    width: 1.4rem;
    height: 1.4rem;
  }

  .player-left .icon-button .icon {
    width: 1.15rem;
    height: 1.15rem;
  }
}
