:root {
    --songsheet-font-size: 16px;
}

/* ── Theme variables ──────────────────────────────────────────────────── */

:root {
    --bg-body: #fff;
    --bg-card: #fff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: rgba(0,0,0,0.08);
    --navbar-bg: #fff;
}

body.theme-dark {
    --bg-body: #1a1a2e;
    --bg-card: #22223a;
    --text-primary: #e0e0e0;
    --text-secondary: #9e9e9e;
    --border-color: rgba(255,255,255,0.08);
    --navbar-bg: #1a1a2e;
}

body.theme-dark { background: var(--bg-body); color: var(--text-primary); }
body.theme-dark .card { background: var(--bg-card); border-color: var(--border-color); }
body.theme-dark .navbar { background: var(--navbar-bg) !important; border-color: var(--border-color) !important; }
body.theme-dark .navbar-light .navbar-brand,
body.theme-dark .navbar-light .nav-link,
body.theme-dark .navbar-light .navbar-brand:hover { color: var(--text-primary) !important; }
body.theme-dark #userEmailLabel { color: var(--text-primary) !important; }
body.theme-dark #userMenuBtn { color: var(--text-primary) !important; background: var(--bg-card) !important; border-color: var(--border-color) !important; }
body.theme-dark .list-group-item { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-color); }
body.theme-dark .list-group-item strong { color: var(--text-primary); }
body.theme-dark .text-muted { color: var(--text-secondary) !important; }
body.theme-dark .small.text-muted,
body.theme-dark small.text-muted { color: var(--text-secondary) !important; }
body.theme-dark .form-control, body.theme-dark .form-select { background: #2a2a40; color: var(--text-primary); border-color: var(--border-color); }
body.theme-dark .dropdown-menu { background: var(--bg-card); border-color: var(--border-color); }
body.theme-dark .dropdown-item { color: var(--text-primary); }
body.theme-dark .dropdown-item:hover { background: rgba(255,255,255,0.08); }
body.theme-dark .dropdown-divider { border-color: var(--border-color); }
body.theme-dark .btn-outline-secondary { color: var(--text-secondary); border-color: var(--text-secondary); }
body.theme-dark .btn-outline-secondary:hover { background: var(--text-secondary); color: #fff; }
body.theme-dark .btn-outline-primary { color: #6ea8fe; border-color: #6ea8fe; }
body.theme-dark .btn-outline-danger { color: #ea868f; border-color: #ea868f; }
body.theme-dark .btn-outline-success { color: #75b798; border-color: #75b798; }
body.theme-dark #preview { background: var(--bg-card); }
body.theme-dark .song-meta-chip { background: #2a2a40; color: #b0b0b0; }
body.theme-dark .song-meta-chip strong { color: var(--text-primary); }
body.theme-dark .modal-content { background: var(--bg-card); color: var(--text-primary); }
body.theme-dark .modal-header { border-color: var(--border-color); }
body.theme-dark .modal-footer { border-color: var(--border-color); }
body.theme-dark .nav-tabs { border-color: var(--border-color); }
body.theme-dark .nav-tabs .nav-link { color: var(--text-secondary); }
body.theme-dark .nav-tabs .nav-link.active { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-color); }

/* Dark mode — songsheet preview */
body.theme-dark .chordsheetjs-output .lyrics { color: var(--text-primary); }
body.theme-dark .chordsheetjs-output .comment { color: var(--text-secondary); }
body.theme-dark .chordsheetjs-output .section-label,
body.theme-dark .chordsheetjs-output .label,
body.theme-dark .chordsheetjs-output .paragraph { color: var(--text-primary); }
body.theme-dark .songsheet .meta { color: var(--text-secondary); }
body.theme-dark .songsheet .meta strong { color: var(--text-primary); }
body.theme-dark .song-meta-line { color: var(--text-secondary); }

/* Dark mode — section headers */
body.theme-dark .card h3, body.theme-dark .card h5, body.theme-dark .card h6,
body.theme-dark .card .h6, body.theme-dark .card .h5, body.theme-dark .card .h3 { color: var(--text-primary); }

/* Dark mode — index hero */
body.theme-dark .hero-title { color: var(--text-primary); }
body.theme-dark .hero-title span { color: #6ea8fe; }
body.theme-dark .hero-sub { color: var(--text-secondary); }
body.theme-dark .hero-pill { background: var(--bg-card); color: var(--text-secondary); }
body.theme-dark .chord-card { background: var(--bg-card); border-color: var(--border-color); }
body.theme-dark .chord-card-body { color: var(--text-primary); }
body.theme-dark .chord-card-filename { color: var(--text-secondary); }
body.theme-dark .chord-directive { color: #75b798; }
body.theme-dark .chord-token { color: #6ea8fe; }
body.theme-dark .feature-item { background: transparent; }
body.theme-dark .feature-title { color: var(--text-primary); }
body.theme-dark .feature-desc { color: var(--text-secondary); }

/* Dark mode — footer */
body.theme-dark footer { color: var(--text-secondary) !important; }
body.theme-dark footer a { color: #6ea8fe; }

/* Dark mode — bootstrap overrides */
body.theme-dark .bg-white { background: var(--bg-card) !important; }
body.theme-dark .border-bottom { border-color: var(--border-color) !important; }
body.theme-dark .shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important; }
body.theme-dark .page-link { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-color); }
body.theme-dark hr { border-color: var(--border-color); }
body.theme-dark .input-group-text { background: #2a2a40; color: var(--text-primary); border-color: var(--border-color); }

/* Dark mode — song row specifics */
body.theme-dark .song-row:hover { background: rgba(255,255,255,0.03); }
body.theme-dark .song-row-main strong { color: var(--text-primary); }

/* Dark mode — index quickstart */
body.theme-dark .quickstart-section { background: var(--bg-body); }
body.theme-dark .quickstart-heading { color: var(--text-primary); }
body.theme-dark .lead-sub { color: var(--text-secondary); }
body.theme-dark .step-row { border-color: transparent; }
body.theme-dark .step-text strong { color: var(--text-primary); }
body.theme-dark .step-text span { color: var(--text-secondary); }
body.theme-dark .cta-banner { background: var(--bg-card); border-color: var(--border-color); }
body.theme-dark .cta-banner h3 { color: var(--text-primary); }
body.theme-dark .cta-banner p { color: var(--text-secondary); }

/* Dark mode — remove harsh lines */
body.theme-dark header .navbar { box-shadow: none !important; }
body.theme-dark .navbar-light { border-bottom-color: var(--border-color) !important; }

/* Dark mode — placeholders */
body.theme-dark ::placeholder { color: #777 !important; }
body.theme-dark .form-control::placeholder { color: #777 !important; }

/* Dark mode — song title in preview */
body.theme-dark .chordsheetjs-output .title,
body.theme-dark .chordsheetjs-output .song-title { color: var(--text-primary); }
body.theme-dark .chordsheetjs-output .subtitle { color: var(--text-secondary); }

/* Dark mode — index feature strip */
body.theme-dark .feature-item { background: transparent; color: var(--text-primary); }
body.theme-dark .feature-icon { color: #6ea8fe; }
body.theme-dark .feature-title { color: var(--text-primary); }
body.theme-dark .feature-desc { color: var(--text-secondary); }
body.theme-dark .feature-strip { background: var(--bg-body); }

/* Dark mode — hero section extras */
body.theme-dark .hero-eyebrow { color: var(--text-secondary); }
body.theme-dark .hero-section { background: var(--bg-body); }
body.theme-dark .notice-small { color: var(--text-secondary); }
body.theme-dark .chord-card-footer { color: var(--text-secondary); border-color: var(--border-color); }
body.theme-dark .chord-tag { color: var(--text-secondary); background: #2a2a40; }

/* ── Settings modal ───────────────────────────────────────────────────── */

.s-bg-btn {
    width: 72px; height: 44px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.15);
    cursor: pointer; padding: 0; position: relative; overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
}
.s-bg-btn span {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 0.65rem; font-weight: 600; color: rgba(255,255,255,0.7);
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.s-bg-btn.active { border-color: #0d6efd; outline: 2px solid #0d6efd; transform: scale(1.05); }
.s-bg-btn:hover { border-color: rgba(255,255,255,0.5); transform: scale(1.03); }

.s-bg-btn[data-bg="default"],
#sBgPreview.bg-default { background: linear-gradient(180deg, #0a0e1a 0%, #0d0d1a 30%, #0a0a12 60%, #060608 100%); }
.s-bg-btn[data-bg="deepBlue"],
#sBgPreview.bg-deepBlue { background: linear-gradient(180deg, #0a1628 0%, #0d1a33 30%, #081020 60%, #040810 100%); }
.s-bg-btn[data-bg="warm"],
#sBgPreview.bg-warm { background: linear-gradient(180deg, #1a0a0a 0%, #2d0d0d 30%, #1a0808 60%, #0a0404 100%); }
.s-bg-btn[data-bg="forest"],
#sBgPreview.bg-forest { background: linear-gradient(180deg, #0a1a0e 0%, #0d2d14 30%, #081a0a 60%, #040a04 100%); }
.s-bg-btn[data-bg="sunset"],
#sBgPreview.bg-sunset { background: linear-gradient(180deg, #1a0e0a 0%, #33140d 30%, #1a0a08 60%, #0a0404 100%); }
.s-bg-btn[data-bg="midnight"],
#sBgPreview.bg-midnight { background: linear-gradient(180deg, #000 0%, #0a0a1a 30%, #000 60%, #000 100%); }

.s-bg-preview {
    width: 100%; max-width: 420px; height: 100px; border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
}
.s-bg-mini { height: 56px; }

/* ── Range slider polish ──────────────────────────────────────────────── */

.form-range {
    height: 1.5rem; padding: 0;
}
.form-range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; }
.form-range::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -5px; }

/* ── Presentation background presets ──────────────────────────────────── */

#worshipOverlay.bg-default {
    background: radial-gradient(ellipse at 50% 30%, rgba(30,50,120,0.35) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(60,30,100,0.25) 0%, transparent 50%),
                linear-gradient(180deg, #0a0e1a 0%, #0d0d1a 30%, #0a0a12 60%, #060608 100%);
}
#worshipOverlay.bg-deepBlue {
    background: radial-gradient(ellipse at 50% 30%, rgba(20,40,100,0.4) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(40,80,140,0.2) 0%, transparent 50%),
                linear-gradient(180deg, #0a1628 0%, #0d1a33 30%, #081020 60%, #040810 100%);
}
#worshipOverlay.bg-warm {
    background: radial-gradient(ellipse at 50% 30%, rgba(120,40,20,0.35) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(100,30,20,0.2) 0%, transparent 50%),
                linear-gradient(180deg, #1a0a0a 0%, #2d0d0d 30%, #1a0808 60%, #0a0404 100%);
}
#worshipOverlay.bg-forest {
    background: radial-gradient(ellipse at 50% 30%, rgba(20,80,40,0.3) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(20,60,30,0.2) 0%, transparent 50%),
                linear-gradient(180deg, #0a1a0e 0%, #0d2d14 30%, #081a0a 60%, #040a04 100%);
}
#worshipOverlay.bg-sunset {
    background: radial-gradient(ellipse at 50% 30%, rgba(120,60,20,0.35) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(100,30,50,0.25) 0%, transparent 50%),
                linear-gradient(180deg, #1a0e0a 0%, #33140d 30%, #1a0a08 60%, #0a0404 100%);
}
#worshipOverlay.bg-midnight {
    background: radial-gradient(ellipse at 50% 30%, rgba(20,20,60,0.2) 0%, transparent 60%),
                linear-gradient(180deg, #000 0%, #0a0a1a 30%, #000 60%, #000 100%);
}

/* ── Chord shadow effects ─────────────────────────────────────────────── */

#worshipOverlay .worship-sheet .chord.shadow-soft { text-shadow: 0 0 8px rgba(255,213,79,0.3); }
#worshipOverlay .worship-sheet .chord.shadow-strong { text-shadow: 0 0 14px rgba(255,213,79,0.5), 0 0 4px rgba(255,213,79,0.3); }
#worshipOverlay .worship-sheet .chord.shadow-outline {
    text-shadow: -1px -1px 0 rgba(0,0,0,0.6), 1px -1px 0 rgba(0,0,0,0.6),
                 -1px 1px 0 rgba(0,0,0,0.6), 1px 1px 0 rgba(0,0,0,0.6);
}

/* ── Base behavior ───────────────────────────────────────────────────── */

html,
body {
    overscroll-behavior-y: contain;
}

button,
.btn,
.form-control,
.form-select,
.dropdown-item {
    touch-action: manipulation;
}

button.btn,
label.btn,
a.btn,
#userMenuBtn,
#userEmailLabel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* ── Songsheet / ChordSheetJS ────────────────────────────────────────── */

.songsheet {
    font-size: var(--songsheet-font-size, 16px);
}

/* ── Metadata bar ──────────────────────────────────────────────────────── */

.song-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.song-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    background: #f0f2f5;
    font-size: 0.8rem;
    color: #495057;
    line-height: 1.5;
}

.song-meta-chip strong {
    font-weight: 600;
    color: #212529;
}

/* ── Meta styles from ChordSheetJS ────────────────────────────────────── */

.songsheet .meta {
    margin-bottom: 0.7rem;
    color: #6c757d;
    font-size: 0.95em;
}

.songsheet .meta strong {
    color: #212529;
    font-size: 1.08em;
}

.song-meta-line {
    margin-bottom: 0.35rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.95em;
}

.songsheet.present-no-chords .chord {
    display: none !important;
}

.songsheet.two-column {
    column-count: 2;
    column-gap: 3rem;
}

.songsheet .chord,
.chordsheetjs-output .chord {
    display: inline-block;
    margin-right: 0.45em;
}

.songsheet .chord:last-child,
.chordsheetjs-output .chord:last-child {
    margin-right: 0;
}

.chordsheetjs-output {
    font-family: inherit;
    line-height: 1.5;
    font-size: inherit;
}

.chordsheetjs-output .paragraph {
    margin-bottom: 1.25rem;
}

/* Override Bootstrap's .row entirely within this scope */
.chordsheetjs-output .row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-end !important;
    margin: 0 !important;
    white-space: pre-wrap;
    line-height: 1;
    font-size: inherit;
}

.chordsheetjs-output .column {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-end !important;
    min-width: max-content !important;
    width: auto !important;
    padding: 0 2px 0 0 !important;
    float: none !important;
    font-size: inherit;
}

.chordsheetjs-output .chord {
    display: block !important;
    min-height: 1.2em;
    color: #ff2c2c;
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1.4;
    white-space: pre;
}

.chordsheetjs-output .lyrics {
    display: block !important;
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 1em;
    font-weight: 400;
}

.chordsheetjs-output .comment {
    display: block;
    margin: 0.25rem 0;
    color: #6c757d;
    font-style: italic;
    font-size: 0.95em;
}

.chordsheetjs-output .title,
.chordsheetjs-output .song-title {
    margin-bottom: 0.15rem;
    font-size: 1.25em;
    font-weight: 700;
}

.chordsheetjs-output .section-label,
.chordsheetjs-output .label,
.chordsheetjs-output .paragraph,
.chordsheetjs-output .subtitle {
    margin: 0.35rem 0 0.15rem;
    font-size: 1em;
    font-weight: 700;
    line-height: 1.4;
    color: inherit;
}

.chordsheetjs-output .paragraph.chorus {
    padding-left: 0.75rem;
    border-left: 3px solid #0d6efd;
}

/* ── Preview ─────────────────────────────────────────────────────────── */

#preview {
    max-height: 70vh;
    overflow: auto;
    padding-left: 0.85rem;
}

/* ── Worship Presentation Mode ──────────────────────────────────────────── */

#worshipOverlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(30, 50, 120, 0.35) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(60, 30, 100, 0.25) 0%, transparent 50%),
        linear-gradient(180deg, #0a0e1a 0%, #0d0d1a 30%, #0a0a12 60%, #060608 100%);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
    overflow: hidden;
}

/* ── Slide area ───────────────────────────────────────────────────────── */

#worshipOverlay .worship-slide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(1400px, 94vw);
    max-height: 92vh;
    padding: 4vh 4vw;
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0;
    transform: translateY(12px);
}

/* ── Section label ────────────────────────────────────────────────────── */

#worshipOverlay .worship-label {
    font-size: clamp(1rem, 2.2vw, 1.6rem);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: clamp(1rem, 3vh, 2.5rem);
    text-align: center;
}

/* ── Lyrics ───────────────────────────────────────────────────────────── */

#worshipOverlay .worship-lyrics {
    width: 100%;
    max-width: 1100px;
    text-align: center;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

#worshipOverlay .worship-lyrics::-webkit-scrollbar {
    width: 4px;
}
#worshipOverlay .worship-lyrics::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

#worshipOverlay .worship-sheet {
    text-align: center;
}

#worshipOverlay .worship-sheet .chord {
    color: #ffd54f !important;
    font-weight: 700;
    font-size: 0.78em;
    text-shadow: 0 0 12px rgba(255, 213, 79, 0.15);
    display: inline-block;
    margin-right: 0.4em;
}

#worshipOverlay .worship-sheet .lyrics {
    color: #fff;
    font-weight: 400;
    line-height: 1.7;
}

#worshipOverlay .worship-sheet .row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-end !important;
    justify-content: center !important;
    margin: 0 !important;
    white-space: pre-wrap;
    line-height: 1;
}

#worshipOverlay .worship-sheet .column {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-end !important;
    min-width: max-content !important;
    width: auto !important;
    padding: 0 2px 0 0 !important;
    float: none !important;
}

#worshipOverlay .worship-sheet .paragraph {
    margin-bottom: 0.6em;
}

#worshipOverlay .worship-sheet .paragraph.chorus {
    padding-left: 0.5rem;
    border-left: 2px solid rgba(255, 213, 79, 0.35);
}

#worshipOverlay .worship-sheet .comment {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    font-size: 0.85em;
    margin: 0.15rem 0;
}

#worshipOverlay .worship-sheet .section-label,
#worshipOverlay .worship-sheet .label {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0.2rem 0;
}

/* ── Key indicator ────────────────────────────────────────────────────── */

#worshipOverlay .worship-key {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    color: rgba(255, 255, 255, 0.3);
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    font-weight: 500;
    letter-spacing: 0.06em;
    pointer-events: none;
}

/* ── Slide counter ────────────────────────────────────────────────────── */

#worshipOverlay .worship-counter {
    position: fixed;
    bottom: 24px;
    right: 28px;
    z-index: 10001;
    color: rgba(255, 255, 255, 0.2);
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    font-weight: 500;
    letter-spacing: 0.04em;
    pointer-events: none;
}

/* ── Controls bar ─────────────────────────────────────────────────────── */

#worshipOverlay .worship-controls {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 999px;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#worshipOverlay .worship-controls-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
    pointer-events: none;
}

#worshipOverlay .worship-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

#worshipOverlay .worship-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: scale(1.08);
}

#worshipOverlay .worship-btn:active {
    transform: scale(0.95);
}

#worshipOverlay .worship-btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

#worshipOverlay .worship-controls-sep {
    display: block;
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 2px;
}

/* ── Media queries ────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    #worshipOverlay .worship-slide {
        padding: 3vh 3vw;
        width: 96vw;
    }

    #worshipOverlay .worship-controls {
        padding: 4px 8px;
        gap: 4px;
        bottom: 16px;
    }

    #worshipOverlay .worship-btn {
        width: 34px;
        height: 34px;
    }

    #worshipOverlay .worship-key,
    #worshipOverlay .worship-counter {
        display: none;
    }
}

/* ── Setlist ──────────────────────────────────────────────────────────── */

#setlistItems .setlist-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.55rem;
}

#setlistItems .setlist-item .setlist-number {
    font-size: 0.7rem;
    font-weight: 700;
    color: #adb5bd;
    min-width: 1.2rem;
    text-align: center;
}

#setlistItems .setlist-item .setlist-title {
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#setlistItems .setlist-item .setlist-actions {
    display: flex;
    gap: 0.2rem;
    flex-shrink: 0;
}

#setlistItems .setlist-item .setlist-actions .btn {
    padding: 0.1rem 0.35rem;
    font-size: 0.7rem;
    line-height: 1.3;
    min-height: auto;
}

#setlistItems .setlist-item.setlist-dragging {
    opacity: 0.4;
}

#setlistItems .setlist-item.setlist-drag-over {
    border-top: 2px solid #0d6efd;
}

/* ── Song tags ────────────────────────────────────────────────────────── */

.song-tag-badge {
    display: inline-block;
    padding: 1px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.01em;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* ── Buttons, menus, controls ────────────────────────────────────────── */

.btn {
    min-height: 32px;
    padding: 0.28rem 0.55rem;
    line-height: 1.15;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.08);
}

.btn.btn-sm {
    min-height: 30px;
    padding: 0.2rem 0.5rem;
    font-size: 0.82rem;
    line-height: 1.1;
}

.btn-group-sm > .btn,
.btn-group-sm .btn {
    min-height: 29px;
    padding: 0.18rem 0.45rem;
    line-height: 1.05;
}

.demo-badge {
    padding: 0.14rem 0.42rem;
    color: #6c757d !important;
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    background: #f8f9fa !important;
    border-color: rgba(108, 117, 125, 0.22) !important;
}

#userMenuBtn {
    min-height: 30px;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
    line-height: 1.1;
}

#userEmailLabel {
    line-height: 1.1;
}

#userMenuBtn.dropdown-toggle::after {
    margin-top: 0;
    align-self: center;
}

.dropdown-menu .dropdown-item {
    padding: 0.32rem 0.75rem;
    font-size: 0.86rem;
    line-height: 1.15;
}

.dropdown-menu .dropdown-divider {
    margin: 0.3rem 0;
}

.view-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem !important;
}

.view-controls .btn {
    border-width: 1px !important;
    box-shadow: none !important;
}

/* ── Accidental preference buttons ───────────────────────────────────── */

label[for="accSharp"],
label[for="accFlat"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    min-height: 2.15rem;
    padding: 0.35rem 0.9rem;
    margin: 0 !important;
    border-radius: 0 !important;
    font-weight: 600;
    line-height: 1;
}

label[for="accSharp"] {
    border-top-left-radius: 0.5rem !important;
    border-bottom-left-radius: 0.5rem !important;
}

label[for="accFlat"] {
    margin-left: -1px !important;
    border-top-right-radius: 0.5rem !important;
    border-bottom-right-radius: 0.5rem !important;
}

#accSharp:checked + label[for="accSharp"],
#accFlat:checked + label[for="accFlat"] {
    position: relative;
    z-index: 1;
}

/* ── Inputs / file controls ──────────────────────────────────────────── */

.input-group.input-group-sm .form-control[type="file"] {
    align-self: center;
    height: auto;
    padding: 0.375rem 0.75rem;
}

.input-group.input-group-sm .btn,
.d-flex .form-control[type="file"] {
    align-self: center;
}

.d-flex .form-control[type="file"] {
    height: auto;
    padding: 0.35rem 0.6rem;
}

/* ── Song rows / list items / library controls ──────────────────────── */

.song-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.song-row-main {
    flex: 1 1 220px;
    min-width: 0;
}

.song-row-actions {
    flex: 0 1 auto;
    min-width: 0;
    margin-left: auto;
    overflow: visible;
}

.song-action-group {
    display: inline-flex;
    align-items: stretch;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0;
    max-width: 100%;
    overflow: visible;
}

.song-action-group > .btn {
    position: relative;
    z-index: 1;
    margin-left: 0 !important;
    border-radius: 0 !important;
}

.song-action-group > .btn:first-child {
    border-top-left-radius: 0.375rem !important;
    border-bottom-left-radius: 0.375rem !important;
}

.song-action-group > .btn:last-child {
    border-top-right-radius: 0.375rem !important;
    border-bottom-right-radius: 0.375rem !important;
}

.song-action-group > .btn:only-child {
    border-radius: 0.375rem !important;
}

.song-action-group > .btn + .btn {
    margin-left: -1px !important;
    border-left-color: transparent !important;
}

.song-action-group > .btn + .btn:hover,
.song-action-group > .btn + .btn:focus {
    z-index: 2;
    border-left-color: inherit !important;
}

#songList,
#libSongList,
#allSongList,
#libraryList {
    overflow: auto;
}

#songList .list-group-item,
#libSongList .list-group-item,
#allSongList .list-group-item,
#libraryList .list-group-item {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 36px;
    padding: 0.25rem 0.55rem;
}

#songList .list-group-item strong,
#libSongList .list-group-item strong,
#allSongList .list-group-item strong,
#libraryList .list-group-item strong {
    font-size: 0.94rem;
    line-height: 1.1;
}

#songList .list-group-item .small,
#songList .list-group-item small,
#libSongList .list-group-item .small,
#libSongList .list-group-item small,
#allSongList .list-group-item .small,
#allSongList .list-group-item small,
#libraryList .list-group-item .small,
#libraryList .list-group-item small {
    font-size: 0.72rem;
    line-height: 1.05;
}

#songList .list-group-item .btn,
#libSongList .list-group-item .btn,
#allSongList .list-group-item .btn,
#libraryList .list-group-item .btn {
    min-height: 28px;
    padding: 0.14rem 0.45rem;
}

#quickFilterBtn {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: 0.375rem !important;
    border-bottom-right-radius: 0.375rem !important;
}

#addSongBtn {
    margin-left: 0.5rem !important;
    border-radius: 0.375rem !important;
}

#quickFilterBtn,
#addSongBtn {
    position: relative;
    z-index: 1;
}

.force-rounded {
    border-radius: 0.375rem !important;
}

/* ── Home page ──────────────────────────────────────────────────────── */

.hero-section {
    padding: 4.5rem 0 3.5rem;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1.1rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid rgba(13, 110, 253, 0.15);
    border-radius: 999px;
    color: #0d6efd;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: rgba(13, 110, 253, 0.07);
}

.hero-title {
    margin-bottom: 1rem;
    color: #0d1b2a;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero-title span {
    color: #0d6efd;
}

.hero-sub {
    max-width: 48ch;
    margin-bottom: 2rem;
    color: #6c757d;
    font-size: 1.05rem;
    line-height: 1.65;
}

.hero-actions .btn-lg {
    padding: 0.7rem 1.6rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.hero-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.75rem;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.8rem;
    border: 1px solid #dee2e6;
    border-radius: 999px;
    color: #495057;
    font-size: 0.8rem;
    background: #f8f9fa;
}

.notice-small {
    color: #adb5bd;
    font-size: 0.72rem;
}

.chord-card {
    overflow: hidden;
    border-radius: 1rem;
    background: #0d1b2a;
    box-shadow: 0 20px 60px rgba(13, 27, 42, 0.18);
}

.chord-card-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
}

.chord-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.chord-card-filename {
    margin-left: 0.5rem;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.72rem;
    font-family: "Roboto Mono", monospace;
}

.chord-card-body {
    padding: 1.25rem 1.35rem 1.5rem;
    color: #c9d1d9;
    font-size: 0.82rem;
    line-height: 1.9;
    font-family: "Roboto Mono", monospace;
}

.chord-token {
    color: #79c0ff;
    font-weight: 600;
}

.chord-directive {
    color: #d2a8ff;
    font-style: italic;
}

.chord-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chord-tag {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.7rem;
    font-family: "Roboto Mono", monospace;
    letter-spacing: 0.05em;
}

.chord-copy-btn {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    border-color: rgba(255, 255, 255, 0.15);
}

.chord-copy-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.feature-strip {
    padding: 2.75rem 0 3rem;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    height: 100%;
    padding: 1.25rem 1.5rem;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    background: #fff;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.feature-item:hover {
    border-color: #d0d7de;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #0d6efd;
}

.feature-title {
    margin: 0;
    color: #0d1b2a;
    font-size: 0.92rem;
    font-weight: 700;
}

.feature-desc {
    margin: 0;
    color: #6c757d;
    font-size: 0.82rem;
    line-height: 1.5;
}

.quickstart-section {
    padding: 3rem 0 3.5rem;
}

.quickstart-heading {
    margin-bottom: 0.3rem;
    color: #0d1b2a;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.lead-sub {
    margin-bottom: 1.75rem;
    color: #6c757d;
    font-size: 0.9rem;
}

.step-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.step-num {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-top: 1px;
    border-radius: 50%;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    background: #0d6efd;
}

.step-text strong {
    display: block;
    color: #0d1b2a;
    font-size: 0.9rem;
}

.step-text span {
    color: #6c757d;
    font-size: 0.82rem;
}

.cta-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 2.75rem 2.5rem;
    border-radius: 1rem;
    color: #fff;
    background: linear-gradient(135deg, #0d1b2a 0%, #1a3a5c 100%);
}

.cta-banner h3 {
    margin-bottom: 0.35rem;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.cta-banner p {
    max-width: 44ch;
    margin: 0;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
}

.cta-banner .btn-light {
    padding: 0.65rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 700;
    white-space: nowrap;
}

/* ── Chord diagrams ─────────────────────────────────────────────────── */

.chord-diagram-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 60px;
}

.chord-diagram-card .chord-name {
    color: #444;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.chord-diagram-card svg {
    display: block;
}

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (hover: none), (pointer: coarse) {
    .btn,
    .btn.btn-sm,
    .form-control,
    .form-control-sm,
    .form-select,
    .form-select-sm,
    .dropdown-item {
        min-height: 38px;
    }

    #songList .list-group-item .btn,
    #libSongList .list-group-item .btn,
    #allSongList .list-group-item .btn,
    #libraryList .list-group-item .btn {
        min-height: 34px;
        padding: 0.2rem 0.55rem;
    }

    .song-row-main,
    .song-row-actions {
        min-height: 34px;
    }
}

@media (max-width: 991px) {
    .songsheet {
        font-size: 15px;
    }

    .navbar .btn {
        padding: 0.2rem 0.45rem;
        font-size: 0.82rem;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    main.container-fluid {
        padding-right: 1rem !important;
        padding-left: 1rem !important;
    }

    #preview {
        max-height: 56vh;
    }

    #songList,
    #libSongList,
    #allSongList,
    #libraryList {
        max-height: 42vh !important;
    }

    .songsheet {
        font-size: 15px;
    }

    .song-row {
        gap: 0.6rem;
    }

    .song-action-group {
        gap: 0.3rem;
    }

    #libraryToggleFloating {
        right: 10px !important;
        padding: 10px 11px !important;
        border-radius: 10px !important;
    }
}

@media (max-width: 768px) {
    .navbar .btn {
        padding: 0.3rem 0.65rem;
    }
}

@media (max-width: 767px) {
    body {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    header.sticky-top {
        position: sticky;
        top: 0;
        z-index: 1030;
    }

    main.container-fluid {
        margin-top: 0.75rem !important;
        margin-bottom: 0.75rem !important;
        padding-right: 0.75rem !important;
        padding-left: 0.75rem !important;
    }

    .card {
        border-radius: 0.85rem;
    }

    .card-body {
        padding: 0.85rem;
    }

    .songsheet {
        font-size: 15px;
        line-height: 1.12;
    }

    .songsheet.two-column {
        column-count: 1;
    }

    .navbar .btn,
    #userMenuBtn {
        min-height: 36px;
    }

    #authControls {
        width: 100%;
        margin-top: 0.5rem;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .view-controls {
        flex-wrap: wrap;
    }

    .view-controls .btn {
        min-height: 34px;
    }

    .input-group.input-group-sm {
        flex-wrap: nowrap;
    }

    .input-group.input-group-sm .form-control,
    .input-group.input-group-sm .btn {
        min-height: 38px;
    }

    #preview {
        min-height: 180px;
        max-height: 52vh;
        padding: 0.65rem !important;
        border-radius: 0.5rem;
    }

    #songList,
    #libSongList,
    #allSongList,
    #libraryList {
        max-height: 40vh !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    #songList .list-group-item,
    #libSongList .list-group-item,
    #allSongList .list-group-item,
    #libraryList .list-group-item {
        display: block !important;
        align-items: flex-start;
        min-height: 44px;
        height: auto !important;
        min-height: unset !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0.7rem !important;
    }

    .song-row,
    #songList .list-group-item .song-row,
    #libSongList .list-group-item .song-row,
    #allSongList .list-group-item .song-row,
    #libraryList .list-group-item .song-row {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0.45rem;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    .song-row-main,
    #songList .list-group-item .song-row-main,
    #libSongList .list-group-item .song-row-main,
    #allSongList .list-group-item .song-row-main,
    #libraryList .list-group-item .song-row-main {
        flex: none;
        display: block !important;
        width: 100% !important;
        min-width: 0;
        min-height: 0 !important;
        height: auto !important;
        margin: 0 0 0.45rem 0 !important;
        overflow: visible !important;
    }

    .song-row-main > .d-flex {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.35rem;
        min-width: 0;
    }

    .song-row-main strong,
    #songList .list-group-item strong,
    #libSongList .list-group-item strong,
    #allSongList .list-group-item strong,
    #libraryList .list-group-item strong {
        display: block !important;
        min-width: 0;
        max-width: 100%;
        line-height: 1.2 !important;
        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
    }

    .song-row-actions,
    #songList .list-group-item .song-row-actions,
    #libSongList .list-group-item .song-row-actions,
    #allSongList .list-group-item .song-row-actions,
    #libraryList .list-group-item .song-row-actions {
        flex: none;
        display: block !important;
        width: 100% !important;
        min-width: 0;
        min-height: 0 !important;
        height: auto !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    .song-action-group,
    #songList .list-group-item .song-action-group,
    #libSongList .list-group-item .song-action-group,
    #allSongList .list-group-item .song-action-group,
    #libraryList .list-group-item .song-action-group {
        display: flex !important;
        width: 100% !important;
        height: auto !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
        gap: 0.35rem !important;
        overflow: visible !important;
    }

    .song-action-group > .btn,
    #songList .list-group-item .song-action-group > .btn,
    #libSongList .list-group-item .song-action-group > .btn,
    #allSongList .list-group-item .song-action-group > .btn,
    #libraryList .list-group-item .song-action-group > .btn,
    #songList .list-group-item .song-row-actions .btn,
    #libSongList .list-group-item .song-row-actions .btn,
    #allSongList .list-group-item .song-row-actions .btn,
    #libraryList .list-group-item .song-row-actions .btn {
        flex: 0 0 auto;
        min-width: 72px !important;
        margin: 0 !important;
        border-radius: 0.375rem !important;
        white-space: nowrap !important;
    }

    .song-action-group > .btn + .btn,
    #songList .list-group-item .song-action-group > .btn + .btn,
    #libSongList .list-group-item .song-action-group > .btn + .btn,
    #allSongList .list-group-item .song-action-group > .btn + .btn,
    #libraryList .list-group-item .song-action-group > .btn + .btn {
        margin-left: 0 !important;
    }

    #songList .list-group-item .small,
    #songList .list-group-item small,
    #libSongList .list-group-item .small,
    #libSongList .list-group-item small,
    #allSongList .list-group-item .small,
    #allSongList .list-group-item small,
    #libraryList .list-group-item .small,
    #libraryList .list-group-item small {
        display: inline-block;
        line-height: 1.15 !important;
        white-space: normal !important;
    }

    #songList .list-group-item .btn,
    #libSongList .list-group-item .btn,
    #allSongList .list-group-item .btn,
    #libraryList .list-group-item .btn {
        min-height: 34px;
        padding: 0.2rem 0.5rem;
    }

    #activeLibraryTitle,
    .card h5,
    .card h6,
    .card .h6 {
        line-height: 1.2;
    }

    .d-flex.gap-2,
    .mb-2.d-flex.align-items-center.gap-2 {
        flex-wrap: wrap;
    }

    .mb-2.d-flex.align-items-center.gap-2 > * {
        min-width: 0;
    }

    .mb-2.d-flex.align-items-center.gap-2 .input-group {
        flex: 1 1 100%;
    }

    #libraryToggleFloating {
        top: auto !important;
        right: 12px !important;
        bottom: 14px !important;
        transform: none !important;
        min-width: 42px;
        min-height: 42px;
        padding: 10px 12px !important;
        border-radius: 999px !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
    }

    #worshipOverlay .worship-controls {
        padding: 4px 8px;
        gap: 4px;
        bottom: 12px;
    }

    #worshipOverlay .worship-btn {
        width: 32px;
        height: 32px;
    }

    footer {
        padding-bottom: calc(0.9rem + env(safe-area-inset-bottom, 0)) !important;
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    #preview {
        max-height: 56vh;
    }

    #songList,
    #libSongList,
    #allSongList,
    #libraryList {
        max-height: 42vh !important;
    }
}

@media (max-width: 932px) and (orientation: landscape) {
    #preview {
        max-height: 44vh;
    }

    #songList,
    #libSongList,
    #allSongList,
    #libraryList {
        max-height: 34vh !important;
    }

    #libraryToggleFloating {
        bottom: 10px !important;
    }

    #worshipOverlay .worship-slide {
        padding: 2vh 3vw;
    }
}

/* ── Title slide ─────────────────────────────────────────────────────── */

#worshipOverlay .worship-title-slide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 40vh;
    gap: 0.5rem;
}

#worshipOverlay .worship-title-main {
    font-size: clamp(2.2rem, 6.5vw, 4.8rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    line-height: 1.2;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
}

#worshipOverlay .worship-title-sub {
    font-size: clamp(1.1rem, 3vw, 2rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.06em;
    margin-top: 0.4rem;
    max-width: 80vw;
}