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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

:root {
    --primary: #E6BE8A;
    /* Premium Champagne Gold */
    --primary-glow: rgba(230, 190, 138, 0.3);
    --secondary: #6366f1;
    /* Indigo accents */
    --bg-dark: #020617;
    /* Deepest Indigo */
    --bg-surface: rgba(15, 23, 42, 0.6);
    --bg-accent: rgba(30, 41, 59, 0.7);
    --text-white: #f8fafc;
    --text-gray: #94a3b8;
    --text-muted: #64748b;
    --header-height: 70px;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
}


html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
}

/* Background Animation Wrapper */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 110%;
    height: 110%;
    z-index: -2;
    background: url('/static/ethereal_aurora_bg.png') no-repeat center center;
    background-size: cover;
    filter: brightness(0.6) saturate(1.2) blur(2px);
    animation: auroraShift 40s ease-in-out infinite alternate;
}

@keyframes auroraShift {
    0% {
        transform: scale(1) translate(0, 0) rotate(0deg);
    }

    50% {
        transform: scale(1.1) translate(-2%, -1%) rotate(1deg);
    }

    100% {
        transform: scale(1) translate(1%, 2%) rotate(-1deg);
    }
}

.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, rgba(2, 6, 23, 0.4), var(--bg-dark));
}

@keyframes kenburns {
    0% {
        transform: scale(1) translate(0, 0);
    }

    50% {
        transform: scale(1.1) translate(-2%, 1%);
    }

    100% {
        transform: scale(1) translate(2%, -1%);
    }
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for mobile */
    display: flex;
    flex-direction: column;
    /* Removed background on container to let body show through */
    background: transparent;
    /* backdrop-filter: blur(5px); Moved to overlay */
    max-width: 100%;
    /* Make it full width always */
    border: none;
    position: relative;
}

/* Removed media query since base style is now full width */

.chat-header {
    flex-shrink: 0;
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -2px;
    text-shadow: 0 0 20px var(--primary-glow);
}

/* Theme Variations */
body.theme-midnight-neon {
    --primary: #00f2ff;
    /* Cyan */
    --primary-glow: rgba(0, 242, 255, 0.4);
    --bg-dark: #0a0a0f;
    --bg-animation-url: url('/static/neon_city.png');
}

body.theme-calm-forest {
    --primary: #94fbab;
    /* Mint Green */
    --primary-glow: rgba(148, 251, 171, 0.4);
    --bg-dark: #06140a;
    --bg-animation-url: url('/static/forest_aurora.png');
}

body.theme-ocean-breeze {
    --primary: #85d7ff;
    /* Sky Blue */
    --primary-glow: rgba(133, 215, 255, 0.4);
    --bg-dark: #020c1b;
    --bg-animation-url: url('/static/ocean_deep.png');
}

body.theme-sunset-rose {
    --primary: #ff85a1;
    /* Pink/Rose */
    --primary-glow: rgba(255, 133, 161, 0.4);
    --bg-dark: #1a0a0f;
    --bg-animation-url: url('/static/sunset_aurora.png');
}

/* Base background handling for dynamic images */
.bg-animation {
    background-image: var(--bg-animation-url, url('/static/ethereal_aurora_bg.png'));
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.settings-toggle-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
}

.settings-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.logout-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    padding: 5px;
}

.logout-link:hover {
    color: var(--primary);
}

/* Chat Area */
.chat-messages {
    flex: 1;
    padding: 20px 15px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-accent) transparent;
    -webkit-overflow-scrolling: touch;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--bg-accent);
    border-radius: 10px;
}

.welcome-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 60px 30px;
    height: 100%;
}

.welcome-glass {
    padding: 3rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 32px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: slideUpFade 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo-image {
    width: 140px;
    height: auto;
    margin: 0 auto 2rem;
    filter: drop-shadow(0 0 15px rgba(230, 190, 138, 0.3));
    animation: float 4s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes slideUpFade {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.welcome-title {
    font-size: clamp(2rem, 10vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(to right, #ffffff, #D4AF37, #ffffff);
    background-size: 200% auto;
    color: #fff;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
    letter-spacing: -1px;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.welcome-subtitle {
    color: var(--text-muted);
    font-size: clamp(1rem, 4vw, 1.2rem);
    max-width: 500px;
    line-height: 1.6;
    opacity: 0.8;
}

/* Message Bubbles */
.message {
    max-width: 85%;
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    animation: messageEnter 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    word-wrap: break-word;
    opacity: 0;
    /* Start invisible for animation */
}

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), #D4AF37);
    color: #000;
    font-weight: 500;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(230, 190, 138, 0.2);
    border: none;
}

.eq-message {
    align-self: flex-start;
    color: var(--text-white);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin-left: 10px;
}

.eq-message strong {
    color: var(--primary);
    font-weight: 600;
}

.eq-message img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.eq-message pre {
    background: #0d0d0d;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 8px;
    color: #00ff41;
    /* Hacker terminal green for code */
}

.user-message {
    position: relative;
    padding-right: 35px;
    /* Make space for edit button */
}

.edit-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    padding: 5px;
}

.user-message:hover .edit-btn {
    opacity: 1;
}

.edit-btn:hover {
    color: var(--primary);
}

/* Edit Mode Styles */
.edit-container {
    width: 100%;
}

.edit-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    padding: 8px;
    font-size: 0.95rem;
    resize: none;
    outline: none;
    font-family: inherit;
    margin-bottom: 8px;
}

.edit-textarea:focus {
    border-color: var(--primary);
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.edit-actions button {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    font-weight: 500;
}

.save-btn {
    background: var(--primary);
    color: black;
}

.cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageEnter {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Typing Indicator */
.typing-indicator {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 10px 0;
    animation: fadeIn 0.3s ease;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Area */
.chat-input-area {
    flex-shrink: 0;
    padding: 20px 25px;
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-top: 1px solid var(--glass-border);
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1000;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.04);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    flex: 1;
}

.input-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px var(--primary-glow);
    border-color: var(--primary);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 1rem;
    padding: 8px 5px;
    outline: none;
    transition: all 0.3s ease;
}

.chat-input:focus {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.chat-input::placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: opacity 0.3s ease;
}

.chat-input:focus::placeholder {
    opacity: 0.4;
}

.action-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.action-button:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.05);
}

.action-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.send-button {
    background: var(--primary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.send-button:hover {
    transform: scale(1.1) rotate(-8deg);
    filter: brightness(1.1);
}

.send-button:active {
    transform: scale(0.9);
}

.send-button svg {
    width: 18px;
    height: 18px;
    fill: #000;
    margin-left: 2px;
    /* Visual centering */
}

/* File Indicator */
.file-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--primary);
}

.file-indicator.active {
    display: flex;
}

/* Voice Overlay */
.voice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.voice-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.voice-status {
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 40px;
    color: var(--text-white);
    letter-spacing: 1px;
}

.voice-visualizer {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 60px;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.voice-visualizer svg {
    width: 40px;
    height: 40px;
    fill: #000;
    transition: opacity 0.2s;
    z-index: 2;
}

.voice-visualizer.speaking {
    background: transparent;
    box-shadow: none;
}

.voice-visualizer.muted {
    background: transparent;
    border: 2px solid #ff4444;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.2);
    opacity: 0.5;
}

.voice-visualizer.muted svg {
    fill: #ff4444;
}

/* Waveform Bars */
.waveform-container {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 60px;
    width: 100%;
    position: absolute;
}

.voice-visualizer.speaking .waveform-container {
    display: flex;
}

.waveform-bar {
    width: 8px;
    background: var(--primary);
    border-radius: 4px;
    animation: waveform 0.6s infinite ease-in-out;
}

.waveform-bar:nth-child(1) {
    height: 20px;
    animation-delay: 0.0s;
}

.waveform-bar:nth-child(2) {
    height: 40px;
    animation-delay: 0.1s;
}

.waveform-bar:nth-child(3) {
    height: 60px;
    animation-delay: 0.2s;
}

.waveform-bar:nth-child(4) {
    height: 40px;
    animation-delay: 0.3s;
}

.waveform-bar:nth-child(5) {
    height: 20px;
    animation-delay: 0.4s;
}

@keyframes waveform {

    0%,
    100% {
        height: 10px;
        opacity: 0.5;
    }

    50% {
        height: 50px;
        opacity: 1;
    }
}

/* Mic Interaction */
#micBtn:not(.recording):hover {
    animation: pulse-mic-idle 2s infinite ease-in-out;
    color: var(--primary);
}

@keyframes pulse-mic-idle {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

.close-voice-btn {
    position: absolute;
    bottom: 40px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    color: var(--text-white);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.close-voice-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Voice Settings Panel */
.voice-settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
}

.mute-voice-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.2s;
}

.mute-voice-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-white);
}

.mute-voice-btn.muted {
    background-color: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
    color: #ff4444;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
    }
}

.voice-settings-panel {
    position: absolute;
    top: 60px;
    right: 20px;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    width: 250px;
    display: none;
    flex-direction: column;
    gap: 10px;
    z-index: 1001;
}

.voice-settings-panel.active {
    display: flex;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-header span {
    font-weight: 600;
    color: var(--primary);
}

.settings-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.settings-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.voice-settings-panel select,
.voice-settings-panel input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 5px;
    border-radius: 4px;
}

.test-voice-btn {
    background: var(--primary);
    border: none;
    padding: 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
    margin-top: 5px;
    color: black;
}

/* Pulse Gold for Overlay Idle */
@keyframes pulse-gold {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 20px rgba(212, 175, 55, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
    }
}

/* Enhanced Mobile UI */

.voice-call-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
    gap: 5px;
    flex-shrink: 0;
}

.voice-call-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--text-gray);
    position: relative;
    overflow: hidden;
}

.voice-call-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.voice-call-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

.voice-call-btn:hover::after {
    opacity: 1;
}

.voice-call-btn svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    z-index: 1;
}

.voice-call-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
}

/* Mobile Touch Targets */
@media (max-width: 600px) {
    .action-button {
        padding: 10px;
        /* Bigger target */
    }

    .chat-input-area {
        padding: 10px 15px;
        padding-bottom: max(15px, env(safe-area-inset-bottom));
        gap: 10px;
        flex-wrap: nowrap;
        /* Prevent wrapping */
    }

    .input-wrapper {
        padding: 8px 12px;
        min-width: 0;
        flex: 1;
        /* Ensure it takes available space */
    }

    .voice-call-wrapper {
        margin: 0;
        margin-left: 5px;
        display: flex;
        align-items: center;
        width: auto;
        min-width: 44px;
        /* Slightly smaller min-width */
        flex-shrink: 0;
    }

    .voice-call-btn {
        width: 50px;
        height: 50px;
        margin-bottom: 0;
    }

    .voice-call-btn svg {
        width: 24px;
        height: 24px;
    }

}

/* End Mobile Touch Targets */

/* Responsive Design & Device Suitability */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .chat-header {
        padding: 0 15px;
    }

    .logo-text {
        font-size: 1.4rem;
    }

    .message {
        max-width: 90%;
        font-size: 0.9rem;
    }

    .welcome-glass {
        padding: 2rem 1.5rem;
        margin: 0 15px;
        border-radius: 24px;
    }

    .welcome-title {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
    }
}

@media (max-width: 600px) {
    .header-actions {
        gap: 10px;
    }

    .logout-link {
        font-size: 0.75rem;
    }

    .main-call-btn {
        width: 90%;
        max-width: 320px;
        padding: 12px 20px;
        font-size: 1rem;
    }

    .fab-call-btn {
        bottom: 100px;
        right: 15px;
        width: 50px;
        height: 50px;
    }

    .fab-call-btn svg {
        width: 22px;
        height: 22px;
    }

    .chat-input-area {
        padding: 8px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        gap: 8px;
    }

    .input-wrapper {
        padding: 6px 14px;
        border-radius: 24px;
    }

    .chat-input {
        font-size: 0.95rem;
    }

    .send-button {
        width: 40px;
        height: 40px;
    }

    .action-button {
        padding: 8px;
    }

    .voice-call-btn {
        width: 44px;
        height: 44px;
    }

    /* Fixed voice settings for mobile */
    .voice-settings-panel {
        position: fixed;
        bottom: 80px;
        top: auto;
        left: 10px;
        right: 10px;
        width: auto;
        transform: translateY(20px);
        opacity: 0;
        visibility: hidden;
        z-index: 1001;
        /* Above input area */
    }

    .voice-settings-panel.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    /* Mobile: Always show edit button since hover doesn't exist */
    .edit-btn {
        opacity: 0.8 !important;
        padding: 8px;
        right: 5px;
    }

    .user-message {
        padding-right: 35px;
    }

    .voice-status {
        font-size: 1.2rem;
    }

    .waveform-container {
        gap: 4px;
    }

    .waveform-bar {
        width: 4px;
        height: 20px;
    }
}

@media (max-width: 400px) {
    .logo-text {
        font-size: 1.2rem;
        letter-spacing: -1px;
    }

    .welcome-title {
        font-size: 2rem;
    }

    .message {
        max-width: 95%;
        padding: 10px 10px;
    }

    .chat-input-area {
        padding: 6px 8px;
    }
}

/* Touch Device Fixes */
@media (hover: none) {
    .action-button:hover {
        background: none;
    }

    .send-button:hover {
        transform: none;
    }
}

/* Personality Onboarding & Preferences Styles */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.onboarding-overlay.active {
    display: flex;
    animation: fadeIn 0.5s ease;
}

.onboarding-card {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.onboarding-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
}

.onboarding-subtitle {
    font-size: 0.9rem;
    color: var(--text-gray);
    text-align: center;
    margin-top: -10px;
}

.pref-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pref-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-white);
}

.pref-textarea {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    color: white;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
}

.pref-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    color: white;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.pref-select option {
    background: #111;
    color: white;
}

.pref-button {
    background: var(--primary);
    color: black;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.pref-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Update Settings Panel to be taller if needed */
.voice-settings-panel {
    width: 280px;
    max-height: 80vh;
    overflow-y: auto;
}

.settings-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 10px 0;
}