:root {
    --bg-color: #0f1014;
    --card-bg: #1c1e26;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #fca311;
    /* Orange */
    --accent-glow: rgba(252, 163, 17, 0.3);
    --secondary-accent: #8a2be2;
    /* Purple */
    --modal-bg: #15161c;
    --font-family: 'Outfit', sans-serif;
    --color-danger: #ef4444;
    --color-success: #10B981;
    --color-youtube: #FF0000;
    --color-youtube-hover: #CC0000;
    --color-danger-hover: #dc2626;
    --color-success-hover: #059669;
    --color-secondary-hover: #7c22ce;
    --color-share: #3B82F6;
    --color-share-hover: #2563EB;
    --color-lyrics: #e0e0e0;
    --color-version: #4a4d5e;
    --color-toggle-off: #333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.6;
}

body.modal-open {
    overflow: hidden;
}

/* Header */
.app-header {
    background: rgba(15, 16, 20, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.title-container {
    display: flex;
    flex-direction: column;
}

h1 {
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: -0.5px;
    line-height: 1;
}

.accent {
    color: var(--accent-color);
}

/* Search */
.search-container {
    position: relative;
    flex: 1 1 200px;
    min-width: 150px;
    max-width: 400px;
}

#searchInput {
    width: 100%;
    padding: 0.8rem 2.5rem 0.8rem 2.5rem;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--card-bg);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s;
}

.search-clear-btn:hover {
    color: var(--text-primary);
}

/* List Grid */
.song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

.song-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

@media (hover: hover) {
    .song-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
        border-color: rgba(255, 255, 255, 0.1);
    }
}

.card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
    gap: 1rem;
    padding-right: 48px;
    /* Space for absolute right column */
}

.song-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    /* Ellipsis logic */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* Standard property */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 3em;
    /* Approx 2 lines */
    line-height: 1.3;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-right: 48px;
}

.tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    /* Color set by JS */
    background: var(--color-toggle-off);
    /* Fallback */
    font-weight: 600;
    text-shadow: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--modal-bg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    z-index: 1001;
    /* Above sticky header if needed */
}

.close-button:hover {
    color: white;
}

.modal-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    position: relative;
    /* Removed padding-right to allow full flex width, close button is absolute */
}

.modal-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-right: 2rem;
    /* Space for close button */
    margin-bottom: 0.5rem;
}

.modal-number {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-left: 1rem;
    align-self: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
    line-height: 1.3;
}

/* Actions in Header */
.actions-header {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.actions-header .primary-btn {
    white-space: nowrap;
    padding: 0.6rem 1rem;
}

.no-sheet-tag {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

.meta-item {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.meta-item .label {
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.lyrics-content {
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-lyrics);
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Share Modal Styles */
.share-modal-content {
    max-width: 400px;
    text-align: center;
}

.share-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.share-modal-body p {
    color: var(--text-secondary);
    margin: 0;
}

.qr-container {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    display: inline-block;
}

.qr-container img,
.qr-container canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.copy-link-btn {
    width: 100%;
    justify-content: center;
}

.primary-btn {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

@media (hover: hover) {
    .primary-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px var(--accent-glow);
    }
}

.youtube-btn {
    background: var(--color-youtube);
    color: white;
    margin-left: 0.5rem;
}

@media (hover: hover) {
    .youtube-btn:hover {
        background: var(--color-youtube-hover);
        box-shadow: 0 5px 15px rgba(255, 0, 0, 0.3);
    }
}

.install-btn {
    background: var(--color-success);
    color: white;
    /* margin-left: auto; if needed */
}

@media (hover: hover) {
    .install-btn:hover {
        background: var(--color-success-hover);
        box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
    }
}

.hidden {
    display: none !important;
}

/* Gallery */
.gallery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #000;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.gallery-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: calc(0.6rem + env(safe-area-inset-top))
             calc(0.9rem + env(safe-area-inset-right))
             0.75rem
             calc(0.9rem + env(safe-area-inset-left));
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.55) 75%, transparent 100%);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.gallery-overlay.toolbar-hidden .gallery-toolbar {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}

.gallery-song-meta {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    min-width: 0;
    flex: 1;
}

.gallery-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-number {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.gallery-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.gallery-page-indicator {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding: 0 0.4rem;
    white-space: nowrap;
}

.gallery-icon-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.gallery-icon-btn:active {
    background: rgba(255, 255, 255, 0.25);
}

.gallery-icon-btn.is-active {
    background: var(--accent-color);
    color: #000;
    border-color: var(--accent-color);
}

@media (hover: hover) {
    .gallery-icon-btn:hover {
        background: rgba(255, 255, 255, 0.22);
        border-color: rgba(255, 255, 255, 0.35);
    }

    .gallery-icon-btn.is-active:hover {
        background: var(--accent-color);
        border-color: var(--accent-color);
    }
}

.close-gallery-btn {
    font-size: 1.75rem;
    line-height: 1;
}

.gallery-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.image-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    transform-origin: center center;
    will-change: transform;
}

.image-wrapper.is-zoom-animating {
    transition: transform 0.2s ease-out;
}

.gallery-overlay.is-zoomed {
    touch-action: none;
}

.gallery-overlay.is-zoomed .image-wrapper {
    overflow: visible;
}

/* Paged Mode (default on tablets) */
.gallery-overlay.mode-paged .image-wrapper {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow: hidden;
    padding: env(safe-area-inset-top)
             env(safe-area-inset-right)
             env(safe-area-inset-bottom)
             env(safe-area-inset-left);
}

.gallery-overlay.mode-paged .image-wrapper img {
    display: none;
}

.gallery-overlay.mode-paged .image-wrapper img.is-visible {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    -webkit-user-drag: none;
}

.gallery-overlay.mode-paged.is-rotated-quarter .image-wrapper img.is-visible {
    max-width: 100vh;
    max-width: 100dvh;
    max-height: 100vw;
}

.gallery-overlay.mode-paged .image-wrapper.spread-two img.is-visible {
    max-width: calc(50% - 4px);
    max-height: 100%;
}

/* Continuous Scroll Mode */
.gallery-overlay.mode-scroll {
    touch-action: pan-x pan-y pinch-zoom;
}

.gallery-overlay.mode-scroll .image-wrapper {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: calc(0.5rem + env(safe-area-inset-top))
             env(safe-area-inset-right)
             calc(1.5rem + env(safe-area-inset-bottom))
             env(safe-area-inset-left);
}

.gallery-overlay.mode-scroll .image-wrapper img {
    display: block;
    max-width: 100%;
    max-height: 98vh;
    max-height: 98dvh;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Floating Prev / Next buttons (visible when toolbar is shown in paged mode) */
.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.22s ease, background 0.18s ease;
}

.gallery-nav-prev {
    left: calc(0.75rem + env(safe-area-inset-left));
}

.gallery-nav-next {
    right: calc(0.75rem + env(safe-area-inset-right));
}

.gallery-overlay.toolbar-hidden .gallery-nav-btn {
    opacity: 0;
    pointer-events: none;
}

@media (hover: hover) {
    .gallery-nav-btn:hover {
        background: rgba(0, 0, 0, 0.8);
    }
}

/* Discreet bottom-right page pill when toolbar is hidden */
.gallery-page-badge {
    position: absolute;
    right: calc(0.75rem + env(safe-area-inset-right));
    bottom: calc(0.6rem + env(safe-area-inset-bottom));
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.gallery-overlay:not(.toolbar-hidden) .gallery-page-badge {
    opacity: 0;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .song-grid {
        grid-template-columns: 1fr;
    }

    .gallery-title {
        font-size: 0.95rem;
    }
}

/* Toggle Switch */
.cache-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 1rem;
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-toggle-off);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent-color);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--accent-color);
}

input:checked+.slider:before {
    transform: translateX(18px);
}

/* Offline Progress */
.offline-progress {
    position: fixed !important;
    bottom: 20px;
    right: 20px;
    background: rgba(15, 16, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--accent-color);
    width: 200px;
    pointer-events: none;
}

.offline-progress.visible {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.offline-progress span {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
    transition: width 0.2s ease;
}

.offline-progress.complete {
    animation: fadeOut 1s forwards 2s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Worship Mode List Layout */
.song-grid.worship-list {
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.song-grid.worship-list .song-card {
    flex-direction: row;
    align-items: center;
    padding: 1rem 1.5rem;
}

.song-grid.worship-list .card-top-row {
    margin-bottom: 0;
    flex: 1;
    align-items: center;
    padding-right: 0;
}

.song-grid.worship-list .song-title {
    font-size: 1.1rem;
    margin-right: 1rem;
}

.song-grid.worship-list .tags-container {
    display: none;
    /* Hide tags in list mode for cleaner look? Or keep them? User said "one song per line", suggesting a list view. */
    /* Let's keep them but maybe smaller or hidden if it gets too crowded. For now, let's hide to make it look like a setlist */
}

.song-grid.worship-list .card-right-col {
    position: static;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    width: auto;
    height: 100%;
}

.song-grid.worship-list .song-number {
    position: static;
    margin: 0;
}

/* If user wants tags, we can re-enable. But setlists usually just need title/number. */

/* Worship Mode Styles */
.worship-btn {
    position: relative;
    background: var(--secondary-accent);
    color: white;
}

@media (hover: hover) {
    .worship-btn:hover {
        background: var(--color-secondary-hover);
        box-shadow: 0 5px 15px rgba(138, 43, 226, 0.3);
    }
}

.exit-worship-btn {
    background: var(--color-danger);
    color: white;
}

@media (hover: hover) {
    .exit-worship-btn:hover {
        background: var(--color-danger-hover);
        box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
    }
}

/* Worship Cart Drawer */

.worship-btn-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--color-danger);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s;
}

.cart-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.cart-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: var(--card-bg);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.3s ease-in-out;
}

.cart-overlay.hidden .cart-drawer {
    transform: translateX(100%);
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.cart-title-row {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.cart-title-row h2 {
    font-size: 1.5rem;
    margin: 0;
}

.cart-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.close-cart-button {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
}

.close-cart-button:hover {
    color: white;
}

.cart-drag-hint {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 1.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    position: relative;
}

.cart-song-list {
    list-style: none;
    padding: 0 5% 0 0;
    margin: 0;
}

.cart-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    gap: 1rem;
    cursor: grab;
    transition: background 0.2s;
    user-select: none;
    -webkit-user-select: none;
}

.cart-item * {
    user-select: none;
    -webkit-user-select: none;
}

.cart-item:active {
    cursor: grabbing;
}

.cart-item.sortable-ghost {
    opacity: 0.4;
    background: var(--accent-glow);
}

.cart-item-drag-handle {
    color: var(--text-secondary);
    cursor: grab;
    display: flex;
    align-items: center;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.cart-item-title {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
    cursor: pointer;
}



.remove-from-cart-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (hover: hover) {
    .remove-from-cart-btn:hover {
        color: var(--color-danger);
    }
}

.empty-cart-msg {
    color: var(--text-secondary);
    text-align: center;
    margin-top: 2rem;
    display: none;
}

.cart-song-list:empty+.empty-cart-msg {
    display: block;
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 1rem;
}

.start-worship-btn {
    flex: 1;
    justify-content: center;
}

.start-worship-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.clear-cart-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

@media (hover: hover) {
    .clear-cart-btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* Add to Cart Button (Icon Only) */
.add-to-cart-grid-btn.icon-only {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    /* Override flex-start */
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    margin: 0;
}

@media (hover: hover) {
    .add-to-cart-grid-btn.icon-only:hover {
        color: var(--accent-color);
        background: rgba(255, 255, 255, 0.05);
    }
}

.song-card.in-cart .add-to-cart-grid-btn.icon-only {
    color: var(--accent-color);
}


/* Played State in Worship Mode */
.song-card.played {
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.02);
    border-color: transparent;
}

@media (hover: hover) {
    .song-card.played:hover {
        opacity: 0.8;
        transform: translateY(-2px);
    }
}

.song-card.played .song-number {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.desktop-only {
    display: inline;
}

/* Tablet Portrait Compact Single-Row Header */
@media (max-width: 900px) {
    .app-header {
        padding: 0.7rem 0;
    }

    .container {
        width: 94%;
    }

    .header-content {
        flex-wrap: nowrap;
        gap: 0.6rem;
    }

    h1 {
        font-size: 1.45rem;
    }

    .search-container {
        flex: 1 1 160px;
        min-width: 0;
        max-width: none;
    }

    #searchInput {
        padding: 0.65rem 2.2rem 0.65rem 2.3rem;
        font-size: 0.95rem;
    }

    .desktop-only {
        display: none;
    }

    .cache-toggle-container {
        margin-right: 0;
        gap: 0;
    }

    .toggle-label {
        display: none;
    }

    .filter-btn,
    .worship-btn,
    .share-worship-btn {
        padding: 0.6rem;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }

    .exit-worship-btn {
        padding: 0.6rem 0.9rem;
        min-height: 44px;
    }
}

@media (max-width: 600px) {
    .header-content {
        flex-wrap: wrap;
    }

    .search-container {
        flex: 1 1 100%;
        order: 10;
    }

    .exit-worship-btn {
        padding: 0.6rem;
    }
}

@media (max-width: 520px) {
    .actions-header .btn-label {
        display: none;
    }

    .actions-header .primary-btn {
        padding: 0.6rem;
    }
}

/* Right Side Card Elements (Icons/Number) */
.card-right-col {
    position: absolute;
    top: 1rem;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center horizontally relative to each other */
    justify-content: space-between;
    /* Push to top and bottom */
    width: 44px;
    /* Matches icon button width to ensure center alignment */
}

.song-number {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 600;
}

.sheet-indicator-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    transition: all 0.2s;
}

@media (hover: hover) {
    .sheet-indicator-btn:hover {
        color: var(--accent-color);
        background: rgba(255, 255, 255, 0.05);
    }

    .sheet-indicator-btn:hover .sheet-indicator {
        color: var(--accent-color);
    }
}

.sheet-indicator {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Override inherited flex alignments */
}

.song-grid.worship-list .sheet-indicator {
    margin-top: 0.1rem;
}

/* Override sheet indicator when inside cart items */
.cart-item .cart-item-sheet {
    align-self: flex-start !important;
    /* Force left align inside the column */
    margin-top: 0.2rem;
    color: var(--text-secondary) !important;
    /* Remove highlight */
}

.song-card.played .sheet-indicator-btn {
    opacity: 0.5;
}

/* Share Button */
.share-worship-btn {
    background: var(--color-share);
    color: white;
}

@media (hover: hover) {
    .share-worship-btn:hover {
        background: var(--color-share-hover);
        box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
    }
}

@media (max-width: 600px) {
    .share-worship-btn {
        padding: 0.6rem;
    }
}

/* Update Toast and Version Text */
.update-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 1px solid var(--accent-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

.update-toast span {
    font-size: 0.95rem;
    color: white;
}

.small-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

.close-update-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.close-update-btn:hover {
    color: white;
}

.clear-cache-toast {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
}

.toast-full-row {
    width: 100%;
}

.danger-btn {
    background: var(--color-danger);
    color: white;
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.version-text {
    font-size: 0.75rem;
    color: var(--color-version);
    opacity: 0.5;
    margin-top: 2px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Landscape Mode Side-by-side Layout for Tablets and above (scroll mode) */
@media (orientation: landscape) and (min-width: 768px) {
    .gallery-overlay.mode-scroll .image-wrapper {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: flex-start;
    }

    .gallery-overlay.mode-scroll .image-wrapper img {
        width: auto;
        max-width: calc(50% - 8px);
        max-height: 98vh;
        max-height: 98dvh;
    }
}

/* Tag Filter Button */
.filter-container {
    position: relative;
}

.filter-btn {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.filter-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
    transform: none;
}

.filter-btn.filter-active {
    background: var(--accent-color);
    color: #000;
    border-color: transparent;
}

.filter-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--color-danger);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Tag Filter Dropdown */
.tag-filter-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 230px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.tag-filter-clear {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    margin-bottom: 0.25rem;
    font-family: inherit;
}

.tag-filter-clear:hover {
    color: var(--color-danger);
}

.tag-filter-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: left;
    transition: background 0.15s;
    font-family: inherit;
}

.tag-filter-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.tag-filter-item.active {
    background: rgba(255, 255, 255, 0.08);
}

.tag-filter-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-filter-check {
    margin-left: auto;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.tag-filter-item.active .tag-filter-check {
    opacity: 1;
}

.tag-filter-section-label {
    padding: 0.6rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 0.25rem;
}

.tag-filter-swatch--neutral {
    background: var(--text-secondary);
    opacity: 0.4;
}

@media (max-width: 600px) {
    .tag-filter-dropdown {
        right: auto;
        left: 0;
    }
}