:root {
    /* Backgrounds */
    --bg-app: #f9f9f9;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f0f0f0;
    --bg-active: #e6f0f7;
    --bg-minimized: #34495e;
    --bg-minimized-darker: #2c3e50;
    --bg-modal: #fff;

    /* Text */
    --text-main: #333333;
    --text-secondary: #555555;
    --text-inverse: #ffffff; /* Text on colored buttons */
    
    /* Brand & Accents */
    --primary-blue: #005a9c;
    --primary-blue-hover: #004070;
    --accent-red: #e74c3c;
    --accent-red-hover: #c0392b;
    --accent-green: #27ae60;
    --accent-green-hover: #2ecc71;
    --accent-gold: #f39c12;

    /* Borders & Dividers */
    --border-color: #dddddd;
    --border-color-light: #eeeeee;

    /* Functional Colors */
    --link-contact-bg: #f7e6e6;
    --link-contact-text: #c0392b;
    
    /* Scrollbars & Progress */
    --scrollbar-track: transparent;
    --scrollbar-thumb: #888;
    --progress-unfinished: rgba(0, 0, 0, 0.05); /* Faint grey for light mode */
}

/* --- DARK MODE OVERRIDES --- */
@media (prefers-color-scheme: dark) {
    :root {
        /* Darker Backgrounds */
        --bg-app: #121212;
        --bg-surface: #1e1e1e;
        --bg-surface-hover: #2c2c2c;
        --bg-active: #1a2733; /* Dark blue-ish tint */
        --bg-minimized: #202b38;
        --bg-minimized-darker: #151d26;
        --bg-modal: #2d2d2d;

        /* Lighter Text */
        --text-main: #e0e0e0;
        --text-secondary: #b0b0b0;
        
        /* Adjusted Accents for Dark Mode Contrast */
        --primary-blue: #4dabf5; /* Lighter blue for better visibility on dark */
        --primary-blue-hover: #2196f3;
        
        --border-color: #333333;
        --border-color-light: #333333;

        /* Contact Link Dark Mode */
        --link-contact-bg: #3e2020;
        --link-contact-text: #ff8a80;

        /* Progress Bar */
        --progress-unfinished: rgba(255, 255, 255, 0.15); /* Faint white for dark mode */
    }
    
    /* Dark Mode Watermark Handling */
    .app-logo-watermark {
        /* Lower this number to make it more subtle (e.g., 0.1 or 0.15) */
        opacity: 0.1; 
        /* Keep this to make the colors nice and rich */
        filter: saturate(1.2); 
    }
    
}

html, body, .app-shell {
    margin: 0 !important;
    padding: 0 !important;
    height: 100%;
    width: 100%;
    overflow: hidden; /* Prevents whole page from scrolling */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
}

/* Make body a flex container to hold panes + footer */
body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh; /* Fallback */
    height: 100dvh; /* FIX: Use dynamic height to respect mobile address bars */
    width: 100vw;
}
.app-shell {
    flex: 1; /* Must GROW to fill space below the body */
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
}

/* --- Iframe Idle Blocker --- */
.iframe-idle-blocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 40; 
    display: none; 
}

.iframe-idle-blocker.active {
    display: block;
}

/* The main container */
.split-container {
    flex: 1; 
    min-height: 0;
    display: flex;
    width: 100%;
    overflow: hidden; 
    flex-direction: row; /* DEFAULT: Landscape Mode */
}

/* Styling for each content pane */
.split-pane {
    position: relative;
    overflow: auto; 
    background-color: var(--bg-app);
    height: 100%;
}
#translate-pane iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

#contact-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* --- Sizing --- */

/* This pane gets 1/3 of the space */
#translate-pane {
    z-index: 10;
    flex: 1; 
    min-width: 300px; 
    overflow-y: hidden; 
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: flex 0.3s ease;
}

/* This pane gets 2/3 of the space */
#carols-pane {
    z-index: 20;
    flex: 2; 
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    position: relative;
    transition: flex 0.3s ease;
}

/* Expanded State */
.split-container.expanded #translate-pane {
    flex: 2 !important; 
}
.split-container.expanded #carols-pane {
    flex: 1 !important; 
}

.song-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.song-content p {
    margin-bottom: 1em;
    line-height: 1.6;
}

.song-content blockquote {
    border-left: 4px solid #e5e7eb; /* Light gray border */
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1em;
}

.song-content ul, .song-content ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
    list-style-type: disc;
}

.song-content .action-button {
    display: inline-block;       /* Allows padding and margins to work correctly */
    background-color: #2563eb;   /* Blue background */
    color: white;                /* White text */
    text-decoration: none;       /* Remove underline */
    border: none;                /* No border line */
    
    /* Shaping */
    padding: 0.5rem 1rem;        /* Top/Bottom and Left/Right padding */
    border-radius: 0.5rem;       /* Rounds the corners (use 9999px for a pill shape) */
    
    /* Text styling */
    font-weight: 600;            /* Make text slightly bold */
    font-family: inherit;        /* Inherit font from parent */
    cursor: pointer;
    
    /* Spacing */
    margin-top: 0.5rem;          /* Adds a little space above if it wraps */
    
    /* Animation */
    transition: background-color 0.2s ease;
}

/* Optional: Darker shade on hover */
.song-content .action-button:hover {
    background-color: #1d4ed8;
}

/* * OVERRIDE: Portrait Mode (Top/Bottom) */
@media (orientation: portrait) {
    .minimize-fab-wrapper {            
        flex-direction: column; 
    }
    
    .minimize-fab {
        position: relative !important;
        bottom: auto !important;
        right: auto !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        margin: 0 !important;                
        opacity: 1; 
        flex-shrink: 0; 
        pointer-events: auto !important;
    }
    .split-container {
        flex-direction: column; 
    }

    #translate-pane {
        z-index: 10;
        flex: 1;
        min-width: 0; 
        min-height: 200px; 
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
 
    .split-container.minimized-portrait {
        flex-direction: column; 
    }
    .split-container.minimized-portrait .split-pane#translate-pane.minimized {
        height: 50px !important; 
        min-height: 50px !important; 
        width: 100% !important; 
        border-bottom: none !important;
        min-width: 0 !important;
    }

    .split-container.minimized-portrait #translate-pane:not(.minimized) {
        flex: 1;
        min-height: 200px !important;
        border-bottom: 1px solid var(--border-color) !important;
    }

    .fab-container {
        bottom: 20px !important; 
    }

    #contact-iframe-container.visible,
    .song-content {
        padding-bottom: 24px 32px 56px 32px !important;
    }
}

@media (orientation: landscape) {
    .minimize-fab-wrapper {
         flex-direction: row;             
    }

    .minimize-fab.rotate-fab {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        top: auto !important;
    }
}

/* Text for minimized bar */
.translation-placeholder {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    flex-grow: 1;
    text-align: left !important;
    max-width: calc(100% - 100px);
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.translation-expand-fab {
     background-color: var(--accent-green);
     color: white;
     width: 100px;
     height: 100%;
     border: none;
     cursor: pointer;
     display: flex;
     justify-content: center;
     align-items: center;
     transition: background-color 0.2s ease;
     border-radius: 0;
     z-index: 10;
}
.minimized-placeholder-bar {
    flex: 1; 
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 0 0 0 20px; 
    max-width: 100%; 
    overflow: hidden; 
}
.translation-expand-fab:hover {
     background-color: #2ecc71; 
}

.translation-expand-fab .material-symbols-outlined {
     font-size: 30px; 
     transform: none; 
}

/* --- Landscape Mode Overrides (for the Minimized Bar) --- */
.split-container:not(.minimized-portrait) .minimized-placeholder-bar {
     flex-direction: column; 
     height: 100%; 
     width: 100%; 
     padding: 20px 0 0 0; 
     justify-content: center;
}

.split-container:not(.minimized-portrait) .translation-placeholder {
     transform: rotate(-90deg);
     text-align: center;
     flex-grow: 0; 
     width: 400px;
     max-width: none;
     margin-bottom: 20px;
     white-space: nowrap; 
     overflow: hidden; 
     text-overflow: ellipsis; 
}

.split-container:not(.minimized-portrait) .translation-expand-fab {
     height: 100px; 
     width: 100%; 
     margin-top: auto; 
     transform: rotate(270deg);
     margin-bottom: 25px;
}

.split-pane.maximized {
    flex: 1 !important; 
}

/* --- STYLES FOR SONGBOOK & WATERMARK --- */

/* 1. Lyrics Container (Middle Layer) */
.song-content {
    flex: 1; 
    /* Layout */
    box-sizing: border-box !important; 
    width: 100% !important;
    max-width: 100% !important;
    padding: 24px 32px 76px 32px !important;
    padding-bottom: 76px;
    
    /* Typography */
    font-size: 1.1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    
    /* Interaction & Touch */
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y !important; /* CRITICAL for swipe gestures */
    -webkit-overflow-scrolling: touch;
    overflow: auto;

    /* --- LAYERING FIX --- */
    position: relative !important; /* Needed for z-index */
    z-index: 10;          /* Higher than the watermark */
    background-color: transparent !important; /* Reveal watermark */
}

/* Ensure children inherit touch behavior */
.song-content * {
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y !important;
}

/* 2. Watermark (Bottom Layer) */
.app-logo-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40vmin; 
    height: 40vmin;
    
    /* Flex allows the SVG inside to center perfectly */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Visuals */
    opacity: 0.12; /* This is the Light Mode opacity */
    pointer-events: none !important; /* CRITICAL so clicks pass through */
    user-select: none;
    
    /* --- LAYERING FIX --- */
    z-index: 0; /* Send to back */
    
    transition: filter 0.3s ease; 
}

.song-content.hidden {
    display: none;
}

.song-content::-webkit-scrollbar, #contact-iframe-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.song-content::-webkit-scrollbar-thumb, #contact-iframe-container::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 4px;
}

/* Contact Iframe container */
#contact-iframe-container {
    flex: 1;
    width: 100%;
    display: none; 
    overflow: auto;
    padding-bottom: 76px; 
}

#contact-iframe-container.visible {
    display: flex; 
    flex-direction: column;
}

#contact-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Song Menu Styles */
.song-nav {
    padding: 0;
    margin: 0;
    background-color: #fff;
    border-bottom: 1px solid #ccc;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.song-menu-toggle {
    display: block;
    width: 100%;
    padding: 6px 40px 6px 20px; 
    cursor: pointer;
    border: none;
    background-color: var(--bg-app);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-blue);
    text-align: left;
    position: relative;
    transition: background-color 0.2s ease;
}

.song-menu-toggle:hover {
    background-color: #f0f0f0;
}

.song-menu-toggle::after {
    content: '▼';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    color: #555;
    transition: transform 0.3s ease;
}

.song-menu-toggle.open::after {
    transform: translateY(-50%) rotate(180deg);
}

.song-menu-dropdown {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: #fff;
    border-top: 1px solid #eee;
}

.song-menu-dropdown.open {
    max-height: 60vh; 
    overflow-y: auto; 
}

.song-menu-link {
    display: block;
    width: 100%;
    padding: 12px 20px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1rem;
    color: #333;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.song-menu-link:hover {
    background-color: #f0f0f0;
}

.song-menu-link.active {
    background-color: var(--bg-active);
    color: var(--primary-blue);
    font-weight: 600;
}

.song-menu-link.contact-link {
    background-color: #f7e6e6; 
    color: #c0392b;
    font-weight: 600;
}

/* FAB Styles */
.fab-menu {
    pointer-events: none;
    position: absolute;
    bottom: 0; 
    right: 0; 
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 76px; 
}

#fab-toggle-button {
    position: absolute; 
    bottom: 0;
    right: 0;
}

.fab-item {
    pointer-events: auto;
    height: 40px;
    width: auto;
    padding: 0 16px;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transform: scale(0);
    transition: transform 0.2s ease, background-color 0.2s ease;
    transform-origin: bottom right; 
}

.fab-item.lang {
    writing-mode: horizontal-tb !important; 
    text-orientation: mixed !important;
}

.fab-item:hover {
    background-color: #2980b9;
}

.fab-item.contact {
    background-color: #95a5a6;
    width: 40px; 
    padding: 0; 
}
.fab-item.contact:hover {
    background-color: #7f8c8d;
}

.fab-container.open .fab-item {
    transform: scale(1);
}

.fab-container.open .fab-item:nth-child(1) { transition-delay: 0.15s; } 
.fab-container.open .fab-item:nth-child(2) { transition-delay: 0.10s; }
.fab-container.open .fab-item:nth-child(3) { transition-delay: 0.05s; }
.fab-container.open .fab-item:nth-child(4) { transition-delay: 0.0s; }

.fab-container {
    position: fixed;
    bottom: 20px; 
    right: 20px; 
    z-index: 1000; 
}

.fab-toggle {
    width: 56px; 
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-blue); 
    color: white;
    font-size: 2rem; 
    line-height: 56px; 
    text-align: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    transition: transform 0.3s ease, background-color 0.2s ease;
}

/* Material Symbols */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;  
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Segmented Progress Bar --- */
.progress-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px; 
    z-index: 60; 
    pointer-events: auto; 
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px; 
    padding: 0 4px; 
    opacity: 1; 
    transition: opacity 0.5s ease-in-out; 
}

.progress-container.idle-hide {
    opacity: 0;
}

.progress-segment {
    flex: 1; 
    height: 100%;
    background-color: var(--progress-unfinished); 
    border-radius: 0 0 2px 2px; 
    transition: background-color 0.3s ease;
    cursor: pointer;
}

.progress-segment.active {
    background-color: var(--accent-red);
    opacity: 0.8; 
}

.progress-segment.special.active {
    background-color: #3498db; 
    opacity: 0.9; 
}

/* Song FAB */
.song-fab-container {
    display: none !important;
    position: absolute;
    top: 20px; 
    right: 20px; 
    z-index: 99; 
    flex-direction: column;
    align-items: flex-end;
}

.song-fab-toggle {
    width: 56px; 
    height: 56px; 
    padding: 0; 
    border-radius: 50%; 
    background-color: var(--accent-red); 
    color: white;
    font-size: 1.5rem; 
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25); 
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.1s ease; 
    line-height: 1; 
}

.song-fab-toggle:hover {
    background-color: #c0392b;
}

.song-fab-toggle:active {
    transform: scale(0.95); 
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); 
}

.song-fab-toggle.open::after {
  transform: translateY(-50% ) rotate(180 deg);
}

.song-fab-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-height: 0; 
    opacity: 0;
    overflow: hidden; 
    transition: max-height 0.4s ease-out, opacity 0.3s ease-in-out;
    gap: 4px;
    background-color: transparent; 
    box-shadow: none; 
    border-radius: 0; 
    z-index: 10;
    min-width: 180px;
}

.song-fab-menu.open {
    max-height: 500px; 
    opacity: 1;
    transform: translateY(-5px); 
}

.song-fab-link {
    height: 40px; 
    width: auto; 
    min-width: 180px; 
    padding: 0 16px; 
    border-radius: 20px; 
    background-color: var(--accent-red); 
    color: white;
    font-size: 0.95rem; 
    font-weight: 600; 
    border: none;
    display: flex; 
    align-items: center; 
    justify-content: flex-end; 
    cursor: pointer;
    transition: background-color 0.1s ease, opacity 0.3s ease-out, transform 0.3s ease-out;
    opacity: 0;
    transform: translateY(-10px);    
}

.song-fab-menu.open .song-fab-link {
    opacity: 1;
    transform: translateY(0);
}

.song-fab-menu.open .song-fab-link:nth-child(1) { transition-delay: 0.02s; }
.song-fab-menu.open .song-fab-link:nth-child(2) { transition-delay: 0.04s; }
.song-fab-menu.open .song-fab-link:nth-child(3) { transition-delay: 0.08s; }
.song-fab-menu.open .song-fab-link:nth-child(4) { transition-delay: 0.1s; }
.song-fab-menu.open .song-fab-link:nth-child(5) { transition-delay: 0.12s; }
.song-fab-menu.open .song-fab-link:nth-child(6) { transition-delay: 0.14s; }
.song-fab-menu.open .song-fab-link:nth-child(7) { transition-delay: 0.16s; }
.song-fab-menu.open .song-fab-link:nth-child(8) { transition-delay: 0.18s; }
.song-fab-menu.open .song-fab-link:nth-child(9) { transition-delay: 0.2s; }

.song-fab-link:hover {
    background-color: #c0392b;
}
.song-fab-link:active {
    transform: scale(0.98); 
}

.song-fab-link.active {
    background-color: #f39c12; 
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.song-fab-link.contact-link {
    background-color: #f7e6e6;
    color: #c0392b;
    font-weight: 600;
}
.fab-lang-text {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    white-space: nowrap; 
    display: block; 
}

/* Minimize FAB Wrapper & Buttons */
.minimize-fab-wrapper {
    position: absolute !important;
    bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    right: 20px !important;
    z-index: 100;
    display: flex;
    gap: 15px; 
    width: auto !important;
    height: auto !important;
    pointer-events: none; 
}

.minimize-fab {
    pointer-events: auto; 
    flex-shrink: 0;      
    position: relative !important; 
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    margin: 0 !important;
    transform-origin: center center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--accent-green);
    color: white;
    font-size: 1.5rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    transition: transform 0.3s ease, background-color 0.2s ease, opacity 0.3s;
}

.minimize-fab:hover {
    background-color: #2ecc71;
}

.minimize-fab.hidden {
    opacity: 0;
    pointer-events: none; 
}

.minimize-fab .material-symbols-outlined {
    transform: rotate(0deg);
    transition: transform 0.3s ease; 
    display: block; 
}

.minimize-fab.rotate-fab .material-symbols-outlined {
    transform: rotate(-90deg);
}

.split-pane.minimized {
    flex: 0 0 auto !important; 
    background-color: #34495e !important; 
    cursor: pointer;
    border: none !important;
    display: flex !important; 
    justify-content: center;
    align-items: center;
    transition: flex-basis 0.3s ease, width 0.3s ease, height 0.3s ease;
    overflow: hidden !important;
}

.split-container .split-pane#translate-pane.minimized {
    width: 50px; 
    min-width: 50px !important; 
    height: 100% !important; 
    border-right: none !important;
    flex-direction: column !important;
}

.fullscreen-fab {
    position: fixed;
    top: 20px; 
    left: 20px; 
    z-index: 1001; 
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(52, 58, 64, 0.9); 
    color: white; 
    font-size: 1.5rem; 
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    transition: background-color 0.2s ease;
}

.fullscreen-fab:hover {
    background-color: rgba(30, 30, 30, 0.95);
}

@supports (-webkit-touch-callout: none) {
    .fullscreen-fab {
        display: none !important;
    }
}

.app-shell.windowed {    
    width: 80vw;
    height: 80vh;
    max-width: 1200px;
    max-height: 800px;
    position: fixed; 
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    border-radius: 8px; 
    overflow: hidden; 
}

/* --- Navigation Tabs (Previous / Next) --- */
@keyframes flashFade {
    0%   { opacity: 0; }
    30%  { opacity: 1; }   
    100% { opacity: 0.5; } 
}

.nav-tab {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--accent-red);
    color: white;
    border: none;
    cursor: pointer;
    z-index: 50; /* Above Lyrics (5) and Watermark (0) */
    min-width: 30px;
    padding: 20px 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    opacity: 0; 
    animation: flashFade 2s ease-out forwards;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.nav-tab:hover {
    background-color: #c0392b;
    opacity: 1 !important; 
}

.nav-tab.prev {
    left: 16px;
    border-radius: 0 8px 8px 0;
}

.nav-tab.next {
    right: 16px;
    border-radius: 8px 0 0 8px;
}

.nav-tab-text {
    display: block;
    white-space: nowrap;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transform: rotate(-90deg);
}

.nav-tab.idle-hide {
    animation: none !important;
    opacity: 0 !important;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out; 
}

/* --- FAB Idle/Invisibility Styling --- */
.fab-container,
.song-fab-container,
.fullscreen-fab,
.minimize-fab {
    transition: transform 0.3s ease, background-color 0.2s ease, opacity 0.3s ease-in-out; 
}

.idle-hide {
    opacity: 0 !important; 
    pointer-events: none !important; 
}

.modal-trigger {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 20px;
    background-color: var(--primary-blue); 
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.modal-trigger:hover {
    background-color: #004070;
}

.action-button {
    display: inline-block;
    margin-top: 10px;
    padding: 12px 24px;
    background-color: var(--primary-blue); 
    color: white !important; 
    border: none;
    border-radius: 20px; 
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none; 
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-align: center;
}

.modal-overlay {
    position: absolute !important; /* Fits to the nearest relative parent (carols-pane) */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50; /* Above lyrics (10) but below Global FABs (1000) */
    background-color: transparent !important; /* Remove dimmer, as the box fills the space */
    padding: 0 !important; /* Remove any spacing */
}

.modal-box {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    overflow: hidden !important; 
    display: flex;
    flex-direction: column;
}

/* Optional: Ensure header looks integrated */
.modal-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

.modal-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    height: 50%;
    max-width: 200px; 
    opacity: 0.1; 
    pointer-events: none; 
    z-index: 0; 
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-header {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
    background-color: var(--bg-surface-hover);
}

.modal-header, 
.modal-box > div:last-child { 
    position: relative;
    z-index: 1; 
}

.modal-close-btn {
    border: none;
    background: transparent;
    font-size: 2rem;
    line-height: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.action-button:hover {
    background-color: #004070;
    transform: translateY(-1px);
}

.action-button:active {
    transform: translateY(1px);
}

/* 1. Modal Toggle between Iframe and Grid */
.modal-content-container {
    flex: 1;
    min-height: 0; /* Important for flex scrolling */

    overflow-y: scroll !important; /* Forces scrollbar to appear */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y !important;
    
    position: relative;
    background-color: #f0f2f5;
    z-index: 20;
}

.modal-content-container::-webkit-scrollbar {
    width: 8px; /* Make it wide enough to see/grab */
    height: 8px;
}

.modal-content-container::-webkit-scrollbar-track {
    background: transparent; 
}

.modal-content-container::-webkit-scrollbar-thumb {
    background-color: #888; /* Visible Grey Colour */
    border-radius: 4px;
}

/* 2. Event Grid Layout */
.event-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 16px;
    padding-bottom: 80px; /* Add extra space at bottom for scrolling */
    touch-action: pan-y !important; /* Allow touches to pass through to scroll */
}

/* 3. Event Cards */
.event-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.event-card:active {
    transform: scale(0.98);
}

.event-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #ddd;
}

.event-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.event-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: #666;
    align-items: center;
    margin-bottom: 4px;
}

.event-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 4. Text Styles */
.event-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-blue);
    line-height: 1.3;
}

.event-desc {
    font-size: 0.95rem;
    color: #444;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 4px;
}

/* 5. Booking Button */
.event-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    padding: 10px 16px;
    background-color: var(--primary-blue);
    color: white !important;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    width: fit-content;
}

.event-action-btn:hover {
    background-color: #002244;
}

.event-empty {
    padding: 40px;
    text-align: center;
    color: #888;
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* 6. FAB Button Specific Color */
.fab-item.whats-on {
    background-color: var(--accent-gold); /* Gold/Orange distinct from Contact */
    color: white;
}
.fab-item.whats-on:hover {
    background-color: #d35400;
}

/* Dark Mode Overrides for Events */
@media (prefers-color-scheme: dark) {
    .modal-content-container {
        background-color: #121212;
    }
    .event-card {
        background-color: #1e1e1e;
        box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    }
    .event-title {
        color: #90caf9;
    }
    .event-desc {
        color: #ccc;
    }
    .event-meta {
        color: #aaa;
    }
    .event-action-btn {
        background-color: #4dabf5;
        color: black !important;
    }
}