:root {
  --padding: 20px;
  --radius: 13px;
  --tap-size: 64px;
  --accent-color: hsl(212, 65%, 70%);
}
* {
  box-sizing: border-box;
}

/* iOS silent switch bypass audio element */
#silent-audio {
  display: none;
}

body {
  background-color: #212121;
  margin: 0;
  padding: 0;
  font-family: monospace;
  height: calc(100dvh + calc(env(safe-area-inset-top) / 8));
}

#app {
  background-color: hsl(0, 0%, 16%);
  position: fixed;
  height: 100%;
  width: 100vw;
  max-width: 550px;
  display: flex;
  justify-self: center;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(env(safe-area-inset-bottom) / 5);
}

#app::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url(noise.png);
  opacity: 0.6;
}

nav {
  padding: var(--padding);
  padding-bottom: calc(var(--padding) - 2px);
  padding-top: 0;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    pointer-events: none;
  }
}
.preloader {
  padding: calc(var(--padding) * 2);
  display: flex;
  justify-content: center;
  animation: fadeOut .5s 2s linear forwards;
}
.preloader.hidden {
  opacity: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

@keyframes appear {
  from {
    opacity: 0;
    filter: blur(16px);
  }
}
@keyframes scale {
  from {
    transform: scale(2) translateY(100%);
  }
}

@keyframes shimmer {
  from {
    mask-position: -100% 0;
  }
  to {
    mask-position: 0% 0;
  }
}

@keyframes goToNav {
  to {
    transform: scale(1) translate3d(0, 0, 0);
  }
}

.preloader-logo {
  transform: scale(1.6) translate3d(0, 41dvh, 0);
  animation: goToNav .8s 1.5s cubic-bezier(0.87, 0, 0.13, 1) forwards;
}

.preloader .logo svg{
  opacity: 1;
  animation: appear 0.5s linear,
            scale 0.8s cubic-bezier(0.16, 1, 0.3, 1),
            shimmer .7s ease-in-out 1s forwards;
  position: relative;
  mask: linear-gradient(90deg,
    white 0%, white 25%,           /* Solid white start section */
    transparent 25%, white 35%,     /* Shimmer effect */
    white 45%, transparent 55%,     /* Shimmer effect */
    white 65%, transparent 75%,     /* Shimmer effect */
    white 85%, transparent 95%,     /* Shimmer effect */
    white 100%, white 150%          /* Solid white end section */
  );
  mask-size: 400% 100%;
}

.preloader p {
  position: absolute;
  bottom: var(--padding);
  opacity: 0.5;
  color: #fff;
  font-size: 12px;
  text-align: center;
  filter: blur(0px) !important;
  animation: appear 1s 0.3s linear backwards,
            fadeOut 0.2s 1.5s linear forwards;
}

.preloader p svg {
  height: 12px;
  display: block;
  margin: 0 auto;
  margin-bottom: 8px;
}

.onboarding {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 550px;
  margin: 0 auto;
  background-color: #212121;
  z-index: 1000;
  text-align: center;
  color: #fff;
  padding: calc(var(--padding) * 2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  --color: #FFA7AE;
}

.onboarding-image {
 width: 95%;
 aspect-ratio: 1/1;
 border: 1.5px solid var(--color);
 border-radius: var(--radius);
 transition: border-color 0.5s linear;
 overflow: hidden;
 cursor: pointer;
}

.onboarding-image svg {
  display: block;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  margin: 0;
}
.onboarding-image.two svg:nth-child(2) {
  transform: translateY(-100%);
}
.onboarding-image.three svg:nth-child(3) {
  transform: translateY(-200%);
}

.onboarding .logo svg {
  opacity: 0.5;
  margin-bottom: calc(var(--padding) * 2);
}

.onboarding-sections {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  width: 100%;
  gap: 0;
}
.onboarding-sections::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.onboarding-sections section {
  flex: none;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 0 var(--padding);
  box-sizing: border-box;
}

.onboarding-sections p {
  opacity: 0.5;
}

.onboarding-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: calc(var(--padding) * 1.5);
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.3);
  transition: background-color 0.5s linear, transform 0.3s ease-in-out;
  cursor: pointer;
}

.indicator-dot.active {
  background-color: var(--color);
  transform: scale(1.2);
}

.onboarding .button {
  position: absolute;
  top: var(--padding);
  right: var(--padding);
  opacity: 0;
  transform: scale(0.8);
  transition: transform 1s linear(0, 0.218 2.1%, 0.862 6.5%, 1.114, 1.296 10.7%, 1.346, 1.37 12.9%, 1.373,
  1.364 14.5%, 1.315 16.2%, 1.032 21.8%, 0.941 24%, 0.891 25.9%, 0.877,
  0.869 27.8%, 0.87, 0.882 30.7%, 0.907 32.4%, 0.981 36.4%, 1.012 38.3%, 1.036,
  1.046 42.7% 44.1%, 1.042 45.7%, 0.996 53.3%, 0.988, 0.984 57.5%, 0.985 60.7%,
  1.001 68.1%, 1.006 72.2%, 0.998 86.7%, 1),
              opacity 0.1s linear;
  transition-delay: 0.5s;
}
.onboarding .button.active {
  opacity: 1;
  transform: scale(1);
}


/* Search overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 550px;
  margin: 0 auto;
  background-color: rgba(31, 31, 31, 0.98);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: all 0.s ease;
}

.search-overlay.active {
  opacity: 1;
  visibility: visible;
}

.search-header {
  display: flex;
  align-items: center;
  padding: var(--padding);
  padding-top: env(safe-area-inset-top);
  gap: var(--padding);
  border-bottom: 1px solid #161616;
}

.search-input {
  flex: 1;
  background-color: #282828;
  border: 1px solid #161616;
  border-radius: var(--radius);
  padding: 15px var(--padding);
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  outline: 2px solid transparent;
  outline-offset: 6px;
  transition: all 0.3s ease;
}

.search-input::placeholder {
  color: #888;
  font-size: 16px;
}

.close-button {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-size);
  height: var(--tap-size);
  border-radius: var(--radius);
  background-color: #282828;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: 2px solid transparent;
  outline-offset: 6px;
  opacity: 0;
  transform: scale(0.8);
}

.search-overlay.active .close-button {
  opacity: 1;
  transform: scale(1);
}

.close-button:hover, .close-button:focus {
  outline-color: var(--accent-color);
}

.close-button svg {
  fill: #fff;
  width: 24px;
  height: 24px;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: var(--padding);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--padding);
  align-content: start;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background-color: #282828;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: 2px solid transparent;
  outline-offset: 6px;
}

.search-result:hover,
.search-result:focus {
  background-color: #333;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  outline-color: var(--accent-color);
}

.search-result.selected {
  background-color: #444;
}

.search-result-artwork {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background-color: #1D1D1D;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

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

.search-result-title {
  color: #fff;
  font-size: 16px;
  font-weight: normal;
  margin: 0 0 5px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-artist {
  color: #bbb;
  font-size: 14px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-duration {
  color: #888;
  font-size: 12px;
  margin-top: 5px;
}

.search-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #fff;
  display: none;
}

.search-loading.active {
  display: block;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.search-loading p {
  margin: 0;
  font-size: 16px;
  color: #bbb;
}

.no-results {
  text-align: center;
  color: #888;
  font-size: 16px;
  padding: 40px;
  grid-column: 1 / -1;
}

.recommendations-header {
  grid-column: 1 / -1;
  padding-left: var(--padding);
}
.recommendations-header p {
  color: #ACACAC;
  margin-top: 8px;
}

.recommendations-header h3 {
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  margin: 0;
  opacity: 0.8;
}

input {
  font-family: inherit;
  font-size: 16px;
}
input::placeholder {
  font-size: 12px;
}
.logo svg {
  height: 16px;
  fill: #fff;
  display: block;
  opacity: 0.25;
  transform: translateX(-1ch);
}

.controls {
  padding: var(--padding);
  z-index: 1;
}
.controls-group {
  background-color: #141414;
  border: 2px solid #121111;
  box-shadow: inset 0 0.1em 0.4em -0.1em rgba(255, 255, 255, 0.05);
  border-radius: calc(var(--radius) * 2);
  padding: var(--padding);
  display: grid;
  gap: var(--padding);
}
.controls-group .button {
  background-color: #141414;
  border: 1px solid #0B0B0B;
  box-shadow: inset 0 0.15em 0.25em 0 rgb(255, 255, 255, 0.05);
}
.controls-group .button:not(.active) svg {
  opacity: 0.3;
}
.controls-group .button.active {
  background-color: #1D1D1D;
  fill: var(--accent-color);
}
.controls-group .button.active svg {
  fill: var(--accent-color);
}
.controls-footer {
  margin-top: 36px;
  align-items: flex-end;
  align-items: center;
}
.speaker {
  --size: 4px;
  width: calc(16 * var(--size) * 2);
  height: calc(4 * var(--size) * 2);
  background-image: radial-gradient(circle at var(--size) var(--size), #0B0B0B calc(var(--size) / 2), transparent calc(var(--size) / 2));
  background-size: calc(var(--size) * 2) calc(var(--size) * 2);
  background-position: 0 0;
}
.sliders {
  display: grid;
  gap: calc(var(--padding) / 1.5);
}
.slider {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  height: calc(var(--tap-size) * 0.9);
  border-radius: var(--radius);

  background-color: #1D1D1D;
  overflow: hidden;
  transition: all 0.2s ease;
  outline: 2px solid #0B0B0B;

  box-sizing: content-box;
}

.slider::-webkit-slider-runnable-track {
  appearance: none;
  -webkit-appearance: none;
  height: 100%;
}
.slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: var(--tap-size);
  height: 100%;
  cursor: ew-resize;
  background-color: #3D3D3D;
  box-shadow:
  -218px 0 0 198px #3D3D3D;
  border-radius: calc(var(--radius) - 2px);
  transition: all 0.2s ease;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  border: 2px solid #282828;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 125 96'%3E%3Cpath fill='%23fff' d='M73.345 95.404H0V73.5h51.44V0h73.008v21.904H73.345v73.5Zm-15.905-81.5h.008V8h-.008v5.904Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center 45%;
  background-size: 60%;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  transition: all 0.2s ease;
  border-radius: var(--radius);
  outline: 2px solid transparent;
  outline-offset: 6px;
}

.switch:hover, .switch:focus {
  outline-color: var(--accent-color);
  transform: scale(1.05);
}

.switch.active {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 125 96' style='transform: rotate(180deg)'%3E%3Cpath fill='%23fff' d='M73.345 95.404H0V73.5h51.44V0h73.008v21.904H73.345v73.5Zm-15.905-81.5h.008V8h-.008v5.904Z'/%3E%3C/svg%3E");
}

.button {
  all: unset;
  display: grid;
  place-items: center;
  width: var(--tap-size);
  height: var(--tap-size);
  border-radius: 50%;
  background-color: #2B2B2B;
  border: 1px solid #161616;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 0.15em 0.25em 0 rgb(255, 255, 255, 0.1);
}

.button:hover, .button:focus {
  outline-color: var(--accent-color);
  transform: scale(1.05);
}

.button svg {
  fill: #fff;
  display: block;
  width: 45%;
}

.button:hover svg {
  fill: var(--accent-color);
  transform: scale(1.1);
}

.play svg:last-of-type {
  opacity: 0;
}
.row {
  display: flex;
  justify-content: space-between;
}
.screen {
  position: relative;
  padding: 4px var(--padding);
  flex: 1;
  overflow: hidden;
}

.screen-content {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) * 2);
  border: 4px solid #141414;
  height: 100%;
  outline: 4px solid rgba(255, 255, 255, 0.005);
}

/* CRT depth border */
.screen::before {
  content: '';
  position: absolute;
  top: 2px;
  left: calc(var(--padding) + 3px);
  right: calc(var(--padding) + 3px);
  bottom: 2px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: calc(var(--radius) * 3.5);
  pointer-events: none;
  filter: blur(8px);
  overflow: hidden;
  z-index: 3;
}

/* CRT scanlines */
.screen-content::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 2px,
    rgba(255, 255, 255, 0.05) 2px,
    rgba(255, 255, 255, 0.05) 3px
  );
  z-index: 2;
}

/* CRT vignette */
.screen-content::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 70% 60% at center,
    transparent 0%,
    transparent 55%,
    rgba(0, 0, 0, 0.15) 70%,
    rgba(0, 0, 0, 0.3) 85%,
    rgba(0, 0, 0, 0.5) 95%,
    rgba(0, 0, 0, 0.6) 100%
  );
  z-index: 3;
}

.screen-content img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.2s linear;
  position: relative;
  box-shadow: 0 0 0.5em rgba(255, 255, 255, 0.1);
}

.screen-info {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  color: #fff;
  padding: var(--padding);
}
.screen-info-item {
  display: flex;
  justify-content: space-between;
  align-items: end;
}
.screen-info-item svg {
  width: 15px;
  transform: translateY(0.3ch);
  fill: #fff;
  stroke: black;
  stroke-width: 1.2px;
  opacity: 0.8;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5)) drop-shadow(0 0 16px rgba(255, 255, 255, 0.3));
}
.screen-info-item:last-of-type {
  text-transform: uppercase;
}
.screen-info-item:last-of-type .screen-info-item-text {
  width: 100%;
}
.screen-cover {
  --size: 56px;
  width: var(--size);
  height: var(--size);
  inset: 0;
  background: url(cover.jpg);
  background-repeat: no-repeat;
  background-size: cover;
  border-radius: var(--radius);
  outline: 3px solid rgba(255, 255, 255, 0.05);

}
.screen-info p {
  margin: 0;
  opacity: 0.8;
  font-size: 14px;
  font-weight: 800;
  filter: blur(0.2px);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 27ch;
  -webkit-text-stroke: 2px black;
  paint-order: stroke fill;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3),
               0 0 16px rgba(255, 255, 255, 0.1);
}
.screen-info-item:first-of-type p {
  margin-top: 4px;
}


.search {
  background-color: #1D1D1D;
  background-color: #282828;
  width: 100%;
  flex-shrink: 1;
  border-radius: var(--radius);
  border: 2px solid #282828;
  padding: 0 var(--padding);
  transition: all 0.2s ease;
  outline: 2px solid transparent;
  outline-offset: 6px;
  position: absolute;
  top: 0;
  left: 0;
  right: calc(var(--tap-size) + calc(var(--padding) / 2));
  height: var(--tap-size);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
}

.search:hover, .search:focus {
  outline-color: var(--accent-color);
}



@media (max-height: 720px) {
  :root {
    --tap-size: 56px;
  }
  .controls-group {
    gap: 12px;
  }
  .controls-footer {
    margin-top: 16px;
  }
  /* .slider {
    height: calc(var(--tap-size) * 0.7);
  } */
}