:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #101114;
  color: #f5f5f5;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 75% 15%, rgb(44 109 80 / 20%), transparent 42%),
    #101114;
}

.shell {
  width: min(100% - 2rem, 68rem);
  margin: 0 auto;
  padding: 2rem 0;
}

.shell--narrow {
  max-width: 34rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-name {
  color: inherit;
  font-size: 1.25rem;
  font-weight: 750;
  text-decoration: none;
}

.brand h1 {
  margin: 0;
  font-size: 1.25rem;
}

.panel {
  margin: 12vh auto 0;
  padding: clamp(1.5rem, 6vw, 3rem);
  border: 1px solid #2c2e34;
  border-radius: 1.5rem;
  background: #191a1e;
}

.panel h2,
.track-list h2 {
  margin: 0.5rem 0 1.5rem;
  font-size: 1.8rem;
}

.panel form {
  display: grid;
  gap: 0.8rem;
}

.panel label {
  margin-top: 0.5rem;
  color: #d3d4d8;
}

.panel input,
.upload-form input[type="file"] {
  width: 100%;
  min-width: 0;
}

.panel input {
  padding: 0.8rem;
  border: 1px solid #42444c;
  border-radius: 0.6rem;
  background: #101114;
  color: inherit;
  font: inherit;
}

button,
.file-picker {
  border: 0;
  border-radius: 999px;
  background: #35c77b;
  color: #101114;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  padding: 0.7rem 1rem;
}

.panel button {
  margin-top: 0.8rem;
}

.form-error {
  border: 1px solid #a34a55;
  border-radius: 0.6rem;
  color: #ffb8bf;
  padding: 0.75rem;
}

.library-page {
  padding-bottom: 8rem;
}

.topbar,
.account,
.source-nav,
.library-heading,
.upload-form,
.track-row,
.player-bar {
  display: flex;
  align-items: center;
}

.topbar,
.library-heading {
  justify-content: space-between;
  gap: 1rem;
}

.topbar {
  min-height: 3rem;
}

.topbar a {
  text-decoration: none;
}

.account {
  gap: 1rem;
}

.source-nav {
  gap: 0.4rem;
  margin-right: auto;
  margin-left: 1.5rem;
}

.source-nav a {
  border-radius: 999px;
  color: #b6b8bf;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
}

.source-nav a[aria-current="page"] {
  background: #292b31;
  color: #fff;
}

.account form {
  margin: 0;
}

.button--quiet {
  background: #292b31;
  color: #f5f5f5;
}

.library-heading {
  margin: 4rem 0 2.5rem;
  align-items: end;
}

.library-heading h1 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 4rem);
}

.upload-form {
  max-width: 100%;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: end;
}

.upload-form input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.file-picker {
  background: #292b31;
  color: #f5f5f5;
}

.notice {
  border-left: 3px solid #35c77b;
  padding: 0.75rem 1rem;
  background: #191a1e;
}

.track-list h2 {
  font-size: 1.2rem;
}

.track-table {
  border-top: 1px solid #2c2e34;
}

.track-row {
  min-height: 4.75rem;
  gap: 1rem;
  border-bottom: 1px solid #25272c;
  padding: 0.6rem 0.25rem;
}

.cover {
  width: 3.25rem;
  height: 3.25rem;
  flex: 0 0 3.25rem;
  border-radius: 0.4rem;
  object-fit: cover;
}

.cover--empty {
  display: grid;
  place-items: center;
  background: #292b31;
  color: #70dfa3;
  font-size: 1.5rem;
}

.play-track {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 2.5rem;
  padding: 0;
}

.delete-track-form {
  margin: 0;
}

.delete-track-button {
  background: #52282e;
  color: #ffe4e7;
  font-size: 0.85rem;
  padding: 0.55rem 0.8rem;
}

.delete-track-button:hover {
  background: #71343d;
}

.track-info {
  min-width: 0;
  flex: 1;
}

.track-info h3,
.track-info p {
  overflow: hidden;
  margin: 0.15rem 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-info h3 {
  font-size: 1rem;
  font-weight: 650;
}

.track-info p,
.track-album,
.track-duration,
.account-name {
  color: #a7a9b0;
  font-size: 0.9rem;
}

.track-album {
  width: 25%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-duration {
  min-width: 3rem;
  text-align: right;
}

.empty-state {
  color: #b6b8bf;
  padding: 2rem 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.youtube-heading {
  margin-bottom: 1.5rem;
}

.youtube-search {
  display: flex;
  max-width: 42rem;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.youtube-search input {
  min-width: 0;
  flex: 1;
  border: 1px solid #42444c;
  border-radius: 999px;
  background: #191a1e;
  color: inherit;
  font: inherit;
  padding: 0.75rem 1rem;
}

.notice--error {
  border-color: #e48a94;
  color: #ffd2d6;
}

.youtube-results h2 {
  margin: 2rem 0 1rem;
  font-size: 1.2rem;
}

.youtube-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
}

.youtube-card {
  overflow: hidden;
  border: 1px solid #2c2e34;
  border-radius: 0.9rem;
  background: #191a1e;
}

.youtube-thumbnail {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #292b31;
}

.youtube-thumbnail--empty {
  display: grid;
  place-items: center;
  color: #70dfa3;
  font-size: 2rem;
}

.youtube-card-content {
  padding: 0.9rem;
}

.youtube-card h3 {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-size: 1rem;
}

.youtube-channel,
.youtube-duration {
  margin: 0.4rem 0;
  color: #a7a9b0;
  font-size: 0.9rem;
}

.youtube-play {
  margin-top: 0;
}

.youtube-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.youtube-add-reason {
  margin: 0.55rem 0 0;
  color: #a7a9b0;
  font-size: 0.8rem;
}

.embed-unavailable {
  color: #ffb8bf;
  font-size: 0.9rem;
}

.youtube-player-section {
  display: grid;
  grid-template-columns: minmax(12rem, 0.7fr) minmax(20rem, 1.3fr);
  align-items: center;
  gap: 1.5rem;
  margin: 3rem 0 1rem;
  border-top: 1px solid #33353b;
  padding-top: 1.5rem;
}

.youtube-now-playing h2 {
  overflow-wrap: anywhere;
  font-size: 1.25rem;
}

.youtube-now-playing p:last-child {
  color: #a7a9b0;
}

#youtube-watch-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: #70dfa3;
}

#youtube-watch-link[hidden] {
  display: none;
}

.youtube-player-frame {
  width: 100%;
  min-width: 200px;
  aspect-ratio: 16 / 9;
  background: #08090a;
}

.youtube-player-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.player-bar {
  position: fixed;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 5.5rem;
  justify-content: center;
  gap: 2rem;
  border-top: 1px solid #33353b;
  background: rgb(16 17 20 / 96%);
  padding: 0.7rem max(1rem, calc((100vw - 68rem) / 2));
}

.now-playing {
  display: grid;
  width: min(24%, 16rem);
  min-width: 8rem;
  gap: 0.25rem;
}

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

.now-playing span,
.player-status {
  color: #a7a9b0;
  font-size: 0.8rem;
}

.player-bar audio {
  width: min(42rem, 70%);
  height: 2.5rem;
}

.player-status {
  min-width: 7rem;
}

.brand-mark {
  display: grid;
  width: 2.5rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 0.75rem;
  background: #35c77b;
  color: #101114;
  font-weight: 800;
}

.welcome {
  max-width: 42rem;
  margin: clamp(5rem, 18vh, 12rem) auto 0;
  padding: clamp(1.5rem, 6vw, 4rem);
  border: 1px solid #2c2e34;
  border-radius: 1.5rem;
  background: rgb(25 26 30 / 88%);
}

.eyebrow {
  color: #70dfa3;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.welcome h2 {
  margin: 0.75rem 0;
  font-size: clamp(2rem, 7vw, 3.5rem);
  line-height: 1.08;
}

.description {
  max-width: 34rem;
  color: #b6b8bf;
  font-size: 1.05rem;
  line-height: 1.7;
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 1.25rem, 68rem);
    padding-top: 1.25rem;
  }

  .library-heading {
    align-items: start;
    flex-direction: column;
    margin: 3rem 0 2rem;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .source-nav {
    order: 3;
    width: 100%;
    margin: 0;
  }

  .account {
    margin-left: auto;
  }

  .upload-form {
    width: 100%;
    justify-content: start;
  }

  .track-row {
    gap: 0.65rem;
  }

  .delete-track-button {
    padding: 0.5rem 0.65rem;
  }

  .track-album {
    display: none;
  }

  .player-bar {
    flex-wrap: wrap;
    gap: 0.4rem 0.8rem;
    justify-content: space-between;
    padding: 0.65rem;
  }

  .now-playing {
    width: calc(100% - 0.5rem);
    min-width: 0;
  }

  .player-bar audio {
    width: 100%;
  }

  .player-status {
    display: none;
  }

  .youtube-search {
    width: 100%;
  }

  .youtube-player-section {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}
