body:has(.sound-test-dialog[open]) { overflow: hidden; }

.sound-test-dialog {
  --magenta: #c5b7f4;
  --quiet: #a3aec3;
  --border: rgb(194 182 250 / 32%);
  --dawn-action: linear-gradient(105deg, #c5b7f4, #a4e8f0);
  width: min(31rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1.65rem;
  background: linear-gradient(145deg, rgb(24 33 62 / 64%), rgb(10 19 36 / 74%));
  color: var(--ink);
  backdrop-filter: blur(9px);
  box-shadow: 0 1.25rem 5rem rgb(0 0 0 / 48%), inset 0 1px rgb(228 217 255 / 15%);
}
.sound-test-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.sound-test-dialog:not([open]) { display: none; }
.sound-test-dialog::backdrop { background: rgb(4 9 19 / 34%); }

.sound-test-bar { display: flex; justify-content: flex-end; padding: .45rem .55rem 0; }
.sound-test-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: .75rem;
  background: transparent;
  color: var(--ink);
  line-height: 1;
  cursor: pointer;
}
.sound-test-close span { font-size: 1.65rem; }
.sound-test-close:hover { border-color: var(--border); background: rgb(255 255 255 / 6%); }

.sound-test-scroll {
  min-height: 0;
  padding: .25rem clamp(.9rem, 4vw, 1.6rem) max(.8rem, env(safe-area-inset-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.sound-test-loading, .sound-test-fallback { margin: 1.5rem .75rem 2rem; text-align: center; }
.sound-test-dialog .progress { margin-bottom: .8rem; }
.sound-test-dialog .screen {
  width: 100%;
  padding: .35rem .2rem;
  grid-template-columns: minmax(0, 1fr);
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.sound-test-dialog .listen-screen::before,
.sound-test-dialog .handoff-screen figure,
.sound-test-dialog [data-result-next] { display: none; }
.sound-test-dialog .listen-copy h1 em { color: var(--magenta); }
.sound-test-dialog .tone-orbit { width: clamp(5.25rem, calc(100dvh - 32rem), 13rem); }
.sound-test-dialog .listening-controls { min-height: 0; }
.sound-test-dialog .secondary-controls:not(:has(button:not([hidden]))) { display: none; }
.sound-test-dialog .handoff-result { justify-content: center; }
.sound-test-dialog .hearing-note { display: none; }
.sound-test-dialog .primary-action {
  background: var(--dawn-action);
  color: #14172f;
  border: 1px solid rgb(255 255 255 / 25%);
}
@media (max-width: 42rem) {
  .sound-test-dialog {
    width: 100%;
    max-width: none;
    min-height: min(37rem, calc(100dvh - .8rem));
    max-height: calc(100dvh - .8rem);
    margin: auto 0 0;
    border-radius: 1.55rem 1.55rem 0 0;
  }
}
@media (max-height: 480px) and (min-width: 600px) {
  .sound-test-dialog .screen > * { grid-column: 1; grid-row: auto; }
}
