:root {
    color-scheme: light dark;
    --background: #f3f1ed;
    --background-center: #fcfbf8;
    --focus: #941524;
    --shadow: rgb(49 30 37 / 26%);
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #191719;
        --background-center: #30292b;
        --focus: #ff9a9e;
        --shadow: rgb(0 0 0 / 56%);
    }
}

body {
    margin: 0;
    background: radial-gradient(ellipse at 50% 42%, var(--background-center), var(--background) 75%);
}

.screen {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
             max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    appearance: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.screen:focus-visible {
    outline: none;
}

.screen:focus-visible .buzzer {
    outline: 3px solid var(--focus);
    outline-offset: 9px;
}

.buzzer {
    position: relative;
    width: min(100%, 20rem, 68vh);
    width: min(100%, 20rem, 68dvh);
    aspect-ratio: 1.14;
    border-radius: 50%;
    pointer-events: none;
}

.buzzer-base,
.buzzer-cap {
    position: absolute;
    border-radius: 50%;
}

.buzzer-base {
    inset: 13% 0 2%;
    background:
        linear-gradient(155deg, rgb(255 255 255 / 21%), transparent 42%),
        linear-gradient(#515053 0%, #3a393d 68%, #211f23 100%);
    box-shadow:
        inset 0 1px 1px rgb(255 255 255 / 45%),
        inset 0 -0.65rem 0.6rem rgb(0 0 0 / 27%),
        0 1rem 1.45rem -0.5rem var(--shadow),
        0 0.25rem 0.4rem var(--shadow);
}

.buzzer-cap {
    --pressed-position: translateY(5%) scale(0.975);
    inset: 1% 6.5% 16%;
    display: block;
    background: linear-gradient(100deg, #9d1023, #be152b 32%, #8a0d21);
    box-shadow: 0 0.25rem 0.6rem rgb(22 7 12 / 45%);
    transition: transform 110ms ease-out;
}

.buzzer-cap::before {
    content: "";
    position: absolute;
    inset: 0 0 8%;
    border-radius: inherit;
    background:
        radial-gradient(ellipse at 36% 12%, rgb(255 211 198 / 53%), transparent 58%),
        linear-gradient(153deg, #ff554e 8%, #f22635 52%, #c70c24 100%);
    box-shadow:
        inset 0 2px 2px rgb(255 216 210 / 68%),
        inset 0 -1px 2px rgb(127 0 22 / 30%);
}

.screen:active .buzzer-cap {
    transform: var(--pressed-position);
    transition-duration: 65ms;
}

@keyframes release-buzzer {
    0%, 24% { transform: var(--pressed-position); }
    100% { transform: none; }
}

.screen.is-releasing:not(:active) .buzzer-cap {
    animation: release-buzzer 190ms ease-out;
}

.sr-only {
    position: absolute;
    inset: 0 auto auto 0;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

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

    .screen.is-releasing:not(:active) .buzzer-cap {
        animation-timing-function: step-end;
    }
}
