:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111;
  color: #eee;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #111;
  color: #eee;
}

main {
  width: min(780px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 170px;
}

header {
  margin-bottom: 32px;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 2rem;
  line-height: 1.2;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

button,
input,
select {
  font: inherit;
}

button,
input[type="search"],
select {
  min-height: 36px;
  border: 1px solid #555;
  background: #181818;
  color: #eee;
}

button {
  padding: 6px 10px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #88b38d;
  background: #222;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.track.is-playable:focus-visible {
  outline: 2px solid #88b38d;
  outline-offset: 2px;
}

button:disabled,
input:disabled {
  cursor: default;
  opacity: 0.5;
}

.quiet,
.upload-panel p,
.track-metadata,
.empty,
.player-label,
.timeline span {
  color: #aaa;
}

.quiet {
  max-width: 560px;
  line-height: 1.5;
}

.upload-panel {
  border-top: 1px solid #444;
}

.upload-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
}

.upload-panel p {
  margin-bottom: 0;
  font-size: 0.85rem;
}

.upload-button input[type="file"] {
  max-width: 260px;
  color: #aaa;
  font: inherit;
  font-size: 0.85rem;
}

.upload-button input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: 8px;
  padding: 6px 10px;
  border: 1px solid #555;
  background: #181818;
  color: #eee;
  cursor: pointer;
  font: inherit;
}

.upload-button input[type="file"]::file-selector-button:hover {
  border-color: #88b38d;
  background: #222;
}

.upload-button.is-disabled {
  opacity: 0.5;
}

.status {
  min-height: 40px;
  padding: 10px 0;
  color: #bbb;
  font-size: 0.85rem;
}

.status.error,
.track-state.failed,
.track-error {
  color: #eee;
  font-weight: 700;
}

.library {
  padding-top: 18px;
}

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

#track-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 8px;
  border-top: 1px solid #333;
}

.track.is-playable {
  cursor: pointer;
}

.track.is-playable:hover,
.track.is-playable:focus-visible {
  background: #1b1b1b;
}

.track.is-playing {
  border-left: 3px solid #88b38d;
  background: #1b1b1b;
  padding-left: 5px;
}

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

.track-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  font-size: 0.8rem;
}

.track-state.ready {
  color: #88b38d;
}

.track-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  margin-left: auto;
}

.track-action {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 0.8rem;
}

.track-action.primary,
.toggle-button[aria-pressed="true"] {
  border-color: #88b38d;
  color: #88b38d;
}

.track-action.danger:hover {
  text-decoration: underline;
}

.track-error {
  flex-basis: 100%;
  margin: -4px 0 0;
  overflow-wrap: anywhere;
  font-size: 0.8rem;
  line-height: 1.4;
}

.empty {
  margin: 0;
  padding: 24px 8px;
  border-top: 1px solid #333;
  font-size: 0.9rem;
}

.player {
  position: fixed;
  z-index: 10;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto minmax(240px, 1.5fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 86px;
  padding: 12px max(16px, calc((100vw - 1000px) / 2));
  border-top: 1px solid #555;
  background: #151515;
}

.now-playing {
  min-width: 0;
}

.player-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.75rem;
}

#player-track {
  display: block;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transport,
.timeline,
.player-options {
  display: flex;
  align-items: center;
}

.transport {
  gap: 6px;
}

.icon-button,
.play-button {
  width: 36px;
  min-height: 36px;
  padding: 4px;
}

.icon-button {
  font-size: 1.25rem;
}

.timeline {
  gap: 8px;
}

.timeline span {
  width: 36px;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.timeline span:last-child {
  text-align: right;
}

input[type="range"] {
  accent-color: #88b38d;
  cursor: pointer;
}

#seek {
  min-width: 100px;
  flex: 1;
}

.player-options {
  gap: 8px;
}

.toggle-button {
  min-height: 32px;
  padding: 4px 7px;
  font-size: 0.72rem;
  white-space: nowrap;
}

@media (max-width: 620px) {
  main {
    width: min(100% - 24px, 780px);
    padding: 32px 0 240px;
  }

  .upload-panel,
  .track {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-button input[type="file"] {
    max-width: 100%;
    width: 100%;
  }

  .track-actions {
    margin-left: 0;
  }

  .player {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 10px 12px;
  }

  .timeline,
  .player-options {
    grid-column: 1 / -1;
  }

  .player-options {
    justify-content: space-between;
  }
}

@media (min-width: 621px) and (max-width: 960px) {
  .player {
    grid-template-columns: minmax(150px, 1fr) auto minmax(220px, 1.5fr);
  }

  .player-options {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}
