html {
  background: black;
  color: white;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;

  --close-button-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' width='30px' height='30px'%3E%3Cpath fill='%23fff' d='M 7.71875 6.28125 L 6.28125 7.71875 L 23.5625 25 L 6.28125 42.28125 L 7.71875 43.71875 L 25 26.4375 L 42.28125 43.71875 L 43.71875 42.28125 L 26.4375 25 L 43.71875 7.71875 L 42.28125 6.28125 L 25 23.5625 Z'/%3E%3C/svg%3E");
  --share-button-url: url("data:image/svg+xml,%3Csvg width='30px' height='30px' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke='%23fff' stroke-width='1' stroke-linecap='square' stroke-linejoin='miter' fill='none' color='%23fff'%3E%3Cpath d='M12 14V6'/%3E%3Cpath d='M9 8L12 5L15 8'/%3E%3Cpath d='M5 13V18H19V13'/%3E%3C/svg%3E");
  --download-button-url: url("data:image/svg+xml,%3Csvg width='30px' height='30px' viewBox='0 0 24 24' role='img' xmlns='http://www.w3.org/2000/svg' stroke='%23fff' stroke-width='1' stroke-linecap='square' stroke-linejoin='miter' fill='none' color='%23fff'%3E%3Cpath d='M12,3 L12,16'/%3E%3Cpolyline points='7 12 12 17 17 12'/%3E%3Cpath d='M20,21 L4,21'/%3E%3C/svg%3E");
  --delete-button-url: url("data:image/svg+xml,%3Csvg width='30px' height='30px' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke='%23fff' stroke-width='1' stroke-linecap='square' stroke-linejoin='miter' fill='none' color='%23fff'%3E%3Cpath d='M19 6L5 6M14 5L10 5M6 10L6 20C6 20.6666667 6.33333333 21 7 21 7.66666667 21 11 21 17 21 17.6666667 21 18 20.6666667 18 20 18 19.3333333 18 16 18 10'/%3E%3C/svg%3E");
}

body {
  min-width: 300px;
  margin: 0;
}

.header {
  position: sticky;
  top: 0;
  background: #000;
  margin: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr minmax(10px, 300px) auto;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  margin: 0 20px 0 0;
  white-space: nowrap;
  font-weight: 500;
  line-height: 30px;
}

.header-buttons button {
  margin-left: 10px;
}

@media (width < 500px) {
  .header h1 {
    font-size: 12pt;
  }
}

.header input {
  width: 100%;
  max-width: 300px;
  line-height: 2;
  border-radius: 100px;
  padding: 0 15px;
}

.header input::-webkit-search-cancel-button {
  width: 24px;
  height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg width='24px' height='24px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12ZM7.29289 16.7071C6.90237 16.3166 6.90237 15.6834 7.29289 15.2929L10.5858 12L7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289C7.68342 6.90237 8.31658 6.90237 8.70711 7.29289L12 10.5858L15.2929 7.29289C15.6834 6.90237 16.3166 6.90237 16.7071 7.29289C17.0976 7.68342 17.0976 8.31658 16.7071 8.70711L13.4142 12L16.7071 15.2929C17.0976 15.6834 17.0976 16.3166 16.7071 16.7071C16.3166 17.0976 15.6834 17.0976 15.2929 16.7071L12 13.4142L8.70711 16.7071C8.31658 17.0976 7.68342 17.0976 7.29289 16.7071Z' fill='%23222222'/%3E%3C/svg%3E");
  display: inline-block;
  position: relative;
  right: -15px;
}

.album {
  cursor: pointer;
  background: #111;
  outline: 1px solid #333;
}

.album:hover {
  background: #222;
}

.album-playing {
  background: #333;
}

.album-playing:hover {
  background: #444;
}

.album-artists {
  color: #888;
  font-size: 10pt;
}

.album-artists,
.album-name,
.album-tags {
  margin: 10px;
}

.tag {
  display: inline-block;
  font-size: 10pt;
  color: #888;
  background: #333;
  padding: 2px 4px;
  border-radius: 4px;
}

@media (width < 760px) {
  .albums {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 1px 10px 11px;
  }

  .album {
    display: flex;
    width: calc(100vw - 20px);
  }

  .album-cover {
    width: 100px;
    height: 100px;
  }
}

@media (width >= 760px) {
  .albums {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 20px;
    margin: 1px 20px 21px;
  }

  .album {
    min-width: 200px;
    max-width: 350px;
    width: calc(100vw - 40px);
  }

  .album-cover {
    min-width: 200px;
    min-height: 200px;
    max-width: 350px;
    max-height: 350px;
    width: calc(100vw - 40px);
    height: calc(100vw - 40px);
  }
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: black;
}

.popup-content {
  display: grid;
  align-items: stretch;
}

.popup-image {
  display: block;
}

.popup-player-loading .popup-controls,
.popup-player-loading .popup-range {
  pointer-events: none;
  animation: loading 0.6s linear infinite;
}

@keyframes loading {
  from {
    opacity: 0.3;
  }

  50% {
    opacity: 0.5;
  }

  to {
    opacity: 0.3;
  }
}

.popup-actions-loading {
  pointer-events: none;
  animation: loading 0.6s linear infinite;
}

.popup-actions .delete-button,
.popup-actions .download-button,
.popup-actions .share-button {
  margin-right: 10px;
}

@media (width < 500px) {
  .popup {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
  }

  .popup-actions {
    position: absolute;
    right: 10px;
    top: 10px;
  }

  .popup-actions button {
    mix-blend-mode: difference;
    background: none;
  }

  .popup-actions .close-button {
    mask: var(--close-button-url);
    background: white;
  }

  .popup-actions .share-button {
    mask: var(--share-button-url);
    background: white;
  }

  .popup-actions .download-button {
    mask: var(--download-button-url);
    background: white;
  }

  .popup-actions .delete-button {
    mask: var(--delete-button-url);
    background: white;
  }

  .popup-content {
    height: calc(100vh);
    height: calc(100dvh);
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  .popup-image {
    width: 100vw;
    height: 100vw;
  }

  .popup-player {
    padding: 10px;
  }

  .popup-playlist {
    padding: 0 10px 10px 10px;
  }
}

@media (width < 500px) and (height < 650px) {
  .popup-overlay {
    overflow-y: scroll;
  }

  .popup {
    height: auto;
    position: relative;
    transform: none;
    margin: 0 auto;
    top: 0;
    left: 0;
  }

  .popup-content {
    height: auto;
  }
}

@media (500px <= width < 925px) {
  .popup {
    width: 90vw;
    max-width: 400px;
    min-width: 300px;
    border: 1px solid #333;
  }

  .popup-actions {
    position: absolute;
    top: -30px;
    right: 0;
  }

  .popup-content {
    height: 90vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  .popup-image {
    width: 90vw;
    height: 90vw;
    max-width: 400px;
    max-height: 400px;
  }

  .popup-player {
    padding: 10px;
  }

  .popup-playlist {
    padding: 0 10px 10px;
  }
}

@media (500px <= width < 925px) and (height < 680px) {
  .popup-overlay {
    overflow-y: scroll;
  }

  .popup {
    height: auto;
    position: relative;
    transform: none;
    margin: 50px auto 20px;
    top: 0;
    left: 0;
  }

  .popup-content {
    height: auto;
  }

  .popup-playlist {
    padding-bottom: 10px;
  }
}

@media (925px <= width < 1315px) {
  .popup {
    max-width: 800px;
    width: 95vw;
    border: 1px solid #333;
  }

  .popup-actions {
    position: absolute;
    top: -30px;
    right: 0;
  }

  .popup-content {
    height: 80vh;
    grid-template-columns: 200px auto;
    grid-template-rows: auto 1fr;
  }

  .popup-image {
    width: 200px;
    height: 200px;
  }

  .popup-player {
    padding: 10px;
  }

  .popup-playlist {
    padding: 10px;
    grid-column: span 2;
  }
}

@media (width >= 1315px) {
  .popup {
    width: 1200px;
    border: 1px solid #333;
  }

  .popup-actions {
    position: absolute;
    top: -30px;
    right: 0;
  }

  .popup-content {
    height: 600px;
    grid-template-columns: 600px auto;
    grid-template-rows: auto 1fr;
  }

  .popup-player {
    padding: 10px;
  }

  .popup-image {
    grid-row: span 2;
    width: 600px;
    height: 600px;
  }

  .popup-playlist {
    padding: 0 10px;
  }
}

.popup-title {
  font-weight: bold;
  font-size: 16pt;
}

.popup-subtitle,
.popup-subtitle a {
  color: #888;
}

.popup-tags {
  margin: 4px 0;
}

.popup-controls {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.popup-controls-current-time,
.popup-controls-duration-time {
  width: 50px;
}

.popup-controls-duration-time {
  text-align: right;
}

.popup-range {
  margin-bottom: 10px;
}

.popup-range input {
  width: 100%;
  margin: 0;
}

.is-safari-desktop .popup-range input::-webkit-slider-runnable-track {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) calc(50% - 2px),
    white calc(50%),
    rgba(0, 0, 0, 0) calc(50% + 1px)
  );
}

.popup-playlist {
  overflow-y: auto;
}

.popup-disk-title {
  line-height: 30px;
  font-weight: bold;
  margin-top: 10px;
}

.popup-song {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.popup-song:hover {
  background: #222;
}

.popup-song-active {
  background: #333;
}

.popup-song-active:hover {
  background: #444;
}

.popup-song-controls {
  margin-right: 10px;
}

.popup-song-index,
.popup-song-duration {
  color: #888;
}

.close-button {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  background-image: var(--close-button-url);
  cursor: pointer;
}

.next-button {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  background-image: url("data:image/svg+xml,%3Csvg width='30px' height='30px' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke='%23fff' stroke-width='1' stroke-linecap='square' stroke-linejoin='miter' fill='none' color='%23fff'%3E%3Cpath d='M17 11.5L6 18V5z'/%3E%3Cpath d='M18 18V5'/%3E%3C/svg%3E");
  cursor: pointer;
}

.prev-button {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  background-image: url("data:image/svg+xml,%3Csvg width='30px' height='30px' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke='%23fff' stroke-width='1' stroke-linecap='square' stroke-linejoin='miter' fill='none' color='%23fff'%3E%3Cpath d='M7 11.5L18 18V5z'/%3E%3Cpath d='M6 18V5'/%3E%3C/svg%3E");
  cursor: pointer;
}

.play-button {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  background-image: url("data:image/svg+xml,%3Csvg width='30px' height='30px' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke='%23fff' stroke-width='1' stroke-linecap='square' stroke-linejoin='miter' fill='none' color='%23fff'%3E%3Cpath d='M20 12L5 21V3z'/%3E%3C/svg%3E");
  cursor: pointer;
}

.pause-button {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  background-image: url("data:image/svg+xml,%3Csvg width='30px' height='30px' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke='%23fff' stroke-width='1' stroke-linecap='square' stroke-linejoin='miter' fill='none' color='%23fff'%3E%3Crect width='4' height='16' x='5' y='4'/%3E%3Crect width='4' height='16' x='15' y='4'/%3E%3C/svg%3E");
  cursor: pointer;
}

.share-button {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  background-image: var(--share-button-url);
  cursor: pointer;
}

.download-button {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  background-image: var(--download-button-url);
  cursor: pointer;
}

.delete-button {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  background-image: var(--delete-button-url);
  cursor: pointer;
}

.refresh-button {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  background-image: url("data:image/svg+xml,%3Csvg width='30px' height='30px' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke='%23fff' stroke-width='1' stroke-linecap='square' stroke-linejoin='miter' fill='none' color='%23fff'%3E%3Cpolyline points='22 12 19 15 16 12'/%3E%3Cpath d='M11,20 C6.581722,20 3,16.418278 3,12 C3,7.581722 6.581722,4 11,4 C15.418278,4 19,7.581722 19,12 L19,14'/%3E%3C/svg%3E");
  cursor: pointer;
}

.playing-button {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  background-image: url("data:image/svg+xml,%3Csvg width='30px' height='30px' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke='%23fff' stroke-width='1' stroke-linecap='square' stroke-linejoin='miter' fill='none' color='%23fff'%3E%3Cpolygon points='18 12 9 16.9 9 7'/%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3C/svg%3E");
  cursor: pointer;
}
