* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --bg-gradient: linear-gradient(135deg, #1e1e2e 0%, #2d2d44 100%);
    --message-user: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --message-ai: #2a2a3e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding: env(safe-area-inset-top, 20px) env(safe-area-inset-right, 20px) env(safe-area-inset-bottom, 20px) env(safe-area-inset-left, 20px);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Login Screen Styles */
.login-container {
    width: 100%;
    max-width: 450px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    width: 100%;
    background: rgba(30, 30, 46, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 48px;
    animation: fadeIn 0.6s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header svg {
    margin-bottom: 24px;
}

.login-header h1 {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 15px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.input-group label {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.input-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.input-group input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group input::placeholder {
    color: var(--text-secondary);
}

.login-button {
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    padding: 14px 24px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    color: #f5576c;
    font-size: 14px;
    text-align: center;
    min-height: 20px;
    animation: slideIn 0.3s ease-out;
}

.login-footer {
    margin-top: 32px;
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 13px;
}

.container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    height: 90dvh;
    background: rgba(30, 30, 46, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-x: hidden;
}

/* Header Styles */
.chat-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo h1 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
}

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

.status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-chat-button,
.logout-button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.clear-chat-button:hover {
    background: rgba(245, 87, 108, 0.1);
    border-color: rgba(245, 87, 108, 0.3);
    color: #f5576c;
    transform: translateY(-2px);
}

.logout-button:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
    color: #667eea;
    transform: translateY(-2px);
}

.clear-chat-button:active,
.logout-button:active {
    transform: translateY(0);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    scroll-behavior: smooth;
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
    animation: fadeIn 0.6s ease-out;
}

.welcome-icon {
    margin-bottom: 20px;
}

.welcome-icon img {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.welcome-message h2 {
    color: var(--text-primary);
    font-size: 32px;
    margin-bottom: 12px;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Message Styles */
.message {
    display: flex;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease-out;
}

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

.message.user {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
}

.message.user .message-content {
    background: var(--message-user);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}

.message.ai .message-content {
    background: var(--message-ai);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.mode-badge {
    display: inline-block;
    font-size: 12px;
    margin-right: 8px;
    opacity: 0.8;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Container */
.input-container {
    padding: 20px 30px 30px;
    padding-bottom: max(30px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border-color);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Uploaded Images Preview */
.uploaded-images {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    padding: 0;
    max-width: 100%;
    overflow-x: auto;
}

.image-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview .remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(245, 87, 108, 0.9);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
}

.image-preview .remove-image:hover {
    background: rgba(245, 87, 108, 1);
    transform: scale(1.1);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.mode-selector {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    flex-shrink: 0;
}

.mode-selector:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #667eea;
}

.mode-selector:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.mode-selector option {
    background: #2a2a3e;
    color: var(--text-primary);
    padding: 8px;
}

.upload-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    color: var(--text-primary);
}

.upload-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #667eea;
    transform: translateY(-2px);
}

.upload-button:active {
    transform: translateY(0);
}

#userInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
}

#userInput::placeholder {
    color: var(--text-secondary);
}

.send-button {
    background: var(--primary-gradient);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-button:active {
    transform: translateY(0);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .container {
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        max-width: 100%;
        width: 100%;
    }

    .chat-header {
        padding: 16px 20px;
        padding-top: max(16px, env(safe-area-inset-top));
    }

    .logo h1 {
        font-size: 20px;
    }

    .chat-container {
        padding: 15px;
    }

    .message-content {
        max-width: 85%;
    }

    .welcome-message {
        padding: 40px 20px;
    }

    .welcome-icon img {
        width: 100px;
        height: 100px;
    }

    .welcome-message h2 {
        font-size: 24px;
    }
    
    .input-container {
        padding: 15px 15px 25px;
        padding-bottom: max(25px, env(safe-area-inset-bottom));
    }
    
    .input-wrapper {
        padding: 10px 14px;
        gap: 10px;
    }
}

/* Small mobile devices */
@media (max-width: 400px) {
    .chat-header {
        padding: 12px 15px;
        padding-top: max(12px, env(safe-area-inset-top));
    }
    
    .logo h1 {
        font-size: 18px;
    }
    
    .chat-container {
        padding: 10px;
    }
    
    .message-content {
        max-width: 95%;
        font-size: 14px;
    }
    
    /* Audio messages full width on small screens */
    .audio-message {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .input-container {
        padding: 12px 12px 20px;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
    
    .input-wrapper {
        padding: 10px 12px;
        gap: 8px;
    }
    
    #userInput {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .send-button,
    .upload-button {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
}

/* ============================================
   Curved Arc Navigation Menu
   ============================================ */

.arc-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.arc-menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.arc-menu-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.arc-menu-overlay.active .arc-menu-backdrop {
    opacity: 1;
}

.arc-menu-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    overflow-x: hidden;
    overflow-y: auto;
}

.arc-menu-shape {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--arc-size, 450px);
    height: var(--arc-size, 450px);
    max-width: 100vw;
    max-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 0 100% 0;
    transform: scale(0);
    transform-origin: top left;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4);
    overflow: hidden;
}

.arc-menu-overlay.active .arc-menu-shape {
    transform: scale(1);
}

.arc-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 10;
}

.arc-menu-close:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.arc-menu-close:active {
    transform: scale(0.95);
}

.arc-menu-items {
    position: absolute;
    top: 150px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.arc-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 30px;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateX(-30px);
}

.arc-menu-overlay.active .arc-menu-item {
    opacity: 1;
    transform: translateX(0);
}

.arc-menu-overlay.active .arc-menu-item:nth-child(1) {
    transition-delay: 0.15s;
}

.arc-menu-overlay.active .arc-menu-item:nth-child(2) {
    transition-delay: 0.2s;
}

.arc-menu-overlay.active .arc-menu-item:nth-child(3) {
    transition-delay: 0.25s;
}

.arc-menu-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.arc-menu-item.active {
    background: rgba(255, 255, 255, 0.2);
}

.arc-menu-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.arc-menu-item:hover .arc-menu-icon {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.arc-menu-label {
    color: white;
    font-size: 16px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

/* Voice Menu Group with Submenu */
.arc-menu-group {
    display: flex;
    flex-direction: column;
}

.arc-menu-parent {
    position: relative;
}

.arc-menu-chevron {
    margin-left: auto;
    transition: transform 0.3s ease;
    opacity: 0.8;
}

.arc-menu-group.expanded .arc-menu-chevron {
    transform: rotate(180deg);
}

.arc-submenu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding-left: 62px;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.arc-menu-group.expanded .arc-submenu {
    max-height: 150px;
    opacity: 1;
    margin-top: 8px;
}

.arc-submenu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 20px;
    transition: all 0.2s ease;
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.arc-submenu-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.arc-submenu-item.active {
    background: rgba(255, 255, 255, 0.25);
}

.arc-submenu-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Arc Menu Credits Display */
.arc-menu-credits {
    position: absolute;
    left: 20px;
    top: 70px;
    width: calc(var(--arc-size, 450px) * 0.45);
    max-width: 180px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.4s ease 0.15s, transform 0.4s ease 0.15s;
    cursor: pointer;
}

.arc-menu-overlay.active .arc-menu-credits {
    opacity: 1;
    transform: translateY(0);
}

.credits-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.credits-values {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 8px;
}

.credits-used {
    color: white;
    font-size: 18px;
    font-weight: 700;
}

.credits-separator {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.credits-total {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
}

.credits-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.credits-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80 0%, #22c55e 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.credits-bar-fill.warning {
    background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
}

.credits-bar-fill.danger {
    background: linear-gradient(90deg, #f87171 0%, #ef4444 100%);
}

.arc-menu-footer {
    position: absolute;
    bottom: 30px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease 0.3s, transform 0.4s ease 0.3s;
}

.arc-menu-overlay.active .arc-menu-footer {
    opacity: 1;
    transform: translateY(0);
}

/* Store Icons */
.store-icons {
    display: flex;
    gap: 16px;
    margin-bottom: 4px;
}

.store-icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
}

.store-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

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

#playStoreBtn {
    background: linear-gradient(135deg, rgba(52, 168, 83, 0.3) 0%, rgba(66, 133, 244, 0.3) 100%);
    border-color: rgba(52, 168, 83, 0.4);
}

#playStoreBtn:hover {
    background: linear-gradient(135deg, rgba(52, 168, 83, 0.5) 0%, rgba(66, 133, 244, 0.5) 100%);
}

#appStoreBtn {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.3) 0%, rgba(88, 86, 214, 0.3) 100%);
    border-color: rgba(0, 122, 255, 0.4);
}

#appStoreBtn:hover {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.5) 0%, rgba(88, 86, 214, 0.5) 100%);
}

/* PWA Install Modal */
.pwa-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

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

.pwa-modal {
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    background: linear-gradient(145deg, #1e1e2e 0%, #2a2a3e 100%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-modal-overlay.active .pwa-modal {
    transform: scale(1) translateY(0);
}

.pwa-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.pwa-modal-header h2 {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 700;
}

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

.pwa-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.pwa-modal-content {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.pwa-install-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pwa-intro {
    text-align: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    margin-bottom: 8px;
}

.pwa-app-icon {
    margin-bottom: 12px;
}

.pwa-intro p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.5;
}

.pwa-intro strong {
    color: white;
}

.pwa-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.pwa-step-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-step-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pwa-step-content p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.4;
}

.pwa-step-content strong {
    color: #667eea;
}

.pwa-step-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
}

.pwa-note {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 12px;
    color: #fbbf24;
    font-size: 13px;
    margin-top: 8px;
}

.pwa-note strong {
    color: #fbbf24;
}

/* Footer row for version and settings */
.arc-menu-footer-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.arc-menu-version {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
}

.arc-menu-settings {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.arc-menu-settings:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(45deg);
}

/* Menu Toggle Button in Header */
.menu-toggle-button {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all 0.3s ease;
    margin-right: 12px;
}

.menu-toggle-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.menu-toggle-button:active {
    transform: scale(0.95);
}

/* Current Mode Indicator (header) */
.current-mode-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    margin-left: 12px;
}

.current-mode-indicator span {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

/* Current Mode Badge (below header) */
.current-mode-badge {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 20px;
    background: rgba(102, 126, 234, 0.15);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
    user-select: none;
}

.current-mode-badge .mode-icon {
    font-size: 16px;
    opacity: 0.9;
}

.current-mode-badge .mode-name {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* Responsive adjustments for arc menu */
@media (max-width: 600px) {
    .arc-menu-overlay {
        overflow: hidden;
    }
    
    .arc-menu-shape {
        /* Constrain to viewport on mobile */
        width: min(350px, 95vw);
        height: min(450px, 90vh);
        max-width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .arc-menu-close {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
    }
    
    .arc-menu-credits {
        left: 10px;
        top: 48px;
        width: calc(var(--arc-size, 350px) * 0.35);
        max-width: 110px;
        padding: 6px 8px;
    }
    
    .arc-menu-items {
        top: 100px;
        left: 10px;
        right: 10px;
        gap: 4px;
        max-width: calc(100% - 20px);
        padding-bottom: 20px;
    }
    
    .arc-menu-item {
        padding: 5px;
        gap: 10px;
    }
    
    .arc-menu-icon {
        width: 34px;
        height: 34px;
    }
    
    .arc-menu-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .arc-menu-label {
        font-size: 12px;
    }
    
    .arc-menu-chevron {
        width: 14px;
        height: 14px;
    }
    
    .arc-submenu {
        padding-left: 44px;
        gap: 4px;
        max-width: calc(100% - 44px);
    }
    
    .arc-menu-group.expanded .arc-submenu {
        max-height: 120px;
        margin-top: 4px;
    }
    
    .arc-submenu-item {
        padding: 6px 10px;
        gap: 8px;
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .arc-submenu-icon {
        width: 26px;
        height: 26px;
        flex-shrink: 0;
    }
    
    .arc-submenu-icon svg {
        width: 14px;
        height: 14px;
    }
    
    .credits-used {
        font-size: 12px;
    }
    
    .credits-total {
        font-size: 10px;
    }
    
    .credits-label {
        font-size: 9px;
        margin-bottom: 3px;
    }
    
    .credits-bar {
        height: 4px;
    }
    
    .credits-values {
        margin-bottom: 4px;
    }
}

/* Profile Modal Styles */
.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.profile-modal {
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    background: linear-gradient(145deg, #1e1e2e 0%, #2a2a3e 100%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.profile-modal-overlay.active .profile-modal {
    transform: scale(1) translateY(0);
}

.profile-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.profile-modal-header h2 {
    margin: 0;
    color: white;
    font-size: 20px;
    font-weight: 700;
}

.profile-modal-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s ease;
}

.profile-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.profile-modal-content {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}

.profile-section {
    margin-bottom: 24px;
}

.profile-section:last-child {
    margin-bottom: 0;
}

.profile-section h4 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

/* Profile User Section */
.profile-user {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.profile-user-info h3 {
    margin: 0 0 4px 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.profile-user-status {
    color: #4ade80;
    font-size: 13px;
    font-weight: 500;
}

/* Credits Overview */
.profile-credits-overview {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.credits-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.credit-stat {
    text-align: center;
    flex: 1;
}

.credit-stat-value {
    display: block;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
}

.credit-stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

.profile-credits-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 12px;
}

.profile-credits-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    transition: width 0.5s ease;
    width: 0%;
}

.credits-usage-text {
    margin: 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Usage Breakdown */
.profile-usage {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.usage-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.usage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: background 0.2s ease;
}

.usage-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.usage-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.usage-item-icon.chat {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
}

.usage-item-icon.image {
    background: rgba(245, 87, 108, 0.2);
    color: #f5576c;
}

.usage-item-icon.video {
    background: rgba(118, 75, 162, 0.2);
    color: #764ba2;
}

.usage-item-icon.voice {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.usage-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.usage-item-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.usage-rate {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

.usage-item-count {
    color: var(--text-secondary);
    font-size: 12px;
}

.usage-item-cost {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

/* Request Credits */
.profile-request-credits {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.profile-request-credits p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 16px 0;
}

.request-credits-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.request-credits-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Make credits section clickable */
.arc-menu-credits {
    cursor: pointer;
    transition: opacity 0.4s ease 0.3s, transform 0.4s ease 0.3s, background 0.2s ease;
}

.arc-menu-credits:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Responsive profile modal */
@media (max-width: 600px) {
    .profile-modal {
        width: 95%;
        max-height: 90vh;
        border-radius: 20px;
    }
    
    .profile-modal-content {
        padding: 16px;
        max-height: calc(90vh - 70px);
    }
    
    .credits-stats {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .credit-stat {
        min-width: 30%;
    }
    
    .credit-stat-value {
        font-size: 20px;
    }
}

/* ============================================
   Voice Controls Styles
   ============================================ */

.voice-controls {
    display: flex;
    flex-direction: column;
    padding: 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.voice-speaker-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.voice-speaker-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #10b981;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.voice-speaker-label svg {
    flex-shrink: 0;
}

.voice-speaker-select {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.voice-speaker-select:hover {
    border-color: rgba(16, 185, 129, 0.5);
    background-color: rgba(255, 255, 255, 0.08);
}

.voice-speaker-select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.voice-speaker-select option {
    background: #1a1a2e;
    color: var(--text-primary);
    padding: 8px;
}

/* Audio Message Styles */
.audio-message {
    background: rgba(16, 185, 129, 0.1) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    width: 100%;
    max-width: 100%;
}

.audio-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.audio-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 50%;
    color: #10b981;
    flex-shrink: 0;
}

.audio-message audio {
    width: 100%;
    min-width: 200px;
    height: 44px;
    border-radius: 8px;
    outline: none;
}

.audio-message audio::-webkit-media-controls-panel {
    background: rgba(255, 255, 255, 0.05);
}

.audio-message audio::-webkit-media-controls-play-button {
    width: 44px;
    height: 44px;
}

.audio-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 10px 16px;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 8px;
    color: #10b981;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.audio-download-btn:hover {
    background: rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

/* Mobile Responsive Voice Controls */
@media (max-width: 600px) {
    .voice-controls {
        padding: 6px 10px;
    }
    
    .voice-speaker-label {
        font-size: 12px;
    }
    
    .voice-speaker-label span {
        display: none;
    }
    
    .voice-speaker-select {
        padding: 6px 10px;
        font-size: 13px;
        padding-right: 30px;
    }
    
    /* Audio player mobile improvements */
    .audio-message {
        padding: 12px !important;
        max-width: 100% !important;
    }
    
    .audio-container {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .audio-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    
    .audio-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .audio-message audio {
        width: 100%;
        min-width: unset;
        height: 48px;
        margin-top: 8px;
    }
    
    .audio-download-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 14px;
        min-height: 48px;
    }
}

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

/* ============================================
   Voice Cloning Controls Styles
   ============================================ */

.voice-clone-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.voice-clone-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.voice-clone-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.voice-clone-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.voice-clone-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #8b5cf6;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.voice-name-input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.voice-name-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.voice-name-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Clone Mode Toggle */
.voice-clone-mode-toggle {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 4px;
}

.clone-mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clone-mode-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.clone-mode-btn.active {
    background: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}

/* Audio Upload Section */
.voice-clone-audio-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audio-upload-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.audio-upload-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px dashed rgba(139, 92, 246, 0.5);
    border-radius: 8px;
    color: #a78bfa;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-upload-btn:hover {
    background: rgba(139, 92, 246, 0.3);
    border-style: solid;
}

.audio-file-name {
    flex: 1;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    min-width: 100px;
}

.audio-file-name.has-file {
    color: #10b981;
    font-style: normal;
    font-weight: 500;
}

.audio-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
    font-style: italic;
}

/* Voice Clone Button in Audio Row */
.audio-upload-row .voice-clone-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

/* Text Design Section */
.voice-clone-text-section {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.voice-instruct-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.2s ease;
}

.voice-instruct-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.voice-instruct-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.voice-language-select {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.voice-language-select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.voice-language-select option {
    background: #1a1a2e;
    color: var(--text-primary);
}

/* Mobile Responsive Voice Cloning */
@media (max-width: 600px) {
    .voice-clone-controls {
        padding: 10px;
    }
    
    .voice-clone-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .voice-clone-input-group {
        min-width: auto;
    }
    
    .voice-clone-mode-toggle {
        justify-content: center;
    }
    
    .voice-clone-audio-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .audio-upload-btn {
        justify-content: center;
    }
    
    .voice-clone-text-section {
        flex-direction: column;
    }
    
    .voice-instruct-input {
        min-width: auto;
    }
}

/* ============================================
   Voice Generate Panel Styles
   ============================================ */

.voice-generate-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.voice-input-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
    max-width: 100%;
}

.voice-clone-action-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
    max-width: 100%;
}

.voice-text-input {
    flex: 1;
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    transition: all 0.2s ease;
    min-height: 50px;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.5;
}

.voice-text-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.voice-text-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.voice-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    padding: 0;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.voice-generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

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

/* Voice Clone Action Row */
.voice-clone-action-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-top: 6px;
    width: 100%;
}

.voice-clone-sample-text {
    flex: 1;
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    transition: all 0.2s ease;
    min-height: 50px;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.5;
}

.voice-clone-sample-text:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.voice-clone-sample-text::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.voice-clone-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    padding: 0;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.voice-clone-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

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

/* Mobile Responsive for Voice Panels */
@media (max-width: 600px) {
    .voice-controls,
    .voice-clone-controls {
        padding: 10px;
        margin-bottom: 6px;
    }
    
    .voice-input-row,
    .voice-clone-action-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .voice-generate-btn,
    .voice-clone-btn {
        width: 100%;
        height: 44px;
    }
    
    .voice-text-input,
    .voice-clone-sample-text {
        min-height: 60px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .voice-speaker-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    
    .voice-speaker-select {
        width: 100%;
        font-size: 16px;
    }
    
    .voice-clone-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        min-width: auto;
    }
    
    .voice-name-input {
        width: 100%;
        font-size: 16px;
    }
    
    .voice-instruct-input {
        min-width: auto;
        width: 100%;
        font-size: 16px;
    }
    
    .voice-language-select {
        width: 100%;
        font-size: 16px;
    }
    
    .audio-upload-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .audio-upload-btn {
        width: 100%;
        justify-content: center;
    }
    
    .audio-file-name {
        text-align: center;
    }
    
    .audio-upload-row .voice-clone-btn {
        width: 100%;
        height: 44px;
    }
}