html:has(body.song-page),
body.song-page {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
}

body.song-page {
    position: fixed;
    inset: 0;
}

#wrapper {
    height: 100%;
    height: 100dvh;
    max-height: 100%;
}

#focus {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    touch-action: manipulation;
}

#pdf-canvas {
    position: relative;
    min-width: 0;
    min-height: 0;
}

/* Keep the last complete page fitted even while its replacement is loading. */
#pdf-canvas > canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#audioContainer {
    position: fixed;
    width: max-content;
    max-width: none;
    box-sizing: border-box;
    transform: scale(var(--player-scale, 1));
    transform-origin: bottom left;
    touch-action: none;
    user-select: none;
}

#audio-scale-handle {
    position: absolute;
    top: -0.6rem;
    right: -0.6rem;
    z-index: 1;
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--color-base-content);
    border-radius: 9999px;
    background: var(--color-base-100);
    cursor: nesw-resize;
    touch-action: none;
}

#audio-scale-handle::after {
    content: "↗";
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    font-size: 1rem;
}

#audio-scale-handle:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

#audio-controls-primary {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.25rem;
    white-space: nowrap;
}

#audio-controls-primary > div:nth-child(2) {
    display: flex;
    flex-wrap: nowrap;
}

#audio-controls-primary > div:nth-child(2) input {
    width: 10rem;
}

#audio-controls-secondary,
#audio-controls-actions,
#audio-controls-icons,
#audio-controls-secondary {
    gap: 0.25rem;
}

#audioContainer select {
    max-width: none;
}

#audioContainer .voice-settings-grid {
    display: grid;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
    gap: 0.25rem 0.5rem;
}

#audioContainer .voice-settings-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
    align-items: center;
    column-gap: 0.5rem;
    min-width: 0;
}

#audioContainer .voice-settings-label {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-size: 0.875rem;
}

#audioContainer .voice-settings-row select {
    width: 100%;
    min-width: 0;
}

#audioContainer .voice-settings-row input[type="range"] {
    width: 100%;
    min-width: 0;
}

#audioContainer .voice-settings-count-in {
    grid-column: 1 / -1;
}
