:root {
            --bg-main: #060a13;       
            --bg-panel: #0f1626;      
            --bg-accent: #1e293b;     
            --accent-primary: #38bdf8;
            --accent-success: #34d399;
            --accent-live: #ef4444;   
            --text-main: #f8fafc;     
            --text-muted: #64748b;    
            --canvas-font-size: 34px;
            --panel-overlay-bg: rgba(0, 0, 0, 0.25);
            --panel-overlay-border: rgba(255, 255, 255, 0.08);
            --card-shadow: 0 10px 25px rgba(0,0,0,0.35);
        }

        /* LIGHT MODE INTERFACE PALETTE — scoped strictly to the control-room chrome.
           Deliberately does NOT touch --accent-primary, and the projected/live
           .display-canvas output locks its own colors below, so switching theme
           never alters what the congregation/OBS/projector sees. */
        html[data-theme="light"] {
            --bg-main: #f4f6fa;
            --bg-panel: #ffffff;
            --bg-accent: #d7dee7;
            --text-main: #16202e;
            --text-muted: #5b6b7f;
            --panel-overlay-bg: #eef2f7;
            --panel-overlay-border: #cdd7e2;
            --card-shadow: 0 6px 16px rgba(15,23,42,0.08);
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        }

        body {
            background-color: var(--bg-main);
            color: var(--text-main);
            height: 100vh;
            display: flex;
            flex-direction: column;
            overflow: hidden; /* STRICT NO GLOBAL SCROLLING */
        }

        /* POLYMORPHIC ARCHITECTURE INTERFACE TOGGLES */
        .main-production-suite { display: flex; flex-direction: row; height: 100%; width: 100%; overflow: hidden; }
        .main-production-suite.sidebar-right { flex-direction: row-reverse; }
        .main-production-suite.sidebar-right .verse-navigation-panel { border-right: none; border-left: 2px solid var(--bg-accent); }
        .content-column { display: flex; flex-direction: column; flex: 1; height: 100%; min-width: 0; overflow: hidden; }
        .remote-standalone-view { display: none; flex-direction: column; height: 100%; width: 100%; background: #070b12; overflow: hidden; }
        .obs-standalone-view { display: none; width: 100vw; height: 100vh; overflow: hidden; background: transparent; }

        body.is-remote-mode .main-production-suite { display: none !important; }
        body.is-remote-mode .remote-standalone-view { display: flex !important; }
        body.is-remote-mode .obs-standalone-view { display: none !important; }
        body.is-remote-mode #welcomeSplashScreen { display: none !important; }
        body.is-remote-mode #micVuMeterWidget { display: none !important; }

        body.is-obs-mode .main-production-suite { display: none !important; }
        body.is-obs-mode .remote-standalone-view { display: none !important; }
        body.is-obs-mode .obs-standalone-view { display: flex !important; }
        body.is-obs-mode #welcomeSplashScreen { display: none !important; }
        body.is-obs-mode #micVuMeterWidget { display: none !important; }

        header {
            background-color: var(--bg-panel);
            padding: 0.75rem 1.25rem;
            border-bottom: 2px solid var(--bg-accent);
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
            box-shadow: 0 6px 25px rgba(0,0,0,0.45);
            z-index: 10;
            flex-shrink: 0;
        }

        .top-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .brand-container {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .brand-cross {
            width: 24px;
            height: 24px;
            color: var(--accent-primary);
            filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
        }

        header h1 {
            font-size: 1.3rem;
            font-weight: 900;
            letter-spacing: 0.05em;
            color: var(--text-main);
        }

        header h1 span { color: var(--accent-primary); }

        .control-deck {
            display: flex;
            align-items: center;
            gap: 0.6rem 0.75rem;
            flex-wrap: wrap;
        }
        .control-deck > * { flex-shrink: 0; }

        .design-deck {
            background: var(--panel-overlay-bg);
            border: 1px solid var(--panel-overlay-border);
            padding: 0.5rem 0.8rem;
            border-radius: 8px;
            display: flex;
            align-items: center;
            gap: 0.6rem 1rem;
            flex-wrap: wrap;
        }
        .design-deck > * { flex-shrink: 0; }

        /* RIBBON UI (VideoPsalm-style Text / Background / Message / Edit tabs) */
        .ribbon-tabs-bar {
            display: flex;
            gap: 0.25rem;
            border-bottom: 1px solid var(--bg-accent);
        }
        .ribbon-tab-btn {
            background: none;
            border: none;
            border-bottom: 3px solid transparent;
            color: var(--text-muted);
            font-size: 0.8rem;
            font-weight: 700;
            padding: 0.5rem 1rem;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s, background-color 0.15s;
            border-radius: 6px 6px 0 0;
        }
        .ribbon-tab-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.04); }
        .ribbon-tab-btn.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); background: rgba(56,189,248,0.08); }

        .ribbon-panel {
            display: none;
            align-items: center;
            gap: 0.6rem 0.9rem;
            flex-wrap: wrap;
            background: var(--panel-overlay-bg);
            border: 1px solid var(--panel-overlay-border);
            border-top: none;
            padding: 0.65rem 0.8rem;
            border-radius: 0 0 8px 8px;
        }
        .ribbon-panel.active { display: flex; }
        .ribbon-panel > * { flex-shrink: 0; }

        .control-group {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .control-group label {
            color: #94a3b8;
            text-transform: uppercase;
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.05em;
            white-space: nowrap;
        }

        select, input[type="text"], input[type="number"], textarea {
            background: var(--bg-main);
            color: var(--text-main);
            border: 1px solid var(--bg-accent);
            padding: 0.45rem 0.75rem;
            border-radius: 6px;
            font-size: 0.85rem;
            outline: none;
            transition: all 0.2s ease;
        }

        select { font-weight: 700; color: var(--accent-primary); cursor: pointer; }
        select:focus, input:focus, textarea:focus { border-color: var(--accent-primary); }
        input[type="text"] { min-width: 160px; font-weight: 500; }

        input[type="color"] {
            -webkit-appearance: none;
            border: none;
            width: 26px;
            height: 26px;
            border-radius: 50%;
            cursor: pointer;
            background: none;
        }
        input[type="color"]::-webkit-color-swatch { border: 2px solid var(--bg-accent); border-radius: 50%; }

        .file-upload-btn {
            background: var(--bg-main);
            border: 1px dashed var(--accent-primary);
            color: var(--accent-primary);
            padding: 0.35rem 0.6rem;
            border-radius: 4px;
            font-size: 0.75rem;
            cursor: pointer;
            font-weight: 700;
        }
        .file-upload-btn:hover { background: rgba(56, 189, 248, 0.1); }
        .hidden-file-input { display: none; }

        .btn {
            padding: 0.55rem 1.1rem;
            font-size: 0.85rem;
            font-weight: 700;
            color: #fff;
            background-color: #334155;
            border: 1px solid #3b82f6;
            border-radius: 6px;
            cursor: pointer;
            white-space: nowrap;
            transition: all 0.15s;
        }

        .btn.listening { background-color: var(--accent-success); border-color: #10b981; animation: pulse 2s infinite; color: #0f172a; }
        .btn.toggle-active { background-color: var(--accent-primary); border-color: #0ea5e9; color: #04121e; }
        .btn.push-live { background-color: var(--accent-live); border-color: #b91c1c; font-size: 0.85rem; padding: 0.55rem 1.5rem; }
        .btn.profile-btn { background-color: #4c1d95; border-color: #6d28d9; font-size: 0.75rem; padding: 0.4rem 0.75rem; }
        .btn.obs-btn { background-color: #0284c7; border-color: #0369a1; font-size: 0.85rem; }
        .btn.settings-btn { background-color: #475569; border-color: #64748b; font-size: 0.85rem; }
        .btn.announcement-btn { background-color: #d97706; border-color: #b45309; font-size: 0.8rem; padding: 0.45rem 0.85rem;}
        .btn:hover { filter: brightness(1.15); }

        .status-pill {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.72rem;
            font-weight: 700;
            padding: 0.25rem 0.7rem;
            background: var(--bg-main);
            border-radius: 50px;
            border: 1px solid var(--bg-accent);
        }

        .status-dot { width: 8px; height: 8px; border-radius: 50%; background-color: #475569; }
        .status-dot.active { background-color: var(--accent-success); box-shadow: 0 0 10px var(--accent-success); }
        .status-dot.loading { background-color: #f59e0b; box-shadow: 0 0 10px #f59e0b; }

        /* STUDIO FLOOR GRID LAYOUT */
        .studio-floor {
            flex: 1;
            display: grid;
            grid-template-columns: 1fr;
            overflow: hidden;
            background-color: var(--bg-main);
        }
        .single-scene-column { border-right: none !important; max-width: 1400px; margin: 0 auto; width: 100%; }

        /* NARROW SCREEN REFLOW CAPABILITY */
        @media (max-width: 1200px) {
            .main-production-suite,
            .main-production-suite.sidebar-right {
                flex-direction: column;
                overflow-y: auto;
            }
            .verse-navigation-panel {
                width: 100%;
                height: 400px;
                border-right: none;
                border-bottom: 2px solid var(--bg-accent);
            }
            .content-column { overflow: visible; height: auto; }
            .studio-floor {
                grid-template-columns: 1fr;
                overflow-y: auto;
            }
            .screen-column {
                height: 400px;
                border-right: none;
                border-bottom: 2px solid var(--bg-accent);
            }
            body { overflow-y: auto; }
        }

        .verse-navigation-panel {
            background-color: var(--bg-panel);
            border-right: 2px solid var(--bg-accent);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            width: 460px;
            flex-shrink: 0;
            height: 100%;
            min-height: 0;
        }

        .panel-tabs-bar {
            display: flex;
            background: rgba(0, 0, 0, 0.4);
            border-bottom: 2px solid var(--bg-accent);
            flex-shrink: 0;
        }

        .panel-tab-btn {
            flex: 1;
            padding: 0.75rem 0.2rem;
            background: transparent;
            border: none;
            color: var(--text-muted);
            font-weight: 800;
            font-size: 0.68rem;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            cursor: pointer;
            transition: all 0.2s;
            text-align: center;
            border-bottom: 2px solid transparent;
        }

        .panel-tab-btn.active {
            color: var(--accent-primary);
            background: rgba(56, 189, 248, 0.04);
            border-bottom-color: var(--accent-primary);
        }

        .panel-tab-content {
            flex: 1;
            display: none;
            flex-direction: column;
            overflow: hidden;
            min-height: 0;
        }

        .panel-tab-content.active {
            display: flex;
        }

        .panel-header {
            padding: 0.75rem 0.9rem;
            background: rgba(0,0,0,0.3);
            border-bottom: 1px solid var(--bg-accent);
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--accent-primary);
            font-weight: 800;
            flex-shrink: 0;
        }

        .verse-grid {
            flex: 1;
            min-height: 0;
            overflow-y: auto; 
            padding: 0.75rem;
            display: flex;
            flex-direction: column;
            gap: 0.55rem;
            scrollbar-width: thin;
            scrollbar-color: var(--bg-accent) transparent;
        }
        .verse-grid::-webkit-scrollbar { width: 10px; }
        .verse-grid::-webkit-scrollbar-track { background: transparent; }
        .verse-grid::-webkit-scrollbar-thumb { background-color: var(--bg-accent); border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
        .verse-grid::-webkit-scrollbar-thumb:hover { background-color: var(--accent-primary); }

        .verse-row {
            padding: 0.85rem 1rem;
            background: var(--bg-main);
            border: 1px solid var(--bg-accent);
            border-radius: 8px;
            font-size: 0.85rem;
            line-height: 1.5;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
            user-select: none;
        }
        .verse-row:hover { border-color: var(--accent-primary); background: rgba(56, 189, 248, 0.04); }
        .verse-row.active { border-color: var(--accent-primary); background: #0284c7; color: #ffffff; }

        .verse-num-badge {
            font-size: 0.65rem;
            font-weight: 800;
            background: rgba(255,255,255,0.15);
            padding: 0.1rem 0.3rem;
            border-radius: 4px;
            color: var(--accent-primary);
            align-self: flex-start;
        }

        .verse-preview-text {
            font-size: 0.8rem;
            line-height: 1.35;
            opacity: 0.8;
        }

        .screen-column {
            display: flex;
            flex-direction: column;
            padding: 1rem;
            overflow: hidden;
            background-color: #080d1a;
            border-right: 1px solid var(--bg-accent);
            height: 100%;
        }
        .screen-column.live-column { background-color: #03050a; border-right: 2px solid var(--bg-accent); position: relative; }
        body.live-is-frozen .screen-column.live-column { outline: 3px solid #0284c7; outline-offset: -3px; }
        body.live-is-frozen .screen-column.live-column::before {
            content: "❄ LIVE FROZEN";
            position: absolute;
            top: 8px; left: 50%; transform: translateX(-50%);
            background: #0284c7; color: #fff; font-weight: 900; font-size: 0.7rem;
            letter-spacing: 0.05em; padding: 0.25rem 0.7rem; border-radius: 20px; z-index: 50;
            box-shadow: 0 4px 12px rgba(0,0,0,0.5);
        }

        .deck-label {
            font-size: 0.7rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            padding: 0.3rem 0.6rem;
            border-radius: 4px;
            margin-bottom: 0.5rem;
            display: inline-block;
            align-self: flex-start;
            flex-shrink: 0;
            z-index: 2;
        }
        .preview-label { background: #1e293b; color: var(--accent-primary); border: 1px solid var(--accent-primary); }
        .live-label { background: rgba(239,68,68,0.15); color: var(--accent-live); border: 1px solid var(--accent-live); }

        .canvas-container {
            flex: 1;
            min-height: 0;
            container-type: size; /* lets the canvas fit BOTH width and height while keeping its exact ratio */
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        /* --- CANVAS RATIO LOCKED TO UPLOADED REFERENCE IMAGE (2752 x 1536) --- */
        .display-canvas {
            width: min(100cqw, calc(100cqh * 2752 / 1536)); /* largest box of the fixed ratio that fits the frame */
            aspect-ratio: 2752 / 1536;
            border-radius: 8px;
            display: flex;
            flex-direction: column;
            box-shadow: 0 20px 45px rgba(0, 0, 0, 0.8);
            overflow: hidden;
            position: relative;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            box-sizing: border-box;
            container-type: inline-size; /* Locking responsive proportions perfectly */
        }
        #previewCanvas { border: 2px dashed #334155; }
        #liveCanvas { border: 2px solid #1e293b; }

        /* Dynamic scale properties based on exact container width queries */
        .display-canvas.size-small { --canvas-font-size: 3.2cqw; }
        .display-canvas.size-medium { --canvas-font-size: 4.8cqw; }
        .display-canvas.size-large { --canvas-font-size: 6.4cqw; }
        .display-canvas.size-xlarge { --canvas-font-size: 8.2cqw; }

        .text-display-box-container {
            position: relative;
            padding: 1.5% 4%;
            border-radius: 8px;
            z-index: 4;
            width: 100%;
            box-sizing: border-box;
            display: flex;
            align-items: center;
            justify-content: center;
            max-height: 92%;
        }
        /* Box-fill background image lives on its own layer behind the text, so the Opacity slider
           fades only the image — never the text, logo or timer sitting on top of it. */
        .text-display-box-container::before {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: inherit;
            background-image: var(--box-bg-image, none);
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            opacity: var(--box-bg-opacity, 1);
            z-index: -1;
        }

        .ticker-wrapper { width: 100%; overflow: hidden; white-space: nowrap; box-sizing: border-box; }
        .ticker-text { display: inline-block; padding-left: 100%; animation: translateMarquee 20s linear infinite; }
        @keyframes translateMarquee { 0% { transform: translate3d(0, 0, 0); } 100% { transform: translate3d(-100%, 0, 0); } }

        /* High Impact Readable Ultra Bold Typography */
        .text-out {
            font-size: var(--canvas-font-size);
            font-weight: 900; 
            line-height: 1.35;
            color: #ffffff; /* Fixed regardless of UI theme — the live/projected display never changes color */
            text-shadow: 0 4px 12px rgba(0,0,0,0.98);
            word-wrap: break-word;
            overflow-wrap: break-word;
            text-align: center;
            width: 100%;
            white-space: pre-wrap; /* Supporting Song Lyric spacing breaks */
        }
        
        .ref-out {
            font-size: calc(var(--canvas-font-size) * 0.45);
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--accent-primary);
            text-shadow: 0 3px 6px rgba(0,0,0,0.98);
            z-index: 4;
            margin-top: 0.5%;
            text-align: center;
        }

        /* DISPLAY TRANSITIONS — applied only to the live/OBS/projector output, never the operator preview */
        @keyframes ebpTransFade { from { opacity: 0; } to { opacity: 1; } }
        @keyframes ebpTransSlide { from { opacity: 0; transform: translateX(18%); } to { opacity: 1; transform: translateX(0); } }
        @keyframes ebpTransZoom { from { opacity: 0; transform: scale(0.72); } to { opacity: 1; transform: scale(1); } }
        .ebp-transition-fade { animation: ebpTransFade 0.85s ease both; }
        .ebp-transition-slide { animation: ebpTransSlide 0.75s cubic-bezier(0.22, 1, 0.36, 1) both; }
        .ebp-transition-zoom { animation: ebpTransZoom 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }

        .flier-graphic-layer {
            position: absolute;
            inset: 0;
            z-index: 3;
            background-size: contain;
            background-position: center;
            background-repeat: no-repeat;
            width: 100%;
            height: 100%;
        }

        .canvas-logo-node {
            position: absolute;
            z-index: 5;
            margin: 2%;
            filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
            object-fit: contain;
            transition: width 0.1s ease, height 0.1s ease;
        }

        /* LIVE TIMER CANVAS NODE */
        .canvas-timer-node {
            position: absolute;
            z-index: 6;
            background: rgba(0,0,0,0.75);
            border: 1.5px solid rgba(255,255,255,0.15);
            color: #ffffff;
            font-family: monospace, monospace;
            font-weight: 900;
            border-radius: 6px;
            padding: 0.2rem 0.5rem;
            letter-spacing: 0.05em;
            pointer-events: none;
            display: none;
            align-items: center;
            justify-content: center;
        }

        .canvas-timer-node.timer-visible { display: flex; }

        /* Timer Positions */
        .timer-top-left { top: 4%; left: 4%; }
        .timer-top-right { top: 4%; right: 4%; }
        .timer-bottom-left { bottom: 4%; left: 4%; }
        .timer-bottom-right { bottom: 4%; right: 4%; }
        
        /* TIMER SPECIAL BACKGROUND/CENTER MODE & SCREEN SCALE */
        .timer-center { 
            top: 50%; 
            left: 50%; 
            transform: translate(-50%, -50%); 
            border-radius: 12px; 
            background: rgba(0,0,0,0.85); 
            box-shadow: 0 10px 35px rgba(0,0,0,0.6); 
            border-width: 2px;
        }

        /* Timer Sizes */
        .timer-size-small { font-size: calc(var(--canvas-font-size) * 0.45); }
        .timer-size-medium { font-size: calc(var(--canvas-font-size) * 0.75); padding: 0.4rem 0.8rem; }
        .timer-size-large { font-size: calc(var(--canvas-font-size) * 1.3); padding: 0.6rem 1.2rem; border-width: 3px; font-weight: 950; }

        /* EXTENDING CHRONO LARGE SIZES FOR CENTER / FULLSCREEN COUNTDOWNS */
        .timer-center.timer-size-small { font-size: 6cqw; }
        .timer-center.timer-size-medium { font-size: 10cqw; }
        .timer-center.timer-size-large { font-size: 16cqw !important; padding: 1rem 2rem; border-width: 4px; }

        .logo-top-left { top: 0; left: 0; } .logo-top-right { top: 0; right: 0; } .logo-bottom-left { bottom: 0; left: 0; } .logo-bottom-right { bottom: 0; right: 0; }

        /* VIDEO BACKGROUND LAYER */
        .canvas-video-bg-node {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            object-fit: contain; /* whole video always visible, centred, never cropped */
            z-index: 1;
            pointer-events: none;
        }
        /* MEDIA DISPLAY LAYER (flier / image / video shown on its own) */
        .media-layer-node { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; background: #000; pointer-events: none; object-fit: contain; }
        .canvas-video-bg-node.media-layer-node { z-index: 3; }

        /* GRADIENT + GLOW TEXT STYLE */
        .text-out.gradient-glow-active {
            background: linear-gradient(180deg, #ffffff 0%, var(--dynamic-text-color, #38bdf8) 58%, var(--dynamic-text-color, #38bdf8) 100%);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent !important;
            filter: drop-shadow(0 0 10px var(--dynamic-text-color, #38bdf8)) drop-shadow(0 0 22px var(--dynamic-text-color, #38bdf8));
        }

        /* TEXT BACKING PANEL (readability box behind text over busy backgrounds) */
        .text-display-box-container.backing-panel-active {
            background-color: rgba(2, 6, 15, 0.55) !important;
            backdrop-filter: blur(2px);
        }

        /* LOWER THIRD NAME TAG (e.g. "Ministering: Pastor Ade") */
        .canvas-namebar-node {
            position: absolute;
            left: 4%;
            bottom: 5%;
            z-index: 7;
            display: none;
            align-items: stretch;
            border-radius: 6px;
            overflow: hidden;
            box-shadow: 0 8px 22px rgba(0,0,0,0.6);
            font-family: inherit;
        }
        .canvas-namebar-node.namebar-visible { display: flex; }
        .canvas-namebar-node .namebar-role {
            background: var(--accent-primary, #38bdf8);
            color: #04121e;
            font-weight: 900;
            font-size: calc(var(--canvas-font-size) * 0.28);
            text-transform: uppercase;
            letter-spacing: 0.04em;
            padding: 0.35em 0.7em;
            display: flex;
            align-items: center;
            white-space: nowrap;
        }
        .canvas-namebar-node .namebar-name {
            background: rgba(4, 10, 20, 0.88);
            color: #ffffff;
            font-weight: 800;
            font-size: calc(var(--canvas-font-size) * 0.32);
            padding: 0.35em 0.9em;
            display: flex;
            align-items: center;
            white-space: nowrap;
        }

        /* ANNOUNCEMENT BANNER — editable, toggleable, shown over the main text (never replaces it) */
        .canvas-announcement-banner {
            display: none;
            position: absolute;
            left: 0;
            right: 0;
            z-index: 8;
            color: #fff8e7;
            font-weight: 800;
            font-size: calc(var(--canvas-font-size) * 0.32);
            padding: 0.5em 1em;
            text-align: center;
            text-shadow: 0 2px 6px rgba(0,0,0,0.8);
            box-shadow: 0 -6px 16px rgba(0,0,0,0.4);
            overflow: hidden;
            white-space: nowrap;
        }
        .canvas-announcement-banner.announcement-visible { display: block; }

        .canvas-announcement-banner.announcement-pos-bottom { bottom: 0; top: auto; }
        .canvas-announcement-banner.announcement-pos-top { top: 0; bottom: auto; box-shadow: 0 6px 16px rgba(0,0,0,0.4); }
        .canvas-announcement-banner.announcement-pos-center { top: 50%; bottom: auto; transform: translateY(-50%); box-shadow: 0 0 24px rgba(0,0,0,0.5); border-radius: 8px; margin: 0 4%; width: auto; left: 4%; right: 4%; }

        @keyframes announcementBreathing { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
        @keyframes announcementFadeInOut { 0%, 100% { opacity: 0; } 15%, 85% { opacity: 1; } }
        .canvas-announcement-banner.announcement-effect-breathing { animation: announcementBreathing 2.4s ease-in-out infinite; }
        .canvas-announcement-banner.announcement-effect-fade { animation: announcementFadeInOut 4s ease-in-out infinite; }

        .display-canvas.mode-center { justify-content: center; align-items: center; text-align: center; padding: 2.5%; }
        .display-canvas.mode-center .text-display-box-container { margin-bottom: 1.5%; }

        .display-canvas.mode-fullscreen { justify-content: center; align-items: center; text-align: center; padding: 2%; }

        .display-canvas.mode-lowerthird { justify-content: flex-end; align-items: center; text-align: center; padding: 0 4% 4% 4% !important; }
        .display-canvas.mode-lowerthird .text-display-box-container { background-color: #0f172a; border: 2px solid rgba(255, 255, 255, 0.1); border-left: 6px solid var(--accent-primary); margin-bottom: 1%; text-shadow: none; box-shadow: 0 10px 30px rgba(0,0,0,0.7); padding: 1.2% 2%; }
        .display-canvas.mode-lowerthird .text-out { font-size: calc(var(--canvas-font-size) * 0.85); text-shadow: none; }
        .display-canvas.mode-lowerthird .ref-out { background: rgba(0,0,0,0.8); padding: 0.4% 1.2%; border-radius: 4px; }

        /* FLIER ONLY BRANDING MATRIX */
        .display-canvas.mode-flieronly { justify-content: center; align-items: center; }
        .display-canvas.mode-flieronly .flier-graphic-layer { background-size: cover; width: 100%; height: 100%; }
        .display-canvas.mode-flieronly .text-display-box-container, .display-canvas.mode-flieronly .ref-out { display: none !important; }
        .placeholder-text { font-style: italic; color: #475569; font-size: 1rem; width: 100%; text-align: center;}

        /* PREMIUM MODAL DIALOG DESIGN TOKEN LAYERS */
        .settings-modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(3, 5, 10, 0.85);
            backdrop-filter: blur(8px);
            z-index: 1000;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }

        .settings-modal-content {
            background-color: var(--bg-panel);
            border: 2px solid var(--bg-accent);
            border-radius: 12px;
            width: 100%;
            max-width: 620px;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
            animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        @keyframes modalFadeIn {
            from { opacity: 0; transform: scale(0.95) translateY(10px); }
            to { opacity: 1; transform: scale(1) translateY(0); }
        }

        .settings-modal-header {
            padding: 1rem 1.25rem;
            background: rgba(0, 0, 0, 0.3);
            border-bottom: 2px solid var(--bg-accent);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .settings-modal-header h3 {
            font-size: 0.9rem;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--accent-primary);
            font-weight: 800;
        }

        .close-settings-btn {
            background: transparent;
            border: none;
            color: var(--text-muted);
            font-size: 1.5rem;
            cursor: pointer;
            transition: color 0.15s;
        }
        .close-settings-btn:hover { color: var(--accent-live); }

        .settings-modal-body {
            padding: 1.25rem;
            overflow-y: auto;
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 1.25rem;
        }

        .integration-card {
            background-color: var(--panel-overlay-bg);
            border: 1px solid var(--bg-accent);
            border-radius: 8px;
            padding: 0.95rem;
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
        }

        .integration-card h4 {
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--accent-primary);
            font-weight: 800;
        }

        /* BG & TEXT EFFECT DROPDOWN PANEL */
        .bg-text-effect-dropdown {
            display: none;
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            width: 360px;
            max-height: 70vh;
            overflow-y: auto;
            background-color: var(--bg-panel);
            border: 1px solid var(--bg-accent);
            border-radius: 8px;
            padding: 0.9rem;
            box-shadow: 0 20px 45px rgba(0,0,0,0.6);
            z-index: 500;
        }
        .bg-text-effect-dropdown.open { display: block; }

        /* FILE MENU DROPDOWN (Google-Drive-style vertical menu) */
        .file-menu-wrapper { position: relative; display: inline-block; }
        .file-menu-dropdown {
            display: none;
            position: absolute;
            top: calc(100% + 6px);
            left: 0;
            min-width: 240px;
            background-color: var(--bg-panel);
            border: 1px solid var(--bg-accent);
            border-radius: 8px;
            padding: 0.4rem 0;
            box-shadow: 0 20px 45px rgba(0,0,0,0.6);
            z-index: 600;
        }
        .file-menu-dropdown.open { display: block; }
        .file-menu-item {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            width: 100%;
            padding: 0.5rem 1rem;
            background: none;
            border: none;
            color: var(--text-main);
            font-size: 0.82rem;
            text-align: left;
            cursor: pointer;
            box-sizing: border-box;
        }
        .file-menu-item:hover { background: var(--bg-accent); }
        .file-menu-icon { font-size: 0.95rem; width: 1.2em; text-align: center; }
        .file-menu-divider { height: 1px; background: var(--bg-accent); margin: 0.35rem 0; }

        .song-title-suggestions {
            display: none;
            position: absolute;
            top: calc(100% + 4px);
            left: 4.5rem;
            right: 0;
            background-color: var(--bg-panel);
            border: 1px solid var(--bg-accent);
            border-radius: 6px;
            box-shadow: var(--card-shadow, 0 10px 25px rgba(0,0,0,0.4));
            z-index: 400;
            max-height: 180px;
            overflow-y: auto;
        }
        .song-title-suggestions.open { display: block; }
        .song-title-suggestion-item {
            padding: 0.5rem 0.7rem;
            font-size: 0.8rem;
            cursor: pointer;
            border-bottom: 1px solid var(--bg-accent);
            color: var(--text-main);
        }
        .song-title-suggestion-item:last-child { border-bottom: none; }
        .song-title-suggestion-item:hover { background: rgba(56, 189, 248, 0.12); }

        .integration-card p {
            font-size: 0.7rem;
            color: var(--text-muted);
            line-height: 1.45;
        }

        .link-input-group {
            display: flex;
            gap: 0.35rem;
            align-items: center;
        }

        .link-input-group input {
            flex: 1;
            font-size: 0.72rem;
            background: #020408;
            color: var(--accent-success);
            border: 1px solid var(--bg-accent);
            padding: 0.45rem 0.6rem;
            border-radius: 4px;
            outline: none;
            width: 100%;
        }

        .hotkey-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.6rem;
            background: var(--panel-overlay-bg);
            border: 1px solid var(--panel-overlay-border);
            border-radius: 6px;
            padding: 0.4rem 0.6rem;
        }
        .hotkey-row-label { font-size: 0.8rem; color: var(--text-main); }
        .hotkey-row-controls { display: flex; align-items: center; gap: 0.4rem; }
        .hotkey-key-display {
            min-width: 60px;
            text-align: center;
            font-size: 0.72rem;
            font-weight: 800;
            padding: 0.25rem 0.5rem;
            background: #020408;
            color: var(--accent-success);
            border: 1px solid var(--bg-accent);
            border-radius: 4px;
        }
        .hotkey-key-display.listening { color: #fbbf24; border-color: #fbbf24; animation: pulse 1s infinite; }

        .btn-copy {
            padding: 0.45rem 0.75rem;
            font-size: 0.7rem;
            font-weight: 800;
            background-color: var(--bg-accent);
            border: 1px solid var(--accent-primary);
            color: var(--accent-primary);
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.1s ease;
        }
        .btn-copy:hover { background-color: var(--accent-primary); color: #000; }

        /* CONTACT INFORMATION FOOTER BLOCK */
        .settings-modal-footer {
            padding: 1rem 1.25rem;
            background: rgba(0, 0, 0, 0.4);
            border-top: 2px solid var(--bg-accent);
            display: flex;
            flex-direction: column;
            gap: 0.4rem;
        }

        .contact-info-title {
            font-size: 0.65rem;
            font-weight: 800;
            text-transform: uppercase;
            color: var(--text-muted);
            letter-spacing: 0.06em;
        }

        .contact-details-row {
            display: flex;
            flex-wrap: wrap;
            gap: 1rem;
            font-size: 0.75rem;
        }

        .contact-details-row a {
            color: var(--accent-success);
            text-decoration: none;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 0.3rem;
            transition: color 0.15s;
        }
        .contact-details-row a:hover { color: #ffffff; text-decoration: underline; }

        footer { background-color: var(--bg-panel); border-top: 1px solid var(--bg-accent); padding: 0.5rem 1.5rem; display: flex; align-items: center; gap: 1rem; height: 35px; flex-shrink: 0; }
        footer h3 { font-size: 0.65rem; text-transform: uppercase; color: #475569; letter-spacing: 0.05em; white-space: nowrap; }
        .transcript-track { flex: 1; font-size: 0.8rem; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }
        .transcript-track .active-words { color: var(--accent-primary); font-style: normal; font-weight: 600; }

        @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); } 70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

        /* WELCOME SPLASH ANIMATION */
        #welcomeSplashScreen {
            position: fixed;
            inset: 0;
            z-index: 99999;
            background: radial-gradient(ellipse at center, #0c1424 0%, #01040a 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            opacity: 1;
            animation: splashFadeOut 0.9s ease forwards;
            animation-delay: 4.4s;
        }
        @keyframes splashFadeOut {
            to { opacity: 0; visibility: hidden; pointer-events: none; }
        }
        .splash-stars { position: absolute; inset: 0; }
        .splash-star {
            position: absolute;
            background: #e2e8f0;
            border-radius: 50%;
            opacity: 0;
            animation-name: starPop;
            animation-iteration-count: infinite;
            animation-timing-function: ease-in-out;
        }
        @keyframes starPop {
            0%, 100% { opacity: 0; transform: scale(0.3); }
            50% { opacity: 0.8; transform: scale(1); }
        }
        .splash-content {
            position: relative;
            z-index: 2;
            text-align: center;
            padding: 0 6%;
        }
        .splash-title {
            font-size: clamp(1.3rem, 3.6vw, 2.5rem);
            font-weight: 900;
            letter-spacing: 0.04em;
            color: #f8fafc;
            text-shadow: 0 4px 18px rgba(0,0,0,0.85);
            opacity: 0;
            animation: splashTextIn 1s ease forwards 0.35s;
        }
        .splash-subtitle {
            margin-top: 0.9rem;
            font-size: clamp(0.7rem, 1.4vw, 1rem);
            font-weight: 700;
            letter-spacing: 0.25em;
            text-transform: uppercase;
            color: var(--accent-primary);
            opacity: 0;
            animation: splashTextIn 1s ease forwards 0.9s;
        }
        @keyframes splashTextIn {
            from { opacity: 0; transform: translateY(16px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .gold-cross-letter {
            background: linear-gradient(180deg, #fff6cf 0%, #e6c65c 45%, #b8862e 100%);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            filter: drop-shadow(0 0 7px rgba(230, 198, 92, 0.85));
        }

        /* FLOATING MIC VU METER WIDGET — fixed position overlay, never affects layout/sizing elsewhere */
        .mic-vu-meter-widget {
            position: fixed;
            bottom: 16px;
            right: 16px;
            z-index: 9000;
            background: rgba(9, 13, 22, 0.9);
            border: 1px solid rgba(255, 255, 255, 0.12);
            border-radius: 10px;
            padding: 9px 10px 7px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
            backdrop-filter: blur(4px);
            pointer-events: none;
            user-select: none;
        }
        .vu-status-row { display: flex; align-items: center; gap: 5px; }
        .vu-status-dot {
            width: 7px; height: 7px; border-radius: 50%;
            background: #475569;
            transition: background 0.25s ease, box-shadow 0.25s ease;
        }
        .vu-status-dot.vu-connected { background: #34d399; box-shadow: 0 0 6px #34d399; }
        .vu-status-dot.vu-disconnected { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
        .vu-status-text {
            font-size: 0.55rem; font-weight: 800; letter-spacing: 0.03em;
            color: #cbd5e1; text-transform: uppercase; white-space: nowrap;
        }
        .vu-bar-track {
            position: relative;
            width: 14px;
            height: 100px;
            border-radius: 4px;
            overflow: hidden;
            background: #0b1120;
            border: 1px solid rgba(255, 255, 255, 0.08);
        }
        .vu-bar-fill {
            position: absolute; inset: 0;
            background: linear-gradient(to top,
                #22c55e 0%, #22c55e 55%,
                #eab308 55%, #eab308 78%,
                #ef4444 78%, #ef4444 100%);
        }
        .vu-bar-mask {
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 100%;
            background: #0b1120;
            transition: height 0.09s linear;
        }
        .vu-label { font-size: 0.5rem; color: #64748b; font-weight: 800; letter-spacing: 0.08em; }

/* ===================== SIGN-IN OVERLAY (passwordless magic-link authentication) ===================== */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999; /* above the welcome splash (99999) and everything else */
    background: radial-gradient(ellipse at center, #0c1424 0%, #01040a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.auth-box {
    width: 100%;
    max-width: 380px;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 2rem 1.75rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.auth-brand { display: flex; align-items: center; gap: 0.6rem; color: #f8fafc; margin-bottom: 0.5rem; }
.auth-brand svg { color: #eab308; flex-shrink: 0; }
.auth-brand h2 { font-size: 1.2rem; margin: 0; }
.auth-subtext { font-size: 0.82rem; color: #94a3b8; margin: 0 0 1.1rem 0; line-height: 1.4; }
.auth-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: #1e293b;
    color: #f8fafc;
    font-size: 0.9rem;
    margin-bottom: 0.85rem;
}
.auth-input:focus { outline: none; border-color: #eab308; }
.auth-btn-primary {
    width: 100%;
    background: #b45309;
    border-color: #d97706;
    padding: 0.7rem;
    font-size: 0.9rem;
    font-weight: 700;
}
.auth-status { font-size: 0.78rem; color: #94a3b8; margin: 0.85rem 0 0 0; line-height: 1.4; min-height: 1em; }

.auth-btn-google {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: #ffffff;
    color: #1f2937;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1rem;
}
.auth-btn-google:hover { background: #f3f4f6; }
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #64748b;
    font-size: 0.72rem;
    margin-bottom: 1rem;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.auth-divider span { padding: 0 0.7rem; }

.auth-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000000; /* above the sign-in overlay itself */
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.auth-modal {
    width: 100%;
    max-width: 380px;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 1.75rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    color: #f8fafc;
}
.auth-modal h3 { margin: 0 0 1rem 0; font-size: 1.05rem; }
.auth-modal label { display: block; font-size: 0.78rem; color: #94a3b8; margin-bottom: 0.35rem; }
.auth-modal-desc { font-size: 0.78rem; color: #94a3b8; line-height: 1.4; margin: 0.4rem 0 1.2rem 0; }
.auth-modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }