:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  color: #eeeeea;
  background: #151515;
  font-synthesis: none;
  --line: #373737;
  --muted: #969696;
  --panel: #1d1d1d;
  --panel-hover: #242424;
  --active: #bde94d;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background: #151515;
}

button {
  font: inherit;
}

.sampler {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 10px;
}

.controls,
.demo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-bottom: 6px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  background: #1b1b1b;
}

.demo audio {
  width: 100%;
  min-width: 0;
  height: 32px;
}

.control-label,
.quality-note {
  color: var(--muted);
  font-size: 0.72rem;
}

.control-label {
  font-weight: 700;
  text-transform: uppercase;
}

.quality-toggle {
  display: flex;
  border: 1px solid #494949;
}

.quality-toggle button {
  min-width: 58px;
  min-height: 28px;
  padding: 4px 9px;
  border: 0;
  border-right: 1px solid #494949;
  color: #b5b5b5;
  background: #121212;
  cursor: pointer;
}

.quality-toggle button:last-child {
  border-right: 0;
}

.quality-toggle button:hover,
.quality-toggle button:focus-visible {
  color: #fff;
  background: #2a2a2a;
  outline: 0;
}

.quality-toggle button[aria-pressed="true"] {
  color: #10130a;
  background: var(--active);
}

.quality-note {
  margin-left: auto;
}

.sound-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.sound-card {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 50px;
  padding: 7px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  color: inherit;
  text-align: left;
  background: var(--panel);
  cursor: pointer;
}

.sound-card:hover,
.sound-card:focus-visible {
  border-color: #5b5b5b;
  outline: 0;
  background: var(--panel-hover);
}

.sound-card.is-playing {
  border-color: var(--active);
}

.play-mark {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid #555;
  color: var(--active);
  font-size: 0.68rem;
}

.is-playing .play-mark {
  border-color: var(--active);
  color: #111;
  background: var(--active);
}

.sound-name {
  min-width: 0;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sound-meta {
  color: var(--muted);
  font-size: 0.64rem;
  text-transform: uppercase;
}

.progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: #282828;
}

.progress > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--active);
}

noscript {
  display: block;
  padding: 12px;
  color: #111;
  background: #ddd;
}

@media (max-width: 640px) {
  .sound-grid {
    grid-template-columns: 1fr;
  }

  .quality-note {
    display: none;
  }
}

@media (max-width: 390px) {
  .controls,
  .demo {
    gap: 6px;
  }

  .quality-toggle {
    flex: 1;
  }

  .quality-toggle button {
    min-width: 0;
    flex: 1;
  }
}
