* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000000;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: rgba(40, 40, 40, 0.3);
    border-right: 2px solid rgba(255, 68, 68, 0.3);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow: hidden; /* Don't scroll sidebar itself, let content area scroll */
    flex-shrink: 0;
    height: 100vh;
    max-height: 100vh;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    transform: translateX(-100%);
    border-right: none;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 68, 68, 0.05);
    flex-shrink: 0; /* Don't shrink header */
}

.sidebar-header h2 {
    font-size: 1.2em;
    color: #ff4444;
    margin: 0;
}

.sidebar-toggle {
    position: fixed;
    top: -5px;
    left: 20px;
    background: transparent;
    color: #ff4444;
    border: 2px solid #ff4444;
    border-radius: 5px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1.3em;
    transition: left 0.3s ease;
    z-index: 1001;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.8), 0 2px 8px rgba(0, 0, 0, 0.3);
    font-weight: bold;
}

/* Sidebar toggle RGB animations - direct class on button */
.sidebar-toggle.border-rgb-chasing,
#sidebar-toggle.border-rgb-chasing {
    border: 2px solid #ff0000 !important;
    animation: rgbChaseBorder 3s linear infinite, rgbChaseText 3s linear infinite !important;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle.border-rgb-pulse,
#sidebar-toggle.border-rgb-pulse {
    border: 2px solid #ff0000 !important;
    animation: rgbPulse 2s ease-in-out infinite, rgbPulseText 2s ease-in-out infinite !important;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle.border-rgb-rotate,
#sidebar-toggle.border-rgb-rotate {
    border: 2px solid #ff0000 !important;
    animation: rgbRotateBorder 4s linear infinite, rgbRotateText 4s linear infinite !important;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle.border-rgb-wave,
#sidebar-toggle.border-rgb-wave {
    border: 2px solid #ff0000 !important;
    animation: rgbWave 3s ease-in-out infinite, rgbWaveText 3s ease-in-out infinite !important;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle.border-rgb-flicker,
#sidebar-toggle.border-rgb-flicker {
    border: 2px solid #ff0000 !important;
    animation: rgbFlicker 0.5s steps(2, end) infinite, rgbFlickerText 0.5s steps(2, end) infinite !important;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle.border-rgb-solid,
#sidebar-toggle.border-rgb-solid {
    border: 2px solid var(--solid-border-color, #ff00ff) !important;
    color: var(--solid-border-color, #ff00ff) !important;
    text-shadow: 0 0 8px var(--solid-border-color-glow, rgba(255, 0, 255, 0.8)) !important;
    box-shadow: 0 0 15px var(--solid-border-color-glow, rgba(255, 0, 255, 0.8)), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:hover {
    transform: scale(1.05);
}

/* Move button when sidebar is open */
.app-container:has(.sidebar:not(.collapsed)) .sidebar-toggle,
.app-container.sidebar-open .sidebar-toggle {
    left: 300px;
}

.sidebar-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* Allows flex item to shrink and scroll */
}

.control-group {
    margin-bottom: 20px;
    flex-shrink: 0; /* Prevent controls from shrinking */
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: #ffaaaa;
    font-weight: bold;
    font-size: 0.9em;
}

.toggle-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
}

.toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.visual-effects-notice {
    padding: 12px;
    background: rgba(255, 140, 0, 0.10);
    border: 1px solid rgba(255, 140, 0, 0.25);
    border-left: 4px solid rgba(255, 140, 0, 0.55);
    border-radius: 8px;
}

.visual-effects-title {
    font-weight: 800;
    color: #ffcc88;
    margin-bottom: 6px;
    font-size: 0.9em;
}

.visual-effects-text {
    color: #ddd;
    font-size: 0.85em;
    line-height: 1.4;
}

.control-group select {
    width: 100%;
    padding: 10px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 5px;
    font-size: 14px;
}

.control-group select:focus {
    outline: none;
    border-color: #ff4444;
}

.control-group textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.control-group textarea:focus {
    outline: none;
    border-color: #ff4444;
}

.no-topics-info {
    margin-top: 8px;
    padding: 8px;
    background: rgba(255, 68, 68, 0.1);
    border-radius: 5px;
    font-size: 0.85em;
    color: #ffaaaa;
    text-align: center;
}

.constraints-info {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 0, 0, 0.1);
    border-radius: 5px;
    border-left: 4px solid #ff4444;
}

.constraints-info strong {
    color: #ff8888;
    display: block;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.constraints-info ul {
    list-style-position: inside;
    color: #ffaaaa;
    font-size: 0.85em;
}

.constraints-info li {
    margin: 5px 0;
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px 20px 20px 20px;
    padding-top: 20px;
    margin-top: 150px;
    position: relative;
    transition: margin-left 0.3s ease;
    min-width: 0;
}

/* When the collapsible footer exists (main chat), keep input/messages clear of the fixed footer bar */
body.has-footer .main-content {
    padding-bottom: 60px; /* 44px bar + breathing room */
}

.logo-header {
    text-align: center;
    margin: 0;
    padding: 10px 15px;
    flex-shrink: 0;
    position: fixed;
    top: -25px;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-height: 150px;
    pointer-events: none;
}

.logo-image {
    max-width: 450px;
    width: auto;
    height: auto;
    margin-bottom: 5px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    filter: drop-shadow(0 0 0 rgba(255, 68, 68, 0));
    transition: filter 0.3s;
}

/* iOS Safari layout fixes:
   - `vh` and fixed headers behave differently due to dynamic toolbars/safe areas.
   - Use safe-area insets to prevent the fixed logo overlapping the disclaimer/chat area.
*/
@supports (-webkit-touch-callout: none) {
    /* iOS: lock the app viewport so the PAGE doesn't scroll/move while chatting.
       The footer is `position: fixed`, so it won't get clipped by 100dvh anymore. */
    body {
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .app-container {
        height: 100dvh;
        max-height: 100dvh;
        min-height: 0;
    }

    .sidebar {
        height: 100dvh;
        max-height: 100dvh;
    }

    .logo-header {
        top: -50px;
        padding-top: calc(10px + env(safe-area-inset-top, 0px));
    }

    .main-content {
        /* iOS notch adds extra top inset; 150px was already tuned for the fixed header on other platforms.
           Use a smaller base offset on iOS so we don't create a large empty gap. */
        /* IMPORTANT: use padding-top instead of margin-top so we don't overflow past the viewport on iPhone */
        margin-top: 0 !important;
        padding-top: calc(138px + env(safe-area-inset-top, 0px)) !important;
        /* Footer is fixed on iPhone; give the chat area clearance so the input isn't covered */
        padding-bottom: calc(44px + 15px + env(safe-area-inset-bottom, 0px)) !important;
        min-height: 0; /* critical for nested flex + scroll on iOS */
    }

    /* iOS: ensure the messages pane SHRINKS and scrolls instead of pushing the input/footer around */
    .chat-messages {
        min-height: 0 !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    /* Footer positioning is handled by `body.has-footer #site-footer` (all platforms) */
}

/* Logo RGB underglow effects */
.logo-header.border-rgb-chasing .logo-image {
    animation: rgbChaseGlow 3s linear infinite;
}

.logo-header.border-rgb-pulse .logo-image {
    animation: rgbPulseGlow 2s ease-in-out infinite;
}

.logo-header.border-rgb-rotate .logo-image {
    animation: rgbRotateGlow 4s linear infinite;
}

.logo-header.border-rgb-wave .logo-image {
    animation: rgbWaveGlow 3s ease-in-out infinite;
}

.logo-header.border-rgb-flicker .logo-image {
    animation: rgbFlickerGlow 0.5s steps(2, end) infinite;
}

.logo-header.border-rgb-solid .logo-image {
    filter: drop-shadow(0 0 20px var(--solid-border-color-glow, rgba(255, 0, 255, 0.8)))
            drop-shadow(0 0 40px var(--solid-border-color-glow, rgba(255, 0, 255, 0.6)))
            drop-shadow(0 0 60px var(--solid-border-color-glow, rgba(255, 0, 255, 0.4)));
}

/* RGB Glow Animations for Logo */
@keyframes rgbChaseGlow {
    0% {
        filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.8))
                drop-shadow(0 0 40px rgba(255, 0, 0, 0.6))
                drop-shadow(0 0 60px rgba(255, 0, 0, 0.4));
    }
    33% {
        filter: drop-shadow(0 0 20px rgba(0, 255, 0, 0.8))
                drop-shadow(0 0 40px rgba(0, 255, 0, 0.6))
                drop-shadow(0 0 60px rgba(0, 255, 0, 0.4));
    }
    66% {
        filter: drop-shadow(0 0 20px rgba(0, 0, 255, 0.8))
                drop-shadow(0 0 40px rgba(0, 0, 255, 0.6))
                drop-shadow(0 0 60px rgba(0, 0, 255, 0.4));
    }
    100% {
        filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.8))
                drop-shadow(0 0 40px rgba(255, 0, 0, 0.6))
                drop-shadow(0 0 60px rgba(255, 0, 0, 0.4));
    }
}

@keyframes rgbPulseGlow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.8))
                drop-shadow(0 0 40px rgba(255, 0, 0, 0.6))
                drop-shadow(0 0 60px rgba(255, 0, 0, 0.4));
    }
    33% {
        filter: drop-shadow(0 0 20px rgba(0, 255, 0, 0.8))
                drop-shadow(0 0 40px rgba(0, 255, 0, 0.6))
                drop-shadow(0 0 60px rgba(0, 255, 0, 0.4));
    }
    66% {
        filter: drop-shadow(0 0 20px rgba(0, 0, 255, 0.8))
                drop-shadow(0 0 40px rgba(0, 0, 255, 0.6))
                drop-shadow(0 0 60px rgba(0, 0, 255, 0.4));
    }
}

@keyframes rgbRotateGlow {
    0% {
        filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.8))
                drop-shadow(0 0 40px rgba(255, 0, 0, 0.6))
                drop-shadow(0 0 60px rgba(255, 0, 0, 0.4));
    }
    25% {
        filter: drop-shadow(0 0 20px rgba(255, 255, 0, 0.8))
                drop-shadow(0 0 40px rgba(255, 255, 0, 0.6))
                drop-shadow(0 0 60px rgba(255, 255, 0, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(0, 255, 0, 0.8))
                drop-shadow(0 0 40px rgba(0, 255, 0, 0.6))
                drop-shadow(0 0 60px rgba(0, 255, 0, 0.4));
    }
    75% {
        filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.8))
                drop-shadow(0 0 40px rgba(0, 255, 255, 0.6))
                drop-shadow(0 0 60px rgba(0, 255, 255, 0.4));
    }
    100% {
        filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.8))
                drop-shadow(0 0 40px rgba(255, 0, 0, 0.6))
                drop-shadow(0 0 60px rgba(255, 0, 0, 0.4));
    }
}

@keyframes rgbWaveGlow {
    0% {
        filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.8))
                drop-shadow(0 0 40px rgba(255, 0, 0, 0.6))
                drop-shadow(0 0 60px rgba(255, 0, 0, 0.4));
    }
    33% {
        filter: drop-shadow(0 0 20px rgba(0, 255, 0, 0.8))
                drop-shadow(0 0 40px rgba(0, 255, 0, 0.6))
                drop-shadow(0 0 60px rgba(0, 255, 0, 0.4));
    }
    66% {
        filter: drop-shadow(0 0 20px rgba(0, 0, 255, 0.8))
                drop-shadow(0 0 40px rgba(0, 0, 255, 0.6))
                drop-shadow(0 0 60px rgba(0, 0, 255, 0.4));
    }
    100% {
        filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.8))
                drop-shadow(0 0 40px rgba(255, 0, 0, 0.6))
                drop-shadow(0 0 60px rgba(255, 0, 0, 0.4));
    }
}

@keyframes rgbFlickerGlow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.8))
                drop-shadow(0 0 40px rgba(255, 0, 0, 0.6))
                drop-shadow(0 0 60px rgba(255, 0, 0, 0.4));
    }
    25% {
        filter: drop-shadow(0 0 20px rgba(0, 255, 0, 0.8))
                drop-shadow(0 0 40px rgba(0, 255, 0, 0.6))
                drop-shadow(0 0 60px rgba(0, 255, 0, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(0, 0, 255, 0.8))
                drop-shadow(0 0 40px rgba(0, 0, 255, 0.6))
                drop-shadow(0 0 60px rgba(0, 0, 255, 0.4));
    }
    75% {
        filter: drop-shadow(0 0 20px rgba(255, 0, 255, 0.8))
                drop-shadow(0 0 40px rgba(255, 0, 255, 0.6))
                drop-shadow(0 0 60px rgba(255, 0, 255, 0.4));
    }
}

.subtitle {
    font-size: 1em;
    color: #ffffff;
    margin-bottom: 0;
    font-weight: 500;
    text-align: center;
}

.disclaimer-banner {
    padding: 10px 12px;
    background: rgba(139, 69, 19, 0.8);
    border-radius: 8px;
    font-size: 0.85em;
    color: #ffcc88;
    text-align: center;
    line-height: 1.4;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid rgba(255, 165, 0, 0.3);
}

.disclaimer-toggle {
    width: 100%;
    background: transparent;
    border: none;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    padding: 2px 0;
    font: inherit;
}

.disclaimer-chevron {
    opacity: 0.9;
    font-weight: 900;
    transition: transform 0.2s ease;
}

.disclaimer-content {
    margin-top: 8px;
    display: block;
}

.disclaimer-banner.collapsed .disclaimer-content {
    display: none;
}

.disclaimer-banner.collapsed .disclaimer-chevron {
    transform: rotate(-90deg);
}

.warning-icon {
    font-size: 1.2em;
}

.disclaimer-banner strong {
    color: #ffffff;
    font-weight: bold;
}

.chat-container {
    background: rgba(40, 40, 40, 0.3);
    border-radius: 10px;
    padding: 20px;
    border: 3px solid #ff6600;
    box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.chat-container.border-rgb-chasing {
    border: 3px solid #ff0000;
    box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1),
                0 0 15px rgba(255, 0, 0, 0.8);
    animation: rgbChaseBorder 3s linear infinite;
}

.chat-container.border-rgb-chasing .message {
    animation: rgbChaseText 3s linear infinite;
}

.chat-container.border-rgb-pulse {
    border: 3px solid #ff0000;
    animation: rgbPulse 2s ease-in-out infinite;
}

.chat-container.border-rgb-pulse .message {
    animation: rgbPulseText 2s ease-in-out infinite;
}

.chat-container.border-rgb-rotate {
    border: 3px solid #ff0000;
    box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1),
                0 0 15px rgba(255, 0, 0, 0.8);
    animation: rgbRotateBorder 4s linear infinite;
}

.chat-container.border-rgb-rotate .message {
    animation: rgbRotateText 4s linear infinite;
}

.chat-container.border-rgb-wave {
    border: 3px solid #ff0000;
    animation: rgbWave 3s ease-in-out infinite;
}

.chat-container.border-rgb-wave .message {
    animation: rgbWaveText 3s ease-in-out infinite;
}

.chat-container.border-rgb-flicker {
    border: 3px solid #ff0000;
    animation: rgbFlicker 0.5s steps(2, end) infinite;
}

.chat-container.border-rgb-flicker .message {
    animation: rgbFlickerText 0.5s steps(2, end) infinite;
}

.chat-container.border-rgb-solid {
    border: 3px solid var(--solid-border-color, #ff00ff);
    box-shadow: 0 0 20px var(--solid-border-color-glow, rgba(255, 0, 255, 0.8)),
                0 0 15px var(--solid-border-color-glow, rgba(255, 0, 255, 0.6));
}

.chat-container.border-rgb-solid .message {
    text-shadow: 0 0 8px var(--solid-border-color-glow, rgba(255, 0, 255, 0.8)),
                 0 0 12px var(--solid-border-color-glow-soft, rgba(255, 0, 255, 0.6));
}

.burn-level-btn {
    width: 100%;
    padding: 12px 20px;
    background: #cc0000;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.burn-level-btn:hover {
    background: #ff2200;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(204, 0, 0, 0.4);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    margin-bottom: 15px;
    background: transparent;
    border-radius: 8px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 8px;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-in;
    width: fit-content;
    max-width: 70%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* RGB Border Animations */
@keyframes rgbChaseBorder {
    0% {
        border-color: #ff0000;
        box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1),
                    0 0 15px rgba(255, 0, 0, 0.8);
    }
    33% {
        border-color: #00ff00;
        box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1),
                    0 0 15px rgba(0, 255, 0, 0.8);
    }
    66% {
        border-color: #0000ff;
        box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1),
                    0 0 15px rgba(0, 0, 255, 0.8);
    }
    100% {
        border-color: #ff0000;
        box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1),
                    0 0 15px rgba(255, 0, 0, 0.8);
    }
}

@keyframes rgbRotateBorder {
    0% {
        border-color: #ff0000;
        box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1),
                    0 0 15px rgba(255, 0, 0, 0.8);
    }
    25% {
        border-color: #ffff00;
        box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1),
                    0 0 15px rgba(255, 255, 0, 0.8);
    }
    50% {
        border-color: #00ff00;
        box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1),
                    0 0 15px rgba(0, 255, 0, 0.8);
    }
    75% {
        border-color: #00ffff;
        box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1),
                    0 0 15px rgba(0, 255, 255, 0.8);
    }
    100% {
        border-color: #ff0000;
        box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 20px rgba(255, 102, 0, 0.1),
                    0 0 15px rgba(255, 0, 0, 0.8);
    }
}

@keyframes rgbPulse {
    0%, 100% {
        border-color: #ff0000;
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
    }
    33% {
        border-color: #00ff00;
        box-shadow: 0 0 15px rgba(0, 255, 0, 0.8);
    }
    66% {
        border-color: #0000ff;
        box-shadow: 0 0 15px rgba(0, 0, 255, 0.8);
    }
}


@keyframes rgbWave {
    0% {
        border-color: #ff0000;
        box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
    }
    33% {
        border-color: #00ff00;
        box-shadow: 0 0 10px rgba(0, 255, 0, 0.6);
    }
    66% {
        border-color: #0000ff;
        box-shadow: 0 0 10px rgba(0, 0, 255, 0.6);
    }
    100% {
        border-color: #ff0000;
        box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
    }
}

@keyframes rgbFlicker {
    0%, 100% {
        border-color: #ff0000;
        filter: hue-rotate(0deg);
    }
    25% {
        border-color: #00ff00;
        filter: hue-rotate(90deg);
    }
    50% {
        border-color: #0000ff;
        filter: hue-rotate(180deg);
    }
    75% {
        border-color: #ff00ff;
        filter: hue-rotate(270deg);
    }
}

/* RGB Text Color Animations for Buttons */
@keyframes rgbChaseText {
    0% {
        color: #ff0000;
        text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    }
    33% {
        color: #00ff00;
        text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    }
    66% {
        color: #0000ff;
        text-shadow: 0 0 10px rgba(0, 0, 255, 0.8);
    }
    100% {
        color: #ff0000;
        text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    }
}

@keyframes rgbPulseText {
    0%, 100% {
        color: #ff0000;
        text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    }
    33% {
        color: #00ff00;
        text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    }
    66% {
        color: #0000ff;
        text-shadow: 0 0 10px rgba(0, 0, 255, 0.8);
    }
}

@keyframes rgbRotateText {
    0% {
        color: #ff0000;
        text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    }
    25% {
        color: #ffff00;
        text-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
    }
    50% {
        color: #00ff00;
        text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    }
    75% {
        color: #00ffff;
        text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    }
    100% {
        color: #ff0000;
        text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    }
}

@keyframes rgbWaveText {
    0% {
        color: #ff0000;
        text-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
    }
    33% {
        color: #00ff00;
        text-shadow: 0 0 10px rgba(0, 255, 0, 0.6);
    }
    66% {
        color: #0000ff;
        text-shadow: 0 0 10px rgba(0, 0, 255, 0.6);
    }
    100% {
        color: #ff0000;
        text-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
    }
}

@keyframes rgbFlickerText {
    0%, 100% {
        color: #ff0000;
        text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    }
    25% {
        color: #00ff00;
        text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    }
    50% {
        color: #0000ff;
        text-shadow: 0 0 10px rgba(0, 0, 255, 0.8);
    }
    75% {
        color: #ff00ff;
        text-shadow: 0 0 10px rgba(255, 0, 255, 0.8);
    }
}

.message.user {
    background: transparent;
    border: 2px solid #4488ff;
    align-self: flex-end;
    max-width: 70%;
    margin-left: auto;
}

.message.assistant {
    background: transparent;
    border: 2px solid #ff4444;
    align-self: flex-start;
    max-width: 70%;
    margin-right: auto;
}

/* RGB border animations for chat bubbles */
.chat-container.border-rgb-chasing .message.user {
    border: 2px solid #ff0000;
    animation: rgbChaseBorder 3s linear infinite;
}

.chat-container.border-rgb-chasing .message.assistant {
    border: 2px solid #ff0000;
    animation: rgbChaseBorder 3s linear infinite;
}

.chat-container.border-rgb-pulse .message.user,
.chat-container.border-rgb-pulse .message.assistant {
    border: 2px solid #ff0000;
    animation: rgbPulse 2s ease-in-out infinite;
}

.chat-container.border-rgb-rotate .message.user,
.chat-container.border-rgb-rotate .message.assistant {
    border: 2px solid #ff0000;
    animation: rgbRotateBorder 4s linear infinite;
}

.chat-container.border-rgb-wave .message.user,
.chat-container.border-rgb-wave .message.assistant {
    border: 2px solid #ff0000;
    animation: rgbWave 3s ease-in-out infinite;
}

.chat-container.border-rgb-flicker .message.user,
.chat-container.border-rgb-flicker .message.assistant {
    border: 2px solid #ff0000;
    animation: rgbFlicker 0.5s steps(2, end) infinite;
}

.chat-container.border-rgb-solid .message.user,
.chat-container.border-rgb-solid .message.assistant {
    border: 2px solid var(--solid-border-color, #ff00ff);
    box-shadow: 0 0 8px var(--solid-border-color-glow, rgba(255, 0, 255, 0.6));
}

.message-header {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9em;
    opacity: 0.9;
}

.message.user .message-label,
.message.user .message-header {
    color: var(--user-text-color, #88aaff);
}

.message.assistant .message-label,
.message.assistant .message-header {
    color: var(--ai-text-color, #ff8888);
}

.message.user .message-content,
.message.user .message-text {
    color: var(--user-text-color, #88aaff);
}

.message.assistant .message-content,
.message.assistant .message-text {
    color: var(--ai-text-color, #ff8888);
}

.message-content {
    line-height: 1.5;
    white-space: pre-wrap;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
}

#user-input {
    min-width: 0; /* Allows flex item to shrink below content size */
}

#send-button {
    flex-shrink: 0; /* Prevent button from shrinking */
    white-space: nowrap;
}

.stt-button {
    flex-shrink: 0; /* Prevent mic button from shrinking */
}

#user-input {
    flex: 1;
    padding: 12px 15px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 2px solid #ff6600;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-shadow: 0 0 10px rgba(255, 102, 0, 0.3);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.chat-container.border-rgb-chasing #user-input {
    border: 2px solid #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
    animation: rgbChaseBorder 3s linear infinite;
}

.chat-container.border-rgb-pulse #user-input {
    border: 2px solid #ff0000;
    animation: rgbPulse 2s ease-in-out infinite;
}

.chat-container.border-rgb-rotate #user-input {
    border: 2px solid #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
    animation: rgbRotateBorder 4s linear infinite;
}

.chat-container.border-rgb-wave #user-input {
    border: 2px solid #ff0000;
    animation: rgbWave 3s ease-in-out infinite;
}

.chat-container.border-rgb-flicker #user-input {
    border: 2px solid #ff0000;
    animation: rgbFlicker 0.5s steps(2, end) infinite;
}

.chat-container.border-rgb-solid #user-input {
    border: 2px solid var(--solid-border-color, #ff00ff);
    box-shadow: 0 0 10px var(--solid-border-color-glow, rgba(255, 0, 255, 0.6)),
                0 0 8px var(--solid-border-color-glow, rgba(255, 0, 255, 0.4));
}

#user-input:focus {
    outline: none;
    border-color: #ff8800;
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.5);
}

/* Prevent focus styles from overriding RGB animations */
.chat-container.border-rgb-chasing #user-input:focus,
.chat-container.border-rgb-pulse #user-input:focus,
.chat-container.border-rgb-rotate #user-input:focus,
.chat-container.border-rgb-wave #user-input:focus,
.chat-container.border-rgb-flicker #user-input:focus,
.chat-container.border-rgb-solid #user-input:focus {
    border-color: inherit;
    box-shadow: inherit;
}

#user-input::placeholder {
    color: #888;
}

#send-button {
    padding: 12px 25px;
    background: transparent;
    color: #ff4444;
    border: 2px solid #ff4444;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.1s;
    box-shadow: 0 0 12px rgba(255, 68, 68, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-chasing #send-button {
    border: 2px solid #ff0000;
    animation: rgbChaseBorder 3s linear infinite, rgbChaseText 3s linear infinite;
    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-pulse #send-button {
    border: 2px solid #ff0000;
    animation: rgbPulse 2s ease-in-out infinite, rgbPulseText 2s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-rotate #send-button {
    border: 2px solid #ff0000;
    animation: rgbRotateBorder 4s linear infinite, rgbRotateText 4s linear infinite;
    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-wave #send-button {
    border: 2px solid #ff0000;
    animation: rgbWave 3s ease-in-out infinite, rgbWaveText 3s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-flicker #send-button {
    border: 2px solid #ff0000;
    animation: rgbFlicker 0.5s steps(2, end) infinite, rgbFlickerText 0.5s steps(2, end) infinite;
    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-solid #send-button {
    border: 2px solid var(--solid-border-color, #ff00ff);
    color: var(--solid-border-color, #ff00ff);
    text-shadow: 0 0 8px var(--solid-border-color-glow, rgba(255, 0, 255, 0.8));
    box-shadow: 0 0 12px var(--solid-border-color-glow, rgba(255, 0, 255, 0.8)), 0 2px 4px rgba(0, 0, 0, 0.3);
}

#send-button:hover {
    transform: scale(1.05);
}

#send-button:disabled {
    background: transparent;
    border-color: #666;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stt-button {
    padding: 12px 15px;
    background: transparent;
    color: #fff;
    border: 2px solid #444;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.3s;
    box-shadow: 0 0 8px rgba(68, 68, 68, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-chasing .stt-button {
    border: 2px solid #ff0000;
    color: #ff0000;
    animation: rgbChaseBorder 3s linear infinite;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-pulse .stt-button {
    border: 2px solid #ff0000;
    color: #ff0000;
    animation: rgbPulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-rotate .stt-button {
    border: 2px solid #ff0000;
    color: #ff0000;
    animation: rgbRotateBorder 4s linear infinite;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-wave .stt-button {
    border: 2px solid #ff0000;
    color: #ff0000;
    animation: rgbWave 3s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-flicker .stt-button {
    border: 2px solid #ff0000;
    color: #ff0000;
    animation: rgbFlicker 0.5s steps(2, end) infinite;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container.border-rgb-solid .stt-button {
    border: 2px solid var(--solid-border-color, #ff00ff);
    color: var(--solid-border-color, #ff00ff);
    box-shadow: 0 0 8px var(--solid-border-color-glow, rgba(255, 0, 255, 0.6)), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stt-button:hover {
    transform: scale(1.05);
}

.stt-button.recording {
    background: transparent;
    border-color: #ff4444;
    color: #ff4444;
    animation: pulse-recording 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(255, 68, 68, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.status-container {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.status {
    padding: 8px;
    text-align: center;
    font-size: 0.85em;
    color: #aaa;
    border-radius: 5px;
}

.status.loading {
    color: #ffaa44;
}

.status.success {
    color: #44ff44;
}

.status.error {
    color: #ff4444;
}

.status-ready-text {
    padding: 8px;
    text-align: center;
    font-size: 0.85em;
    color: #ffffff;
    border-radius: 5px;
}

.share-container {
    position: relative;
    margin-top: 15px;
}

.share-button {
    padding: 10px 20px;
    background: #444;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-button:hover {
    background: #666;
}

.share-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 5px;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 8px;
    overflow: hidden;
    display: none;
    min-width: 150px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.share-container:hover .share-dropdown {
    display: block;
}

.share-dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 15px;
    background: transparent;
    color: #e0e0e0;
    border: none;
    border-bottom: 1px solid #444;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: background 0.2s;
}

.share-dropdown-item:last-child {
    border-bottom: none;
}

.share-dropdown-item:hover {
    background: #444;
}

.share-dropdown-item span {
    margin-right: 8px;
}

/* Button Styles */
button {
    font-family: inherit;
}

.new-roast-btn, .games-btn, .arena-btn, .suggestions-btn, .bug-report-btn, .account-btn, .admin-btn, .admin-chat-btn, .logout-btn {
    width: 100%;
    padding: 12px;
    background: #ff4444;
    color: #000000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s, transform 0.1s;
    margin-bottom: 10px;
    position: relative;
}

.new-roast-btn:hover, .games-btn:hover, .arena-btn:hover, .suggestions-btn:hover, .bug-report-btn:hover, .admin-btn:hover, .admin-chat-btn:hover {
    background: #ff6666;
    transform: scale(1.02);
}

.unread-badge {
    display: inline-block;
    background: #ff0000;
    color: #ffffff;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 6px;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

.logout-btn {
    background: #666;
    color: #fff;
}

.logout-btn:hover {
    background: #888;
}

.tts-install-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 68, 68, 0.18);
    color: #ffaaaa;
    border: 1px solid rgba(255, 68, 68, 0.35);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s, transform 0.1s;
}

.tts-install-btn:hover {
    background: rgba(255, 68, 68, 0.28);
    transform: scale(1.01);
}

@keyframes pulse-recording {
    from {
        background-color: #ff4444;
    }
    to {
        background-color: #cc0000;
    }
}

/* Scrollbar Styles */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(20, 20, 20, 0.5);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* TTS Button Styles */
.tts-button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    margin-left: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
    color: #e0e0e0;
}

.tts-button:hover {
    opacity: 1;
}

/* Battleship Game Styles */
.battleship-grid {
    user-select: none;
}

.battleship-cell {
    transition: all 0.3s ease;
}

.ship-container {
    user-select: none;
}

.ship-container:active {
    cursor: grabbing !important;
}

.ship-segment {
    transition: all 0.2s ease;
}

/* Hit animation */
@keyframes hitExplosion {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 20px 10px rgba(255, 0, 0, 0.9);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

.hit-animation {
    animation: hitExplosion 0.5s ease-out;
}

/* AI Miss Flash */
@keyframes aiMissFlash {
    0%, 100% {
        background-color: #001166;
    }
    50% {
        background-color: #ffff00;
        box-shadow: 0 0 15px 5px rgba(255, 255, 0, 0.8);
    }
}

.ai-miss-flash {
    animation: aiMissFlash 1s ease-in-out;
}

/* Ship placement hover effect */
.battleship-cell.drag-over {
    background-color: rgba(68, 255, 68, 0.5) !important;
}

/* Footer Styles */
.site-footer {
    background: rgba(20, 20, 20, 0.92);
    border-top: 2px solid rgba(255, 68, 68, 0.3);
    padding: 0;
    margin-top: auto;
    color: #aaa;
    font-size: 0.9em;
    position: relative;
    overflow: hidden;
    z-index: 100; /* Ensure footer is above content but below modals */
    flex-shrink: 0; /* Prevent footer toggle bar from being squeezed off-screen */
}

.site-footer:not(.collapsed) {
    background: rgba(20, 20, 20, 0.95);
}

/* Main chat footer: keep it visible and expanding "up" over the app (all platforms) */
body.has-footer #site-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 3000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

body.has-footer #site-footer.collapsed {
    max-height: 44px !important;
    height: 44px !important;
    overflow: hidden !important;
}

body.has-footer #site-footer:not(.collapsed) {
    max-height: min(70vh, 520px) !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.site-footer:not(.collapsed) {
    padding: 30px 20px 15px;
}

.site-footer.collapsed {
    padding: 0 !important;
    max-height: 44px !important; /* Limit collapsed footer height to just the toggle button */
    height: 44px !important;
    overflow: hidden !important;
}

.footer-content,
.footer-bottom {
    transition: opacity 0.3s ease, max-height 0.3s ease;
    overflow: hidden;
}

.site-footer.collapsed .footer-content,
.site-footer.collapsed .footer-bottom {
    max-height: 0 !important;
    opacity: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: none !important; /* Force hide on collapsed for Android WebView compatibility */
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

.site-footer:not(.collapsed) .footer-content,
.site-footer:not(.collapsed) .footer-bottom {
    max-height: 1000px;
    opacity: 1;
    display: block; /* Ensure visible when not collapsed */
}

.footer-toggle {
    width: 100%;
    background: rgba(255, 68, 68, 0.2);
    border: none;
    border-bottom: 1px solid rgba(255, 68, 68, 0.3);
    color: #ffaaaa;
    padding: 10px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s, color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    -webkit-tap-highlight-color: rgba(255, 68, 68, 0.3); /* Better touch feedback on Android */
    touch-action: manipulation; /* Prevent double-tap zoom on Android */
    position: relative;
    z-index: 101; /* Ensure toggle button is always clickable */
}

.footer-toggle:hover {
    background: rgba(255, 68, 68, 0.3);
    color: #ffcccc;
}

.footer-toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

.site-footer.collapsed .footer-toggle-icon {
    transform: rotate(-90deg);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 20px;
}

.footer-section h3 {
    color: #ff4444;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.footer-section h4 {
    color: #ddd;
    font-size: 1em;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-section p {
    color: #999;
    line-height: 1.6;
    margin: 0;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: #aaa;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: #ff4444;
    text-decoration: underline;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: #888;
    font-size: 0.85em;
}

.footer-bottom p {
    margin: 0;
}

/* 18+ / Terms Consent Modal */
.consent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.consent-modal {
    width: 100%;
    max-width: 520px;
    background: rgba(25, 25, 25, 0.98);
    border: 2px solid rgba(255, 68, 68, 0.35);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.consent-modal h2 {
    margin: 0 0 10px 0;
    color: #ff4444;
    font-size: 1.4em;
}

.consent-text {
    color: #ccc;
    line-height: 1.6;
    margin: 0 0 14px 0;
}

.consent-modal a {
    color: #ff4444;
    text-decoration: underline;
}

.consent-modal a:hover {
    color: #ff6666;
}

.consent-modal a:focus-visible {
    outline: 2px solid rgba(255, 68, 68, 0.6);
    outline-offset: 2px;
    border-radius: 4px;
}

.consent-checkbox {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: #ddd;
    margin: 10px 0 16px 0;
}

.consent-checkbox input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: #ff4444;
}

.consent-actions {
    display: flex;
    gap: 10px;
}

.consent-accept,
.consent-decline {
    flex: 1;
    border: none;
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: bold;
    cursor: pointer;
}

.consent-accept {
    background: #ff4444;
    color: #000;
}

.consent-accept:disabled {
    background: #666;
    color: #222;
    cursor: not-allowed;
}

.consent-decline {
    background: rgba(255, 255, 255, 0.08);
    color: #ddd;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.consent-note {
    margin: 14px 0 0 0;
    color: #888;
    font-size: 0.9em;
}

.consent-visual-warning {
    margin: 10px 0 0 0;
    padding: 10px 12px;
    background: rgba(255, 140, 0, 0.10);
    border: 1px solid rgba(255, 140, 0, 0.25);
    border-radius: 8px;
    color: #ddd;
    font-size: 0.9em;
    line-height: 1.4;
}

.consent-visual-warning strong {
    color: #ffcc88;
}

/* Reduce Visual Intensity (comfort mode) */
body.reduce-visual .chat-container.border-rgb-chasing,
body.reduce-visual .chat-container.border-rgb-pulse,
body.reduce-visual .chat-container.border-rgb-rotate,
body.reduce-visual .chat-container.border-rgb-wave,
body.reduce-visual .chat-container.border-rgb-flicker,
body.reduce-visual #sidebar-toggle.border-rgb-chasing,
body.reduce-visual #sidebar-toggle.border-rgb-pulse,
body.reduce-visual #sidebar-toggle.border-rgb-rotate,
body.reduce-visual #sidebar-toggle.border-rgb-wave,
body.reduce-visual #sidebar-toggle.border-rgb-flicker,
body.reduce-visual #send-button.border-rgb-chasing,
body.reduce-visual #send-button.border-rgb-pulse,
body.reduce-visual #send-button.border-rgb-rotate,
body.reduce-visual #send-button.border-rgb-wave,
body.reduce-visual #send-button.border-rgb-flicker,
body.reduce-visual .logo-header.border-rgb-chasing .logo-image,
body.reduce-visual .logo-header.border-rgb-pulse .logo-image,
body.reduce-visual .logo-header.border-rgb-rotate .logo-image,
body.reduce-visual .logo-header.border-rgb-wave .logo-image,
body.reduce-visual .logo-header.border-rgb-flicker .logo-image {
    animation: none !important;
}

body.reduce-visual .chat-container {
    box-shadow: 0 0 10px rgba(255, 102, 0, 0.18), inset 0 0 10px rgba(255, 102, 0, 0.05) !important;
}

body.reduce-visual #user-input {
    box-shadow: 0 0 8px rgba(255, 102, 0, 0.18) !important;
}

body.reduce-visual #send-button,
body.reduce-visual #sidebar-toggle,
body.reduce-visual .stt-button {
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.25), 0 2px 6px rgba(0, 0, 0, 0.25) !important;
    text-shadow: none !important;
}

body.reduce-visual .logo-image {
    filter: drop-shadow(0 0 12px rgba(255, 68, 68, 0.18)) drop-shadow(0 0 24px rgba(255, 68, 68, 0.12)) !important;
}

body.reduce-visual .logo-header.border-rgb-solid .logo-image {
    filter: drop-shadow(0 0 12px var(--solid-border-color-glow-soft, rgba(255, 0, 255, 0.35)))
            drop-shadow(0 0 22px var(--solid-border-color-glow-soft, rgba(255, 0, 255, 0.25))) !important;
}

body.reduce-visual #sidebar-toggle.border-rgb-solid,
body.reduce-visual #send-button.border-rgb-solid {
    text-shadow: none !important;
    box-shadow: 0 0 10px var(--solid-border-color-glow-soft, rgba(255, 0, 255, 0.25)), 0 2px 6px rgba(0, 0, 0, 0.25) !important;
}

/* Adjust body to accommodate footer */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    /* Critical: don't force 100vh, or the footer (toggle bar) gets pushed off-screen */
    height: auto;
    min-height: 0;
}

/* Responsive footer */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .footer-section {
        text-align: center;
    }

    .footer-bottom {
        text-align: center;
        font-size: 0.8em;
    }

    /* On mobile, ensure footer doesn't cover content when collapsed */
    .site-footer.collapsed {
        max-height: 44px !important; /* Just enough for toggle button */
        height: 44px !important;
        overflow: hidden !important;
    }

    .site-footer.collapsed .footer-content,
    .site-footer.collapsed .footer-bottom {
        display: none !important; /* Force hide on mobile */
        visibility: hidden !important;
        height: 0 !important;
        max-height: 0 !important;
        opacity: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
    }

    /* Ensure toggle button is always visible and clickable */
    .footer-toggle {
        position: relative !important;
        z-index: 1000 !important;
        display: flex !important;
        visibility: visible !important;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Sidebar - overlay on mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        max-height: 100vh;
        z-index: 1000;
        width: 280px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
        overflow: hidden; /* Don't scroll sidebar itself, let content area scroll */
        display: flex;
        flex-direction: column;
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    /* Sidebar toggle positioning on mobile */
    .sidebar-toggle {
        top: 15px;
        left: 15px;
        padding: 8px 12px;
        font-size: 1.2em;
    }

    .app-container:has(.sidebar:not(.collapsed)) .sidebar-toggle,
    .app-container.sidebar-open .sidebar-toggle {
        left: 295px;
    }

    /* Overlay when sidebar is open */
    .app-container.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    /* Main content full width on mobile */
    .main-content {
        width: 100%;
        padding: 15px;
        margin-left: 0;
    }

    /* Header adjustments */
    .logo-header {
        padding: 12px;
        margin-bottom: 15px;
        top: 15px;
    }

    .logo-image {
        max-width: 350px;
    }

    .subtitle {
        font-size: 0.9em;
    }

    /* Chat area adjustments */
    .chat-container {
        padding: 10px;
    }

    .chat-messages {
        padding: 10px;
        font-size: 0.95em;
    }

    .message {
        max-width: 85%;
        padding: 10px 12px;
        margin-bottom: 12px;
        font-size: 0.95em;
        word-wrap: break-word;
    }

    /* Input area */
    .input-container {
        padding: 10px;
        gap: 8px;
    }

    .chat-input-container {
        padding: 10px;
        gap: 8px;
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
    }

    #user-input {
        flex: 1;
        min-width: 0; /* Allows flex item to shrink below content size */
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }

    #send-button {
        padding: 12px 16px;
        font-size: 0.9em;
        white-space: nowrap;
        flex-shrink: 0; /* Prevent button from shrinking */
    }

    .stt-button {
        flex-shrink: 0; /* Prevent mic button from shrinking */
        padding: 12px;
    }

    .message-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
        min-height: 50px;
    }

    .send-button {
        padding: 12px 20px;
        font-size: 1em;
        min-width: 70px;
    }

    /* Control buttons */
    .control-group {
        margin-bottom: 15px;
    }

    .control-group select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }

    .control-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 100px;
        padding: 12px;
    }

    /* Buttons - larger touch targets */
    button {
        min-height: 44px; /* iOS recommended touch target */
        padding: 12px 16px;
    }

    .new-roast-btn,
    .admin-btn,
    .admin-chat-btn,
    .games-btn,
    .arena-btn,
    .logout-btn {
        padding: 12px 16px;
        font-size: 1em;
        width: 100%;
    }

    /* Burn meter */
    .burn-meter {
        padding: 8px;
    }

    .burn-meter-label {
        font-size: 0.9em;
    }

    /* Status text */
    .status {
        font-size: 0.85em;
        padding: 8px;
    }

    /* Constraints info */
    .constraints-info {
        padding: 12px;
        font-size: 0.85em;
    }

    /* Sidebar header */
    .sidebar-header {
        padding: 15px;
    }

    .sidebar-header h2 {
        font-size: 1.1em;
    }

    .sidebar-content {
        padding: 15px;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding-bottom: 20px; /* Extra padding at bottom for scrolling */
    }
}

/* iOS Safari (mobile) specific tweaks */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .logo-header {
            top: -30px;
            padding-top: calc(12px + env(safe-area-inset-top, 0px));
        }

        .main-content {
            /* Mobile iOS: keep enough clearance for fixed logo + notch, without leaving a big dead zone */
            margin-top: 0 !important;
            padding-top: calc(138px + env(safe-area-inset-top, 0px)) !important;
        }

        .logo-image {
            max-height: 120px;
            object-fit: contain;
        }
    }
}

/* Smaller mobile devices */
@media (max-width: 480px) {
    h1 {
        font-size: 2em;
    }

    .sidebar {
        width: 260px;
    }

    .app-container:has(.sidebar:not(.collapsed)) .sidebar-toggle,
    .app-container.sidebar-open .sidebar-toggle {
        left: 275px;
    }

    .main-content {
        padding: 10px;
    }

    .message {
        max-width: 90%;
        font-size: 0.9em;
        padding: 8px 10px;
    }

    .input-container {
        padding: 8px;
    }

    .chat-input-container {
        padding: 8px;
        gap: 6px;
    }

    #user-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px;
    }

    #send-button {
        padding: 10px 14px;
        font-size: 0.85em;
    }

    .stt-button {
        padding: 10px;
    }

    .footer-content {
        padding: 0 10px;
    }
}