/* Splash Screen Styles */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #2d3748;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: splashFadeOut 0.8s ease-in-out 2.2s forwards;
}

.splash-content {
    text-align: center;
    animation: splashContentZoom 2s ease-out;
}

.splash-logo {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    margin-bottom: 20px;
    animation: splashLogoSpin 2s ease-out;
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.3);
}

.splash-text {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 4px;
    animation: splashTextGlow 2s ease-out;
}

/* Splash Screen Animations */
@keyframes splashLogoSpin {
    0% {
        transform: scale(0.3) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes splashTextGlow {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    60% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes splashContentZoom {
    0% {
        transform: scale(0.8);
    }
    80% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes splashFadeOut {
    0% {
        opacity: 1;
        visibility: visible;
    }
    100% {
        opacity: 0;
        visibility: hidden;
    }
}

/* Logo wiggle animation - Safari compatible */
@keyframes logoWiggle {
    0%, 90%, 100% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
    }
    92% {
        -webkit-transform: rotate(-3deg);
        transform: rotate(-3deg);
    }
    94% {
        -webkit-transform: rotate(3deg);
        transform: rotate(3deg);
    }
    96% {
        -webkit-transform: rotate(-2deg);
        transform: rotate(-2deg);
    }
    98% {
        -webkit-transform: rotate(2deg);
        transform: rotate(2deg);
    }
}

/* Blue neon tracer animation - Safari compatible box-shadow approach */
@keyframes neonTracer {
    0%, 90%, 100% {
        -webkit-box-shadow: inset 0 0 0 2px transparent;
        box-shadow: inset 0 0 0 2px transparent;
    }
    95% {
        -webkit-box-shadow: inset 0 0 0 2px #4A90E2, 0 0 15px rgba(74, 144, 226, 0.5);
        box-shadow: inset 0 0 0 2px #4A90E2, 0 0 15px rgba(74, 144, 226, 0.5);
    }
}

/* Red tracer for both cue mode and performance mode listening state */
@keyframes neonTracerContinuous {
    0% {
        -webkit-box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.3), 0 0 8px rgba(220, 38, 38, 0.2);
        box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.3), 0 0 8px rgba(220, 38, 38, 0.2);
    }
    50% {
        -webkit-box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.8), 0 0 20px rgba(220, 38, 38, 0.6);
        box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.8), 0 0 20px rgba(220, 38, 38, 0.6);
    }
    100% {
        -webkit-box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.3), 0 0 8px rgba(220, 38, 38, 0.2);
        box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.3), 0 0 8px rgba(220, 38, 38, 0.2);
    }
}

/* Continuous red tracer for performance mode listening state */
@keyframes neonTracerContinuousRed {
    0% {
        -webkit-box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.3), 0 0 8px rgba(220, 38, 38, 0.2);
        box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.3), 0 0 8px rgba(220, 38, 38, 0.2);
    }
    50% {
        -webkit-box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.8), 0 0 20px rgba(220, 38, 38, 0.6);
        box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.8), 0 0 20px rgba(220, 38, 38, 0.6);
    }
    100% {
        -webkit-box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.3), 0 0 8px rgba(220, 38, 38, 0.2);
        box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.3), 0 0 8px rgba(220, 38, 38, 0.2);
    }
}

/* Mode indicator glow animations */
@keyframes modeGlowBlue {
    0%, 100% {
        -webkit-box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4), 0 0 20px rgba(74, 144, 226, 0.3);
        box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4), 0 0 20px rgba(74, 144, 226, 0.3);
    }
    50% {
        -webkit-box-shadow: 0 4px 25px rgba(74, 144, 226, 0.8), 0 0 35px rgba(74, 144, 226, 0.6);
        box-shadow: 0 4px 25px rgba(74, 144, 226, 0.8), 0 0 35px rgba(74, 144, 226, 0.6);
    }
}

@keyframes modeGlowRed {
    0%, 100% {
        -webkit-box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4), 0 0 20px rgba(220, 38, 38, 0.3);
        box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4), 0 0 20px rgba(220, 38, 38, 0.3);
    }
    50% {
        -webkit-box-shadow: 0 4px 25px rgba(220, 38, 38, 0.8), 0 0 35px rgba(220, 38, 38, 0.6);
        box-shadow: 0 4px 25px rgba(220, 38, 38, 0.8), 0 0 35px rgba(220, 38, 38, 0.6);
    }
}

@keyframes textGlowBlue {
    0%, 100% {
        -webkit-text-shadow: 0 2px 8px rgba(74, 144, 226, 0.6), 0 0 15px rgba(74, 144, 226, 0.4);
        text-shadow: 0 2px 8px rgba(74, 144, 226, 0.6), 0 0 15px rgba(74, 144, 226, 0.4);
    }
    50% {
        -webkit-text-shadow: 0 2px 15px rgba(74, 144, 226, 1), 0 0 25px rgba(74, 144, 226, 0.8);
        text-shadow: 0 2px 15px rgba(74, 144, 226, 1), 0 0 25px rgba(74, 144, 226, 0.8);
    }
}

@keyframes textGlowRed {
    0%, 100% {
        -webkit-text-shadow: 0 2px 8px rgba(220, 38, 38, 0.6), 0 0 15px rgba(220, 38, 38, 0.4);
        text-shadow: 0 2px 8px rgba(220, 38, 38, 0.6), 0 0 15px rgba(220, 38, 38, 0.4);
    }
    50% {
        -webkit-text-shadow: 0 2px 15px rgba(220, 38, 38, 1), 0 0 25px rgba(220, 38, 38, 0.8);
        text-shadow: 0 2px 15px rgba(220, 38, 38, 1), 0 0 25px rgba(220, 38, 38, 0.8);
    }
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 1) Kill page scrolling + text auto-zoom for iOS PWA viewport bug fix */
html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: #f8fafc;
    -webkit-text-size-adjust: 100%;
    width: 100%;
    max-width: 100%;
    /* STANDALONE MODE: Prevent any body movement */
    position: relative;
    overscroll-behavior: none;
    touch-action: manipulation;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    /* iOS Safe Area Support */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Additional standalone mode body locking */
@media (display-mode: standalone) {
    body {
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
        overscroll-behavior: none !important;
        touch-action: manipulation !important;
        -webkit-overflow-scrolling: auto !important;
    }
}

/* Remove stage wrapper - no longer needed */

/* Fallback for older engines (we'll set --vh/--vw via JS) */
@supports not (height: 100dvh) {
    :root {
        --vh: 1vh;
        --vw: 1vw;
    }
    #stage {
        width: calc(var(--vw) * 100);
        height: calc(var(--vh) * 100);
    }
    /* Apply fallback to landscape modals too */
    .landscape-skip-modal,
    .landscape-tap-modal,
    .landscape-orientation-modal {
        width: calc(var(--vw) * 100);
        height: calc(var(--vh) * 100);
    }
}

/* Prevent background scrolling when modal is open, but allow modal scrolling */
body.modal-open {
    overflow: hidden !important;
}

/* Ensure lines container can always scroll regardless of modal state */
.lines-container {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Mobile viewport fix for modals */
@media (max-width: 768px) {
    body.modal-open {
        position: fixed !important;
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        top: 0 !important;
        left: 0 !important;
    }
    
    .modal-content {
        max-height: 80vh;
        margin-top: 2rem;
        margin-bottom: 2rem;
    }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 70px 20px 20px 20px; /* Reduced bottom padding */
    height: calc(100dvh - 80px); /* Use dvh for proper viewport height */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
    position: relative;
    /* Ensure container shows above stage background */
    z-index: 1;
    /* Lock main container in place */
    transform: none !important;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
}

/* iOS Standalone Mode Safe Area Adjustments */
@media (display-mode: standalone) {
    .container {
        /* Account for floating menu properly in standalone mode */
        height: calc(100dvh - 100px - env(safe-area-inset-bottom)) !important;
        max-height: calc(100dvh - 100px - env(safe-area-inset-bottom)) !important;
        padding-top: calc(90px + env(safe-area-inset-top)); /* Standard spacing for floating elements */
        padding-bottom: calc(120px + env(safe-area-inset-bottom)) !important; /* More space for floating menu */
        /* Standard positioning - LOCKED DOWN */
        margin-top: 0 !important;
        position: relative !important;
        width: 100% !important;
        max-width: 800px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        /* PREVENT CONTAINER MOVEMENT */
        transform: none !important;
        will-change: auto !important;
        overscroll-behavior: none !important;
        touch-action: manipulation !important;
        -webkit-overflow-scrolling: auto !important;
    }
    
    /* Add proper safe area spacing for floating elements in standalone */
    .floating-logo {
        top: calc(15px + env(safe-area-inset-top)) !important;
    }
    
    .floating-mode {
        top: calc(15px + env(safe-area-inset-top)) !important;
    }
    
    .floating-toggle {
        top: calc(35px + env(safe-area-inset-top)) !important;
    }
    
    /* Fix help modal positioning for standalone mode */
    .help-modal-backdrop {
        padding-top: calc(16px + env(safe-area-inset-top)) !important;
        padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
        padding-left: calc(16px + env(safe-area-inset-left)) !important;
        padding-right: calc(16px + env(safe-area-inset-right)) !important;
    }
    
    .help-surface {
        max-height: calc(88vh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    }
}

/* Landscape Skip Modal - Full screen modal for performance mode listening in landscape */
.landscape-skip-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100dvw;
    height: 100dvh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 15000; /* Higher than all other modals */
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    /* Landscape mode only */
}

/* Use JavaScript-based orientation classes instead of CSS media queries */
html.landscape .landscape-skip-modal.show {
    display: flex;
}



.landscape-skip-content {
    text-align: center;
    color: white;
    padding: 40px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
    pointer-events: none; /* Let clicks pass through to parent */
    /* Rotate content -90 degrees for landscape display (counterclockwise) */
    transform: rotate(-90deg);
    width: 60vh; /* Use viewport height as width when rotated */
    height: 60vw; /* Use viewport width as height when rotated */
}

.landscape-skip-modal:active .landscape-skip-content {
    transform: rotate(-90deg) scale(0.95);
}

.landscape-skip-title {
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
}

.landscape-skip-subtitle {
    font-size: 1.5rem;
    opacity: 0.9;
    font-weight: 300;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Hide the modal in portrait mode */
@media (orientation: portrait) {
    .landscape-skip-modal {
        display: none !important;
    }
}

/* Landscape Tap Modal - Only shown in landscape mode during tap mode */
.landscape-tap-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100dvw;
    height: 100dvh;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 15000; /* Higher than all other modals */
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    /* Landscape mode only */
}

/* Use JavaScript-based orientation classes instead of CSS media queries */
html.landscape .landscape-tap-modal.show {
    display: flex;
}

.landscape-tap-content {
    text-align: center;
    color: white;
    padding: 40px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
    pointer-events: none; /* Let clicks pass through to parent */
    /* Rotate content -90 degrees for landscape display (counterclockwise) */
    transform: rotate(-90deg);
    width: 60vh; /* Use viewport height as width when rotated */
    height: 60vw; /* Use viewport width as height when rotated */
}

.landscape-tap-modal:active .landscape-tap-content {
    transform: rotate(-90deg) scale(0.95);
}

.landscape-tap-title {
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.landscape-tap-subtitle {
    font-size: 1.5rem;
    opacity: 0.9;
    font-weight: 300;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Hide the tap modal in portrait mode using JavaScript-based classes */
html.portrait .landscape-tap-modal {
    display: none !important;
}

/* Landscape Orientation Warning Modal - Only shown in landscape mode when not in tap/performance mode */
.landscape-orientation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100dvw;
    height: 100dvh;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 15000; /* Higher than all other modals */
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    /* Landscape mode only */
}

/* Use JavaScript-based orientation classes instead of CSS media queries */
html.landscape .landscape-orientation-modal.show {
    display: flex;
}

.landscape-orientation-content {
    text-align: center;
    color: white;
    padding: 40px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    /* Rotate content -90 degrees for landscape display (counterclockwise) */
    transform: rotate(-90deg);
    width: 60vh; /* Use viewport height as width when rotated */
    height: 60vw; /* Use viewport width as height when rotated */
}

.landscape-orientation-icon {
    font-size: 5rem;
    margin-bottom: 30px;
    animation: rotateIcon 2s ease-in-out infinite;
}

@keyframes rotateIcon {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.landscape-orientation-title {
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.landscape-orientation-subtitle {
    font-size: 1.5rem;
    opacity: 0.9;
    font-weight: 300;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Hide the orientation modal in portrait mode using JavaScript-based classes */
html.portrait .landscape-orientation-modal {
    display: none !important;
}



/* Safari-specific container fixes */
@supports (-webkit-touch-callout: none) {
    .container {
        height: calc(100vh - 80px) !important; /* Force height calculation in Safari */
        height: calc(100dvh - 80px) !important;
        padding-bottom: 10px !important; /* Minimal bottom padding */
        max-height: none; /* Remove max-height conflicts */
        /* PREVENT SAFARI CONTAINER MOVEMENT */
        transform: none !important;
        will-change: auto !important;
        overscroll-behavior: none !important;
    }
}

/* Override Safari rules specifically for standalone mode */
@supports (-webkit-touch-callout: none) {
    @media (display-mode: standalone) {
        .container {
            height: calc(100lvh - 170px - env(safe-area-inset-bottom)) !important;
            max-height: calc(100lvh - 170px - env(safe-area-inset-bottom)) !important;
            padding-bottom: 15px !important; /* Ensure full container rendering in standalone */
            /* Use largest viewport height - container fully visible without bottom clipping */
            /* ABSOLUTE LOCK FOR STANDALONE SAFARI */
            position: relative !important;
            transform: none !important;
            will-change: auto !important;
            overscroll-behavior: none !important;
            touch-action: manipulation !important;
            -webkit-overflow-scrolling: auto !important;
        }
    }
    
    /* Ensure floating menu is visible in Safari */
    .floating-menu {
        bottom: env(safe-area-inset-bottom, 0);
        padding-bottom: env(safe-area-inset-bottom, 12px);
        height: 80px; /* Force specific height */
    }
    
    /* Ensure lines section reaches closer to menu in Safari */
    section.lines-section {
        flex: 1;
        min-height: 0;
        max-height: calc(100vh - 260px) !important; /* Account for floating menu properly */
        max-height: calc(100dvh - 260px) !important;
        overflow: hidden !important; /* Force container overflow handling */
        overflow-x: hidden !important;
        overflow-y: hidden !important;
        overflow-x: hidden !important;
        overflow-y: hidden !important; /* Never allow section scroll */
        margin-bottom: 100px; /* Proper margin from floating menu */
        /* Lock container position completely */
        position: relative;
        transform: none !important;
        scroll-behavior: auto;
        -webkit-overflow-scrolling: auto;
        overscroll-behavior: none;
    }
    
    /* Force body height calculation in Safari */
    body {
        height: 100vh !important;
        height: 100dvh !important;
    }
}

/* Header Styles */
/* Floating App Header */
.app-header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: transparent;
    color: #333;
    padding: 0.75rem 1.5rem;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    /* iOS Safe Area Support */
    padding-top: 0;
    padding-left: calc(1.5rem + env(safe-area-inset-left));
    padding-right: calc(1.5rem + env(safe-area-inset-right));
}

/* Scene Switcher Styles */
.scene-switcher {
    display: flex;
    gap: 6px;
    background: #f7fafc;
    padding: 4px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    margin-top: 32px;
    transform: scale(1.0);
}

.scene-btn {
    position: relative;
    background: transparent;
    border: none;
    border-radius: 15px;
    width: 30px;
    height: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
    font-weight: 500;
    font-size: 12px;
}

.scene-btn:hover {
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.scene-btn.scene-active {
    background: linear-gradient(180deg, #ffd66c, #ffb000);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 176, 0, 0.5), 0 0 20px rgba(255, 214, 108, 0.3);
    border: 1px solid rgba(255, 176, 0, 0.6);
}

.scene-number {
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

.scene-count {
    font-size: 7px;
    font-weight: 400;
    line-height: 1;
    margin-top: 1px;
    opacity: 0.8;
}

/* Remove header-center as it's no longer needed */

.mode-icon {
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

/* Mode icon glow animations - both red */
.mode-icon.cue-active {
    -webkit-box-shadow: 0 4px 15px rgba(220, 38, 38, 0.6), 0 0 25px rgba(220, 38, 38, 0.4);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.6), 0 0 25px rgba(220, 38, 38, 0.4);
    -webkit-animation: modeGlowRed 2s ease-in-out infinite;
    animation: modeGlowRed 2s ease-in-out infinite;
}

.mode-icon.performance-active {
    -webkit-box-shadow: 0 4px 15px rgba(220, 38, 38, 0.6), 0 0 25px rgba(220, 38, 38, 0.4);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.6), 0 0 25px rgba(220, 38, 38, 0.4);
    -webkit-animation: modeGlowRed 2s ease-in-out infinite;
    animation: modeGlowRed 2s ease-in-out infinite;
}

/* Floating Logo */
.floating-logo {
    position: fixed;
    top: 15px;
    left: 20px;
    z-index: 500;
    pointer-events: none;
}



.floating-logo-image {
    height: 110px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    -webkit-filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    opacity: 0.9;
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
    -webkit-animation: logoWiggle 12s ease-in-out infinite;
    animation: logoWiggle 12s ease-in-out infinite;
}

.floating-logo-image:hover {
    opacity: 1;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
    transform: scale(1.05);
}

/* Adjust on mobile to be smaller and positioned better */
@media (max-width: 768px) {
    .floating-logo {
        top: 10px;
        left: 15px;
    }
    
    .floating-logo-image {
        height: 70px;
        max-width: 110px;
    }
}

/* Section Styles */
section {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    flex-shrink: 0;
    margin-top: -20px; /* Move section up */
    position: relative;
    overflow: hidden !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    transition: all 0.3s ease;
}

/* Decorative corner frames for sections */
section::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: 25px;
    height: 25px;
    border-top: 3px solid #00BFFF;
    border-left: 3px solid #00BFFF;
    border-top-left-radius: 16px;
    opacity: 0.5;
}

section::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 25px;
    height: 25px;
    border-bottom: 3px solid #00BFFF;
    border-right: 3px solid #00BFFF;
    border-bottom-right-radius: 16px;
    opacity: 0.5;
}

section.lines-section {
    flex: 1;
    min-height: 0;
    margin-top: 15px; /* Move lines section down slightly */
    overflow: hidden !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    width: 100%;
    max-width: 100%;
    /* ABSOLUTE LOCK - NO MOVEMENT ALLOWED */
    position: relative !important;
    transform: none !important;
    scroll-behavior: auto !important;
    -webkit-overflow-scrolling: auto !important;
    overscroll-behavior: none !important;
    overscroll-behavior-y: none !important;
    overscroll-behavior-x: none !important;
    touch-action: none !important;
    pointer-events: auto;
    /* Prevent any type of scrolling or movement */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Blue neon tracer animation on scene container only */
    border-radius: 16px;
    -webkit-animation: neonTracer 25s ease-in-out infinite;
    animation: neonTracer 25s ease-in-out infinite;
}

/* Dynamic tracer for cue mode listening */
section.lines-section.cue-listening {
    -webkit-animation: neonTracerContinuous 3s ease-in-out infinite !important;
    animation: neonTracerContinuous 3s ease-in-out infinite !important;
}

/* Dynamic tracer for performance mode listening */
section.lines-section.performance-listening {
    -webkit-animation: neonTracerContinuousRed 3s ease-in-out infinite !important;
    animation: neonTracerContinuousRed 3s ease-in-out infinite !important;
}

section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Input Section */
/* Removed Create Section - now in menu bar */

/* Input Section */
.input-section {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    border: 2px solid #e8f0fe;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4285f4, #34a853, #fbbc05, #ea4335);
    border-radius: 16px 16px 0 0;
}

.input-container:focus-within {
    border-color: #4285f4;
    box-shadow: 0 25px 70px rgba(66, 133, 244, 0.2);
}

/* Close Button */
/* Legacy close button styles - keeping for other modals */
.close-btn.legacy {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #6b7280;
    transition: all 0.2s ease;
}

.close-btn.legacy:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #374151;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.input-section.hidden {
    display: none;
}

/* Modal Overlay Styles */
.input-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15000;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
}

.input-container {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 2px solid #e8f0fe;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 500px;
    margin: 2rem auto;
    animation: slideDown 0.3s ease;
    min-height: auto;
    max-height: calc(100vh - 4rem);
}

.input-section h2 {
    margin: 0 0 1.5rem 0;
    color: #1a202c;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-fields-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .input-fields-row {
        grid-template-columns: 1fr;
    }
    
    .input-section {
        padding: 0.5rem;
        align-items: center;
    }
    
    .input-container {
        margin: 1rem auto;
        padding: 1.5rem;
        max-height: calc(100vh - 2rem);
        max-width: calc(100vw - 1rem);
    }
    
    /* Adjust for virtual keyboard on mobile */
    @supports (-webkit-touch-callout: none) {
        .input-section {
            height: 100vh;
            height: 100dvh; /* Dynamic viewport height for mobile browsers */
        }
        
        .input-container {
            max-height: calc(100dvh - 2rem);
        }
    }
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.button-group .btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 10px;
    font-weight: 600;
    min-width: 140px;
    justify-content: center;
}

.number-field {
    min-width: 80px;
}

.number-input {
    width: 100%;
    text-align: center;
    font-weight: 600;
    padding: 0.75rem 0.5rem;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-field label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field input {
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.input-field input:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.1);
    background: white;
}

.input-field input::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.input-field label {
    font-weight: 500;
    color: #4a5568;
}

.input-field input {
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #f7fafc;
}

.input-field input:focus {
    outline: none;
    border-color: #00BFFF;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.1);
}

/* Label with Toggle Container */
.label-with-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.label-with-toggle label {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Reader Toggle Container */
.reader-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Reader Toggle Button */
.reader-toggle-btn {
    position: relative;
    width: 32px;
    height: 18px;
    background: #e5e7eb;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    flex-shrink: 0;
}

.reader-toggle-btn:hover {
    background: #d1d5db;
}

.reader-toggle-btn.active {
    background: #00BFFF;
}

.reader-toggle-switch {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.reader-toggle-btn.active .reader-toggle-switch {
    transform: translateX(12px);
}

/* Reader Designation Text */
.reader-designation {
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a5568;
    min-width: 40px;
    z-index: 10;
    position: relative;
    display: inline-block;
    text-align: left;
}

/* Dark mode styling for reader toggle */
body.dark-mode .reader-toggle-btn {
    background: #4a5568;
}

body.dark-mode .reader-toggle-btn:hover {
    background: #4b5563;
}

body.dark-mode .reader-toggle-btn.active {
    background: #00BFFF;
}

body.dark-mode .reader-designation {
    color: #e2e8f0;
}

/* Reader toggle section layout */
.reader-toggle-section {
    margin-bottom: 1rem;
}

.reader-toggle-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
}

body.dark-mode .reader-toggle-section label {
    color: #d1d5db;
}

/* Reader Designation Text */
.reader-designation {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    min-width: 50px;
}

/* Whose Line Header - New styling for modal header */
.whose-line-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.whose-line-header .reader-toggle-container {
    position: absolute;
    left: 58%;
    transform: translateX(-50%);
}

.whose-line-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

/* Dark mode styling for whose line label */
body.dark-mode .whose-line-label {
    color: #e2e8f0;
}

body.dark-mode .whose-line-header {
    border-bottom-color: #4a5568;
}

/* Line Item Reader Toggle */
.line-reader-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    z-index: 2;
}

.line-reader-toggle-btn {
    position: relative;
    width: 32px;
    height: 16px;
    background: #e5e7eb;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.line-reader-toggle-btn:hover {
    background: #d1d5db;
}

.line-reader-toggle-btn.active {
    background: #00BFFF;
}

.line-reader-toggle-btn .reader-toggle-switch {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.line-reader-toggle-btn.active .reader-toggle-switch {
    transform: translateX(16px);
}

.line-reader-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #4a5568;
    min-width: 40px;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    background: #e2e8f0;
    color: #4a5568;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #00BFFF;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.3);
}

.btn-success {
    background: #00BFFF;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #0099CC;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.3);
}

.btn-danger {
    background: #00BFFF;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #0099CC;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover:not(:disabled) {
    background: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(226, 232, 240, 0.3);
}

/* Lines Container */
.lines-section {
    height: calc(100vh - 260px); /* Account for header + floating menu + padding */
    display: flex;
    flex-direction: column;
    margin-bottom: 100px; /* End at floating menu top */
    overflow: hidden !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
}

/* Standalone mode specific lines-section sizing */
@media (display-mode: standalone) {
    .lines-section {
        height: calc(100lvh - 350px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
        /* Properly account for header, floating menu, and safe areas in standalone */
        margin-bottom: 120px !important;
        max-height: calc(100lvh - 350px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    }
}

.lines-section {
    position: relative;
    /* Completely prevent any scrolling or movement */
    scroll-behavior: auto;
    -webkit-overflow-scrolling: auto;
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
}

.section-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
    position: relative;
    overflow: hidden !important;
    /* LOCK HEADER - prevent any movement or scroll triggers */
    width: 100% !important;
    max-width: 100% !important;
    touch-action: none !important;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: auto;
}

.status-display {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.status-left-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: #ffffff;
    flex-shrink: 0;
}

.status-center {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.status-display .status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f7fafc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.status-display .status-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
    min-width: 80px;
    transition: all 0.3s ease;
}

/* Status Display Animations */
.status-display .status-icon.listening {
    background: rgba(0, 191, 255, 0.95);
    color: white;
    animation: pulse-gentle 2s infinite;
}

.status-display .status-icon.speaking {
    background: rgba(237, 137, 54, 0.95);
    color: white;
    animation: bounce-gentle 1s infinite;
}

.status-display .status-icon.stopped {
    background: #f7fafc;
    color: #4a5568;
}

.section-header h2 {
    margin: 0;
}

/* Floating Toggle */
.floating-toggle {
    position: fixed;
    top: 35px;
    right: 20px;
    z-index: 500;
    background: transparent !important;
}

/* Floating Mode Display */
.floating-mode {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    width: fit-content;
    text-align: center;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 28px;
    background: transparent !important;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 28px;
    border: 2px solid #999;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

input:checked + .toggle-slider {
    background-color: #00BFFF;
    border-color: #0099CC;
}

input:checked + .toggle-slider:before {
    transform: translateX(32px);
}

/* Disabled toggle switch styling */
.mode-toggle-container.disabled .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #999 !important;
    border-color: #666 !important;
}

.mode-toggle-container.disabled .toggle-switch input:checked + .toggle-slider {
    background-color: #999 !important;
    border-color: #666 !important;
}

.mode-toggle-container.disabled .toggle-slider:before {
    background-color: #ccc !important;
}

.mode-toggle-container.disabled .mode-text {
    opacity: 0.5;
}

.mode-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    min-width: 110px;
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

/* Mode text glow animations - both red */
.mode-text.cue-active {
    -webkit-text-shadow: 0 2px 10px rgba(220, 38, 38, 0.8), 0 0 20px rgba(220, 38, 38, 0.6);
    text-shadow: 0 2px 10px rgba(220, 38, 38, 0.8), 0 0 20px rgba(220, 38, 38, 0.6);
    -webkit-animation: textGlowRed 2s ease-in-out infinite;
    animation: textGlowRed 2s ease-in-out infinite;
}

.mode-text.performance-active {
    -webkit-text-shadow: 0 2px 10px rgba(220, 38, 38, 0.8), 0 0 20px rgba(220, 38, 38, 0.6);
    text-shadow: 0 2px 10px rgba(220, 38, 38, 0.8), 0 0 20px rgba(220, 38, 38, 0.6);
    -webkit-animation: textGlowRed 2s ease-in-out infinite;
    animation: textGlowRed 2s ease-in-out infinite;
}

/* Voice Selector Styles */
.voice-selector-alert {
    text-align: left;
    max-width: 500px;
    margin: 0 auto;
}

.voice-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    padding: 1rem;
    margin: 0;
    align-content: start;
}

.voice-option {
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    text-align: left;
}

.voice-option:hover {
    border-color: #00BFFF;
    background: #f0f9ff;
}

.voice-option.selected {
    border-color: #00BFFF !important;
    background: #00BFFF !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(0, 191, 255, 0.3) !important;
}



/* Sleek Delay Modal Styles */
.delay-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

body.delay-modal-open {
    overflow: hidden;
    touch-action: none;
}

.delay-surface {
    position: relative;
    width: min(480px, 92vw);
    max-height: 88vh;
    border-radius: 18px;
    background: linear-gradient(180deg, #2a3441, #252e3a);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.delay-head {
    padding: 22px 22px 8px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.delay-head h2 {
    font-size: 20px;
    letter-spacing: 0.2px;
    margin: 0;
    color: #eef2f6;
}

.delay-sub {
    color: #9fb0c3;
    font-size: 14px;
    margin: 4px 0 0 0;
}

.delay-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: auto;
}

.delay-readout {
    align-self: center;
    min-width: 240px;
    padding: 18px 22px;
    border-radius: 16px;
    background: linear-gradient(180deg, #1e2732, #1a2230);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.delay-time {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: #e8f2f9;
}

.delay-unit {
    color: #9fb0c3;
    font-weight: 700;
    margin-left: 6px;
}

.delay-stepper {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.delay-chip {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: #3a4452;
    color: #e7edf5;
    padding: 10px 12px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
}

.delay-chip:active {
    transform: translateY(1px);
}

.delay-chip.delay-ghost {
    background: transparent;
    color: #9fb0c3;
}

.delay-slider-wrap {
    padding: 8px 4px 2px;
}

.delay-range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 28px;
    background: transparent;
    margin: 0;
}

.delay-range-slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #2dd0ff, #7ee3ff);
    opacity: 0.35;
}

.delay-range-slider::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #2dd0ff, #7ee3ff);
    opacity: 0.35;
}

.delay-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    margin-top: -10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(45, 208, 255, 0.25);
    border: 2px solid #e8f2f9;
}

.delay-range-slider::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #e8f2f9;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.delay-range-slider:focus-visible {
    outline: none;
}

.delay-range-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 6px rgba(45, 208, 255, 0.33);
}

.delay-range-slider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 6px rgba(45, 208, 255, 0.33);
}

.delay-footer {
    display: flex;
    gap: 20px;
    padding: 24px 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.02));
    justify-content: center;
    align-items: center;
}

/* Modal Cancel and Save buttons - completely new styling */
.delay-modal-cancel-btn {
    flex: 0 0 auto;
    border: 0;
    border-radius: 12px;
    padding: 20px 48px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    font-size: 18px;
    white-space: nowrap;
    min-width: 140px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3a4452;
    color: #e7edf5;
}

.delay-modal-save-btn {
    flex: 0 0 auto;
    border: 0;
    border-radius: 12px;
    padding: 20px 48px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    font-size: 18px;
    white-space: nowrap;
    min-width: 140px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #ffd66c, #ffb000);
    color: #141414;
    box-shadow: 0 12px 28px rgba(255, 176, 0, 0.35);
}

.delay-modal-cancel-btn:active,
.delay-modal-save-btn:active {
    transform: translateY(1px);
}

/* Line item delay button (small circular) */
.line-delay-btn {
    background: rgba(0, 191, 255, 0.1);
    border: 2px solid #00BFFF;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.line-delay-btn:hover {
    background: rgba(0, 191, 255, 0.2);
    transform: scale(1.05);
}

/* Delay modal buttons (large) */
.delay-modal-cancel-btn, .delay-modal-save-btn {
    flex: 0 0 auto;
    border: 0;
    border-radius: 12px;
    padding: 20px 48px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    font-size: 18px;
    white-space: nowrap;
    min-width: 140px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.delay-modal-cancel-btn {
    background: #3a4452;
    color: #e7edf5;
}

.delay-modal-cancel-btn:hover {
    background: #485563;
}

.delay-modal-save-btn {
    background: linear-gradient(180deg, #ffd66c, #ffb000);
    color: #141414;
    box-shadow: 0 12px 28px rgba(255, 176, 0, 0.35);
}

.delay-modal-save-btn:hover {
    background: linear-gradient(180deg, #ffe485, #ffc633);
}

.delay-modal-cancel-btn:active, .delay-modal-save-btn:active {
    transform: translateY(1px);
}

/* Mobile-optimized voice settings buttons */
.voice-btn-mobile {
    padding: 16px 20px !important;
    font-size: 16px !important;
    min-width: 80px !important;
    height: 48px !important;
    flex: 1 1 auto;
}

/* Trim Audio Modal Styles - Copy Alert Modal Design Exactly */
#trimModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    overflow: hidden;
    padding: 1rem;
    overscroll-behavior: none;
    touch-action: none;
}

#trimModal .modal-content {
    background: white;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: auto;
}

#trimModal .modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f7fafc;
}

#trimModal .modal-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.25rem;
    flex: 1;
}

#trimModal .modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    background: #f8fafc;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.trim-setting {
    margin-bottom: 0;
}

.trim-setting label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: #e2e8f0;
    font-size: 16px;
    text-align: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 280px;
}

.stepper-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 800;
    color: #e9eef5;
    transition: all 0.2s ease;
    font-size: 18px;
    outline: none;
}

.stepper-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.stepper-btn:active {
    transform: translateY(1px);
}

.control-group input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: linear-gradient(90deg, #2dd0ff, #7ee3ff);
    border-radius: 3px;
    opacity: 0.35;
    outline: none;
    cursor: pointer;
    margin: 0 8px;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 26px;
    height: 26px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(45, 208, 255, 0.25);
    border: 2px solid #e8f2f9;
    cursor: pointer;
    margin-top: -10px;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 26px;
    height: 26px;
    background: #ffffff;
    border-radius: 50%;
    border: 2px solid #e8f2f9;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.control-group input[type="range"]:focus-visible {
    outline: none;
}

.control-group input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 6px rgba(45, 208, 255, 0.33);
}

.control-group input[type="range"]:focus::-moz-range-thumb {
    box-shadow: 0 0 0 6px rgba(45, 208, 255, 0.33);
}

.readout {
    min-width: 60px;
    text-align: center;
    font-weight: 800;
    color: #e8f2f9;
    font-size: 34px;
    background: linear-gradient(180deg, #1e2732, #1a2230);
    padding: 18px 22px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.25);
    letter-spacing: 0.2px;
}

/* Modal Footer for Trim Modal - Copy Alert Modal Footer */
#trimModal .modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #f7fafc;
}

#trimModal .modal-footer .btn {
    min-width: 80px;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.trim-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

#testTrimBtn, #saveTrimBtn {
    min-width: 80px;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid;
}

#testTrimBtn {
    background: #f7fafc;
    color: #4a5568;
    border-color: #e2e8f0;
}

#testTrimBtn:hover {
    background: #edf2f7;
}

#saveTrimBtn {
    background: #00BFFF;
    color: white;
    border-color: #00BFFF;
}

#saveTrimBtn:hover {
    background: #0099CC;
    border-color: #0099CC;
}

#closeTrimBtn {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    min-width: 80px;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

#closeTrimBtn:hover {
    background: #edf2f7;
}

.trim-btn {
    background: rgba(255, 165, 0, 0.1);
    border: 2px solid #FFA500;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.trim-btn:hover {
    background: rgba(255, 165, 0, 0.2);
    transform: scale(1.05);
}

/* Dark mode overrides for trim modal - Match Alert Modal */
body.dark-mode #trimModal {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode #trimModal .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #trimModal .modal-header {
    background: #1a202c !important;
    border-bottom-color: #4a5568 !important;
}

body.dark-mode #trimModal .modal-header h3 {
    color: #ffffff !important;
}

body.dark-mode #trimModal .modal-body {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .trim-setting label {
    color: #e2e8f0 !important;
}

body.dark-mode .stepper-btn {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .stepper-btn:hover {
    background: #2d3748 !important;
    border-color: #2d3748 !important;
}

body.dark-mode .readout {
    background: #1a202c !important;
    color: #ffffff !important;
    border-color: #4a5568 !important;
}

body.dark-mode #trimModal .modal-footer {
    background: #1a202c !important;
    border-top-color: #4a5568 !important;
}

body.dark-mode #trimModal .modal-footer .btn {
    color: #e2e8f0 !important;
}

/* Dark mode overrides for tip jar modal - Match Alert Modal */
body.dark-mode #tipJarModal {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode #tipJarModal .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #tipJarModal .modal-body {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #tipJarModal .modal-footer {
    background: #1a202c !important;
    border-top-color: #4a5568 !important;
}

body.dark-mode #tipJarModal .modal-footer .btn {
    color: #e2e8f0 !important;
}

body.dark-mode #tipJarModal .btn-secondary {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #tipJarModal .btn-secondary:hover {
    background: #2d3748 !important;
    border-color: #2d3748 !important;
}

body.dark-mode #testTrimBtn {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #testTrimBtn:hover {
    background: #2d3748 !important;
    border-color: #2d3748 !important;
}

body.dark-mode #saveTrimBtn {
    background: #00BFFF !important;
    border-color: #00BFFF !important;
}

body.dark-mode #saveTrimBtn:hover {
    background: #5a67d8 !important;
    border-color: #5a67d8 !important;
}

body.dark-mode #closeTrimBtn {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #closeTrimBtn:hover {
    background: #2d3748 !important;
    border-color: #2d3748 !important;
}

@media (max-width: 480px) {
    .delay-footer {
        gap: 8px;
        padding: 16px !important;
    }
    
    .voice-btn-mobile {
        padding: 14px 16px !important;
        font-size: 14px !important;
        min-width: 70px !important;
        height: 44px !important;
    }
}

/* Help Modal Styles */
.help-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000; /* Increased z-index to ensure it's on top */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    /* iOS Safe Area Support */
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
}

body.help-modal-open {
    overflow: hidden;
    touch-action: none;
}

.help-surface {
    position: relative;
    width: min(640px, 94vw);
    max-height: calc(88vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #2a3441, #252e3a);
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.help-surface::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #43e97b, #38f, #9f6, #ffb000, #ff5b84);
}

.help-head {
    padding: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.help-head h2 {
    flex: 1;
    font-size: 20px;
    letter-spacing: 0.2px;
    color: #e7edf5;
    margin: 0;
}

.help-close-btn {
    border: 0;
    border-radius: 12px;
    padding: 10px 12px;
    background: #3a4452;
    color: #e7edf5;
    cursor: pointer;
    font-weight: 800;
    transition: all 0.2s ease;
}

.help-close-btn:active {
    transform: translateY(1px);
}

.help-body {
    padding: 14px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.help-intro {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 14px;
    color: #e7edf5;
}

.help-intro svg {
    min-width: 22px;
    width: 22px;
    height: 22px;
}

.help-intro p {
    margin: 0;
}

.help-section {
    background: #232c38;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px 12px;
    transition: all 0.2s ease;
}

.help-section[open] {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.help-section summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: #e7edf5;
    outline: none;
}

.help-section summary::-webkit-details-marker {
    display: none;
}

.sum-ico {
    width: 18px;
    height: 18px;
    color: #9fd9ff;
}

.help-content {
    padding: 10px 6px 4px 6px;
    color: #9fb0c3;
}

.help-content ul {
    margin: 8px 0 0 18px;
    padding: 0;
}

.help-content li {
    margin: 6px 0;
}

.help-content p {
    margin: 0 0 8px 0;
}

.help-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #1d2632;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #a9bed6;
    font-weight: 700;
    font-size: 12px;
}

.help-footer {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.02));
}

.help-btn-secondary, .help-btn-primary {
    flex: 1;
    border: 0;
    border-radius: 12px;
    padding: 12px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.help-btn-secondary {
    background: #3a4452;
    color: #e7edf5;
}

.help-btn-secondary:hover {
    background: #485563;
}

.help-btn-primary {
    background: linear-gradient(180deg, #ffd66c, #ffb000);
    color: #141414;
    box-shadow: 0 12px 28px rgba(255, 176, 0, 0.35);
}

.help-btn-primary:hover {
    background: linear-gradient(180deg, #ffe485, #ffc633);
}

.help-btn-secondary:active, .help-btn-primary:active {
    transform: translateY(1px);
}

.lines-container {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05), 0 4px 6px rgba(0, 0, 0, 0.05);
    /* ONLY this container is allowed to scroll - vertical only */
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
    width: 100% !important;
    max-width: 100% !important;
    /* Force proper scroll behavior - contained within locked parent */
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
    min-height: 0 !important;
    height: auto !important;
    /* Prevent parent container scrolling */
    overscroll-behavior: contain !important;
    overscroll-behavior-y: contain !important;
    overscroll-behavior-x: none !important;
    /* Allow only internal scrolling */
    touch-action: pan-y !important;
}

/* Decorative corner frames for lines container */


.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #a0aec0;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.line-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    margin: 0.75rem 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    border: 2px solid transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Decorative corner frames */
.line-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-top: 3px solid #00BFFF;
    border-left: 3px solid #00BFFF;
    border-top-left-radius: 12px;
    opacity: 0.7;
}

.line-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    border-bottom: 3px solid #00BFFF;
    border-right: 3px solid #00BFFF;
    border-bottom-right-radius: 12px;
    opacity: 0.7;
}

.drag-handle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    cursor: grab;
    color: #00BFFF;
    font-weight: bold;
    user-select: none;
    transition: all 0.2s ease;
    background: #f7fafc;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.drag-handle:hover {
    color: #00BFFF;
    transform: scale(1.1);
}

.drag-handle:active {
    cursor: grabbing;
}

.line-item.dragging {
    opacity: 0.9;
    transform: rotate(2deg) scale(1.05);
    z-index: 1000;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), 0 5px 15px rgba(0, 191, 255, 0.4);
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-color: #00BFFF;
    border-width: 2px;
}

.line-item.drag-over {
    background: rgba(0, 191, 255, 0.15);
    border-color: #00BFFF;
    border-style: dashed;
    border-width: 2px;
    box-shadow: inset 0 0 10px rgba(0, 191, 255, 0.2);
    position: relative;
}

/* Visual drop indicator */
.line-item.drag-over::before {
    content: '↓ Drop here ↓';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #00BFFF;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    white-space: nowrap;
    z-index: 1001;
}

/* Smooth shift animations for other items during drag */
.line-item.drag-shift-up,
.line-item.drag-shift-down {
    transition: transform 0.2s ease-out;
}

.line-item:hover {
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    border-color: #00BFFF;
    box-shadow: 0 8px 15px rgba(0, 191, 255, 0.15), 0 3px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.line-item:hover::before,
.line-item:hover::after {
    opacity: 1;
}

.line-item.selected {
    background: linear-gradient(135deg, #edf2f7 0%, #e6fffa 100%);
    border-color: #00BFFF;
    box-shadow: 0 6px 12px rgba(0, 191, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.line-item.selected::before {
    border-color: #00BFFF;
}

.line-item.selected::after {
    border-color: #00BFFF;
}

.line-item.selected .line-number {
    background: #00BFFF;
    transform: scale(1.05);
}

.line-item.playing {
    background: linear-gradient(135deg, #00BFFF 0%, #0099CC 100%);
    color: white;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 191, 255, 0.3);
}

.line-item.playing .cue-text {
    color: rgba(255, 255, 255, 0.9);
}

.line-item.playing .drag-handle {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.line-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    background: #00BFFF;
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.line-item:last-child {
    border-bottom: none;
}

.line-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    overflow: hidden;
}

.line-text {
    font-size: 1rem;
    color: #2d3748;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-width: 100%;
}

.cue-text {
    font-size: 0.875rem;
    color: #00BFFF;
    font-weight: 700;
    background: rgba(0, 191, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    max-width: fit-content;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.line-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.play-line-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #00BFFF;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.play-line-btn:hover {
    background: #0099CC;
    transform: scale(1.1);
}

.play-line-btn:disabled {
    background: #9ca3af !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
    transform: none !important;
    opacity: 0.6;
}

.play-line-btn.stop-mode {
    background: #ff6b6b;
    animation: pulse-stop 1.5s infinite;
}

.play-line-btn.stop-mode:hover {
    background: #e55252;
}

@keyframes pulse-stop {
    0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7); }
    50% { box-shadow: 0 0 0 8px rgba(255, 107, 107, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

.edit-btn, .remove-btn, .voice-btn, .delay-btn, .audio-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    max-width: 36px;
    max-height: 36px;
    flex-shrink: 0;
}

.edit-btn {
    color: #319795;
}

.edit-btn:hover {
    background: rgba(49, 151, 149, 0.1);
    color: #2c7a7b;
}

.remove-btn {
    color: #00BFFF;
}

.remove-btn:hover {
    background: rgba(0, 191, 255, 0.1);
    color: #0099CC;
}

/* Controls Section */
.controls-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e2e8f0;
    color: #4a5568;
    transition: all 0.3s ease;
}

.status-icon.listening {
    background: #00BFFF;
    color: white;
    animation: pulse 2s infinite;
}

.status-icon.speaking {
    background: #00BFFF;
    color: white;
    animation: bounce 1s infinite;
}

.status-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #4a5568;
}

.control-buttons {
    display: flex;
    gap: 1rem;
}

/* Warning Styles */
.warning {
    background: #fed7d7;
    color: #c53030;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #feb2b2;
}

/* Director Instructions - Center Screen */
.director-instructions-center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    transition: all 0.3s ease;
}

.director-instructions-center.hidden {
    display: none;
}

.director-card {
    background: linear-gradient(135deg, #00BFFF 0%, #764ba2 100%);
    color: white;
    padding: 30px 40px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    min-width: 300px;
}

.director-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

.director-text {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Performance Countdown Display */
.performance-countdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001; /* Higher than director instructions */
    transition: all 0.3s ease;
}

.performance-countdown.hidden {
    display: none;
}

.countdown-number {
    font-size: 8rem;
    font-weight: bold;
    color: #00BFFF;
    text-shadow: 0 4px 20px rgba(0, 191, 255, 0.5);
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% { 
        transform: scale(0.5);
        opacity: 0;
    }
    50% { 
        transform: scale(1.2);
        opacity: 1;
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile responsive countdown */
@media (max-width: 768px) {
    .countdown-number {
        font-size: 6rem;
    }
}

/* Chrome-specific styles for better compatibility */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .countdown-number {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Director Speaking Animation - Red Screen Outline */
.director-speaking-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9998; /* Below countdown but above everything else */
    pointer-events: none; /* Don't block interactions */
    transition: opacity 0.3s ease;
}

.director-speaking-animation.hidden {
    display: none;
}

.director-speaking-animation:not(.hidden) {
    border: 8px solid red;
    animation: redPulseOutline 1.5s ease-in-out infinite;
    box-sizing: border-box;
}

@keyframes redPulseOutline {
    0% {
        border-color: #ff0000;
        opacity: 1;
    }
    25% {
        border-color: #ff4444;
        opacity: 0.8;
    }
    50% {
        border-color: #ff6666;
        opacity: 0.6;
    }
    75% {
        border-color: #ff4444;
        opacity: 0.8;
    }
    100% {
        border-color: #ff0000;
        opacity: 1;
    }
}

/* Mobile responsive outline */
@media (max-width: 768px) {
    .director-speaking-animation:not(.hidden) {
        border-width: 6px;
    }
}

/* Chrome-specific styles for better outline rendering */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .director-speaking-animation:not(.hidden) {
        border-style: solid;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    overflow: hidden;
    padding: 1rem;
    overscroll-behavior: none;
    touch-action: none;
}

.modal-content {
    background: white;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f7fafc;
}

.modal-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.25rem;
    flex: 1;
}

.modal-header i {
    color: #00BFFF;
}

.modal-header .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    white-space: pre-wrap;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    background: #f8fafc;
    max-height: 70vh;
    word-break: break-word;
}

.record-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.record-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 40vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #f7fafc;
}

.modal-footer .btn {
    min-width: 80px;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Debug Modal Styles */
.debug-modal-content {
    max-width: 800px;
    max-height: 80vh;
}

.debug-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.debug-logs-container {
    background: #1a202c;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.debug-log-entry {
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid #2d3748;
}

.debug-log-entry:last-child {
    border-bottom: none;
}

.debug-log-timestamp {
    color: #718096;
    font-size: 0.75rem;
}

.debug-log-level-info {
    color: #63b3ed;
}

.debug-log-level-warn {
    color: #f6e05e;
}

.debug-log-level-error {
    color: #fc8181;
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    section {
        padding: 1.5rem;
    }
    
    .controls-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-buttons {
        justify-content: center;
    }
    
    .status-indicator {
        justify-content: center;
    }
    
    .line-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .input-group {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .number-field {
        grid-column: 1;
        justify-self: start;
        min-width: 60px;
    }
    
    .line-item {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .line-number {
        min-width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .line-content {
        flex: 1;
        min-width: 200px;
    }
    
    .line-actions {
        gap: 0.25rem;
    }
    
    .edit-btn, .remove-btn {
        min-width: 32px;
        height: 32px;
        padding: 0.4rem;
    }
    
    .floating-indicator {
        bottom: 80px;
        left: 10px;
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .indicator-text {
        font-size: 0.8rem;
    }
    
    /* Menu Status Indicator Mobile */
    .menu-status-indicator {
        padding: 6px 10px;
        gap: 0.4rem;
    }
    
    .menu-status-icon {
        font-size: 0.9rem;
    }
    
    .menu-status-text {
        font-size: 0.7rem;
    }
    
    /* Adjust container padding for mobile */
    .container {
        padding-bottom: 90px;
    }
    
    /* Mobile Header */
    .app-header-bar {
        padding: 0.5rem 1rem;
    }
    
    .app-name {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    
    /* Adjust container padding for mobile */
    .container {
        padding-top: 50px;
    }
}

/* Settings Modal Styles */
.settings-section {
    padding: 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.setting-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
}

.setting-text {
    display: flex;
    flex-direction: column;
}

.setting-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.setting-desc {
    font-size: 0.875rem;
    color: #64748b;
}

.setting-toggle {
    position: relative;
    width: 48px;
    height: 24px;
    background: #e2e8f0;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.setting-toggle.active {
    background: #3b82f6;
}

.setting-toggle .toggle-switch {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.setting-toggle.active .toggle-switch {
    transform: translateX(24px);
}

.setting-button {
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #334155;
    font-weight: 500;
}

.setting-button:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.setting-button.danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.setting-button.danger:hover {
    background: #fee2e2;
}

/* Menu Modal Styles */
.menu-modal {
    z-index: 10000;
}

.menu-content {
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.menu-content .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.menu-content .modal-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.25rem;
    font-weight: 600;
}

.menu-logo {
    height: 36px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(139, 227, 136, 0.4));
}

.menu-content .close-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: static; /* Override absolute positioning */
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
    z-index: 10;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.close-btn:hover {
    background: #e2e8f0;
    color: #475569;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dark mode styling for close button */
body.dark-mode .close-btn {
    background: #4a5568;
    border-color: #2d3748;
    color: #e2e8f0;
}

body.dark-mode .close-btn:hover {
    background: #2d3748;
    color: #f7fafc;
    border-color: #1a202c;
}

.menu-body {
    padding: 1.5rem 0 0.5rem 0;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    justify-items: center;
}

.menu-item-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 80px;
    width: 100%;
    max-width: 120px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-item-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-color: #cbd5e1;
}

.menu-item-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-icon {
    font-size: 1.5rem;
    display: block;
}

.menu-text {
    font-size: 0.75rem;
    font-weight: 500;
    color: #475569;
    text-align: center;
    line-height: 1.2;
}

/* Mobile adjustments for menu */
@media (max-width: 768px) {
    .menu-content {
        width: 95%;
        max-height: 70vh;
    }
    
    .menu-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.75rem;
    }
    
    .menu-item-btn {
        padding: 0.75rem 0.5rem;
        min-height: 70px;
        max-width: 100px;
    }
    
    .menu-icon {
        font-size: 1.25rem;
    }
    
    .menu-text {
        font-size: 0.7rem;
    }
}

/* Conflict Dialog removed - using automatic numbering */

/* Skip Button for Performance Mode */
.skip-button {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    padding: 20px;
    padding-top: env(safe-area-inset-top, 20px);
}

.skip-button.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%);
}

.skip-btn {
    background: #00BFFF;
    border: none;
    border-radius: 12px;
    padding: 20px 24px;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 191, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center;
    min-height: 70px;
}

.skip-btn:hover {
    background: #0099CC;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 191, 255, 0.5);
}

.skip-btn:active {
    transform: scale(0.95);
}

.skip-text {
    font-size: 0.9rem;
}

/* Dark mode styling for skip button */
body.dark-mode .skip-btn {
    background: #00BFFF;
    box-shadow: 0 4px 15px rgba(0, 191, 255, 0.4);
}

body.dark-mode .skip-btn:hover {
    background: #0099CC;
    box-shadow: 0 6px 20px rgba(0, 191, 255, 0.5);
}

/* Tap Mode Button Styles */
.tap-mode-btn {
    transition: all 0.3s ease;
}

.tap-mode-btn.active {
    background: rgba(0, 191, 255, 0.9) !important;
    animation: tapModeActive 2s ease-in-out infinite;
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.3);
}

@keyframes tapModeActive {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Tap Bar Styles */
.tap-bar {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 20px);
    left: 0;
    right: 0;
    z-index: 1100;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateY(-100%);
    opacity: 0;
}

.tap-bar.show {
    transform: translateY(0);
    opacity: 1;
}

.tap-next-btn {
    width: 100%;
    background: rgba(0, 191, 255, 0.9);
    color: white;
    border: none;
    padding: 25px 20px;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.2);
    backdrop-filter: blur(10px);
}

.tap-next-btn:hover {
    background: rgba(0, 191, 255, 1);
    box-shadow: 0 6px 16px rgba(0, 191, 255, 0.3);
    transform: translateY(-1px);
}

.tap-text {
    font-size: 0.9rem;
}

/* Dark mode styling for tap button */
body.dark-mode .tap-next-btn {
    background: rgba(0, 191, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.2);
}

body.dark-mode .tap-next-btn:hover {
    background: rgba(0, 191, 255, 1);
    box-shadow: 0 6px 16px rgba(0, 191, 255, 0.3);
}

body.dark-mode .tap-mode-btn.active {
    background: rgba(0, 191, 255, 0.9) !important;
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.3);
}

/* Portrait-only orientation lock - REMOVED: Conflicted with stage wrapper iOS PWA fix */

/* Orientation warning for landscape */
.orientation-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    text-align: center;
    padding: 2rem;
}

.orientation-warning.show {
    display: flex;
}

.orientation-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.orientation-message {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.orientation-subtitle {
    font-size: 1rem;
    opacity: 0.8;
}

/* Current line highlighting for tap mode */
.line-item.current-line {
    background: rgba(0, 191, 255, 0.1);
    border-left: 4px solid #00BFFF;
    animation: currentLineHighlight 2s ease-in-out;
}

/* Playing line highlighting for cue and performance modes */
.line-item.playing {
    background: rgba(0, 191, 255, 0.1);
    border-left: 4px solid #00BFFF;
    animation: playingLineHighlight 2s ease-in-out;
}

@keyframes currentLineHighlight {
    0% { background: rgba(0, 191, 255, 0.3); }
    100% { background: rgba(0, 191, 255, 0.1); }
}

@keyframes playingLineHighlight {
    0% { background: rgba(0, 191, 255, 0.3); }
    50% { background: rgba(0, 191, 255, 0.2); }
    100% { background: rgba(0, 191, 255, 0.1); }
}

body.dark-mode .line-item.current-line {
    background: rgba(0, 191, 255, 0.15);
    border-left: 4px solid #00BFFF;
}

body.dark-mode .line-item.playing {
    background: rgba(0, 191, 255, 0.15);
    border-left: 4px solid #00BFFF;
}

/* Tap Mode Indicator */
.tap-mode-indicator {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(74, 144, 226, 0.9);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    z-index: 999;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.tap-mode-indicator.hidden {
    display: none;
}

/* File Validation Alert Modal - appears above record modal */
#alertModal6.file-validation-alert {
    z-index: 11000 !important;
}

#alertModal6.file-validation-alert .modal-content {
    background: #fff;
    border: 2px solid #ff6b6b;
    box-shadow: 0 25px 50px rgba(255, 107, 107, 0.3);
    animation: validationSlideIn 0.3s ease-out;
}

@keyframes validationSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Validation Alert Modal - appears above all form modals */
#alertModal6.validation-alert {
    z-index: 50000 !important;
}

#alertModal6.validation-alert .modal-content {
    background: #fff;
    border: 2px solid #ff6b6b;
    box-shadow: 0 30px 60px rgba(255, 107, 107, 0.4);
    animation: validationBounceIn 0.4s ease-out;
}

@keyframes validationBounceIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* High Priority Alert Modal - appears above everything else */
#alertModal6 {
    z-index: 30000 !important;
}

#alertModal6 .modal-content {
    background: #fff;
    border: 2px solid #ff6b6b;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

#alertModal6 #alertMessage6 {
    font-weight: 500;
    color: #2d3748;
    line-height: 1.5;
    white-space: pre-line;
}

/* Choice Alert Styling */
#createChoiceModal .alert-box {
    background: #15161a;
    border-radius: 14px;
    padding: 20px;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    text-align: center;
    margin: 0 auto;
    position: relative;
}

#createChoiceModal .alert-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 18px;
    color: #e9eef5;
}

#createChoiceModal .option {
    background: #1f2128;
    border-radius: 10px;
    padding: 14px;
    margin: 10px 0;
}

#createChoiceModal .option:first-child {
    margin-top: 0;
}

#createChoiceModal .option:last-child {
    margin-bottom: 0;
}

#createChoiceModal .option-label {
    font-size: 12px;
    color: #9aa0a6;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

#createChoiceModal .option-btn {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 10px;
    background: #2a2d33;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#createChoiceModal .option-btn:hover {
    background: #343843;
}

#createChoiceModal .option-btn:active {
    background: #3a3f4a;
    transform: translateY(1px);
}





/* Floating Menu Bar */
.floating-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding: 12px 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 500;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    min-height: 80px; /* Ensure consistent height across browsers */
}

/* Fix floating menu position in standalone mode to prevent movement after rotation */
@media (display-mode: standalone) {
    .floating-menu {
        bottom: env(safe-area-inset-bottom, 0px);
        /* Force consistent positioning in standalone mode */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
}



.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: #f7fafc;
    color: #4a5568;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-btn:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.15);
}

.menu-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.create-btn {
    background: #f7fafc !important;
    color: #4a5568 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.create-btn:hover {
    background: #e2e8f0 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

.create-btn:disabled {
    background: #9ca3af !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.record-btn {
    background: linear-gradient(135deg, #00BFFF 0%, #0099CC 100%) !important;
    color: white !important;
}

.record-btn:hover {
    background: linear-gradient(135deg, #0099CC 0%, #0077AA 100%) !important;
    transform: translateY(-2px) !important;
}

.record-btn:disabled {
    background: #9ca3af !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.play-btn {
    background: #f7fafc;
    color: #4a5568;
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.play-btn:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.play-btn.stop-btn {
    background: #00BFFF;
    color: white;
}

.play-btn.stop-btn:hover {
    background: #0099CC;
}

.settings-btn {
    background: #f7fafc !important;
    color: #4a5568 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.settings-btn:hover {
    background: #e2e8f0 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

.placeholder-btn {
    opacity: 0.6;
    cursor: not-allowed;
}

.placeholder-btn:hover {
    background: #f7fafc;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Add padding to main content to avoid overlap with floating elements */
.container {
    padding-bottom: 80px; /* Space for status bar */
    padding-top: 60px; /* Space for floating header */
}

/* Menu Status Indicator */
.menu-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(247, 250, 252, 0.9);
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    backdrop-filter: blur(5px);
    margin-left: auto;
}

.menu-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.menu-status-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: #4a5568;
    margin: 0;
    white-space: nowrap;
}

/* Floating Status Indicator */


/* Gentle animations for floating indicator */
@keyframes pulse-gentle {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes bounce-gentle {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #1a202c;
    color: #e2e8f0;
}

body.dark-mode .container {
    background-color: #1a202c;
}

body.dark-mode .main-content {
    background-color: #1a202c;
}

body.dark-mode .section-header {
    background-color: #2d3748;
    border-color: #4a5568;
}

body.dark-mode .content-area {
    background-color: #1a202c;
}

body.dark-mode .app-container {
    background-color: #1a202c;
}

body.dark-mode main {
    background-color: #1a202c;
}

body.dark-mode .lines-section {
    background-color: #1a202c;
}

body.dark-mode .warning {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .floating-indicator {
    background: rgba(26, 32, 44, 0.95);
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .indicator-text {
    color: #e2e8f0;
}

body.dark-mode .toggle-switch {
    background-color: #4a5568;
}

body.dark-mode .reader-toggle-btn.active .reader-toggle-switch {
    background-color: #00BFFF;
}

body.dark-mode .reader-designation {
    color: #e2e8f0;
}

body.dark-mode .status-text {
    color: #ffffff;
}

body.dark-mode .mode-text {
    color: #ffffff;
}

body.dark-mode .line-reader-designation {
    color: #ffffff;
}

body.dark-mode .reader-me-toggle {
    color: #ffffff;
}

body.dark-mode .modal {
    background-color: rgba(0, 0, 0, 0.8);
}

body.dark-mode .menu-modal {
    background-color: rgba(0, 0, 0, 0.8);
}

body.dark-mode .settings-modal {
    background-color: rgba(0, 0, 0, 0.8);
}

body.dark-mode .alert-modal {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Dark mode styling for mode switch guard modal */
body.dark-mode #modeSwitchGuardModal {
    background-color: rgba(0, 0, 0, 0.8);
}

body.dark-mode #modeSwitchGuardModal .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #modeSwitchGuardModal .modal-body {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #modeSwitchGuardModal .modal-footer {
    background: #2d3748 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode #modeSwitchGuardModal .modal-footer .btn {
    background: #4a5568 !important;
    color: #e2e8f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

body.dark-mode #modeSwitchGuardModal .modal-footer .btn:hover {
    background: #718096 !important;
    color: #ffffff !important;
}

/* Dark mode styling for line action guard modal */
body.dark-mode #lineActionGuardModal {
    background-color: rgba(0, 0, 0, 0.8);
}

body.dark-mode #lineActionGuardModal .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #lineActionGuardModal .modal-body {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #lineActionGuardModal .modal-footer {
    background: #2d3748 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode #lineActionGuardModal .modal-footer .btn {
    background: #4a5568 !important;
    color: #e2e8f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

body.dark-mode #lineActionGuardModal .modal-footer .btn:hover {
    background: #718096 !important;
    color: #ffffff !important;
}

/* Dark mode styling for text-to-speech modal specifically */
body.dark-mode #inputSection .modal-content {
    background: #1b2330;
    color: #e2e8f0;
}

body.dark-mode #inputSection .modal-header {
    background: #1b2330;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode #inputSection .modal-header h3 {
    color: #e2e8f0;
}

body.dark-mode #inputSection .modal-body {
    background: #1b2330;
    color: #e2e8f0;
    font-family: inherit;
}

body.dark-mode #inputSection .input-group label {
    color: #c0d3ff;
}

body.dark-mode #inputSection input[type="text"] {
    background: #0f1520;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

body.dark-mode #inputSection input[type="text"]:focus {
    border-color: rgba(10, 132, 255, 0.5);
}

body.dark-mode #inputSection input[type="text"]::placeholder {
    color: #69758a;
}

body.dark-mode .create-choice-modal {
    background-color: rgba(0, 0, 0, 0.8);
}

body.dark-mode .record-modal {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Record Modal Z-Index */
.record-modal {
    z-index: 10000;
}

/* Record Modal z-index fix */
.record-modal {
    z-index: 15000 !important;
}

/* Record Modal Specific Styles */
.file-select-btn {
    width: 100%;
    padding: 20px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.file-select-btn:hover {
    border-color: #007bff;
    background: #f0f8ff;
}

.file-select-btn .file-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.file-select-btn .file-text {
    font-size: 1.1rem;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.file-select-btn .file-desc {
    font-size: 0.9rem;
    color: #666;
    display: block;
}

.selected-audio {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
    margin-bottom: 20px;
}

.selected-audio h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #333;
}

.audio-file-name {
    margin: 10px 0 0 0;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.reader-toggle-section {
    margin: 20px 0;
}

.reader-toggle-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.toggle-container {
    display: flex;
    gap: 8px;
}

.reader-toggle-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.reader-toggle-btn.active {
    border-color: #007bff;
    background: #007bff;
    color: white;
}

.reader-toggle-btn:hover:not(.active) {
    border-color: #007bff;
    background: #f0f8ff;
}

/* Dark mode support for record modal */
body.dark-mode .file-select-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .file-select-btn:hover {
    border-color: #00bfff;
    background: #1a2332;
}

body.dark-mode .file-select-btn .file-desc {
    color: #a0aec0;
}

body.dark-mode .selected-audio {
    background: #2d3748;
    border-color: #4a5568;
}

body.dark-mode .selected-audio h4 {
    color: #e2e8f0;
}

body.dark-mode .audio-file-name {
    color: #a0aec0;
}

body.dark-mode .reader-toggle-section label {
    color: #e2e8f0;
}

body.dark-mode .reader-toggle-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .reader-toggle-btn.active {
    border-color: #00bfff;
    background: #00bfff;
    color: white;
}

body.dark-mode .reader-toggle-btn:hover:not(.active) {
    border-color: #00bfff;
    background: #1a2332;
}

body.dark-mode .menu-text {
    color: #ffffff;
}

body.dark-mode .menu-icon {
    color: #ffffff;
}

body.dark-mode .setting-title {
    color: #ffffff;
}

body.dark-mode .setting-desc {
    color: #a0aec0;
}

body.dark-mode .close-btn {
    color: #ffffff;
}

body.dark-mode .director-text {
    color: #ffffff;
}

body.dark-mode .line-reader-text {
    color: #ffffff;
}

body.dark-mode .delay-modal,
body.dark-mode .voice-modal,
body.dark-mode .conflict-modal {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode .delay-content,
body.dark-mode .voice-content,
body.dark-mode .conflict-content {
    background: #2d3748 !important;
    color: #e2e8f0;
}

/* Ensure all modal containers are dark */
body.dark-mode .modal > .modal-content {
    background: #2d3748 !important;
}

body.dark-mode .settings-modal .modal-content {
    background: #2d3748 !important;
}

/* Specific fix for settings modal */
body.dark-mode #settingsModal {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode #settingsModal .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #settingsModal .modal-body {
    background: #2d3748 !important;
}

body.dark-mode #settingsModal .settings-section {
    background: #2d3748 !important;
}

/* Specific fix for menu modal */
body.dark-mode #menuModal {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode #menuModal .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #menuModal .menu-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #menuModal .modal-body {
    background: #2d3748 !important;
}

body.dark-mode #menuModal .menu-body {
    background: #2d3748 !important;
}

body.dark-mode #menuModal .menu-grid {
    background: #2d3748 !important;
}

body.dark-mode #menuModal .menu-item-btn {
    background: #374151 !important;
    border-color: #4a5568 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .voice-selector-alert h3 {
    color: #ffffff !important;
}

body.dark-mode #menuModal .menu-item-btn:hover {
    background: #4b5563 !important;
}

/* Fix all other modal dialogs for dark mode */
body.dark-mode .alert-modal,
body.dark-mode .create-choice-modal,
body.dark-mode .record-modal,
body.dark-mode .delay-modal,
body.dark-mode .voice-modal,
body.dark-mode .conflict-modal {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode .alert-modal .modal-content,
body.dark-mode .create-choice-modal .modal-content,
body.dark-mode .record-modal .modal-content,
body.dark-mode .delay-modal .modal-content,
body.dark-mode .voice-modal .modal-content,
body.dark-mode .conflict-modal .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

/* Specific fix for alert modal (used by Directions, About, Privacy, Terms, Help, Feedback) */
body.dark-mode #alertModal {
    background-color: rgba(0, 0, 0, 0.8) !important;
    z-index: 25000 !important; /* Highest priority for alerts */
}

/* Standard alert modal should also have highest z-index */
#alertModal {
    z-index: 25000 !important;
}

body.dark-mode #alertModal .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal .modal-body {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertMessage {
    color: #ffffff !important;
}

body.dark-mode #alertModal .modal-footer {
    background: #1a202c !important;
    border-top-color: #4a5568 !important;
}

body.dark-mode #alertModal .modal-footer .btn {
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal .modal-footer .btn-primary {
    background: #00BFFF !important;
    border-color: #00BFFF !important;
}

body.dark-mode #alertModal .modal-footer .btn-primary:hover {
    background: #5a67d8 !important;
    border-color: #5a67d8 !important;
}

body.dark-mode #alertModal .modal-footer .btn-secondary {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
}

body.dark-mode #alertModal .modal-footer .btn-secondary:hover {
    background: #2d3748 !important;
    border-color: #2d3748 !important;
}

/* Dark mode styles for license modal */
body.dark-mode #licenseModal {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode #licenseModal .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #licenseModal .modal-body {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #licenseMessage {
    color: #ffffff !important;
}

body.dark-mode #licenseModal .modal-footer {
    background: #1a202c !important;
    border-top-color: #4a5568 !important;
}

body.dark-mode #licenseModal .modal-footer .btn {
    color: #e2e8f0 !important;
}

body.dark-mode #licenseModal .modal-footer .btn-primary {
    background: #00BFFF !important;
    border-color: #00BFFF !important;
}

body.dark-mode #licenseModal .modal-footer .btn-primary:hover {
    background: #5a67d8 !important;
    border-color: #5a67d8 !important;
}

body.dark-mode #licenseModal .modal-footer .btn-secondary {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
}

body.dark-mode #licenseModal .modal-footer .btn-secondary:hover {
    background: #2d3748 !important;
    border-color: #2d3748 !important;
}

/* Light mode styles for upgrade modal */
#alertModal4 .modal-footer {
    background: #4a5568 !important;
    border-top-color: #2d3748 !important;
}

#alertModal4 .btn-secondary {
    background: #f8f9ff !important;
    border: 2px solid #e2e8f0 !important;
    color: #2d3748 !important;
}

#alertModal4 .btn-secondary:hover {
    background: #ffffff !important;
    border-color: #00BFFF !important;
    color: #2d3748 !important;
}

/* Dark mode styles for upgrade modal */
body.dark-mode #alertModal4 {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode #alertModal4 .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal4 .modal-header {
    background: #2d3748 !important;
    border-bottom-color: #4a5568 !important;
    color: #ffffff !important;
}

body.dark-mode #alertModal4 .modal-header h3 {
    color: #ffffff !important;
}

body.dark-mode #alertModal4 .modal-body {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal4 .upgrade-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal4 .upgrade-content p {
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal4 .upgrade-option {
    background: #1a202c !important;
    border-color: #4a5568 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal4 .upgrade-option h4 {
    color: #ffffff !important;
}

body.dark-mode #alertModal4 .upgrade-divider {
    color: #a0aec0 !important;
}

body.dark-mode #alertModal4 .license-input {
    background: #1a202c !important;
    border-color: #4a5568 !important;
    color: #ffffff !important;
}

body.dark-mode #alertModal4 .license-input::placeholder {
    color: #a0aec0 !important;
}

body.dark-mode #alertModal4 .btn {
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal4 .btn-primary {
    background: #00BFFF !important;
    border-color: #00BFFF !important;
}

body.dark-mode #alertModal4 .btn-primary:hover {
    background: #5a67d8 !important;
    border-color: #5a67d8 !important;
}

body.dark-mode #alertModal4 .btn-secondary {
    background: #2d3748 !important;
    border: 2px solid #4a5568 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal4 .btn-secondary:hover {
    background: #1a202c !important;
    border-color: #00BFFF !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal4 .modal-footer {
    background: #4a5568 !important;
    border-top-color: #2d3748 !important;
}

/* Dark mode styles for license entry modal */
body.dark-mode #licenseEntryModal {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode #licenseEntryModal .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #licenseEntryModal .modal-body {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #licenseEntryModal .modal-body p {
    color: #e2e8f0 !important;
}

body.dark-mode #licenseEntryModal .modal-footer {
    background: #1a202c !important;
    border-top-color: #4a5568 !important;
}

body.dark-mode #licenseEntryModal .license-input {
    background: #1a202c !important;
    border-color: #4a5568 !important;
    color: #ffffff !important;
}

body.dark-mode #licenseEntryModal .license-input::placeholder {
    color: #a0aec0 !important;
}

body.dark-mode #licenseEntryModal .btn {
    color: #e2e8f0 !important;
}

body.dark-mode #licenseEntryModal .btn-primary {
    background: #00BFFF !important;
    border-color: #00BFFF !important;
}

body.dark-mode #licenseEntryModal .btn-primary:hover {
    background: #0099CC !important;
    border-color: #0099CC !important;
}

body.dark-mode #licenseEntryModal .btn-secondary {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
}

body.dark-mode #licenseEntryModal .btn-secondary:hover {
    background: #2d3748 !important;
    border-color: #2d3748 !important;
}

/* Dark mode styles for Alert Modal 2 */
body.dark-mode #alertModal2 {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode #alertModal2 .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal2 .modal-body {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertMessage2 {
    color: #ffffff !important;
}

body.dark-mode #alertModal2 .modal-footer {
    background: #1a202c !important;
    border-top-color: #4a5568 !important;
}

body.dark-mode #alertModal2 .modal-footer .btn {
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal2 .modal-footer .btn-primary {
    background: #00BFFF !important;
    border-color: #00BFFF !important;
}

body.dark-mode #alertModal2 .modal-footer .btn-primary:hover {
    background: #5a67d8 !important;
    border-color: #5a67d8 !important;
}

body.dark-mode #alertModal2 .modal-footer .btn-secondary {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
}

body.dark-mode #alertModal2 .modal-footer .btn-secondary:hover {
    background: #2d3748 !important;
    border-color: #2d3748 !important;
}

.delete-scene-btn {
    background: #f7fafc !important;
    color: #4a5568 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.delete-scene-btn:hover {
    background: #e2e8f0 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Dark mode styles for modal headers */
body.dark-mode .modal-header {
    background: #1a202c !important;
    border-bottom-color: #4a5568 !important;
}

body.dark-mode .modal-header h3 {
    color: #e2e8f0 !important;
}

body.dark-mode .modal-header .btn {
    color: #e2e8f0 !important;
}

body.dark-mode .modal-header .btn-secondary {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
}

body.dark-mode .modal-header .btn-secondary:hover {
    background: #2d3748 !important;
    border-color: #2d3748 !important;
}

/* Dark mode styles for Alert Modal 3 */
body.dark-mode #alertModal3 .modal-content {
    background: #1a202c !important;
    border-color: #4a5568 !important;
}

body.dark-mode #alertModal3 .modal-body {
    background: #1a202c !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal3 .modal-footer {
    background: #1a202c !important;
    border-color: #4a5568 !important;
}

body.dark-mode #alertModal3 .modal-footer .btn-primary {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: white !important;
}

body.dark-mode #alertModal3 .modal-footer .btn-primary:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}

body.dark-mode #alertModal3 .modal-footer .btn-secondary {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal3 .modal-footer .btn-secondary:hover {
    background: #2d3748 !important;
    border-color: #2d3748 !important;
}

/* Specific fix for alert modal 6 (license error) */
body.dark-mode #alertModal6 {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode #alertModal6 .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal6 .modal-body {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #alertMessage6 {
    color: #ffffff !important;
}

body.dark-mode #alertModal6 .modal-footer {
    background: #1a202c !important;
    border-top-color: #4a5568 !important;
}

body.dark-mode #alertModal6 .modal-footer .btn {
    color: #e2e8f0 !important;
}

body.dark-mode #alertModal6 .modal-footer .btn-primary {
    background: #00BFFF !important;
    border-color: #00BFFF !important;
}

body.dark-mode #alertModal6 .modal-footer .btn-primary:hover {
    background: #5a67d8 !important;
    border-color: #5a67d8 !important;
}

body.dark-mode #alertModal6 .modal-footer .btn-secondary {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
}

body.dark-mode #alertModal6 .modal-footer .btn-secondary:hover {
    background: #2d3748 !important;
    border-color: #2d3748 !important;
}

/* Enhanced Dark Mode Line Item Styling */
body.dark-mode .line-item {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-color: transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.4);
}

body.dark-mode .line-item::before {
    border-color: #00BFFF;
}

body.dark-mode .line-item::after {
    border-color: #00BFFF;
}

body.dark-mode .line-item:hover {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    border-color: #00BFFF;
    box-shadow: 0 8px 15px rgba(0, 191, 255, 0.3), 0 3px 6px rgba(0, 0, 0, 0.4);
}

body.dark-mode .line-item.selected {
    background: linear-gradient(135deg, #2d3748 0%, #1e3a3a 100%);
    border-color: #00BFFF;
    box-shadow: 0 6px 12px rgba(0, 191, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.dark-mode .line-item.dragging {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    border-color: #00BFFF;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 5px 15px rgba(0, 191, 255, 0.5);
}

body.dark-mode .line-item.drag-over {
    background: rgba(0, 191, 255, 0.2);
    border-color: #00BFFF;
    border-style: dashed;
    border-width: 2px;
    box-shadow: inset 0 0 10px rgba(0, 191, 255, 0.3);
}

body.dark-mode .line-item.drag-over::before {
    background: #00BFFF;
    color: white;
}

body.dark-mode .line-text {
    color: #e2e8f0;
}

body.dark-mode .cue-text {
    color: #00BFFF;
    font-weight: 700;
    background: rgba(0, 191, 255, 0.2);
}

body.dark-mode .drag-handle {
    background: #4a5568;
    border-color: #4a5568;
    color: #90cdf4;
}

body.dark-mode .menu-modal .modal-content {
    background: #2d3748 !important;
}

body.dark-mode .alert-modal .modal-content {
    background: #2d3748 !important;
}

body.dark-mode .create-choice-modal .modal-content {
    background: #2d3748 !important;
}

body.dark-mode .record-modal .modal-content {
    background: #2d3748 !important;
}

/* Force all modal backgrounds and content to be dark */
body.dark-mode .modal .modal-content,
body.dark-mode .modal-content,
body.dark-mode .menu-content,
body.dark-mode .input-container {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .app-header-bar {
    background: transparent;
    color: #e2e8f0;
}

body.dark-mode .floating-menu {
    background: rgba(26, 32, 44, 0.95);
    border-top-color: #4a5568;
}

/* Dark mode styles for tap mode indicator */
body.dark-mode .tap-mode-indicator {
    background: rgba(96, 165, 250, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Script PDF Styles */
.script-pdf-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.script-pdf-controls .btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.script-status {
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    font-size: 14px;
    text-align: center;
}

.script-status.loaded {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #166534;
}

/* PDF Viewer Modal Styles */
.script-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    background: #000;
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.script-viewer-header {
    flex-shrink: 0;
    height: 50px;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    color: white;
    position: relative;
    z-index: 10001;
}

.script-viewer-title {
    font-size: 16px;
    font-weight: 600;
}

.script-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.script-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.script-viewer-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.script-pdf-viewer {
    width: 100%;
    height: 100%;
    border: none;
    background: #f8fafc;
    display: block;
}

/* Prevent body scroll when PDF modal is open */
body.pdf-modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Isolate PDF touch interactions */
#scriptViewerModal {
    /* Prevent page zoom when PDF modal is open */
    touch-action: none;
}

#scriptViewerModal .script-pdf-viewer {
    /* Allow only specific touch actions within PDF */
    touch-action: pan-x pan-y pinch-zoom;
    -webkit-overflow-scrolling: touch;
}

/* Mobile-specific PDF viewer improvements */
@media (max-width: 768px) {
    .script-viewer-header {
        height: 44px;
        padding: 0 12px;
    }
    
    .script-viewer-title {
        font-size: 14px;
    }
    
    .script-close-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* Dark mode styles for script PDF */
body.dark-mode .script-status {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

body.dark-mode .script-status.loaded {
    background: #064e3b;
    border-color: #065f46;
    color: #00BFFF;
}

body.dark-mode .script-pdf-viewer {
    background: #1f2937;
}

body.dark-mode .script-viewer-header {
    background: rgba(17, 24, 39, 0.9);
}

body.dark-mode .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0;
}

body.dark-mode .menu-content {
    background: #2d3748 !important;
    color: #e2e8f0;
}

body.dark-mode .input-container {
    background: #2d3748 !important;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .modal-header {
    border-bottom-color: #4a5568;
}

body.dark-mode .setting-item {
    border-bottom-color: #4a5568;
}

body.dark-mode .setting-title {
    color: #e2e8f0;
}

body.dark-mode .setting-desc {
    color: #a0aec0;
}

body.dark-mode .section-header h2 {
    color: #e2e8f0;
}

body.dark-mode .line-item {
    background: #2d3748;
    border-color: #4a5568;
}

body.dark-mode .line-item:hover {
    background: #374151;
}

body.dark-mode .empty-state {
    color: #a0aec0;
}

body.dark-mode .line-to-speak {
    color: #ffffff !important;
}

body.dark-mode .line-text {
    color: #e2e8f0;
}

body.dark-mode .cue-text {
    color: #00BFFF;
    font-weight: 700;
    background: rgba(0, 191, 255, 0.2);
}

body.dark-mode .line-number {
    color: #cbd5e0;
}

body.dark-mode .scene-container {
    background: #2d3748;
    border-color: #4a5568;
}

body.dark-mode .lines-container {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-color: #4a5568;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.4);
}

body.dark-mode .lines-container::before,
body.dark-mode .lines-container::after {
    border-color: #90cdf4;
    opacity: 0.8;
}

/* Dark Mode Section Styling */
body.dark-mode section {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-color: transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.4);
}

body.dark-mode section::before,
body.dark-mode section::after {
    border-color: #90cdf4;
    opacity: 0.7;
}

body.dark-mode .alert-modal .modal-content {
    background: #2d3748;
    border-color: #4a5568;
}

body.dark-mode .alert-message {
    color: #e2e8f0;
}

body.dark-mode .input-section {
    background: rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode .input-section .input-container {
    background: #2d3748 !important;
    border-color: #4a5568;
}

body.dark-mode .input-group label {
    color: #e2e8f0;
}

body.dark-mode .input-group input,
body.dark-mode .input-group textarea {
    background: #374151;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .input-group input::placeholder,
body.dark-mode .input-group textarea::placeholder {
    color: #9ca3af;
}

body.dark-mode .add-btn,
body.dark-mode .cancel-btn {
    background: #374151;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .add-btn:hover {
    background: #4b5563;
}

body.dark-mode .cancel-btn:hover {
    background: #4b5563;
}

body.dark-mode .menu-modal .modal-content {
    background: #2d3748;
    color: #e2e8f0;
}

body.dark-mode .menu-title {
    color: #e2e8f0;
    border-bottom-color: #4a5568;
}

body.dark-mode .menu-item {
    color: #e2e8f0;
    border-bottom-color: #4a5568;
}

body.dark-mode .menu-item:hover {
    background: #374151;
}

body.dark-mode .create-choice-modal .modal-content,
body.dark-mode .record-modal .modal-content {
    background: #2d3748;
    color: #e2e8f0;
}

body.dark-mode .choice-btn {
    background: #374151;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .choice-btn:hover {
    background: #4b5563;
}

body.dark-mode .record-controls {
    background: #374151;
    border-color: #4a5568;
}

body.dark-mode .record-btn {
    background: #374151;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .record-btn:hover {
    background: #4b5563;
}

body.dark-mode .audio-playback {
    background: #374151;
    border-color: #4a5568;
}

body.dark-mode .delay-modal .modal-content,
body.dark-mode .voice-modal .modal-content,
body.dark-mode .conflict-modal .modal-content {
    background: #2d3748;
    color: #e2e8f0;
}

body.dark-mode .delay-slider {
    background: #374151;
}

body.dark-mode .delay-slider::-webkit-slider-thumb {
    background: #e2e8f0;
}

body.dark-mode .voice-option {
    background: #374151;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .voice-option:hover {
    background: #4b5563;
}

body.dark-mode .conflict-actions button {
    background: #374151;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .conflict-actions button:hover {
    background: #4b5563;
}

/* Custom Scrollbar */
.lines-container::-webkit-scrollbar {
    width: 8px;
}

.lines-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

body.dark-mode .lines-container::-webkit-scrollbar-track {
    background: #2d3748;
}

.lines-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

body.dark-mode .lines-container::-webkit-scrollbar-thumb {
    background: #4a5568;
}

.lines-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

body.dark-mode .lines-container::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* Create Choice Modal Styles */
.choice-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem 0;
}

.choice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.choice-btn:hover {
    border-color: #00BFFF;
    background: #edf2f7;
}

.choice-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.choice-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #2d3748;
}

.choice-desc {
    font-size: 0.9rem;
    color: #718096;
}

/* Record Modal Styles */
.record-section {
    margin-bottom: 2rem;
}

.record-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.record-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background: #00BFFF;
    color: white;
    border: none;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.record-button:hover {
    background: #5a67d8;
    transform: scale(1.05);
}

.record-button.recording {
    background: #00BFFF !important;
    animation: pulse 1.5s infinite;
}

.record-button:not(.recording) {
    animation: none !important;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#recordIcon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

#recordText {
    font-size: 1rem;
    font-weight: 600;
}

.recording-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #00BFFF;
    font-weight: 600;
}

.recording-indicator {
    font-size: 1.2rem;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.recorded-audio {
    text-align: center;
    padding: 1rem;
    background: #f7fafc;
    border-radius: 8px;
}

.recorded-audio h4 {
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.recorded-audio audio {
    width: 100%;
    max-width: 300px;
}

.record-inputs {
    margin-top: 1rem;
}

.reader-toggle-section {
    margin: 1.5rem 0;
}

.reader-toggle-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2d3748;
}

.toggle-container {
    display: flex;
    gap: 0.5rem;
}

.reader-toggle-btn {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    background: #f7fafc;
    color: #2d3748;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reader-toggle-btn.active {
    border-color: #00BFFF;
    background: #edf2f7;
    color: #00BFFF;
}

/* Recorded Audio Button Styling */
.recorded-audio-btn {
    background: rgba(0, 191, 255, 0.1);
    border: 2px solid #00BFFF;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.recorded-audio-btn:hover {
    background: rgba(0, 191, 255, 0.2);
    transform: scale(1.05);
}

.recorded-audio-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.recorded-audio-btn:disabled:hover {
    transform: none;
    background: #e2e8f0;
}

.recorded-audio-btn.stop-mode {
    background: rgba(255, 107, 107, 0.2);
    border-color: #ff6b6b;
    animation: pulse-stop 1.5s infinite;
}

.recorded-audio-btn.stop-mode:hover {
    background: rgba(229, 82, 82, 0.3);
    border-color: #e55252;
}

/* Tap to Skip Button */
.tap-to-skip-btn {
    position: absolute;
    right: 8px;
    top: 0;
    bottom: 0;
    width: 140px;
    background: #00BFFF;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    box-shadow: 0 3px 10px rgba(0, 191, 255, 0.4);
    z-index: 100;
    margin: 2px 0;
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    padding: 8px;
}

.tap-to-skip-btn:hover {
    background: #0099CC;
    transform: translateX(-2px) scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 191, 255, 0.5);
}

.tap-to-skip-btn:active {
    transform: translateX(0) scale(0.98);
    box-shadow: 0 2px 6px rgba(0, 191, 255, 0.3);
}

.skip-text {
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    display: block;
    width: 100%;
}

/* Ensure the lines section is positioned relative for absolute positioning */
.lines-section {
    position: relative;
}

/* Dark mode styles for tap-to-skip */
body.dark-mode .tap-to-skip-btn {
    background: linear-gradient(135deg, #4c51bf 0%, #553c9a 100%);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(76, 81, 191, 0.4);
}

body.dark-mode .tap-to-skip-btn:hover {
    background: linear-gradient(135deg, #434190 0%, #4c1d95 100%);
    box-shadow: 0 4px 12px rgba(76, 81, 191, 0.5);
}

/* Upgrade Modal Styles */
/* Custom Upgrade Modal Design - Based on Mockup */
.upgrade-modal-surface {
    width: min(520px, 92vw);
    max-height: 88vh;
    background: linear-gradient(180deg, #2a3441, #252e3a);
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    color: #eef2f6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Dark mode override for upgrade modal */
body.dark-mode .upgrade-modal-surface {
    background: linear-gradient(180deg, #2a3441, #252e3a);
    color: #eef2f6;
}

.upgrade-head {
    padding: 22px 22px 10px;
    text-align: center;
}

.upgrade-head h2 {
    font-size: 22px;
    letter-spacing: 0.2px;
    margin: 0;
    color: #eef2f6;
}

.upgrade-sub {
    margin-top: 6px;
    color: #9fb0c3;
    font-size: 14px;
    margin-bottom: 0;
}

.upgrade-plan {
    margin: 10px 12px 0;
    background: #232c38;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 14px;
}

.plan-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.plan-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 18px;
    color: #eef2f6;
}

.star-icon {
    width: 20px;
    height: 20px;
}

.plan-price {
    color: #9fb0c3;
    font-weight: 600;
}

.plan-benefit {
    margin-top: 10px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 600;
    color: #eef2f6;
}

.check-icon {
    width: 22px;
    height: 22px;
    margin-right: 8px;
}

.upgrade-cta {
    margin: 14px 12px 0;
    border: 0;
    width: calc(100% - 24px);
    align-self: center;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffd66c, #ffb000);
    color: #151515;
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 12px 28px rgba(255, 176, 0, 0.35);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.upgrade-cta:active {
    transform: translateY(1px);
}

.upgrade-guarantee {
    text-align: center;
    color: #9fb0c3;
    font-size: 12px;
    margin: 8px 0 2px;
}

.upgrade-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px 14px;
}

.upgrade-btn {
    border: 0;
    border-radius: 12px;
    padding: 12px;
    font-weight: 700;
    background: #3a4452;
    color: #e7edf5;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.upgrade-btn:hover {
    background: #4a5462;
}

.upgrade-btn-ghost {
    background: transparent;
    color: #9fb0c3;
    text-decoration: underline;
    padding: 8px;
}

.upgrade-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    text-decoration: none;
}

.upgrade-meta {
    text-align: center;
    color: #9fb0c3;
    font-weight: 700;
    margin: 8px 0 0;
}

/* Legacy upgrade styles for compatibility */
.upgrade-content {
    text-align: center;
    padding: 0;
    margin-top: 0;
}

.upgrade-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

/* Welcome Modal Styles - Based on Mockup */
.welcome-modal-surface {
    position: relative;
    width: min(520px, 92vw);
    max-height: 88vh;
    background: linear-gradient(180deg, #2a3441, #252e3a);
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #eef2f6;
}

/* Dark mode override for welcome modal */
body.dark-mode .welcome-modal-surface {
    background: linear-gradient(180deg, #2a3441, #252e3a);
    color: #eef2f6;
}

.welcome-head {
    padding: 22px 22px 8px;
    text-align: center;
}

.welcome-head h2 {
    font-size: 22px;
    letter-spacing: 0.2px;
    margin: 0;
    color: #eef2f6;
}

.welcome-sub {
    margin-top: 6px;
    color: #9fb0c3;
    font-size: 14px;
    margin-bottom: 0;
}

.welcome-body {
    padding: 12px 14px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.welcome-callout {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.mic-icon {
    min-width: 24px;
    min-height: 24px;
    width: 24px;
    height: 24px;
}

.welcome-callout p {
    margin: 0;
    color: #eef2f6;
    line-height: 1.4;
}

.welcome-cta {
    margin: 14px 14px 0;
    border: 0;
    width: calc(100% - 28px);
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffd66c, #ffb000);
    color: #151515;
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 12px 28px rgba(255, 176, 0, 0.35);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.welcome-cta:active {
    transform: translateY(1px);
}

.welcome-details {
    background: #232c38;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 10px 12px;
    margin: 8px 14px 0;
}

.welcome-details summary {
    cursor: pointer;
    font-weight: 700;
    color: #e6ecf3;
    outline: none;
}

.welcome-tips {
    margin: 10px 2px 0;
    color: #9fb0c3;
    font-size: 14px;
}

.welcome-tips ol {
    margin: 6px 0 0 18px;
}

.welcome-tips li {
    margin: 6px 0;
}

.welcome-footer {
    display: flex;
    gap: 10px;
    padding: 12px 14px 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

.welcome-btn-secondary {
    flex: 1;
    border: 0;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 700;
    background: #3a4452;
    color: #e7edf5;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.welcome-btn-secondary:hover {
    background: #4a5462;
    transform: translateY(-1px);
}

.welcome-btn-secondary:active {
    transform: translateY(1px);
}

/* Welcome Modal Option Cards */
.welcome-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.option-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-icon {
    font-size: 18px;
}

.option-title {
    font-weight: 700;
    color: #eef2f6;
    font-size: 16px;
}

.option-desc {
    margin: 0;
    color: #9fb0c3;
    font-size: 13px;
    line-height: 1.3;
    margin-left: 26px;
}

/* Check icon for permissions granted */
.check-icon {
    min-width: 24px;
    min-height: 24px;
    width: 24px;
    height: 24px;
}

/* Voice Picker Modal Styles - Based on Mockup */
.voice-modal {
    z-index: 1000;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.voice-surface {
    position: relative;
    width: min(520px, 92vw);
    max-height: 88vh;
    background: linear-gradient(180deg, #2a3441, #252e3a);
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #eef2f6;
}

/* Dark mode override for voice modal */
body.dark-mode .voice-surface {
    background: linear-gradient(180deg, #2a3441, #252e3a);
    color: #eef2f6;
}

.voice-head {
    padding: 22px 22px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.voice-head h2 {
    font-size: 20px;
    letter-spacing: 0.2px;
    margin: 0;
    color: #eef2f6;
}

.voice-body {
    padding: 12px;
    gap: 10px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 58vh;
}

.voice-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
    color: #e9eef5;
    cursor: pointer;
    transition: transform 0.04s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

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

.voice-item:active {
    transform: translateY(1px);
}

.voice-item .voice-name {
    font-weight: 700;
    color: #e9eef5;
}

.voice-item .voice-meta {
    color: #9fb0c3;
    font-weight: 600;
    font-size: 14px;
}

/* Selected state */
.voice-item[aria-selected="true"] {
    background: #2dd0ff;
    color: #0f1a20;
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(45, 208, 255, 0.35);
}

.voice-item[aria-selected="true"] .voice-name {
    color: #0f1a20;
}

.voice-item[aria-selected="true"] .voice-meta {
    color: #08303b;
}

.voice-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.02));
}

.voice-btn {
    border: 0;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 800;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

.voice-close {
    background: #3a4452;
    color: #e7edf5;
    padding: 14px 20px;
    font-size: 16px;
    min-width: 80px;
}

.voice-close:active {
    transform: translateY(1px);
}

.license-input-section {
    margin-top: 15px;
}

.license-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 10px;
    background: white;
    color: #333;
}

.dark-mode .license-input {
    background: #333;
    border-color: #555;
    color: #e0e0e0;
}

.license-note {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin: 8px 0 0 0;
    line-height: 1.4;
    font-style: italic;
}

.dark-mode .license-note {
    color: #999;
}

.license-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.license-buttons .btn {
    flex: 1;
    max-width: 120px;
}

/* File selection styles */
.file-select-area {
    text-align: center;
    margin-bottom: 20px;
}

.file-select-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 12px;
    padding: 20px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.file-select-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.file-icon {
    font-size: 24px;
}

.file-text {
    font-size: 16px;
    font-weight: 600;
}

.file-desc {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 400;
}

/* Selected audio styles */
.selected-audio {
    margin: 20px 0;
    text-align: center;
}

.audio-file-name {
    font-size: 14px;
    color: #666;
    margin: 10px 0;
}

/* === Text-to-Speech Modal Styling === */
/* Now uses standard .modal styling */

.whose-line-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.whose-line-label {
    font-weight: 600;
    color: #bcd1ff;
}

.reader-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reader-toggle {
    display: flex;
    align-items: center;
    background: #2c3649;
    border-radius: 999px;
    padding: 2px;
    width: 100px;
    height: 28px;
    position: relative;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #cfe0ff;
}

.reader-toggle span {
    flex: 1;
    text-align: center;
    z-index: 2;
    position: relative;
}

.reader-toggle-switch {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    width: 48px;
    border-radius: 999px;
    background: #0a84ff;
    transition: transform 0.25s ease;
    z-index: 1;
}

.reader-toggle.active .reader-toggle-switch {
    transform: translateX(48px);
}

.reader-toggle.active span.right {
    color: #fff;
}

.reader-toggle:not(.active) span.left {
    color: #fff;
}

#inputSection .input-group {
    display: grid;
    gap: 16px;
}

.input-fields-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.input-field {
    flex: 1;
    display: grid;
    gap: 4px;
    min-width: 200px;
}

.input-field label {
    font-size: 13px;
    color: #c0d3ff;
    font-weight: 500;
}

.input-field input[type="text"] {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #0f1520;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-field input[type="text"]:focus {
    border-color: rgba(10, 132, 255, 0.5);
}

.input-field input[type="text"]::placeholder {
    color: #69758a;
}

.button-group {
    display: flex;
    justify-content: flex-end;
}

#inputSection .btn {
    border: none;
    cursor: pointer;
    border-radius: 10px;
    font-weight: 600;
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.2s ease;
}

#inputSection .btn-primary {
    background: #0a84ff;
    color: #fff;
}

#inputSection .btn-primary:hover {
    background: #0968d3;
    transform: translateY(-1px);
}

#inputSection .btn-primary span {
    margin-right: 4px;
}

#inputSection .btn-secondary {
    background: #3a4452;
    color: #e7edf5;
    margin-left: 10px;
}

#inputSection .btn-secondary:hover {
    background: #4a5462;
}


/* Loading Spinner Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner-circle {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #3182CE;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    color: white;
    font-weight: 500;
}

/* Voice settings styling for Chrome pitch/rate controls - matches delay modal */
.voice-setting-group {
    margin-bottom: 24px;
}

.voice-setting-name {
    color: #9fb0c3;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
}

/* Trim Modal Styles - Based on Voice Settings Modal */
.trim-setting {
    margin-bottom: 24px;
}

.trim-setting label {
    color: #9fb0c3;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
}

.trim-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.trim-buttons .btn {
    min-width: 80px;
}

/* Responsive trim buttons for mobile */
@media (max-width: 480px) {
    .trim-buttons .btn {
        font-size: 14px;
        padding: 8px 12px;
        min-width: 70px;
    }
}
