/* Controlos de leitura, limitados ao cancioneiro. */
#cancioneiro {
    --song-font-size: 1.18rem;
    --song-refrain-space: 0px;
    --song-tabbar-height: 0px;
    --song-toolbar-top: 0px;
}
#cancioneiro [hidden] { display: none !important; }
#cancioneiro #musica { min-width: 0; }
#cancioneiro #song-view h2 { overflow-wrap: anywhere; }
#cancioneiro .song-reading-controls {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
}
#cancioneiro .song-reading-controls button,
#song-refrain-toggle {
    min-height: 44px;
    min-width: 44px;
    padding: .55rem .7rem;
    border: 1px solid #b8c6cd;
    border-radius: 12px;
    background: #fff;
    color: #29485b;
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
}
#cancioneiro button:focus-visible,
#song-refrain-content:focus-visible { outline: 3px solid #1f5fbf; outline-offset: 3px; }
#cancioneiro .song-reading-controls button:disabled { opacity: .45; cursor: default; }
#cancioneiro[data-song-font="large"] { --song-font-size: 1.4rem; }
#cancioneiro[data-song-font="xlarge"] { --song-font-size: 1.7rem; }
#cancioneiro #letra { font-size: var(--song-font-size); }
#cancioneiro .song-line .lyrics { overflow-wrap: anywhere; }
#cancioneiro #song-reading-toolbar {
    position: sticky;
    top: var(--song-toolbar-top);
    z-index: 30;
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem 0;
    background: #fff;
    border-bottom: 1px solid #dce2e5;
}
#cancioneiro #song-toolbar {
    position: static;
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    flex-wrap: wrap;
}
#cancioneiro #song-toolbar.hidden { display: none !important; }
#cancioneiro #back-to-list {
    position: static;
    min-height: 44px;
    margin: 0;
    padding: .5rem .65rem;
    white-space: nowrap;
    text-decoration: none;
}
#cancioneiro .controls-toggle {
    width: auto;
    min-height: 44px;
    padding: .55rem .7rem;
    white-space: nowrap;
}
#cancioneiro #transposicao {
    position: static;
    flex: 1 0 100%;
    width: 100%;
    max-height: min(38vh, 24rem);
    margin: 0;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #bac8cf;
    box-shadow: none;
}
#cancioneiro #song-reading-toolbar { flex-wrap: wrap; }
#cancioneiro #song-toolbar.controls-is-open { flex: 1 0 100%; }
#song-result-count { margin: .5rem 0; color: #536570; font-size: .85rem; }
#lista-header h1 { font-size: 1.4rem; margin: 0; }
#cancioneiro #song-load-feedback { padding: 1rem; border: 1px solid #bac8cf; border-radius: 12px; }
#song-load-feedback button { min-height: 44px; margin: .25rem; padding: .5rem .75rem; border-radius: 9px; border: 1px solid #bac8cf; background: #fff; color: #29485b; }
@media (max-width: 768px) {
    #cancioneiro.is-list #musica { display: none; }
    #cancioneiro #lista-musicas { max-height: calc(100dvh - 22rem); min-height: 10rem; }
    #cancioneiro #song-reading-toolbar { gap: .35rem; }
}
#cancioneiro #song-view { box-shadow: none; border-color: transparent; }
#cancioneiro #musica { padding-bottom: var(--song-refrain-space); }
body.page-template-page-cancioneiro .pwa-install-prompt { display: none !important; }
.song-guide-context {
    margin-bottom: .5rem;
    padding: .55rem .7rem;
    border: 1px solid #d4b06a;
    border-radius: 10px;
    background: #fffaf0;
    color: #29485b;
}
.song-guide-context__meta, .song-guide-context__nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.song-guide-context__meta { font-size: .85rem; font-weight: 700; }
.song-guide-context__nav { margin-top: .25rem; }
.song-guide-context__nav a { display: flex; min-width: 5.5rem; max-width: 48%; align-items: center; gap: .35rem; padding: .2rem .45rem; border-radius: 8px; background: #fff; color: #29485b; text-decoration: none; }
.song-guide-context__nav a:last-child { justify-content: flex-end; text-align: right; }
.song-guide-context__nav span { overflow: hidden; font-size: .74rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.song-guide-context__nav strong { font-size: 1rem; }
#song-sticky-refrain {
    position: fixed;
    z-index: 85;
    left: max(1rem, env(safe-area-inset-left));
    right: max(1rem, env(safe-area-inset-right));
    bottom: calc(max(var(--song-tabbar-height), env(safe-area-inset-bottom)) + .5rem);
    width: auto;
    max-width: 46rem;
    margin: 0 auto;
    border: 1px solid #d4b06a;
    border-radius: 14px;
    background: #fffaf0;
    color: #172c37;
    box-shadow: 0 -4px 20px #172c3726;
    overflow: hidden;
}
#song-refrain-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
}
#song-refrain-action { font-size: .85rem; }
#song-refrain-content {
    max-height: 25vh;
    max-height: 25dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: .25rem .8rem .75rem;
    font-size: var(--song-font-size);
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
#song-refrain-content p { margin: 0; font: inherit; }
body.has-menu-open #song-sticky-refrain { visibility: hidden; }
#cancioneiro .song-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
@media (max-width: 768px) {
    #cancioneiro #song-reading-toolbar { justify-content: space-between; }
    #cancioneiro #song-toolbar { min-width: 0; }
    #cancioneiro .controls-toggle > span:first-child { font-size: 0; }
    #cancioneiro .controls-toggle > span:first-child::after {
        content: "⚙";
        font-size: 1rem;
    }
    #cancioneiro .controls-toggle__chevron { display: none; }
    #cancioneiro #song-view { padding: .8rem .3rem; }
    #cancioneiro #song-view h2 { font-size: 1.7rem; }
}
@media (min-width: 769px) {
    /* Alinha o refrão com a leitura e mantém a lista de cânticos acessível. */
    #song-sticky-refrain {
        left: max(1rem, var(--song-reading-left, 1rem));
        right: max(1rem, var(--song-reading-right, 1rem));
    }
}
@media (min-width: 1024px) {
    /* Deixa espaço para o botão flutuante de horários do tema. */
    #song-sticky-refrain { bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
    #cancioneiro *, #chord-panel { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
    #song-sticky-refrain, #song-toolbar { display: none !important; }
    #cancioneiro #musica { padding-bottom: 0; }
}

.song-guide-context__meta { flex-wrap: wrap; gap: .5rem; }
.song-guide-context__nav a { min-height: 44px; flex-wrap: wrap; gap: .15rem .4rem; }
.song-guide-context__nav strong { font-size: .9rem; }
#song-sequence-open { min-height: 44px; margin-top: .5rem; padding: .4rem .8rem; border: 1px solid #bac8cf; border-radius: 8px; background: white; color: #29485b; font: inherit; font-weight: 700; cursor: pointer; }
#song-sequence { box-sizing: border-box; width: min(40rem, calc(100% - 2rem)); max-height: 75dvh; overflow: auto; padding: 1rem; border: 1px solid #bac8cf; border-radius: 16px; color: #29485b; background: #fff; }
#song-sequence::backdrop { background: rgb(15 32 41 / 55%); }
.song-sequence-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.song-sequence-heading h2 { margin: 0; font-size: 1.5rem; }
.song-sequence-heading button { min-height: 44px; min-width: 44px; border: 0; border-radius: 8px; background: #edf3f5; cursor: pointer; }
#song-sequence ol { padding: 0; margin: 1rem 0 0; list-style: none; }
#song-sequence li a { display: grid; padding: .75rem; min-height: 44px; border-top: 1px solid #dce4e8; color: inherit; text-decoration: none; }
#song-sequence li a[aria-current] { background: #fff2cf; border-radius: 8px; }
#song-sequence li a span { font-size: .8rem; }
@media (max-width: 768px) {
    #song-sequence { margin: auto auto calc(max(var(--song-tabbar-height, 4.5rem), env(safe-area-inset-bottom)) + .5rem); max-height: calc(85dvh - 5rem); }
}
