:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #242036;
  background: #f8f6fc;
  --ink: #242036;
  --muted: #625a73;
  --purple: #6939ba;
  --line: #e7e0f0;
  --lilac: #eee5fd;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }

.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; min-height: 68px; font-weight: 750; }
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: var(--purple);
}
.brand-mark i { width: 2px; height: 6px; border-radius: 4px; background: white; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { height: 11px; }
.brand-mark i:nth-child(3) { height: 17px; }

main { padding-block: 34px 132px; }
.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 215px;
  overflow: hidden;
  padding: clamp(24px, 5vw, 58px);
  border: 1px solid #e8dcf9;
  border-radius: 24px;
  background: linear-gradient(110deg, #f3ebff, #eadffd);
}
h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(2.4rem, 7.3vw, 5.2rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.075em;
}
h1 span { color: var(--purple); }
.waveform {
  display: flex;
  flex: 0 1 36%;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, .75vw, 10px);
  height: 112px;
  opacity: .8;
}
.waveform i {
  flex: 1;
  max-width: 9px;
  min-width: 3px;
  height: var(--height);
  border-radius: 15px;
  background: linear-gradient(#b99ae9, #9664df);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-block: 24px 30px;
  padding-inline: 18px 10px;
  border: 1px solid #ddd4eb;
  border-radius: 13px;
  background: white;
  box-shadow: 0 2px 6px #32234e08;
}
.search-field:focus-within { outline: 2px solid var(--purple); outline-offset: 2px; }
.search-icon {
  position: relative;
  flex: none;
  width: 15px;
  height: 15px;
  margin-right: 3px;
  border: 2px solid var(--purple);
  border-radius: 50%;
}
.search-icon::after {
  content: "";
  position: absolute;
  top: 9px;
  left: 10px;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: var(--purple);
  transform: rotate(45deg);
  transform-origin: left center;
}
.search-field input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 54px;
  padding: 0;
  outline: none;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.search-field input::placeholder { color: var(--muted); }
.search-field input::-webkit-search-cancel-button { display: none; }
.clear-button {
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--purple);
  font-size: 1.4rem;
}
.clear-button:hover { background: var(--lilac); }

.library-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 15px; }
.library-header h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.025em; }
.library-header p { margin: 0; color: var(--muted); font-size: .9rem; }
.sounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 12px; }
.sound {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 2px 5px #32234e06;
  transition: background-color .15s, border-color .15s;
}
.sound:hover { border-color: #b89bdf; background: #fcfaff; }
.sound:has(.sound-play[aria-pressed="true"]) { border-color: #a97bdc; background: #f3ebff; }
.sound-play {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  width: 100%;
  padding: 13px 15px;
  border: 0;
  border-radius: 13px 13px 0 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
.sound-play:focus-visible { outline-offset: -3px; }
.sound-name { min-width: 0; font-size: .9375rem; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.play-icon {
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  height: 38px;
  border-radius: 10px;
  background: var(--lilac);
  color: var(--purple);
}
.play-icon::before {
  content: "";
  margin-left: 2px;
  border-block: 6px solid transparent;
  border-left: 9px solid currentColor;
}
.sound-play[aria-pressed="true"] .play-icon { background: var(--purple); color: white; }
.sound-play[aria-pressed="true"] .play-icon::before {
  width: 10px;
  height: 10px;
  margin: 0;
  border: 0;
  border-radius: 2px;
  background: currentColor;
}
.sound-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 8px;
  margin-inline: 15px;
  padding: 2px 0 3px;
  border-top: 1px solid var(--line);
}
.sound-details { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.download {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding-inline: 6px;
  border-radius: 6px;
  color: var(--purple);
  font-size: .875rem;
  font-weight: 650;
  text-decoration: none;
}
.download:hover { background: var(--lilac); text-decoration: underline; }
.empty { padding: 28px; border: 1px dashed #d9c9ed; border-radius: 14px; color: var(--muted); text-align: center; }

.player {
  position: fixed;
  z-index: 2;
  inset: auto 0 max(16px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(580px, calc(100% - 32px));
  margin-inline: auto;
  padding: 12px 12px 12px 18px;
  border: 1px solid #dcd0ef;
  border-radius: 16px;
  background: white;
  box-shadow: 0 10px 32px #32234e26;
}
.player-details { display: grid; flex: 1; min-width: 0; gap: 7px; }
.player-heading { display: grid; min-width: 0; gap: 3px; }
.player-status { color: var(--purple); font-size: .875rem; font-weight: 700; }
.player-title { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; font-size: .9375rem; }
.timeline { display: flex; align-items: center; gap: 10px; }
.timeline progress { flex: 1; min-width: 0; height: 7px; appearance: none; overflow: hidden; border: 0; border-radius: 6px; background: var(--lilac); }
.timeline progress::-webkit-progress-bar { background: var(--lilac); }
.timeline progress::-webkit-progress-value { background: var(--purple); }
.timeline progress::-moz-progress-bar { background: var(--purple); }
.playback-time { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.player button { min-height: 42px; padding-inline: 16px; border: 0; border-radius: 9px; background: var(--purple); color: white; font-weight: 700; }
.player button:hover { background: #542999; }

@media (max-width: 620px) {
  .shell { width: calc(100% - 32px); }
  main { padding-top: 20px; }
  .hero { min-height: 150px; }
  .waveform { position: absolute; inset: 14px 14px 14px 46%; height: auto; opacity: .23; }
  .search-field { margin-block: 16px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .sound { transition: none; }
}
