/* =============================================
   WEBWAIFU V2 - Professional Modern Styles
   ============================================= */

/* CSS Variables - Futuristic HUD Theme */
:root {
    /* Core Background */
    --bg-primary: #02030a;
    --bg-secondary: #070817;
    --bg-tertiary: #0e1024;
    --bg-elevated: #15172b;

    /* Text */
    --text-primary: #f9fafb;
    --text-secondary: #b4b9d9;
    --text-muted: #6b6f8f;

    /* Accents - Neon HUD */
    --accent-primary: #7c5cff;
    --accent-secondary: #4fd1ff;
    --accent-magenta: #ff4fd8;
    --accent-cyan: #22d3ee;
    --accent-hover: #a78bfa;
    --accent-soft: rgba(124, 92, 255, 0.18);
    --accent-gradient: linear-gradient(135deg, #7c5cff 0%, #4fd1ff 40%, #ff4fd8 100%);

    /* Status */
    --success: #22c55e;
    --warning: #fbbf24;
    --error: #f97373;
    --info: #38bdf8;

    /* Borders & Glows */
    --border-color: rgba(148, 163, 253, 0.18);
    --border-color-soft: rgba(148, 163, 253, 0.08);
    --border-color-hover: rgba(129, 140, 248, 0.45);
    --shadow-sm: 0 4px 10px rgba(15, 23, 42, 0.65);
    --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.9);
    --shadow-neon: 0 0 24px rgba(124, 92, 255, 0.45);
    --shadow-soft-neon: 0 0 14px rgba(79, 209, 255, 0.25);

    /* Radii & Layout */
    --sidebar-width: 420px;
    --header-height: 64px;
    --footer-height: 32px;
    --border-radius: 10px;
    --border-radius-lg: 16px;
    --border-radius-pill: 999px;

    /* Transitions */
    --transition-fast: 140ms ease-out;
    --transition-base: 220ms cubic-bezier(0.33, 0.02, 0.11, 0.99);
    --transition-slow: 360ms cubic-bezier(0.19, 0.09, 0.07, 1);

    /* Overlay / Lines */
    --hud-line-color: rgba(148, 163, 253, 0.18);
    --hud-grid-color: rgba(31, 41, 55, 0.9);

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', -system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

/* =============================================
   Reset & Base Styles
   ============================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

body {
    font-family: var(--font-sans);
    background:
        radial-gradient(circle at top, #050816 0%, #020817 40%, #00040a 100%);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle ambient glow — closer to Polaris style (no busy gradients) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% -10%, rgba(124, 92, 255, 0.22), transparent 65%),
        radial-gradient(circle at 80% -20%, rgba(56, 189, 248, 0.16), transparent 70%);
    opacity: 0.55;
    z-index: -2;
    pointer-events: none;
    mix-blend-mode: screen;
    animation: backgroundPulse 26s ease-in-out infinite;
}

@keyframes backgroundPulse {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-30px) scale(1.05);
        opacity: 1;
    }
}

code {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* =============================================
   Header
   ============================================= */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    padding: 0 26px;
    display: flex;
    align-items: center;
    z-index: 1000;
    background:
        linear-gradient(to bottom, rgba(3, 7, 18, 0.98), rgba(3, 7, 18, 0.92));
    backdrop-filter: blur(32px) saturate(220%);
    -webkit-backdrop-filter: blur(32px) saturate(220%);
    border-bottom: 1px solid rgba(148, 163, 253, 0.22);
    box-shadow:
        0 10px 40px rgba(2, 6, 23, 0.96),
        0 0 38px rgba(124, 92, 255, 0.26);
    animation: headerSlideDown 0.7s var(--transition-base);
}

@keyframes headerSlideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center; /* center title block */
    width: 100%;
    max-width: 1640px;
    margin: 0 auto;
    position: relative;
}

.app-title {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    text-align: center;
}

.title-glow {
    font-family: var(--font-sans);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(90deg, #7dd3fc 0%, #38bdf8 40%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.5));
    animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 30px rgba(118, 75, 162, 0.8));
    }
}

.title-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    color: var(--text-muted);
    text-transform: uppercase;
    opacity: 0.85;
}

.title-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.header-controls {
    position: absolute;
    inset: 0 26px 0 auto; /* lock to right padding, no horizontal influence on centering */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    pointer-events: none; /* prevent invisible box from affecting interactions */
}

.header-controls .control-btn {
    pointer-events: auto; /* keep the actual button clickable */
}

.control-btn {
    padding: 9px 14px;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.98));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: var(--border-radius-pill);
    border: 1px solid var(--border-color-soft);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow:
        0 4px 14px rgba(2, 6, 23, 0.9),
        inset 0 0 0 0 rgba(124, 92, 255, 0);
}

.control-btn:hover {
    color: var(--accent-secondary);
    border-color: var(--border-color-hover);
    background:
        radial-gradient(circle at top, rgba(17, 24, 39, 1), rgba(9, 9, 22, 0.98));
    transform: translateY(-1px);
    box-shadow:
        var(--shadow-sm),
        var(--shadow-soft-neon);
}

/* =============================================
   Canvas Container
   ============================================= */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

canvas {
    width: 100% !important;
    height: 100% !important;
    cursor: grab;
    display: block;
    filter: drop-shadow(0 26px 90px rgba(2, 6, 23, 1));
}

canvas:active {
    cursor: grabbing;
}

/* =============================================
   Speech Bubble Overlay
   ============================================= */
.speech-bubble-overlay {
    position: fixed;
    top: 18%;
    right: 40px;
    width: 420px;
    max-height: 480px;
    background: rgba(4, 7, 15, 0.98);
    backdrop-filter: blur(60px) saturate(200%);
    -webkit-backdrop-filter: blur(60px) saturate(200%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 50px rgba(99, 102, 241, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    z-index: 900;
    overflow: hidden;
    display: none;
    animation: bubbleFadeIn 0.5s ease-out;
}

.speech-bubble-overlay.show {
    display: block;
}

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

.speech-overlay-content {
    padding: 24px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.7;
    overflow-y: auto;
    max-height: 500px;
}

.ai-response-text {
    color: var(--text-primary);
    font-weight: 400;
    letter-spacing: 0.2px;
}

/* Custom Scrollbar */
.speech-overlay-content::-webkit-scrollbar {
    width: 8px;
}

.speech-overlay-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.speech-overlay-content::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}

.speech-overlay-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* =============================================
   Floating Chat Input
   ============================================= */
.floating-chat {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: min(900px, 94vw);
}

.chat-input-container {
    background: radial-gradient(circle at top, rgba(9, 9, 11, 0.98), rgba(2, 6, 23, 0.98));
    backdrop-filter: blur(32px) saturate(220%);
    -webkit-backdrop-filter: blur(32px) saturate(220%);
    border: 1px solid rgba(75, 85, 99, 0.9);
    border-radius: 20px;
    padding: 14px 14px 12px;
    box-shadow:
        0 18px 55px rgba(0, 0, 0, 0.9);
    animation: chatSlideUp 0.8s ease-out 0.3s backwards;
}

@keyframes chatSlideUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

#chatInput {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 16px;
    font-size: 15px;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
}

#chatInput::placeholder {
    color: var(--text-muted);
}

.voice-btn, .send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(99, 102, 241, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    flex-shrink: 0;
    font-size: 20px;
    position: relative;
    overflow: hidden;
}

.voice-btn::before, .send-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    z-index: -1;
    transition: all var(--transition-base);
}

.voice-btn {
    background: transparent;
    color: white;
}

.voice-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.6);
    border-color: rgba(99, 102, 241, 0.8);
}

.voice-btn:hover::before {
    filter: brightness(1.2);
}

.voice-btn.recording {
    animation: pulseGlow 1.5s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 40px rgba(239, 68, 68, 1);
    }
}

.send-btn {
    background: transparent;
    color: white;
}

.send-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.6);
    border-color: rgba(99, 102, 241, 0.8);
}

.send-btn:hover::before {
    filter: brightness(1.2);
}

.send-btn:active {
    transform: scale(0.95) rotate(15deg);
}

/* =============================================
   Settings Panel
   ============================================= */
.settings-panel {
    position: fixed;
    top: 0;
    right: calc(-1 * var(--sidebar-width)); /* fully off-screen when hidden */
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(20, 20, 31, 0.9);
    backdrop-filter: blur(40px) saturate(220%);
    -webkit-backdrop-filter: blur(40px) saturate(220%);
    border-left: 1px solid rgba(129, 140, 248, 0.28);
    box-shadow:
        -10px 0 40px rgba(2, 6, 23, 0.96),
        0 0 40px rgba(124, 92, 255, 0.24);
    transition: right var(--transition-slow);
    z-index: 1001;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.settings-panel.show {
    right: 0;
    animation: panelSlideIn 0.5s ease-out;
}

@keyframes panelSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.settings-header h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.close-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.settings-content {
    padding: 20px 24px;
    flex: 1;
}

/* =============================================
   Accordion Sections
   ============================================= */
.accordion-section {
    margin-bottom: 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: rgba(20, 20, 31, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all var(--transition-base);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.accordion-section:hover {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    background: rgba(20, 20, 31, 0.5);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all var(--transition-base);
    user-select: none;
}

.accordion-header:hover {
    background: var(--bg-elevated);
}

.accordion-header.active {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
}

.accordion-header span:first-child {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.accordion-icon {
    color: var(--text-muted);
    font-size: 12px;
    transition: transform var(--transition-base);
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow), padding var(--transition-slow);
    padding: 0 20px;
    background: var(--bg-secondary);
}

.accordion-content.expanded {
    max-height: 2000px;
    padding: 20px;
}

/* =============================================
   Form Controls
   ============================================= */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.control-group label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.1px;
}

.control-group input[type="text"],
.control-group input[type="password"],
.control-group input[type="number"],
.control-group textarea,
.control-group select {
    padding: 10px 14px;
    background: rgba(26, 26, 46, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-fast);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.control-group input::placeholder,
.control-group textarea::placeholder {
    color: var(--text-muted);
}

.control-group input:focus,
.control-group textarea:focus,
.control-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.control-group input:hover,
.control-group textarea:hover,
.control-group select:hover {
    border-color: var(--border-color-hover);
}

/* Range Sliders */
.control-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    border: 1px solid var(--border-color);
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-gradient);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent-gradient);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
}

.range-value {
    color: var(--accent-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

/* Checkboxes */
.control-group input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-tertiary);
    cursor: pointer;
    position: relative;
    margin-right: 10px;
    vertical-align: middle;
    transition: all var(--transition-fast);
}

.control-group input[type="checkbox"]:checked {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
}

.control-group input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.control-group input[type="checkbox"]:hover {
    border-color: var(--accent-primary);
}

/* Select Dropdowns */
.control-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23b4b4c8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.control-group select option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 10px;
}

/* Textarea */
.control-group textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

/* =============================================
   Buttons
   ============================================= */
.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--accent-gradient);
    color: white;
    border: 1px solid rgba(99, 102, 241, 0.5);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-base);
    width: 100%;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

.upload-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.upload-btn:hover::before {
    width: 300px;
    height: 300px;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
    border-color: rgba(99, 102, 241, 0.8);
}

.upload-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.upload-hint {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    margin-top: 8px;
}

.background-controls {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.background-controls .control-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.background-controls .control-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* =============================================
   Info Boxes
   ============================================= */
.tts-info {
    background: rgba(5, 7, 12, 0.98);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(31, 41, 55, 0.9);
    border-radius: var(--border-radius);
    padding: 14px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.6;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.tts-info p {
    margin: 0 0 6px 0;
    color: var(--text-secondary);
}

.tts-info p:last-child {
    margin-bottom: 0;
}

.tts-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* =============================================
   Status Indicator
   ============================================= */
.status-indicator {
    position: fixed;
    top: 84px;
    right: 24px;
    padding: 10px 14px;
    border-radius: var(--border-radius-lg);
    background:
        radial-gradient(circle at top, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.98));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(148, 163, 253, 0.28);
    color: var(--text-primary);
    z-index: 999;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    transition: all var(--transition-base);
    transform: translateX(320px);
    opacity: 0;
    box-shadow:
        0 14px 40px rgba(2, 6, 23, 0.96),
        0 0 22px rgba(79, 209, 255, 0.22);
}

.status-indicator.show {
    transform: translateX(0);
    opacity: 1;
    animation: statusGlow 2s ease-in-out infinite;
}

@keyframes statusGlow {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 40px rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 60px rgba(99, 102, 241, 0.5);
    }
}

.status-icon {
    font-size: 18px;
    line-height: 1;
}

.status-text {
    font-weight: 500;
    letter-spacing: -0.2px;
}

/* =============================================
   Loading Screen
   ============================================= */
.loading-screen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.loading-screen.show {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingText {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 16px;
}

/* =============================================
   Provider Config
   ============================================= */
.provider-config {
    margin-top: 16px;
    padding: 16px;
    background: rgba(20, 20, 31, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.provider-config.hidden {
    display: none;
}

/* =============================================
   Input with Eye Toggle
   ============================================= */
.input-with-eye {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-eye input {
    flex: 1;
    padding-right: 48px !important;
}

.eye-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.eye-btn:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* =============================================
   Footer
   ============================================= */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 24px 8px;
    z-index: 400;
    background:
        linear-gradient(to top, rgba(2, 6, 23, 0.98), rgba(2, 6, 23, 0.88));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(148, 163, 253, 0.18);
    pointer-events: none;
}

.credits {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.credits a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
    pointer-events: all;
}

.credits a:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

/* =============================================
   Scrollbar Styling
   ============================================= */
.settings-panel::-webkit-scrollbar {
    width: 8px;
}

.settings-panel::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.settings-panel::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}

.settings-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* =============================================
   Responsive Design
   ============================================= */
@media (max-width: 768px) {
    .app-header {
        padding: 0 16px;
    }
    
    .title-glow {
        font-size: 20px;
    }
    
    .title-sub {
        font-size: 9px;
    }
    
    .floating-chat {
        width: 95%;
        bottom: 24px;
    }
    
    .speech-bubble-overlay {
        right: 16px;
        width: calc(100% - 32px);
        max-width: 400px;
    }
    
    .settings-panel {
        width: 100%;
        right: -100%;
    }
    
    .settings-panel.show {
        right: 0;
    }
    
    #chatInput {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .voice-btn, .send-btn {
        width: 52px;
        height: 52px;
    }
}

/* =============================================
   Animations
   ============================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeIn 0.3s ease-out;
}

/* =============================================
   Model Selector
   ============================================= */
.model-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.model-selector select {
    flex: 1;
}

.refresh-btn {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 16px;
}

.refresh-btn:hover {
    background: var(--bg-elevated);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: rotate(90deg);
}

/* =============================================
   File Upload Container
   ============================================= */
.file-upload-container {
    text-align: center;
    padding: 20px 0;
}

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

/* =============================================
   Global Particle Effects (Subtle)
   ============================================= */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.03) 0%, transparent 3%),
        radial-gradient(circle at 90% 30%, rgba(139, 92, 246, 0.03) 0%, transparent 3%),
        radial-gradient(circle at 30% 80%, rgba(99, 102, 241, 0.03) 0%, transparent 3%),
        radial-gradient(circle at 70% 60%, rgba(139, 92, 246, 0.03) 0%, transparent 3%),
        radial-gradient(circle at 50% 40%, rgba(99, 102, 241, 0.03) 0%, transparent 3%);
    animation: particleGentleFloat 30s ease-in-out infinite;
}

/* Hide body::after overlay when Live2D is active */
body.live2d-active::after {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

@keyframes particleGentleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0.5;
    }
    25% {
        transform: translateY(-20px) translateX(10px);
        opacity: 0.7;
    }
    50% {
        transform: translateY(-10px) translateX(-10px);
        opacity: 0.6;
    }
    75% {
        transform: translateY(-30px) translateX(5px);
        opacity: 0.8;
    }
}

/* =============================================
   AI Splash Screen - Cyberpunk / Matrix Inspired
   ============================================= */
.ai-splash-screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    background:
        radial-gradient(circle at top, #020817 0%, #020812 40%, #000000 100%);
    backdrop-filter: blur(40px) saturate(260%);
    -webkit-backdrop-filter: blur(40px) saturate(260%);
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow: hidden;
}

/* Holographic light sweep - inspired by chaos mode but controlled */
.ai-splash-screen::before,
.ai-splash-screen::after {
    content: '';
    position: absolute;
    inset: -40%;
    background:
        linear-gradient(
            120deg,
            transparent 0%,
            rgba(34, 197, 94, 0.03) 24%,
            rgba(56, 189, 248, 0.06) 40%,
            rgba(124, 92, 255, 0.06) 55%,
            transparent 78%
        );
    mix-blend-mode: screen;
    opacity: 0.45;
    pointer-events: none;
    transform-origin: center;
    animation: splashSweep 18s linear infinite;
}

.ai-splash-screen::after {
    animation-delay: -9s;
    opacity: 0.32;
}

@keyframes splashSweep {
    0% { transform: translate3d(-3%, -1%, 0) rotate(0.6deg); }
    50% { transform: translate3d(2%, 3%, 0) rotate(-0.4deg); }
    100% { transform: translate3d(-3%, -1%, 0) rotate(0.6deg); }
}

/* Holographic diagonal beams */
.ai-splash-screen::before,
.ai-splash-screen::after {
    content: '';
    position: absolute;
    inset: -40%;
    background:
        linear-gradient(
            120deg,
            transparent 0%,
            rgba(56, 189, 248, 0.035) 25%,
            rgba(124, 92, 255, 0.06) 40%,
            transparent 65%
        );
    mix-blend-mode: screen;
    opacity: 0.7;
    pointer-events: none;
    transform-origin: center;
    animation: splashSweep 18s linear infinite;
}

.ai-splash-screen::after {
    animation-delay: -9s;
    opacity: 0.5;
}

@keyframes splashSweep {
    0% { transform: translate3d(-4%, -2%, 0) rotate(0.5deg); }
    50% { transform: translate3d(2%, 3%, 0) rotate(-0.5deg); }
    100% { transform: translate3d(-4%, -2%, 0) rotate(0.5deg); }
}

.ai-splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}

/* Remove any frame-within-frame feel: no visible borders or hard edges */
.splash-orbit,
.splash-scanline {
    display: none !important;
}

.splash-particles {
    position: absolute;
    inset: -20%;
    background-image:
        radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.16) 0%, transparent 55%),
        radial-gradient(circle at 85% 20%, rgba(129, 140, 248, 0.18) 0%, transparent 55%),
        radial-gradient(circle at 20% 85%, rgba(22, 163, 74, 0.10) 0%, transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.12) 0%, transparent 60%);
    opacity: 0.65;
    mix-blend-mode: screen;
    animation: particleFloat 24s ease-in-out infinite;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-30px) scale(1.05);
        opacity: 0.8;
    }
}

.splash-orbit,
.splash-scanline {
    position: absolute;
    inset: 12%;
    border-radius: 28px;
    border: 1px solid rgba(148, 163, 253, 0.16);
    box-shadow: 0 0 30px rgba(15, 23, 42, 0.9);
    pointer-events: none;
}

.splash-scanline {
    inset: 18%;
    border-radius: 22px;
    border-color: rgba(79, 209, 255, 0.14);
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(148, 163, 253, 0.02) 0,
        rgba(148, 163, 253, 0.02) 1px,
        transparent 1px,
        transparent 3px
    );
    mix-blend-mode: screen;
    opacity: 0.3;
    animation: scanlineDrift 8s linear infinite;
}

@keyframes scanlineDrift {
    0% { transform: translateY(0); opacity: 0.16; }
    50% { transform: translateY(10px); opacity: 0.27; }
    100% { transform: translateY(0); opacity: 0.16; }
}

.splash-content {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12px;
}

/* Logo Section */
.splash-logo {
    margin-bottom: 12px;
    animation: fadeInDown 0.7s ease-out;
    text-align: center;
}

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

.logo-kicker {
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.92;
    margin-bottom: 4px;
    font-family: var(--font-mono);
}

.logo-text {
    font-family: var(--font-sans);
    font-size: 42px;
    font-weight: 900;
    letter-spacing: -0.08em;
    background: linear-gradient(90deg, #22c55e 0%, #38bdf8 40%, #6366f1 75%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    text-shadow:
        0 0 26px rgba(56, 189, 248, 0.65),
        0 0 42px rgba(15, 23, 42, 0.9);
}

.logo-sub {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.logo-version {
    font-size: 11px;
    font-weight: 400;
    color: var(--accent-secondary);
    font-family: var(--font-mono);
    opacity: 0.9;
}

/* Models Section */
.splash-models {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    margin-top: 4px;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.model-item {
    background: radial-gradient(circle at top, rgba(3, 7, 18, 0.98), rgba(2, 6, 23, 0.98));
    backdrop-filter: blur(22px);
    border: 1px solid rgba(31, 41, 55, 0.95);
    border-radius: var(--border-radius-lg);
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 40px 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px 12px;
    align-items: center;
    transition: all var(--transition-base);
}

.model-item:hover {
    background: radial-gradient(circle at top, rgba(9, 9, 11, 1), rgba(2, 6, 23, 1));
    border-color: rgba(99, 102, 241, 0.9);
    transform: translateY(-2px);
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.98),
        0 0 24px rgba(56, 189, 248, 0.32);
}

.model-item.loading {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.model-item.loaded {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.model-item.error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}

.model-icon {
    grid-row: 1 / 3;
    font-size: 26px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.model-info {
    grid-column: 2;
    text-align: left;
}

.model-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.model-desc {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.model-status {
    grid-column: 3;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-icon {
    font-size: 20px;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.95);
    }
}

.model-item.loading .status-icon {
    animation: spin 2s linear infinite;
}

.model-item.loaded .status-icon {
    animation: checkBounce 0.6s ease-out;
}

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

.status-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.model-item.loading .status-text {
    color: var(--accent-primary);
}

.model-item.loaded .status-text {
    color: var(--success);
}

.model-item.error .status-text {
    color: var(--error);
}

.model-progress {
    grid-column: 2 / 4;
    width: 100%;
}

.progress-bar-mini {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-fill-mini {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.model-item.loaded .progress-fill-mini {
    background: linear-gradient(90deg, var(--success), #059669);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.model-item.error .progress-fill-mini {
    background: var(--error);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

/* Actions Section */
.splash-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    margin-top: 2px;
    animation: fadeInUp 0.8s ease-out 0.35s backwards;
}

.splash-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-sans);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-direction: column;
}

.load-all-btn {
    background: var(--accent-gradient);
    color: #0b1020;
    border: 1px solid transparent;
    box-shadow:
        0 10px 30px rgba(124, 92, 255, 0.5),
        0 0 25px rgba(79, 209, 255, 0.4);
}

.load-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
}

.load-all-btn:active {
    transform: translateY(0);
}

.load-all-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.splash-btn-sub {
    font-size: 8px;
    font-weight: 400;
    opacity: 0.75;
    letter-spacing: 0.05em;
    text-transform: none;
    line-height: 1.3;
    max-width: 200px;
}

/* Footer Section */
.splash-footer {
    animation: fadeInUp 0.8s ease-out 0.45s backwards;
}

.splash-tip {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
    line-height: 1.4;
}

.splash-size {
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.splash-warning {
    font-size: 10px !important;
    padding: 6px 10px !important;
    line-height: 1.3 !important;
}

/* Responsive for Splash Screen */
@media (max-width: 768px) {
    .splash-content {
        width: 100%;
        max-width: 100%;
        padding: 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .logo-text {
        font-size: 36px;
    }

    .logo-kicker {
        font-size: 9px;
    }

    .logo-sub {
        font-size: 11px;
        letter-spacing: 2px;
    }

    .model-item {
        padding: 12px;
        grid-template-columns: 36px 1fr;
        gap: 10px;
    }

    .model-icon {
        font-size: 22px;
        width: 36px;
        height: 36px;
    }

    .model-status {
        grid-column: 2;
        grid-row: 2;
        justify-self: start;
    }

    .model-progress {
        grid-column: 1 / 3;
        grid-row: 3;
    }

    .splash-actions {
        flex-direction: column;
    }

    .load-all-btn {
        padding: 14px 20px;
        font-size: 11px;
        min-height: 56px;
        touch-action: manipulation;
    }

    .splash-tip {
        font-size: 10px;
    }

    .splash-size {
        font-size: 9px;
    }

    /* Mobile status indicator */
    .status-indicator {
        top: 74px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    /* Mobile speech bubble */
    .speech-bubble-overlay {
        top: 80px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: 50vh;
    }

    /* Touch-friendly controls */
    .control-btn {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }

    /* Prevent zoom on input focus for iOS */
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* =============================================
   Live Subtitles
   ============================================= */
.live-subtitles {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 900px;
    z-index: 950;
    pointer-events: none;
    display: none;
}

.live-subtitles.show {
    display: block;
    animation: subtitleFadeIn 0.3s ease-out;
}

@keyframes subtitleFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.subtitle-text {
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--border-radius-lg);
    padding: 16px 24px;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.6;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 50px rgba(99, 102, 241, 0.3);
    letter-spacing: 0.3px;
}

@media (max-width: 768px) {
    .live-subtitles {
        bottom: 120px;
        width: 95%;
    }

    .subtitle-text {
        font-size: 16px;
        padding: 14px 20px;
    }
}

/* =============================================
   Extra Sexy HUD / Header Enhancements
   ============================================= */

.header-glow-bar {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.12), transparent 60%),
        radial-gradient(circle at 100% 0%, rgba(244, 114, 182, 0.08), transparent 70%);
    opacity: 0.7;
    mix-blend-mode: screen;
    z-index: -1;
}

.title-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 4px;
    color: var(--accent-secondary);
    text-transform: uppercase;
    opacity: 0.85;
}

.title-sub {
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 8px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    background: rgba(20, 20, 31, 0.9);
    border: 1px solid rgba(129, 140, 248, 0.5);
    color: var(--accent-secondary);
    box-shadow: 0 0 14px rgba(129, 140, 248, 0.4);
}

.neon-icon {
    background: radial-gradient(circle at 30% 0%, rgba(248, 250, 252, 0.09), transparent 70%);
    box-shadow: 0 0 18px rgba(129, 140, 248, 0.5);
}

.neon-icon:hover {
    box-shadow: 0 0 26px rgba(129, 140, 248, 0.9);
}

/* Hero HUD */
.hero-hud {
    position: fixed;
    top: calc(var(--header-height) + 8px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    padding: 6px 14px;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.96), rgba(9, 9, 16, 0.98));
    border-radius: 999px;
    border: 1px solid rgba(129, 140, 248, 0.35);
    box-shadow:
        0 10px 40px rgba(15, 23, 42, 0.9),
        0 0 30px rgba(79, 70, 229, 0.35);
    z-index: 950;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: var(--text-muted);
    backdrop-filter: blur(26px) saturate(220%);
    -webkit-backdrop-filter: blur(26px) saturate(220%);
}

.hud-pill {
    padding: 4px 10px 5px;
    border-radius: 999px;
    border: 1px solid rgba(75, 85, 99, 0.8);
    background: rgba(10, 10, 15, 0.9);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.hud-pill-accent {
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.6);
}

.hud-pill-soft {
    border-style: dashed;
    opacity: 0.9;
}

/* Floating Chat + Hints */
.glassy {
    background: radial-gradient(circle at top left, rgba(129, 140, 248, 0.18), rgba(10, 10, 15, 0.94));
}

.chat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin: 0 4px 4px;
}

.chat-label-strong {
    color: var(--accent-secondary);
    font-weight: 600;
}

.dot-live {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.9);
    animation: dotPulse 1.4s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }
}

.chat-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.9;
}

.chat-hints span {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(75, 85, 99, 0.7);
    background: rgba(6, 8, 16, 0.96);
}

/* Status indicator: richer look */
.status-indicator {
    align-items: flex-start;
    padding: 10px 14px 10px 12px;
}

.status-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.status-sub {
    font-size: 10px;
    color: var(--text-muted);
}

/* Mobile tweaks for new elements */
@media (max-width: 768px) {
    .hero-hud {
        top: calc(var(--header-height) + 4px);
        gap: 6px;
        padding: 4px 10px;
        font-size: 7.5px;
        width: auto;
/* =============================================
   Sage Console - Matrix-inspired Prompt Bar
   ============================================= */

.sage-console {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sage-console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 4px 0;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-muted);
    opacity: 0.9;
}

.sage-label {
    font-family: var(--font-mono);
    color: var(--accent-secondary);
}

.sage-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 8px;
    color: var(--accent-cyan);
}

.sage-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.9);
    animation: sageDotPulse 1.6s ease-in-out infinite;
}

@keyframes sageDotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

.sage-matrix-bar {
    margin: 2px 4px 6px;
    padding: 4px 8px;
    border-radius: 10px;
    background: radial-gradient(circle at top, rgba(6, 8, 16, 0.98), rgba(2, 6, 23, 0.98));
    border: 1px solid rgba(31, 41, 55, 0.9);
    display: flex;
    gap: 6px;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 8px;
    color: rgba(148, 163, 253, 0.35);
    opacity: 0.9;
    position: relative;
}

.sage-matrix-bar span {
    white-space: nowrap;
    animation: sageScroll 9s linear infinite;
}

@keyframes sageScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-40%); }
}

/* Respect reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .sage-matrix-bar span,
    .sage-dot {
        animation: none;
    }
}
        max-width: 96%;
        overflow-x: auto;
    }

    .chat-hints {
        font-size: 8px;
        gap: 6px;
    }
}
