* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    background-color: #fff;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    background: radial-gradient(1200px 600px at 20% -10%, #254a82 0%, transparent 60%),
                radial-gradient(900px 500px at 100% 10%, #1e3f73 0%, transparent 60%),
                linear-gradient(180deg, #0f2547, #102f60);
}
/* Character Selection Screen */
.character-selection {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Floating Settings Button */
.floating-settings {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-settings:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.5);
}

.floating-settings[aria-pressed="true"] {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    box-shadow: 0 8px 25px rgba(90, 111, 216, 0.6);
}

.characters-grid {
    display: flex;
    flex-direction: column;
    padding: 30px 15px;
    flex: 1;
    overflow-y: auto;
}

/* Swipe-to-delete container */
.swipe-item {
    position: relative;
    /* overflow: hidden; */
    margin-bottom: 1rem;
}

.swipe-content {
    position: relative;
    z-index: 2;
    transition: transform 0.2s ease;
    height: 100%;
}

.delete-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: calc(100% - 4px);
    width: 90px;
    background: #ff3b30;
    color: #fff;
    border: none;
    border-radius: 10px;
    margin-right: 10px;
    z-index: 1;
    font-size: 16px;
    font-weight: 600;
    /* box-shadow: 0 6px 14px rgba(255,59,48,0.35); */
}

.character-card {
    background: #364C70;
    border-radius: 15px;
    /* padding: 20px; */
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #ddd;
    /* min-height: 200px; */
    max-height: 250px;
    display: flex;
    overflow: hidden;
    /* flex-direction: column; */
    /* justify-content: center; */
}

.character-card:hover {
    /* transform: translateY(-5px); */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}


/* .character-card.new-character:hover {
    border-color: #667eea;
    background: white;
} */


.character-avatar {
    /* margin: 5px; */
    width: 100px;
    height: auto;
    min-height: 100px;
    overflow: hidden;
    position: relative;
    background: #fff;
    display: flex;
    align-items: center;
}

.character-avatar img {
    object-position: top;
    object-fit: cover;
    width: 100px;
    height: 100px;
    margin: 0 auto;
    /* border-radius: 50%; */
    overflow: hidden;
    /* border: 3px solid #dedede; */
}



.placeholder-avatar {
    font-size: 2rem;
    color: white;
    font-weight: bold;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.character-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #fff;
}
.character-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    padding: 10px 15px;
    flex: 1;
    color: #bcdaf0;
}
.character-card p {
    font-size: 0.9rem;
    /* color: #666; */
    line-height: 1.4;
}

/* Upload Modal */
.upload-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.upload-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.upload-content h2 {
    color: #333;
    margin-bottom: 10px;
}

.upload-content p {
    color: #666;
    margin-bottom: 20px;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 40px 20px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.upload-placeholder span {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.uploaded-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
}

.upload-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
}

/* Upload Form Styles */
.upload-form {
    margin-bottom: 20px;
}

.form-field {
    margin-bottom: 20px;
    text-align: left;
}

.form-field label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.generation-progress {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.progress-spinner {
    font-size: 2rem;
    margin-bottom: 10px;
    animation: spin 2s linear infinite;
}

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

.generation-progress p {
    color: #333;
    margin-bottom: 5px;
    font-weight: 500;
}

.generation-progress small {
    color: #666;
    font-size: 0.85rem;
}

/* Character Interaction Screen */
.character-interaction {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Character View (Full Screen) */
.character-view {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
}

.character-video-fullscreen {
    width: 100%;
    height: 100%;
    /* object-fit: cover; */
    transition: opacity 0.3s ease-in-out;
}

.character-video-fullscreen.video-transitioning {
    opacity: 0.7;
}

/* Chat History View */
.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #222;
    border-radius: 20px;
    overflow: hidden;
    padding-top: 20px;
}

.chat-view .messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 100px 20px; /* Top: 0, Sides: 20px, Bottom: 100px for controls */
    scroll-behavior: smooth;
}

/* Custom scrollbar for webkit browsers */
.chat-view .messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-view .messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-view .messages-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-view .messages-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.no-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #666;
    min-height: 300px;
}

.no-messages-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-messages p {
    margin: 5px 0;
    font-size: 1rem;
}

/* Bottom Controls */
.bottom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 50px;
    z-index: 30;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.bottom-controls.fade-in {
    opacity: 1;
}

.bottom-controls > * {
    pointer-events: auto;
}

/* View Switch Button (Bottom Left) */
.view-switch-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.view-switch-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* Back Button (Bottom Left) */
.back-btn-bottom {
    background: radial-gradient(circle at 30% 30%, #417A9C, #3BB6A8);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    margin-left: 10px;
    width: 70px;
    height: 70px;
}

.back-btn-bottom:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-2px);
}

/* Floating Start Conversation Button */
.start-conversation-floating {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.start-conversation-floating:hover {
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.5);
}

/* Recording Controls */
.recording-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.record-btn-floating {
    background: radial-gradient(circle at 30% 30%, #7289da, #3a4fb2);
    color: white;
    border: none;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.record-btn-floating:hover {
    transform: translateY(-3px);
}

/* .record-btn-floating.recording {
    background: linear-gradient(135deg, #ff4757, #ff3838);
    animation: pulse 1.5s infinite;
}

.record-btn-floating.playing {
    background: linear-gradient(135deg, #ff4757, #ff3838);
    animation: pulse 1.5s infinite;
} */

.record-btn-floating .btn-icon {
    font-size: 1.8rem;
}

.processing-indicator-floating {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
}

.status-floating {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
    text-align: center;
    max-width: 250px;
}

/* Chat View Message Styles */
.chat-view .message {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: flex-start;
}

.chat-view .message.user {
    flex-direction: row-reverse;
}

.chat-view .message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #ffa726);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.chat-view .message.user .message-avatar {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.chat-view .message-bubble {
    max-width: 70%;
    background: white;
    border-radius: 15px;
    padding: 12px 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    border: 1px solid #f0f0f0;
}

.chat-view .message.user .message-bubble {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
    border: none;
}

.chat-view .message-content {
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 5px;
}

.chat-view .message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #666;
}

.chat-view .message.user .message-footer {
    color: rgba(255, 255, 255, 0.8);
}

.chat-view .play-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 5px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.chat-view .play-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 10px;
}

.message {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: flex-start;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #ffa726);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.message-bubble {
    max-width: 70%;
    background: white;
    border-radius: 15px;
    padding: 12px 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
}

.message-content {
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 5px;
}

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #666;
}

.message.user .message-footer {
    color: rgba(255, 255, 255, 0.8);
}

.play-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 5px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.play-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.start-conversation-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-conversation-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.conversation-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.record-btn {
    background: linear-gradient(135deg, #ff6b6b, #ffa726);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 180px;
    box-shadow: 0 5px 20px rgba(255, 107, 107, 0.3);
}

.record-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.record-btn.recording {
    background: linear-gradient(135deg, #ff4757, #ff3838);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 5px 20px rgba(255, 71, 87, 0.4); }
    50% { box-shadow: 0 5px 30px rgba(255, 71, 87, 0.8); }
    100% { box-shadow: 0 5px 20px rgba(255, 71, 87, 0.4); }
}

.btn-icon {
    font-size: 1.5rem;
}

.css-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.btn-text {
    font-size: 1rem;
    font-weight: 500;
}

.processing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-size: 0.9rem;
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.status {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Settings */
.settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.api-config {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.config-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.config-header span {
    font-weight: 600;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: #f5f5f5;
}

.config-section {
    margin-bottom: 15px;
}

.config-section label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #555;
    font-weight: 500;
}

.api-input, .voice-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

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

.clear-btn {
    width: 100%;
    padding: 10px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: #ff5252;
    transform: translateY(-1px);
}

.fetch-keys-btn {
    width: 100%;
    padding: 10px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fetch-keys-btn:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-1px);
}

.fetch-keys-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
}

.api-config small {
    color: #888;
    font-size: 0.8rem;
    display: block;
    margin-top: 10px;
    text-align: center;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    -webkit-overflow-scrolling: touch;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.welcome-emoji {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: wave 1s ease-in-out infinite alternate;
}

.welcome-text p {
    font-size: 1.2rem;
    margin: 10px 0;
    line-height: 1.5;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: slideIn 0.3s ease-out;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    background: linear-gradient(135deg, #fff, #f0f0f0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.message-bubble {
    max-width: 100%;
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.user .message-bubble {
    background: linear-gradient(135deg, #ff6b6b, #ffa726);
    color: white;
    border-bottom-right-radius: 5px;
}

.assistant .message-bubble {
    background: linear-gradient(135deg, #4fc3f7, #29b6f6);
    color: white;
    border-bottom-left-radius: 5px;
}

.message-content {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 8px;
}

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.message-time {
    font-size: 0.8rem;
    opacity: 0.7;
}

.play-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    opacity: 0.7;
    touch-action: manipulation;
}

.play-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.play-btn:active {
    transform: scale(0.95);
}

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

.assistant .play-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.user .play-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.controls {
    padding: 30px;
    text-align: center;
    background: rgba(248, 250, 252, 0.9);
    border-top: 1px solid rgba(226, 232, 240, 0.5);
}

.record-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #66bb6a, #4caf50);
    color: white;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-icon {
    font-size: 2rem;
}

.btn-text {
    font-size: 0.9rem;
    font-weight: 600;
}

.record-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

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

.record-btn.recording {
    background: linear-gradient(135deg, #ff5722, #f44336);
    animation: pulse 1.5s infinite;
}

.processing-indicator {
    margin-top: 20px;
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.spinner {
    font-size: 2rem;
    margin-bottom: 8px;
    animation: spin 1s linear infinite;
}

.processing-text {
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

.record-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.status {
    margin-top: 15px;
    font-size: 1rem;
    color: #64748b;
    font-weight: 500;
}

.config-section {
    margin-bottom: 20px;
}

.config-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.voice-select {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.voice-select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.settings-btn {
    position: fixed;
    background: rgba(255, 255, 255, 0.2);
    top: 1.2rem;
    right: 15px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px solid #ddd;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.settings-btn:hover {
    transform: scale(1.1);
}

.api-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.api-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.api-input::placeholder {
    color: #94a3b8;
}

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

@keyframes wave {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(20deg);
    }
}

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

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 10px 30px rgba(255, 87, 34, 0.3);
    }
    50% {
        box-shadow: 0 10px 30px rgba(255, 87, 34, 0.6), 0 0 0 10px rgba(255, 87, 34, 0.1);
    }
}

/* Status Alert Styles */
.status-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.3s ease-out;
    pointer-events: auto;
    /* Escape any parent container constraints */
    transform: translateZ(0);
    will-change: transform;
}

.status-alert {
    background-color: #fff;
    border-radius: 12px;
    padding: 24px;
    margin: 20px;
    max-width: 90%;
    width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    animation: slideUp 0.3s ease-out;
    z-index: 100000;
}

.status-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.status-message {
    flex: 1;
    font-size: 16px;
    color: #333;
    line-height: 1.4;
}

.status-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.status-close:hover {
    background-color: #f0f0f0;
    color: #666;
}

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

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

/* PWA Install Prompt Styles */
.install-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.install-prompt {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

.install-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.install-prompt h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 12px;
}

.install-prompt p {
    color: #666;
    line-height: 1.5;
    margin-bottom: 24px;
}

/* Generated Character Display */
.generated-character-display {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f0ff 100%);
    border-radius: 15px;
    border: 1px solid #e0e8ff;
}

.generated-character-avatar {
    width: 100px;
    height: auto;
    min-height: 100px;
    overflow: hidden;
    position: relative;
    background: #fff;
    display: flex;
    align-items: center;
    margin: 0 auto 15px;
}

.generated-character-avatar img {
    object-position: top;
    object-fit: cover;
    width: 100px;
    height: 100px;
    margin: 0 auto;
    overflow: hidden;
}

.generated-character-avatar .placeholder-avatar {
    font-size: 2rem;
    color: white;
    font-weight: bold;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.generated-character-name {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 8px;
    font-weight: 600;
}

.generated-character-desc {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
    margin: 0;
}

.install-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.install-actions .btn-secondary,
.install-actions .btn-primary {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.install-actions .btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.install-actions .btn-secondary:hover {
    background: #e5e5e5;
}

.install-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.install-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
header {
    padding: 1.5rem 1rem;
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.00));
    border-bottom: 1px solid rgba(255, 255, 255, .4);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
}
header .app-logo {
    height: 40px;
}
.mic-logo, .speaker-logo {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.speaker-logo i {
  font-size: 1.25rem;
}
/* wave ring (inside container) */
.wave {
  position: absolute;
  width: 60%;
  height: 60%;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.45);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0.5;
  animation: wave-expand 2s ease-out infinite;
}

.wave:nth-child(1) { animation-delay: 0s; }
.wave:nth-child(2) { animation-delay: 0.4s; }
.wave:nth-child(3) { animation-delay: 0.8s; }

@keyframes wave-expand {
  0% {
    transform: translate(-50%, -50%) scale(0.7);
    opacity: 0.7;
  }
  70% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0.25;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0;
  }
}