.sound-picker {
    min-inline-size: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.sound-picker .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.hero-copy > .sound-picker {
    margin: 1.75rem 0 1.5rem;
}

.controls-row > .sound-picker {
    flex: 1 1 340px;
}

.sound-picker legend {
    padding: 0;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.sound-options-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.sound-choice {
    position: relative;
    cursor: pointer;
}

.sound-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    clip-path: inset(50%);
}

.sound-choice span,
.sound-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-deep);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.25;
    cursor: pointer;
    transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.sound-choice span::before {
    content: '\2713';
    margin-right: 0.4rem;
    color: var(--cta);
    opacity: 0;
}

.sound-choice input:checked + span {
    border-color: var(--cta);
    background: rgba(249, 115, 22, 0.14);
    color: var(--text-main);
}

.sound-choice input:checked + span::before {
    opacity: 1;
}

.sound-choice:hover span,
.sound-preview:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

.sound-choice input:focus-visible + span,
.sound-preview:focus-visible {
    outline: 2px solid var(--cta);
    outline-offset: 3px;
}

.sound-hint,
.sound-status {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.45;
}

.sound-status:empty {
    display: none;
}

@media (max-width: 768px) {
    .controls-row > .sound-picker {
        flex-basis: auto;
    }
}

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

/* A compact sound desk, shared by the landing and practice pages. */
.hero-copy > .sound-picker {
    max-width: 430px;
}

.sound-options-row {
    gap: 0.45rem;
}

.sound-choice span,
.sound-preview {
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease,
        box-shadow 160ms ease, transform 100ms ease;
}

.sound-choice:active span,
.sound-preview:active:not(:disabled) {
    transform: scale(0.97);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.sound-choice input:checked + span {
    box-shadow: inset 0 1px 0 rgba(249, 115, 22, 0.12);
}

.sound-preview {
    gap: 0.5rem;
}

.sound-preview:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.sound-preview:disabled:hover {
    color: var(--text-muted);
    border-color: var(--border-subtle);
}

.sound-preview-bars {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 16px;
    height: 18px;
    color: var(--teal-400);
}

.sound-preview-bars i {
    width: 3px;
    height: 7px;
    border-radius: 2px;
    background: currentColor;
}

.sound-preview-bars i:nth-child(2) {
    height: 14px;
}

.sound-preview.is-previewing {
    border-color: var(--teal-400);
    background: rgba(45, 212, 191, 0.1);
    color: var(--text-main);
}

.sound-preview.is-previewing i {
    animation: sound-audition 180ms ease-in-out 2 alternate;
}

.sound-preview.is-previewing i:nth-child(2) {
    animation-direction: alternate-reverse;
}

@keyframes sound-audition {
    from { transform: scaleY(0.45); }
    to { transform: scaleY(1); }
}

.sound-volume-panel {
    margin-top: 0.8rem;
    padding: 0.45rem 0.8rem 0.65rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: linear-gradient(120deg, rgba(45, 212, 191, 0.035), rgba(0, 0, 0, 0.1));
    transition: border-color 160ms ease;
}

.sound-volume-panel:focus-within {
    border-color: var(--border-strong);
}

.sound-volume-heading,
.sound-volume-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.sound-volume-heading {
    justify-content: space-between;
}

.sound-volume-label {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.6rem;
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 700;
}

#sound-state {
    color: var(--teal-400);
    font-size: 0.7rem;
    font-weight: 500;
}

.sound-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 44px;
    min-height: 44px;
    cursor: pointer;
}

.sound-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    clip-path: inset(50%);
}

.sound-switch-track {
    position: relative;
    width: 36px;
    height: 22px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--bg-deep);
    transition: background 180ms ease, border-color 180ms ease;
}

.sound-switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), background 180ms ease;
}

.sound-switch input:checked + .sound-switch-track {
    background: rgba(249, 115, 22, 0.18);
    border-color: var(--cta);
}

.sound-switch input:checked + .sound-switch-track::after {
    transform: translateX(14px);
    background: var(--cta);
}

.sound-switch:hover .sound-switch-track {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.08);
}

.sound-switch:active .sound-switch-track::after {
    width: 16px;
}

.sound-switch input:focus-visible + .sound-switch-track {
    outline: 2px solid var(--cta);
    outline-offset: 4px;
}

.sound-speaker {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.sound-speaker-mute {
    display: none;
}

.is-muted .sound-speaker-waves {
    display: none;
}

.is-muted .sound-speaker-mute {
    display: initial;
}

.is-muted #sound-state {
    color: var(--text-muted);
}

#sound-volume {
    --volume-fill: 60%;
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 44px;
    background: transparent;
    cursor: pointer;
    accent-color: var(--cta);
}

#sound-volume::-webkit-slider-runnable-track {
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(to right, var(--cta) 0 var(--volume-fill), rgba(157, 184, 179, 0.22) var(--volume-fill) 100%);
}

#sound-volume::-moz-range-track {
    height: 5px;
    border-radius: 999px;
    background: rgba(157, 184, 179, 0.22);
}

#sound-volume::-moz-range-progress {
    height: 5px;
    border-radius: 999px;
    background: var(--cta);
}

#sound-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -6.5px;
    border: 3px solid var(--bg-deep);
    border-radius: 50%;
    background: var(--cta);
    box-shadow: 0 0 0 1px var(--cta), 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: box-shadow 130ms ease, transform 130ms ease;
}

#sound-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: 3px solid var(--bg-deep);
    border-radius: 50%;
    background: var(--cta);
    box-shadow: 0 0 0 1px var(--cta);
    transition: box-shadow 130ms ease, transform 130ms ease;
}

#sound-volume:hover::-webkit-slider-thumb,
#sound-volume:active::-webkit-slider-thumb {
    box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.18);
    transform: scale(1.12);
}

#sound-volume:hover::-moz-range-thumb,
#sound-volume:active::-moz-range-thumb {
    box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.18);
    transform: scale(1.12);
}

#sound-volume:focus-visible {
    outline: 2px solid var(--cta);
    outline-offset: 3px;
    border-radius: 5px;
}

#sound-volume-value {
    min-width: 4.1ch;
    color: var(--text-main);
    font: 600 0.8rem var(--font-mono);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.sound-volume-scale {
    display: flex;
    justify-content: space-between;
    margin: -0.2rem calc(4.1ch + 0.65rem) 0 calc(20px + 0.65rem);
    color: var(--text-muted);
    font-size: 0.65rem;
    letter-spacing: 0.02em;
}

/* Press feedback complements existing hover states without shifting layout. */
:is(button, .btn, .panel-action, .completion-btn, .guide-close, .sound-preview, .segmented-option span) {
    transition: transform 100ms ease, box-shadow 160ms ease, color 160ms ease,
        background 160ms ease, border-color 160ms ease, filter 160ms ease;
    -webkit-tap-highlight-color: transparent;
}

:where(button, .btn):active:not(:disabled),
.segmented-option:active span {
    transform: scale(0.97);
    filter: brightness(1.08);
}

:where(button, .btn):focus-visible {
    outline: 2px solid var(--cta);
    outline-offset: 3px;
}

.panel-action kbd {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.12rem 0.3rem;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.15);
    font: 500 0.65rem var(--font-mono);
}

@media (prefers-reduced-motion: reduce) {
    .sound-picker *,
    .sound-picker *::after,
    :where(button, .btn, .segmented-option span) {
        animation: none !important;
        transition: none !important;
    }

    :where(button, .btn):active:not(:disabled),
    .sound-choice:active span,
    .segmented-option:active span {
        transform: none;
    }
}
