:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #657168;
  --line: #dce4dc;
  --surface: #ffffff;
  --surface-strong: #edf5ee;
  --accent: #2ec27e;
  --accent-dark: #168658;
  --warm: #f2a65a;
  --berry: #c44d75;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 16px;
}

body {
  min-height: 100%;
  margin: 0;
  background: #f4f6f2;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent-dark);
}

.library-page {
  display: grid;
  gap: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.5rem);
  font-weight: 900;
  line-height: .95;
}

h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.upload-button {
  position: relative;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-radius: 8px;
  background: #17201b;
  color: #ffffff;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-button span {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #101611;
}

.library-grid {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(320px, 1fr);
  gap: 18px;
}

.panel,
.library-workspace {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.upload-panel,
.player-panel {
  min-height: 270px;
  padding: 22px;
}

.upload-panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

.upload-panel p,
.empty-player p,
.track-main p,
.info-page p {
  margin: 6px 0 0;
  color: var(--muted);
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-group label,
.search-box label {
  color: #415047;
  font-size: .82rem;
  font-weight: 800;
}

.field-group input,
.search-box input,
.track-editor input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.field-group input:focus,
.search-box input:focus,
.track-editor input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 194, 126, .16);
}

.status {
  margin: 0;
  color: var(--accent-dark);
  font-weight: 750;
}

.player-panel {
  display: grid;
  align-content: space-between;
  gap: 18px;
  background: #17201b;
  color: #ffffff;
}

.now-playing,
.empty-player {
  display: flex;
  align-items: center;
  gap: 18px;
}

.empty-player {
  min-height: 170px;
}

.cover-art {
  width: 126px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    radial-gradient(circle at 72% 18%, rgba(255, 255, 255, .34), transparent 24%),
    linear-gradient(145deg, rgba(46, 194, 126, .96), rgba(242, 166, 90, .82) 58%, rgba(196, 77, 117, .8)),
    #2ec27e;
  color: #101611;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .24);
}

.beat-meter {
  width: 82%;
  height: 62%;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 5px;
}

.beat-meter span {
  --level: 14%;
  width: 7px;
  height: var(--level);
  min-height: 10px;
  border-radius: 999px;
  background: rgba(16, 22, 17, .86);
  box-shadow: 0 0 18px rgba(255, 255, 255, .22);
  transition: height 70ms linear;
}

.beat-meter.idle span {
  animation: idle-meter 1.4s ease-in-out infinite alternate;
}

.beat-meter.idle span:nth-child(3n) {
  animation-delay: .16s;
}

.beat-meter.idle span:nth-child(3n + 1) {
  animation-delay: .32s;
}

@keyframes idle-meter {
  from {
    height: 16%;
  }

  to {
    height: 54%;
  }
}

.player-panel audio {
  width: 100%;
  min-height: 42px;
}

.audio-stack {
  position: relative;
}

.audio-player.active {
  display: block;
}

.audio-player.inactive {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.playback-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.shuffle-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #101611;
  font-weight: 850;
}

.transport-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  color: #ffffff;
  font-weight: 800;
}

.transport-button:hover {
  background: rgba(255, 255, 255, .14);
}

.shuffle-button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.transport-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.loop-toggle {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  color: #eef6ef;
  font-weight: 800;
}

.loop-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.queue-status {
  margin: -6px 0 0;
  color: #cbd6ce;
  font-size: .86rem;
  font-weight: 700;
}

.lyrics-panel {
  max-height: 240px;
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
}

.lyrics-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.lyrics-heading span {
  color: #cbd6ce;
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.lyrics-panel pre {
  margin: 0;
  color: #f5fbf6;
  font: inherit;
  line-height: 1.6;
  white-space: pre-wrap;
}

.lyrics-panel p {
  margin: 0;
  color: #cbd6ce;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-row span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: #31513f;
  font-size: .78rem;
  font-weight: 800;
}

.player-panel .tag-row span {
  background: rgba(255, 255, 255, .12);
  color: #e8f1ea;
}

.library-workspace {
  overflow: hidden;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.search-box {
  display: grid;
  gap: 7px;
}

.category-strip {
  display: flex;
  align-items: end;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 1px;
}

.category-strip button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #344339;
  font-weight: 800;
  white-space: nowrap;
}

.category-strip button.active,
.category-strip button:hover {
  border-color: #17201b;
  background: #17201b;
  color: #ffffff;
}

.track-list {
  display: grid;
}

.track-row {
  display: grid;
  grid-template-columns: 46px minmax(180px, 1fr) minmax(115px, auto) minmax(220px, 300px);
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

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

.track-row.selected {
  background: #f0f8f0;
}

.play-select {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #17201b;
  color: #ffffff;
}

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

.track-main p {
  margin-bottom: 8px;
}

.track-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 700;
  white-space: nowrap;
}

.track-editor {
  display: grid;
  gap: 10px;
}

.track-editor label {
  display: grid;
  gap: 5px;
  color: #415047;
  font-size: .78rem;
  font-weight: 800;
}

.empty-state,
.info-page {
  padding: 42px;
}

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

.info-page {
  max-width: 760px;
}

code {
  color: var(--berry);
}

@media (max-width: 1120px) {
  .library-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .track-row {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .track-meta,
  .track-editor {
    grid-column: 2;
    justify-items: start;
  }

  .track-editor {
    width: min(100%, 420px);
  }
}

@media (max-width: 640px) {
  .topbar,
  .now-playing,
  .empty-player {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-button {
    justify-content: center;
    width: 100%;
  }

  .cover-art {
    width: 100%;
    max-width: 220px;
  }

  .track-row {
    padding: 14px;
  }
}
