        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            /* Prevent text selection but allow touch scrolling */
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            touch-action: manipulation;
            -webkit-touch-callout: none;
            -webkit-tap-highlight-color: transparent;
            -webkit-user-drag: none;
            -webkit-appearance: none;
            /* Prevent Safari auto-zoom */
            -webkit-text-size-adjust: 100%;
            -ms-text-size-adjust: 100%;
        }

        /* Allow touch actions on interactive UI elements */
        .info-button, .hamburger-menu, .menu-item, .modal-close, .light-dark-toggle, .imaginary-symbol {
            touch-action: auto !important;
            -webkit-touch-callout: none !important;
            -webkit-user-select: none !important;
        }

        /* Specific elements that need full touch control for scrolling */
        .modal-content, .modal-body, .menu-content {
            touch-action: auto !important;
        }

        /* Prevent touch actions only on the canvas and background */
        #three-canvas, body {
            touch-action: none !important;
        }

        body {
            margin: 0;
            padding: 0;
            overflow: hidden;
            font-family: 'Courier New', monospace;
            background-color: #000000;
            transition: background-color 1.5s ease-in-out;
        }

        body.light-mode {
            background: #FFFFFF !important;
        }

        #three-canvas {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 1;
        }

        .imaginary-symbol {
            position: fixed;
            top: 10px;    /* Match hamburger menu top position */
            left: 10px;   /* Match hamburger menu side spacing */
            width: 50px;  /* Match hamburger menu container size */
            height: 50px; /* Match hamburger menu container size */
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 3000; /* Higher than all other elements */
            cursor: pointer;
            opacity: 1;
            /* Add transition for smooth rotation, filter, and italic animation */
            transition: transform 0.3s ease-out, filter 0.3s ease-in-out;
            transform-origin: center center;
        }

        /* Press and hold italic animation states */
        .imaginary-symbol.pressing {
            transform: skewX(-4deg);
            transition: transform 0.6s ease-out;
        }

        .imaginary-symbol.holding {
            transform: skewX(-6deg);
            transition: transform 1.2s ease-out;
        }

        .imaginary-symbol img {
            /* Add transition to the image filter */
            transition: filter 1.5s ease-in-out;
            filter: brightness(0) invert(1); /* White logo for dark mode */
            opacity: 1; /* Prevent transparency inheritance */
            color: white !important; /* Force white color */
        }
        /* Light mode color change */
        body.light-mode .imaginary-symbol img {
            filter: brightness(0) invert(0); /* Black logo for light mode */
        }
        /* Mobile Safari link color override */
        @media screen and (-webkit-min-device-pixel-ratio: 1) {
            .version-display a {
                color: #fff !important;
                -webkit-text-fill-color: #fff !important;
                -webkit-tap-highlight-color: transparent !important;
            }
            
            body.light-mode .version-display a {
                color: #000 !important;
                -webkit-text-fill-color: #000 !important;
            }
        }

        /* Mobile Safari compatibility */
        /* Version display - Clean CSS with white-to-black transitions */
        .version-display {
            position: fixed;
            bottom: 0;
            right: 15px;
            height: 50px;
            display: flex;
            align-items: center;
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            font-size: 11px;
            font-weight: 400;
            letter-spacing: 1px;
            z-index: 1000;
            color: #FFFFFF !important;
            transition: color 1.5s ease-in-out !important;
            pointer-events: none;
            user-select: none;
            -webkit-touch-callout: none;
            -webkit-user-select: none;
        }

        /* Version display light mode */
        body.light-mode .version-display {
            color: #000000 !important;
        }

        /* Copyright notice - Clean CSS with white-to-black transitions */
        .copyright-notice {
            position: fixed;
            bottom: 0;
            left: 15px;
            height: 50px;
            display: flex;
            align-items: center;
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            font-size: 11px;
            font-weight: 400;
            letter-spacing: 1px;
            z-index: 2001;
            color: #FFFFFF !important;
            transition: color 1.5s ease-in-out !important;
            pointer-events: auto;
            user-select: none;
            cursor: pointer;
            -webkit-touch-callout: none;
            -webkit-user-select: none;
        }

        /* Copyright notice light mode */
        body.light-mode .copyright-notice {
            color: #000000 !important;
        }

        /* CSS @property for smooth gradient transitions */
        @property --footer-gradient-color {
            syntax: '<color>';
            initial-value: rgba(255, 255, 255, 0.17);
            inherits: false;
        }

        .powered-by-kaos {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            width: 100%;
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            font-size: 14px;
            font-weight: 400;
            color: white;
            letter-spacing: 2px;
            cursor: pointer;
            z-index: 500; /* Lower than menu overlay (999) to hide behind menu */
            transition: color 1.5s ease-in-out, --footer-gradient-color 1.5s ease-in-out; /* Transition the custom property */
            /* Footer-like styling */
            height: 50px; /* Set to exactly 50px */
            display: flex;
            align-items: center; /* Perfect vertical centering */
            justify-content: center; /* Perfect horizontal centering */
            background: linear-gradient(to top, var(--footer-gradient-color) 0%, rgba(255, 255, 255, 0) 50%); /* Use custom property */
            backdrop-filter: blur(10px); /* Subtle blur effect */
            /* Touch optimization */
            touch-action: auto;
        }

        /* Light mode footer - black text with black gradient fade */
        body.light-mode .powered-by-kaos {
            --footer-gradient-color: rgba(0, 0, 0, 0.25); /* Change custom property value */
            color: black;
        }

        /* Mobile positioning - align with POWERED BY KAOS */
        @media (max-width: 768px) {
            .version-display {
                bottom: 0px;
            }
            .copyright-notice {
                bottom: 0px;
            }
        }

        /* Iframe Loading Indicator */
        .iframe-loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            font-size: 18px;
            z-index: 1000;
            text-align: center;
        }

        /* Iframe Close Button */
        .iframe-close-button {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 50px;
            height: 50px;
            background: rgba(0, 0, 0, 0.8);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 1001;
            transition: background 0.3s ease;
            backdrop-filter: blur(10px);
        }

        .iframe-close-button:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        .iframe-close-button span {
            color: white;
            font-size: 24px;
            font-weight: bold;
            line-height: 1;
        }

        /* Hamburger Menu Styles */
        .hamburger-menu {
            position: fixed;
            top: 10px;  /* Adjusted for larger hit box */
            right: 10px; /* Adjusted for larger hit box */
            z-index: 10000;
            cursor: pointer;
            width: 50px;  /* Increased from 30px for larger hit area */
            height: 50px; /* Increased from 30px for larger hit area */
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            /* Add padding for even larger touch area */
            padding: 10px;
            /* Visual feedback on hover/touch */
            border-radius: 8px;
            transition: background-color 0.2s ease;
        }

        .hamburger-menu:hover,
        .hamburger-menu:active {
            background-color: rgba(255, 255, 255, 0.1);
        }

        .hamburger-line {
            width: 25px;
            height: 2px;
            background-color: white;
            transition: all 0.3s ease-in-out;
            transform-origin: center;
            margin: 2px 0; /* Add spacing between lines for centered layout */
        }

        /* Staggered animation delays for each line */
        .hamburger-line:nth-child(1) {
            transition-delay: 0s;
        }

        .hamburger-line:nth-child(2) {
            transition-delay: 0.1s;
        }

        .hamburger-line:nth-child(3) {
            transition-delay: 0.2s;
        }

        .hamburger-menu.active .hamburger-line:nth-child(1) {
            transform: rotate(45deg) translate(5px, 5px);
            background-color: white !important;
            transition-delay: 0.2s;
        }

        .hamburger-menu.active .hamburger-line:nth-child(2) {
            opacity: 0;
            transition-delay: 0.1s;
        }

        .hamburger-menu.active .hamburger-line:nth-child(3) {
            transform: rotate(-45deg) translate(7px, -7px);
            background-color: white !important;
            transition-delay: 0s;
        }

        .menu-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.95);
            backdrop-filter: blur(10px);
            z-index: 9999;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

        .menu-overlay.active {
            opacity: 1;
            visibility: visible;
        }

        .menu-content {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            color: white;
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            font-weight: 400;
        }

        .menu-item {
            display: block;
            font-size: 24px;
            margin: 20px 0;
            color: white;
            text-decoration: none;
            transition: all 0.3s ease;
            cursor: pointer !important;
            padding: 10px 20px;
            border: 1px solid transparent;
        }

        .menu-item:hover {
            color: #00ffff;
            text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
            border: 1px solid #00ffff;
            background: rgba(0, 255, 255, 0.1);
            cursor: pointer !important;
            box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
        }

        .menu-section-title {
            font-size: 16px;
            color: #888;
            margin: 30px 0 10px 0;
            text-transform: uppercase;
            letter-spacing: 2px;
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            font-weight: 600;
        }

        .menu-version {
            position: absolute;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 12px;
            color: #666;
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            font-weight: 400;
            opacity: 0.7;
        }

        .version-number {
            position: fixed;
            bottom: 10px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 10px;
            color: #ffffff;
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            font-weight: 400;
            opacity: 0.8;
            z-index: 1001; /* Higher than menu overlay */
        }

        .menu-version-top {
            position: absolute;
            top: 20px;
            left: 20px;
            font-size: 12px; /* Increased from 8px */
            color: white;
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            font-weight: 400;
            opacity: 0.6;
            z-index: 1001;
        }

        /* Modal Overlay Styles */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
            /* Prevent background scrolling but allow modal content scrolling */
            overflow: hidden;
            touch-action: none;
        }

        .modal-overlay.active {
            opacity: 1;
            visibility: visible;
        }

        .modal-content {
            background: rgba(20, 20, 20, 0.95);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 12px;
            padding: 40px;
            max-width: 600px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
            transform: scale(0.9);
            transition: transform 0.3s ease;
            position: relative;
            /* COMPREHENSIVE iPhone scrolling fix */
            touch-action: auto !important;
            -webkit-overflow-scrolling: touch !important;
            overscroll-behavior: contain;
            /* Force hardware acceleration */
            transform: translateZ(0);
            will-change: scroll-position;
            /* iOS-specific fixes */
            -webkit-transform: translateZ(0);
            -webkit-backface-visibility: hidden;
            /* Ensure scrolling works on all iOS versions */
            overflow: auto;
            -webkit-overflow-scrolling: touch;
        }

        .modal-overlay.active .modal-content {
            transform: scale(1);
        }
        .modal-close {
            position: absolute;
            top: 10px;  /* Adjusted for larger hit box */
            right: 10px; /* Adjusted for larger hit box */
            background: none;
            border: none;
            color: white;
            font-size: 36px;
            cursor: pointer;
            opacity: 0.7;
            transition: opacity 0.3s ease, background-color 0.2s ease;
            width: 60px;  /* Increased from 50px for larger hit area */
            height: 60px; /* Increased from 50px for larger hit area */
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            /* Add hover/active states for better feedback */
        }

        .modal-close:hover,
        .modal-close:active {
            opacity: 1;
            background-color: rgba(255, 255, 255, 0.1);
        }

        .modal-body {
            /* Comprehensive iPhone modal scrolling fix - different approach */
            overflow-y: auto;
            overflow-x: hidden;
            max-height: calc(80vh - 120px);
            
            /* iOS Safari momentum scrolling */
            -webkit-overflow-scrolling: touch;
            
            /* Prevent body scroll when modal is scrolling */
            overscroll-behavior: contain;
            
            /* Ensure touch events work properly */
            touch-action: pan-y;
            
            /* Force hardware acceleration for smooth scrolling */
            transform: translate3d(0, 0, 0);
            -webkit-transform: translate3d(0, 0, 0);
            
            /* Ensure proper z-index layering */
            position: relative;
            z-index: 1;
        }

        /* Additional iPhone-specific modal fixes */
        .modal-overlay.active {
            /* Prevent body scroll when modal is open */
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            overflow: auto; /* Allow scrolling within overlay */
            -webkit-overflow-scrolling: touch; /* Enable momentum scrolling on iOS */
        }

        /* Ensure modal content is scrollable on iPhone */
        .modal-content {
            /* Allow content to be scrollable */
            overflow: visible;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            /* Add margin for iOS safe areas */
            margin: 5vh auto;
        }

        /* Make modal text container scrollable */
        .modal-text {
            /* Enable scrolling within text container */
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            touch-action: pan-y;
            flex: 1;
            /* Ensure minimum height for scrolling */
            min-height: 200px;
        }

        .modal-title {
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            font-size: 28px;
            font-weight: 600;
            color: white;
            margin-bottom: 20px;
            text-align: center;
        }

        .modal-text {
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            font-size: 16px;
            line-height: 1.6;
            color: #e0e0e0;
            margin-bottom: 20px;
        }

        /* Morphing Input System */
        .morphing-input-container {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 1500;
            opacity: 0;
            visibility: hidden;
            transition: all 0.5s ease;
            pointer-events: none;
        }

        .morphing-input-container.active {
            opacity: 1;
            visibility: visible;
            pointer-events: all;
        }

        .cosmic-input {
            width: 400px;
            height: 60px;
            background: rgba(0, 0, 0, 0.8);
            border: 2px solid rgba(0, 255, 255, 0.6);
            border-radius: 30px;
            color: white;
            font-size: 18px;
            font-family: 'Cabin', 'Helvetica Neue', Arial, sans-serif;
            padding: 0 25px;
            outline: none;
            text-align: center;
            box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
            transition: all 0.3s ease;
        }

        .cosmic-input:focus {
            border-color: rgba(0, 255, 255, 1);
            box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
            text-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
        }

        .cosmic-input::placeholder {
            color: rgba(255, 255, 255, 0.5);
            text-align: center;
        }

        /* Input morphing animation */
        .cosmic-input.morphing {
            border-radius: 8px;
            transform: scaleX(1.1);
        }

        .voice-indicator {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 20px;
            opacity: 0.6;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .voice-indicator:hover {
            opacity: 1;
            transform: translateY(-50%) scale(1.1);
        }

        .voice-indicator.active {
            color: #ff4444;
            animation: pulse 1s infinite;
        }

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


/* ===== DEBUG VISUALIZATION CONTROLS ===== */
/* Add 'debug-lines-visible' class to body to show swipe zone boundaries */
body.debug-lines-visible {
    /* This class enables debug line visibility via JavaScript */
}

/* Debug toggle helper - uncomment to enable debug lines */
/* body { debug-lines: visible; } */



/* ===== CLOSED CAPTION STYLES ===== */
.caption-area {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 600px;
    text-align: center;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.caption-user {
    top: 20%;
}

.caption-zoe {
    bottom: 20%;
}

.caption-text {
    font-family: 'Arial', sans-serif;
    font-size: 28px;
    line-height: 1.5;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
    word-wrap: break-word;
    position: relative;
    /* Remove all box styling - no background, border, shadow, or blur */
}

/* Dark mode caption styling */
.dark-mode .caption-text {
    color: white;
    /* Remove background and border - clean text only */
}

/* Add fade in/out transparency effects at top and bottom */
.caption-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
    pointer-events: none;
    z-index: 1;
}

.caption-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
    pointer-events: none;
    z-index: 1;
}

/* Light mode caption styling */
.light-mode .caption-text {
    color: black;
    /* Remove background and border - clean text only */
}

/* Light mode fade effects */
.light-mode .caption-text::before {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
}

.light-mode .caption-text::after {
    background: linear-gradient(to top, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
}

/* Show captions when active */
.caption-area.active {
    opacity: 1;
}

/* Interim text styling (less opacity for non-final speech) */
.caption-text .interim {
    opacity: 0.6;
    font-style: italic;
}

/* Scrolling animation for book-like reading */
.caption-text {
    scroll-behavior: smooth;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .caption-area {
        width: 90%;
    }
    
    .caption-text {
        font-size: 24px;
        padding: 0;
    }
    
    .caption-user {
        top: 15%;
    }
    
    .caption-zoe {
        bottom: 15%;
    }
}

