:root {
  color-scheme: dark;
  --bg: #101216;
  --panel: #171b22;
  --panel-2: #202632;
  --text: #f5f7fb;
  --muted: #a7b0bf;
  --line: #303847;
  --accent: #25c2a0;
  --accent-2: #f2b84b;
  --danger: #ef6f6c;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 3vw, 3.1rem);
  line-height: 1;
}

.status-pill {
  min-width: 88px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
}

.player-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.library-panel,
.now-panel,
.setup-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.library-panel {
  min-height: calc(100vh - 128px);
  padding: 18px;
}

.controls-row {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 1fr;
  gap: 14px;
  align-items: end;
}

.search-box {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c0f14;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
}

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tab,
.text-button,
.main-button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
}

.tab {
  min-height: 42px;
  padding: 0 14px;
}

.tab.is-active,
.main-button {
  border-color: transparent;
  background: var(--accent);
  color: #07120f;
  font-weight: 800;
}

.library-meta {
  padding: 14px 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.album-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12161d;
}

.cover-button {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
}

.cover-img,
.cover-fallback,
.now-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-fallback,
.now-cover {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1d6f68, #263d65 55%, #7d6231);
  color: #f8fbff;
  font-size: 2rem;
  font-weight: 900;
}

.album-info {
  padding: 12px;
}

.album-info h3,
.list-row h3 {
  margin-bottom: 6px;
  font-size: 1rem;
  line-height: 1.2;
}

.album-info p,
.list-row p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--accent);
}

.list-view,
.track-list {
  display: grid;
  gap: 8px;
}

.list-row,
.track-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12161d;
  padding: 12px;
}

.track-row {
  width: 100%;
  color: var(--text);
  text-align: left;
}

.track-row.is-active {
  border-color: var(--accent);
}

.track-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.track-main strong,
.track-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-main span,
.track-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.now-panel {
  position: sticky;
  top: 20px;
  padding: 16px;
}

.now-cover {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 16px;
}

.now-text h2 {
  margin-bottom: 6px;
  font-size: 1.25rem;
  line-height: 1.2;
}

.now-text p:last-child {
  color: var(--muted);
}

audio {
  width: 100%;
  margin: 8px 0 12px;
}

.transport-row {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  margin-bottom: 14px;
}

.main-button,
.icon-button {
  min-height: 42px;
}

.icon-button {
  font-size: 1.6rem;
  line-height: 1;
}

.queue-list {
  display: grid;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.queue-list button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px;
}

.queue-list .is-active button {
  border-color: var(--accent);
  background: rgba(37, 194, 160, 0.08);
}

.queue-list span,
.queue-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-list small {
  color: var(--muted);
}

.empty-view,
.setup-panel {
  padding: 28px;
  color: var(--muted);
}

.setup-panel {
  max-width: 760px;
}

code {
  color: var(--accent-2);
}

@media (max-width: 980px) {
  .player-layout {
    grid-template-columns: 1fr;
  }

  .now-panel {
    position: static;
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 14px;
  }

  .now-cover {
    margin-bottom: 0;
  }

  .now-panel audio,
  .transport-row,
  .queue-list {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding: 14px 0;
  }

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

  .controls-row {
    grid-template-columns: 1fr;
  }

  .tabbar {
    justify-content: flex-start;
  }

  .tab {
    flex: 1 1 calc(50% - 8px);
  }

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

  .library-panel,
  .now-panel {
    padding: 12px;
  }

  .now-panel {
    grid-template-columns: 88px 1fr;
  }
}
