/* Version 2026.01.25.5 - Fix alt video transition */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: background 0.3s ease;
}

/* Dark mode styles */
body.dark-mode {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

body.dark-mode main {
    background: #1e1e1e;
    color: #e0e0e0;
}

body.dark-mode .form-group label,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4 {
    color: #e0e0e0;
}

body.dark-mode .form-group input[type="text"],
body.dark-mode .form-group input[type="file"],
body.dark-mode .form-group textarea {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-mode .form-group input[type="text"]::placeholder,
body.dark-mode .form-group textarea::placeholder {
    color: #888;
}

body.dark-mode .upload-area {
    background: #2a2a2a;
    border-color: #444;
}

body.dark-mode .upload-placeholder {
    color: #888;
}

body.dark-mode .companion-card {
    background: #2a2a2a;
    color: #e0e0e0;
}

body.dark-mode .companion-card:hover {
    border-color: #667eea;
}

body.dark-mode .companion-card h4 {
    color: #e0e0e0;
}

body.dark-mode .companion-card p {
    color: #aaa;
}

body.dark-mode .style-option {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-mode .style-option:hover {
    border-color: #667eea;
}

body.dark-mode .style-option.selected {
    background: #667eea;
    color: white;
}

body.dark-mode .voice-option {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-mode .voice-option:hover {
    border-color: #667eea;
}

body.dark-mode .voice-option.selected {
    background: #667eea;
    color: white;
}

body.dark-mode .chat-section {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.dark-mode .chat-messages {
    background: #0f172a;
}

body.dark-mode .chat-message.user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body.dark-mode .chat-message.companion .message-bubble {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

body.dark-mode .chat-message .message-sender {
    color: #94a3b8;
}

body.dark-mode .chat-message.companion .message-sender {
    color: #818cf8;
}

body.dark-mode .typing-indicator {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .chat-input-container {
    background: #1e293b;
    border-top-color: #334155;
}

body.dark-mode #chatInput {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode #chatInput:focus {
    border-color: #667eea;
}

body.dark-mode #chatInput::placeholder {
    color: #64748b;
}

body.dark-mode .personality-text {
    color: #cbd5e1;
}

body.dark-mode .btn-secondary {
    background: #1e293b;
    color: #818cf8;
    border-color: #334155;
}

body.dark-mode .btn-secondary:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

body.dark-mode .btn-audio {
    background: #1e293b;
    color: #818cf8;
    border: 1px solid #334155;
}

body.dark-mode .btn-audio:hover {
    background: #667eea;
    color: white;
}

body.dark-mode .see-more-btn {
    background: transparent;
    color: #818cf8;
}

body.dark-mode .see-more-btn:hover {
    background: #1e293b;
    color: #a5b4fc;
}

body.dark-mode .preview-container {
    background: #1e293b;
}

body.dark-mode .send-btn {
    background: #667eea;
}

body.dark-mode .send-btn:hover:not(:disabled) {
    background: #5568d3;
}

body.dark-mode .result-header h2 {
    color: #e2e8f0;
}

body.dark-mode .result-card h2 {
    color: #e2e8f0;
}

body.dark-mode .result-info {
    background: #1e293b;
    border: 1px solid #334155;
}

body.dark-mode .result-info p {
    color: #cbd5e1;
}

body.dark-mode .personality-container > p:first-child {
    color: #e2e8f0;
}

body.dark-mode .btn-edit {
    background: #1e293b;
    color: #818cf8;
    border-color: #334155;
}

body.dark-mode .btn-edit:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

body.dark-mode .audio-player {
    background: #1e293b;
    border: 1px solid #334155;
}

body.dark-mode .audio-info {
    color: #818cf8;
}

body.dark-mode .video-player {
    background: #1e293b;
    border: 1px solid #334155;
}

body.dark-mode .media-display {
    background: #1e293b;
    border: 1px solid #334155;
}

body.dark-mode .confirm-actions .hint-text {
    color: #94a3b8;
}

body.dark-mode .creator-section h2 {
    color: #e2e8f0;
}

body.dark-mode .preview-section h3 {
    color: #e2e8f0;
}

body.dark-mode .companion-grid::-webkit-scrollbar-track {
    background: #1e293b;
}

body.dark-mode .upload-placeholder svg {
    stroke: #64748b;
}

body.dark-mode .upload-placeholder p {
    color: #94a3b8;
}

body.dark-mode .upload-hint {
    color: #64748b;
}

body.dark-mode .save-message {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    color: #a7f3d0;
}

body.dark-mode .btn-save-changes {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

body.dark-mode .btn-save-changes:hover:not(:disabled) {
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.4);
}

.container {
    width: 100%;
    max-width: 600px;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.theme-toggle .sun-icon {
    display: block;
}

.theme-toggle .moon-icon {
    display: none;
}

body.dark-mode .theme-toggle .sun-icon {
    display: none;
}

body.dark-mode .theme-toggle .moon-icon {
    display: block;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info label {
    color: white;
    font-weight: 500;
    font-size: 0.95rem;
}

.user-info input {
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    min-width: 200px;
}

.user-info input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.user-info input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

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

.tier-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tier-icon {
    flex-shrink: 0;
}

.tier-badge.free {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    color: white;
}

.tier-badge.free .tier-icon {
    display: none;
}

.tier-badge.silver {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #374151;
}

.tier-badge.silver .tier-icon {
    color: #9ca3af;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.tier-badge.gold {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
}

.tier-badge.gold .tier-icon {
    color: #fbbf24;
    filter: drop-shadow(0 1px 2px rgba(120, 53, 15, 0.3));
}

.tier-stats {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-right: 8px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
}

.lang-btn img {
    display: block;
    border-radius: 2px;
}

body.dark-mode .lang-btn {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .lang-btn.active {
    background: rgba(102, 126, 234, 0.4);
    border-color: #667eea;
}

/* Profile Button */
.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.profile-btn .user-icon {
    flex-shrink: 0;
}

.profile-btn .tier-badge {
    padding: 4px 10px;
    font-size: 0.75rem;
    box-shadow: none;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Hide header text when viewing companion */
body.viewing-companion header h1,
body.viewing-companion header .subtitle {
    display: none;
}

body.viewing-companion header {
    margin-bottom: 10px;
}

main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 100px;
}

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

/* ==========================================
   RICH TEXT EDITOR STYLES
   ========================================== */

.rich-text-wrapper {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.rich-text-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px;
    background: #f5f6fa;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
}

.rich-text-toolbar.mini {
    padding: 6px 8px;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #555;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: #e8eaf6;
    border-color: #c5cae9;
}

.toolbar-btn:active,
.toolbar-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.toolbar-btn.emoji-btn,
.toolbar-btn.gif-btn {
    font-size: 16px;
}

.toolbar-btn.gif-btn {
    font-size: 11px;
    font-weight: bold;
    color: #667eea;
}

.toolbar-select {
    height: 32px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 12px;
    cursor: pointer;
    color: #555;
}

.toolbar-select:hover {
    border-color: #667eea;
}

.toolbar-select:focus {
    outline: none;
    border-color: #667eea;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: #ddd;
    margin: 0 4px;
}

.rich-text-input {
    padding: 12px 16px;
    min-height: 50px;
    outline: none;
    font-size: 1rem;
    line-height: 1.5;
    overflow-y: auto;
}

.rich-text-input.single-line {
    min-height: 44px;
    max-height: 44px;
    overflow: hidden;
    white-space: nowrap;
}

.rich-text-input.multi-line {
    min-height: 100px;
    max-height: 300px;
}

/* Secrets input */
.secrets-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.secrets-input:focus {
    outline: none;
    border-color: #ff6b9d;
}

.field-hint {
    font-size: 0.85rem;
    color: #666;
    margin: 4px 0 8px 0;
    line-height: 1.4;
}

body.dark-mode .secrets-input {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #444;
}

body.dark-mode .field-hint {
    color: #999;
}

.rich-text-input:empty:before {
    content: attr(data-placeholder);
    color: #999;
    pointer-events: none;
}

.rich-text-input img {
    max-width: 100%;
    max-height: 150px;
    vertical-align: middle;
    border-radius: 4px;
}

.rich-text-input img.emoji-inline {
    width: 1.2em;
    height: 1.2em;
    max-height: 1.2em;
    vertical-align: text-bottom;
}

/* Emoji Picker Popup */
.emoji-picker-popup,
.gif-picker-popup {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 320px;
    max-height: 350px;
    overflow: hidden;
}

.emoji-picker-header,
.gif-picker-header {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.emoji-search,
.gif-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.emoji-search:focus,
.gif-search:focus {
    outline: none;
    border-color: #667eea;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 10px;
    max-height: 280px;
    overflow-y: auto;
}

.emoji-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.emoji-item:hover {
    background: #f0f2ff;
}

.gif-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
    max-height: 280px;
    overflow-y: auto;
}

.gif-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.15s ease;
}

.gif-item:hover {
    transform: scale(1.02);
}

.gif-item img {
    width: 100%;
    height: auto;
    display: block;
}

.gif-hint {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 14px;
}

/* Dark mode for rich text editor */
body.dark-mode .rich-text-wrapper {
    border-color: #444;
}

body.dark-mode .rich-text-toolbar {
    background: #2a2a2a;
    border-color: #444;
}

body.dark-mode .toolbar-btn {
    color: #ccc;
}

body.dark-mode .toolbar-btn:hover {
    background: #3a3a3a;
    border-color: #555;
}

body.dark-mode .toolbar-select {
    background: #333;
    border-color: #555;
    color: #ccc;
}

body.dark-mode .rich-text-input {
    background: #2a2a2a;
    color: #e0e0e0;
}

body.dark-mode .rich-text-input:empty:before {
    color: #666;
}

body.dark-mode .emoji-picker-popup,
body.dark-mode .gif-picker-popup {
    background: #2a2a2a;
    border-color: #444;
}

body.dark-mode .emoji-picker-header,
body.dark-mode .gif-picker-header {
    border-color: #444;
}

body.dark-mode .emoji-search,
body.dark-mode .gif-search {
    background: #333;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .emoji-item:hover {
    background: #3a3a3a;
}

body.dark-mode .toolbar-separator {
    background: #444;
}

.upload-area {
    border: 2px dashed #d0d0d0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.upload-area.drag-over {
    border-color: #667eea;
    background-color: #f0f2ff;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #666;
}

.upload-placeholder svg {
    color: #667eea;
    margin-bottom: 15px;
}

.upload-placeholder p {
    margin: 5px 0;
}

.upload-hint {
    font-size: 0.85rem;
    color: #999;
}

.preview-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.preview-container img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
}

.remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ff4757;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.remove-btn:hover {
    background: #ff3838;
    transform: scale(1.1);
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

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

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

.btn-secondary {
    width: 100%;
    padding: 14px 24px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    color: #667eea;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 10px;
}

.back-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(-3px);
}

.back-btn svg {
    stroke: currentColor;
}

body.dark-mode .back-btn {
    color: #818cf8;
}

body.dark-mode .back-btn:hover {
    background: rgba(129, 140, 248, 0.15);
}

.edit-actions {
    margin-top: 20px;
}

.btn-save-changes {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-save-changes:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

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

.edit-actions .btn-secondary {
    margin-top: 10px;
}

.save-message {
    padding: 12px 16px;
    margin-top: 10px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    animation: fadeIn 0.3s ease;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

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

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

.loading-content p {
    font-size: 1.2rem;
    margin: 10px 0;
}

.loading-hint {
    font-size: 0.9rem;
    opacity: 0.7;
}

.result-section {
    text-align: center;
    position: relative;
}

.result-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 25px;
}

.result-header h2 {
    color: #333;
    font-size: 2rem;
    margin: 0;
}

.btn-edit {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f0f2ff;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit:hover {
    background: #667eea;
    color: white;
}

.btn-edit svg {
    flex-shrink: 0;
}

.result-card h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 2rem;
}

.avatar-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 25px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.avatar-container img {
    width: 100%;
    height: auto;
    display: block;
}

.result-info {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 10px;
    margin-top: 20px;
}

.result-info p {
    margin: 10px 0;
    color: #555;
    font-size: 1rem;
}

.personality-container {
    text-align: left;
}

.personality-container > p:first-child {
    margin-bottom: 8px;
    color: #333;
}

.personality-text {
    line-height: 1.5;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.personality-text.collapsed {
    max-height: 3em; /* Approximately 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.personality-text.expanded {
    max-height: none;
    -webkit-line-clamp: unset;
}

.see-more-btn {
    background: none;
    border: none;
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 5px 0;
    margin-top: 5px;
    transition: color 0.2s ease;
}

.see-more-btn:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Scene Display Container (companion page) */
.scene-display-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    text-align: left;
}

body.dark-mode .scene-display-container {
    border-top-color: #334155;
}

.scene-display-container p {
    margin-bottom: 8px;
    color: #333;
}

body.dark-mode .scene-display-container p {
    color: #e2e8f0;
}

.scene-display-container #sceneDisplayName {
    color: #667eea;
}

.btn-choose-scene {
    background: none;
    border: 1px solid #667eea;
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.btn-choose-scene:hover {
    background: #667eea;
    color: white;
}

body.dark-mode .btn-choose-scene {
    border-color: #818cf8;
    color: #818cf8;
}

body.dark-mode .btn-choose-scene:hover {
    background: #818cf8;
    color: #1e293b;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #4caf50;
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.voice-controls {
    margin: 25px 0;
}

.btn-voice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-voice:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

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

.btn-voice svg {
    flex-shrink: 0;
}

.audio-player {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 12px;
}

.audio-player audio {
    width: 100%;
    margin-bottom: 10px;
}

.audio-info {
    color: #667eea;
    font-size: 0.9rem;
    margin: 0;
    font-weight: 500;
}

.video-controls {
    margin: 25px 0;
}

.btn-video {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-video:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(245, 87, 108, 0.3);
}

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

.btn-video svg {
    flex-shrink: 0;
}

.video-player {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 12px;
}

.video-player video {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 10px;
}

.video-info {
    color: #f5576c;
    font-size: 0.9rem;
    margin: 0;
    font-weight: 500;
}

/* Selection Section */
.companion-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.companion-list-header h2 {
    margin: 0;
    color: #333;
}

.companion-search {
    display: flex;
    align-items: center;
    position: relative;
}

.companion-search input {
    padding: 8px 35px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    width: 180px;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

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

.companion-search input::placeholder {
    color: #999;
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: color 0.2s ease;
}

.clear-search-btn:hover {
    color: #667eea;
}

body.dark-mode .companion-list-header h2 {
    color: #f1f5f9;
}

body.dark-mode .companion-search input {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .companion-search input:focus {
    border-color: #667eea;
    background: #0f172a;
}

body.dark-mode .companion-search input::placeholder {
    color: #64748b;
}

body.dark-mode .clear-search-btn {
    color: #64748b;
}

body.dark-mode .clear-search-btn:hover {
    color: #667eea;
}

.selection-section h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.companion-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 30px;
    max-height: 600px; /* Adjusted for larger cards */
    overflow-y: auto;
    padding-right: 5px;
}

.companion-grid::-webkit-scrollbar {
    width: 6px;
}

.companion-grid::-webkit-scrollbar-track {
    background: #f0f2ff;
    border-radius: 3px;
}

.companion-grid::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.companion-grid::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.companion-card {
    background: #f8f9ff;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.companion-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.companion-card-media {
    position: relative;
    width: 100%;
    height: 250px;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.companion-stats {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    flex-direction: row;
    gap: 3px;
    z-index: 10;
}

.stat-item {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

.private-label {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 10;
    backdrop-filter: blur(4px);
    letter-spacing: 0.5px;
}

.companion-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 2; /* Above placeholder gradient */
}

.companion-card-media video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.companion-card:hover .companion-card-media video {
    opacity: 1;
}

/* Placeholder shown while image loads */
.card-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 0; /* Below image z-index:2 */
}

.placeholder-name {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    padding: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.companion-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.companion-card h4 {
    margin: 0;
    color: #333;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.companion-card p {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* Preview Section */
.preview-section {
    margin-top: 30px;
    padding-top: 30px;
}

.preview-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
    margin-bottom: 30px;
}

.preview-section h3 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
}

.btn-audio {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-audio:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.btn-audio.muted {
    background: rgba(255, 255, 255, 0.9);
    color: #999;
}

.btn-audio.muted:hover {
    background: #667eea;
    color: white;
}

/* Style Selector */
.style-selector {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.style-option {
    flex: 1;
    padding: 10px 16px;
    background: #f0f2ff;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
    color: #555;
}

.style-option:hover {
    background: #e0e4ff;
}

.style-option.selected {
    background: #667eea;
    color: white;
    border-color: #5568d3;
}

.voice-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

.voice-option {
    flex: 1;
    min-width: 120px;
    padding: 10px 15px;
    background: #f0f2ff;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 500;
    color: #555;
}

.voice-option:hover {
    background: #e0e4ff;
}

.voice-option.selected {
    background: #667eea;
    color: white;
    border-color: #5568d3;
}

/* Privacy Toggle */
.privacy-toggle-container {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 12px;
    text-align: center;
}

body.dark-mode .privacy-toggle-container {
    background: #2a2a3e;
}

.toggle-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

body.dark-mode .toggle-label {
    color: #e0e0e0;
}

.toggle-switch-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.toggle-option {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    transition: color 0.2s ease;
}

body.dark-mode .toggle-option {
    color: #888;
}

.toggle-option.active {
    color: #667eea;
    font-weight: 600;
}

body.dark-mode .toggle-option.active {
    color: #8b9cf9;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #667eea;
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .toggle-slider {
    background-color: #22c55e;
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.privacy-description {
    font-size: 0.8rem;
    color: #22c55e;
    margin: 0;
    font-style: italic;
}

.privacy-description.private {
    color: #f59e0b;
}

body.dark-mode .privacy-description {
    color: #4ade80;
}

body.dark-mode .privacy-description.private {
    color: #fbbf24;
}

.confirm-actions {
    margin-top: 30px;
    text-align: center;
}

.confirm-actions .hint-text {
    margin-top: 15px;
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

/* Creator Title */
.creator-section h2 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
}

/* Media Display */
.media-display {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 12px;
}

.media-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    background: #000; /* Black background for crossfade effect */
    aspect-ratio: 1 / 1; /* Maintain square aspect ratio to prevent layout shift */
}

.media-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

/* Video crossfade for smooth looping */
.media-container video {
    transition: opacity 0.3s ease-in-out;
    border-radius: 8px;
}

/* Primary video - on top by default */
.media-container video {
    position: relative;
    z-index: 2;
}

/* Alternate video for cycling - behind primary by default */
.media-container .video-alt {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    pointer-events: none;
    display: block;
    z-index: 1;
}

/* In immersive mode, ensure videos fill screen */
body.immersive-mode .media-container .video-alt {
    object-fit: cover;
    object-position: top center;
}

.video-loading-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.video-loading-indicator p {
    margin: 0;
    font-size: 0.9rem;
}

.small-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Chat Section */
.chat-section {
    margin-top: 25px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
}

.chat-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9ff;
}

.chat-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.chat-message.user {
    align-items: flex-end;
}

.chat-message.companion {
    align-items: flex-start;
}

.chat-message .message-bubble {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.companion .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chat-message .message-sender {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 4px;
    padding: 0 5px;
}

.chat-message.companion .message-sender {
    color: #667eea;
    font-weight: 500;
}

/* Roleplay narration styling */
.chat-message.narration {
    align-items: center;
}

.chat-message.narration .message-sender {
    color: #9b59b6;
    font-weight: 600;
    font-style: italic;
}

.chat-message.narration .message-bubble,
.narration-bubble {
    background: linear-gradient(135deg, #f8f4ff 0%, #efe8ff 100%);
    color: #4a4a6a;
    border: 1px solid #d4c4e8;
    border-radius: 12px;
    font-style: italic;
    max-width: 90%;
    padding: 12px 18px;
}

body.dark-mode .chat-message.narration .message-bubble,
body.dark-mode .narration-bubble {
    background: linear-gradient(135deg, #2a2640 0%, #3a3060 100%);
    color: #d0c0e8;
    border-color: #5a4a7a;
}

/* Roleplay mode indicator */
.roleplay-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 20px;
    margin: 10px auto;
    width: fit-content;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #667eea;
    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.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.chat-input-container {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    gap: 10px;
}

.chat-input-container input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.chat-input-container input:focus {
    border-color: #667eea;
}

.chat-input-container button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-input-container button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.chat-input-container button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Tablet styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
        align-items: flex-start;
    }

    .container {
        max-width: 100%;
    }

    main {
        padding: 20px 15px;
        border-radius: 15px;
    }

    .header-top {
        flex-wrap: wrap;
        gap: 10px;
    }

    .user-info {
        flex-wrap: wrap;
        justify-content: center;
    }

    .user-info input {
        min-width: 150px;
        width: 100%;
        max-width: 200px;
    }

    .companion-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .companion-card-media {
        height: 200px;
    }

    .companion-card img {
        height: 200px;
    }

    .media-container {
        max-width: 100%;
    }

    .avatar-container {
        max-width: 100%;
    }
}

/* Mobile styles */
@media (max-width: 640px) {
    body {
        padding: 0;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    .container {
        max-width: 100%;
        width: 100%;
    }

    main {
        padding: 20px 15px;
        border-radius: 0;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    header {
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    /* Header layout for mobile - keep horizontal like desktop */
    .header-top {
        flex-direction: row;
        gap: 10px;
        align-items: center;
        justify-content: space-between;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .user-info {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }

    .user-info label {
        display: none;
    }

    .user-info input {
        display: none;
    }

    /* Tier display mobile */
    .tier-display {
        justify-content: center;
    }

    .tier-badge {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    .tier-stats {
        font-size: 0.75rem;
    }

    /* Companion grid mobile */
    .companion-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        max-height: none;
        padding-bottom: 10px;
    }

    .companion-card {
        padding: 8px;
    }

    .companion-card-media {
        height: 150px;
    }

    .companion-card img {
        height: 150px;
    }

    .companion-card h4 {
        font-size: 0.9rem;
    }

    .companion-card p {
        font-size: 0.75rem;
        -webkit-line-clamp: 1;
    }

    .companion-stats {
        gap: 2px;
    }

    .stat-item {
        padding: 2px 4px;
        font-size: 0.6rem;
    }

    /* Buttons mobile */
    .btn-primary,
    .btn-voice,
    .btn-video,
    .btn-confirm {
        font-size: 0.9rem;
        padding: 12px 20px;
        width: 100%;
    }

    .btn-secondary {
        font-size: 0.85rem;
        padding: 10px 16px;
    }

    /* Form elements mobile */
    .form-group label {
        font-size: 0.9rem;
    }

    .form-group input[type="text"],
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }

    .upload-area {
        padding: 30px 15px;
    }

    .upload-placeholder p {
        font-size: 0.85rem;
    }

    /* Style selector mobile */
    .style-selector {
        flex-wrap: wrap;
    }

    .style-option {
        flex: 1 1 45%;
        min-width: 0;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* Voice selector mobile */
    .voice-selector {
        gap: 8px;
    }

    .voice-option {
        flex: 1 1 45%;
        min-width: 0;
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    /* Preview section mobile */
    .preview-section {
        margin-top: 20px;
        padding-top: 20px;
    }

    .preview-container {
        padding: 15px;
    }

    .preview-image {
        max-width: 100%;
    }

    /* Result section mobile */
    .result-header {
        flex-direction: row;
        gap: 10px;
    }

    .result-header h2 {
        font-size: 1.5rem;
    }

    .btn-edit {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        width: auto;
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .btn-edit span {
        display: none;
    }

    .result-info {
        padding: 15px;
    }

    .result-info p {
        font-size: 0.9rem;
    }

    /* Media display mobile */
    .media-display {
        padding: 15px;
        margin-top: 15px;
    }

    .media-container {
        max-width: 100%;
    }

    .audio-controls {
        gap: 8px;
    }

    .btn-audio {
        width: 40px;
        height: 40px;
    }

    /* Chat section mobile */
    .chat-section {
        margin-top: 15px;
    }

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

    .chat-header h3 {
        font-size: 0.9rem;
    }

    .chat-messages {
        height: 250px;
        padding: 12px;
    }

    .chat-message .message-bubble {
        max-width: 85%;
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .chat-input-container {
        padding: 10px;
        gap: 8px;
    }

    .chat-input-container input {
        padding: 10px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .chat-input-container button {
        width: 40px;
        height: 40px;
    }

    /* Audio player mobile */
    .audio-player {
        padding: 12px;
    }

    .audio-player audio {
        width: 100%;
    }

    /* Confirm actions mobile */
    .confirm-actions {
        margin-top: 20px;
    }

    .confirm-actions .hint-text {
        font-size: 0.8rem;
    }

    /* Loading overlay mobile */
    .loading-content p {
        font-size: 1rem;
    }

    .spinner {
        width: 50px;
        height: 50px;
    }

    /* Edit modal mobile */
    .edit-modal-content {
        padding: 20px;
        margin: 10px;
        max-height: 90vh;
    }

    .edit-modal-header h3 {
        font-size: 1.1rem;
    }

    /* Personality text mobile */
    .personality-text.collapsed {
        max-height: 4.5em;
        -webkit-line-clamp: 3;
    }

    .see-more-btn {
        font-size: 0.85rem;
    }

    /* Mobile immersive mode - ensure chat input is accessible */
    body.immersive-mode .chat-section {
        z-index: 1000; /* Higher z-index on mobile to ensure it's on top */
    }

    body.immersive-mode .chat-input-container {
        padding: 12px 10px;
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }

    body.immersive-mode .chat-input-container input {
        font-size: 16px; /* Prevents zoom on iOS */
        -webkit-user-select: text;
        user-select: text;
        touch-action: manipulation;
    }

    body.immersive-mode .media-display {
        /* Ensure media doesn't block chat on mobile */
        bottom: 200px; /* Make room for chat section */
    }
}

/* Small mobile styles */
@media (max-width: 375px) {
    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .companion-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .companion-card-media {
        height: 130px;
    }

    .companion-card img {
        height: 130px;
    }

    .companion-card h4 {
        font-size: 0.85rem;
    }

    .style-option,
    .voice-option {
        flex: 1 1 100%;
        padding: 10px;
    }

    .chat-messages {
        height: 200px;
    }

    .result-header h2 {
        font-size: 1.3rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn-audio {
        width: 44px;
        height: 44px;
    }

    .chat-input-container button {
        width: 44px;
        height: 44px;
    }

    .theme-toggle {
        width: 44px;
        height: 44px;
    }

    /* Remove hover effects that don't work well on touch */
    .companion-card:hover {
        transform: none;
    }

    .companion-card:active {
        transform: scale(0.98);
        border-color: #667eea;
    }

    /* On mobile/touch devices, videos auto-play when visible - always show them */
    .companion-card-media video {
        opacity: 1 !important;
    }

    /* Hide the image when video is present on mobile */
    .companion-card-media:has(video) img {
        display: none;
    }
}

/* Landscape mobile */
@media (max-width: 900px) and (orientation: landscape) {
    body {
        align-items: flex-start;
    }

    main {
        min-height: auto;
    }

    .chat-messages {
        height: 150px;
    }

    .companion-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .companion-card-media {
        height: 120px;
    }

    .companion-card img {
        height: 120px;
    }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

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

/* ==========================================
   IMMERSIVE MODE STYLES
   ========================================== */

/* Exit immersive mode button */
.exit-immersive-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: background 0.2s ease, transform 0.2s ease;
}

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

/* Immersive mode active state */
body.immersive-mode {
    padding: 0;
    background: #000;
    overflow: hidden;
    /* iOS Safari fullscreen support */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    /* Use -webkit-fill-available for iOS */
    height: -webkit-fill-available;
    /* Prevent pull-to-refresh on iOS */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

body.immersive-mode main {
    width: 100vw;
    height: 100vh;
    /* iOS Safari: use fill-available to get actual viewport height */
    height: -webkit-fill-available;
    /* Also try dynamic viewport height for modern iOS */
    height: 100dvh;
    max-width: none;
    margin: 0;
    padding: 0;
    /* Add safe area insets for notched iPhones */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    border-radius: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Hide elements in immersive mode */
body.immersive-mode .header,
body.immersive-mode .header-top,
body.immersive-mode .tier-display,
body.immersive-mode #companionSelection,
body.immersive-mode #creatorSection,
body.immersive-mode .result-info,
body.immersive-mode .result-actions,
body.immersive-mode #backToSelectionBtn,
body.immersive-mode #editCompanionBtn,
body.immersive-mode .audio-controls,
body.immersive-mode .companion-stats,
body.immersive-mode .chat-header,
body.immersive-mode .auth-section,
body.immersive-mode #loginSection,
body.immersive-mode #registerSection,
body.immersive-mode #verifySection,
body.immersive-mode #profileSection,
body.immersive-mode #themeToggle,
body.immersive-mode #profileBtn,
body.immersive-mode .theme-toggle,
body.immersive-mode .profile-btn {
    display: none !important;
}

/* Result section in immersive mode */
body.immersive-mode #resultSection {
    display: block !important;
    position: relative;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    width: 100vw;
    padding: 0;
    overflow: hidden;
}

/* Media display fills the entire screen */
body.immersive-mode .media-display {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex !important;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
    margin: 0;
    background: transparent;
    z-index: 1;
}

body.immersive-mode .media-container {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    margin: 0;
    padding: 0;
}

body.immersive-mode .media-container video,
body.immersive-mode .media-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center; /* Align video/image to top */
    border-radius: 0;
    margin: 0;
    padding: 0;
    /* Don't use opacity !important - it breaks crossfade transitions */
    filter: brightness(1.1); /* Slightly boost brightness for better visibility on mobile */
    -webkit-filter: brightness(1.1);
}

/* Chat section in immersive mode - overlay at bottom */
body.immersive-mode .chat-section {
    display: flex !important;
    flex-direction: column;
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    max-height: 200px;
    min-height: 120px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.8) 70%, transparent 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 0;
    margin: 0;
    padding: 0;
    padding-top: 20px;
    z-index: 100;
    border: none;
    pointer-events: auto; /* Ensure chat section receives touch/click events */
}

/* Ensure chat input receives touch events on mobile */
body.immersive-mode .chat-input-container,
body.immersive-mode .chat-input-container input,
body.immersive-mode .chat-input-container button {
    pointer-events: auto;
    touch-action: manipulation; /* Improve touch responsiveness */
}

body.immersive-mode .chat-messages {
    flex: 1;
    max-height: 100px;
    min-height: 50px;
    padding: 8px 15px;
    overflow-y: auto;
    font-size: 14px;
    scrollbar-width: thin;
    background: transparent;
}

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

body.immersive-mode .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

body.immersive-mode .chat-message {
    margin-bottom: 6px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.3;
}

body.immersive-mode .chat-message .message-bubble {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

body.immersive-mode .chat-message.user .message-bubble {
    background: rgba(102, 126, 234, 0.6);
    color: white;
}

body.immersive-mode .chat-message .message-sender {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

body.immersive-mode .chat-input-container {
    padding: 10px 15px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.6);
    gap: 10px;
    display: flex;
    align-items: center;
}

body.immersive-mode .chat-input-container input {
    flex: 1;
    font-size: 15px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: white;
}

body.immersive-mode .chat-input-container input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

body.immersive-mode .chat-input-container input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(255, 255, 255, 0.18);
}

body.immersive-mode .chat-input-container button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Typing indicator in immersive mode */
body.immersive-mode .typing-indicator {
    padding: 4px 15px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

/* Video loading indicator in immersive mode */
body.immersive-mode .video-loading-indicator {
    background: rgba(0, 0, 0, 0.7);
    z-index: 50;
}

/* ==========================================
   ASR (Voice Input) STYLES
   ========================================== */

.asr-mic-btn {
    position: fixed;
    bottom: 220px;
    right: 15px;
    z-index: 1001;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.asr-mic-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

.asr-mic-btn.recording {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    animation: pulse-recording 1.5s ease-in-out infinite;
}

.asr-mic-btn.recording .mic-icon {
    display: none;
}

.asr-mic-btn.recording .mic-recording-icon {
    display: block !important;
    animation: pulse-icon 1s ease-in-out infinite;
}

@keyframes pulse-recording {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(231, 76, 60, 0.8);
    }
}

@keyframes pulse-icon {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.8);
        opacity: 0.7;
    }
}

/* ASR Listening Indicator */
.asr-indicator {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    width: 85vw;
    max-width: 85vw;
}

.asr-status {
    color: #22c55e;
    font-size: 16px;
    font-weight: 500;
    font-style: italic;
    animation: glow-text 1.5s ease-in-out infinite;
}

.asr-status.processing {
    color: #f59e0b;
    animation: none;
}

.asr-status.error {
    color: #ef4444;
    animation: none;
}

.asr-status.responding {
    color: #22c55e;
    animation: glow-text 1.5s ease-in-out infinite;
}

.asr-speech {
    color: white;
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    max-width: 80vw;
    word-wrap: break-word;
    display: none;
}

.asr-speech.responding {
    color: #22c55e;
}

.asr-speech.visible {
    display: block;
}

@keyframes glow-text {
    0%, 100% {
        text-shadow: 0 0 5px rgba(34, 197, 94, 0.5), 0 0 10px rgba(34, 197, 94, 0.3);
        opacity: 1;
    }
    50% {
        text-shadow: 0 0 15px rgba(34, 197, 94, 0.8), 0 0 25px rgba(34, 197, 94, 0.5);
        opacity: 0.8;
    }
}

/* ASR mode - hide chat input */
body.immersive-mode.asr-mode .chat-section {
    display: none !important;
}

body.immersive-mode.asr-mode .asr-mic-btn {
    bottom: 30px;
    right: 50%;
    transform: translateX(50%);
}

body.immersive-mode.asr-mode .asr-mic-btn:hover {
    transform: translateX(50%) scale(1.1);
}

/* ==========================================
   PROFILE PAGE STYLES
   ========================================== */

.profile-section {
    max-width: 600px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.profile-header h2 {
    margin: 0;
    flex: 1;
    text-align: center;
    padding-right: 80px; /* Balance the back button */
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f0f2ff;
    color: #667eea;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.profile-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-card {
    background: #f8f9ff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
}

.profile-card h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #333;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-field label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.profile-field input {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.profile-field input:focus {
    outline: none;
    border-color: #667eea;
}

/* User ID Display */
.user-id-display {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-id-label {
    font-size: 0.85rem;
    color: #888;
}

.user-id-value {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #667eea;
    background: #f0f2ff;
    padding: 4px 10px;
    border-radius: 4px;
    user-select: all;
}

/* Current Tier Display */
.current-tier-display {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.tier-badge-large {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tier-badge-large.free {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    color: white;
}

.tier-badge-large.free .tier-icon {
    display: none;
}

.tier-badge-large.silver {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #374151;
}

.tier-badge-large.silver .tier-icon {
    color: #9ca3af;
}

.tier-badge-large.gold {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
}

.tier-badge-large.gold .tier-icon {
    color: #fbbf24;
}

/* Credits Display */
.credits-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.credit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.credit-label {
    color: #666;
    font-size: 0.95rem;
}

.credit-value {
    font-weight: 600;
    font-size: 1.1rem;
    color: #667eea;
}

/* Upgrade Options */
.upgrade-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.upgrade-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upgrade-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.upgrade-header {
    margin-bottom: 15px;
}

.upgrade-tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1rem;
}

.upgrade-tier-badge.silver {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #374151;
}

.upgrade-tier-badge.silver svg {
    color: #9ca3af;
}

.upgrade-tier-badge.gold {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
}

.upgrade-tier-badge.gold svg {
    color: #fbbf24;
}

.upgrade-perks {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
}

.upgrade-perks li {
    padding: 6px 0;
    color: #555;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.upgrade-perks li::before {
    content: "✓";
    color: #10b981;
    font-weight: bold;
}

.btn-upgrade {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.btn-upgrade:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Creator overlay on video */
.creator-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    backdrop-filter: blur(5px);
    z-index: 10;
}

/* Dark mode for profile */
body.dark-mode .profile-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .profile-card h3 {
    color: #e2e8f0;
}

body.dark-mode .profile-field label {
    color: #94a3b8;
}

body.dark-mode .profile-field input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .credit-item {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .credit-label {
    color: #94a3b8;
}

/* Voice Settings */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.setting-info {
    flex: 1;
}

.setting-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.setting-description {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

body.dark-mode .setting-label {
    color: #e2e8f0;
}

body.dark-mode .setting-description {
    color: #94a3b8;
}

body.dark-mode .upgrade-card {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .upgrade-card:hover {
    border-color: #667eea;
}

body.dark-mode .upgrade-perks li {
    color: #94a3b8;
}

body.dark-mode .btn-back {
    background: #1e293b;
    color: #818cf8;
    border-color: #334155;
}

body.dark-mode .btn-back:hover {
    background: #667eea;
    color: white;
}

/* Mobile styles for profile */
@media (max-width: 640px) {
    .profile-header h2 {
        padding-right: 0;
        font-size: 1.3rem;
    }

    .btn-back span {
        display: none;
    }

    .btn-back {
        padding: 8px;
    }

    .profile-card {
        padding: 15px;
    }

    .upgrade-options {
        gap: 12px;
    }
}

/* ==========================================
   PAYMENT MODAL STYLES
   ========================================== */

.payment-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.payment-dialog {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 440px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: paymentSlideIn 0.25s ease-out;
}

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

.payment-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.payment-close:hover {
    color: #333;
}

.payment-header {
    text-align: center;
    margin-bottom: 20px;
}

.payment-tier-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.payment-tier-icon.silver {
    background: linear-gradient(135deg, #e8e8e8, #c0c0c0);
    color: #666;
}

.payment-tier-icon.gold {
    background: linear-gradient(135deg, #fde68a, #f59e0b);
    color: #92400e;
}

.payment-header h3 {
    font-size: 22px;
    color: #333;
    margin: 0 0 8px;
}

.payment-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}

.payment-amount {
    font-size: 36px;
    font-weight: 700;
    color: #333;
}

.payment-once {
    font-size: 14px;
    color: #888;
}

.payment-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px 20px;
}

.payment-features li {
    padding: 6px 0;
    color: #555;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.payment-features li::before {
    content: '\2713';
    color: #22c55e;
    font-weight: 700;
    font-size: 16px;
}

#paypalButtonContainer {
    min-height: 50px;
}

.payment-status {
    text-align: center;
    padding: 16px;
    border-radius: 10px;
    margin-top: 16px;
    font-weight: 600;
    font-size: 14px;
}

.payment-status.success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.payment-status.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.payment-status.processing {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* Payment modal dark mode */
body.dark-mode .payment-dialog {
    background: #1e293b;
}

body.dark-mode .payment-close {
    color: #94a3b8;
}

body.dark-mode .payment-close:hover {
    color: #e0e0e0;
}

body.dark-mode .payment-header h3 {
    color: #e0e0e0;
}

body.dark-mode .payment-amount {
    color: #e0e0e0;
}

body.dark-mode .payment-once {
    color: #94a3b8;
}

body.dark-mode .payment-features {
    background: #0f172a;
}

body.dark-mode .payment-features li {
    color: #cbd5e1;
}

/* Payment modal mobile */
@media (max-width: 640px) {
    .payment-dialog {
        padding: 24px 20px;
        width: 95%;
    }

    .payment-amount {
        font-size: 28px;
    }
}

/* ==========================================
   SCENE SYSTEM STYLES (Gold Tier Feature)
   ========================================== */

/* Scene Section on Homepage */
.scene-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .scene-section {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.scene-section h3 {
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: #333;
}

body.dark-mode .scene-section h3 {
    color: #e0e0e0;
}

.scene-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

body.dark-mode .scene-subtitle {
    color: #999;
}

/* Scene Grid */
.scene-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.no-scenes-hint {
    color: #888;
    font-size: 0.85rem;
    text-align: center;
    padding: 20px;
    grid-column: 1 / -1;
}

/* Scene Card */
.scene-card {
    position: relative;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

body.dark-mode .scene-card {
    background: #2a2a2a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.scene-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.scene-card-image {
    width: 100%;
    height: 80px;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
}

body.dark-mode .scene-card-image {
    background-color: #333;
}

.scene-card-info {
    padding: 10px;
}

.scene-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .scene-card-name {
    color: #e0e0e0;
}

.scene-card-description {
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .scene-card-description {
    color: #999;
}

.scene-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.scene-card:hover .scene-delete-btn {
    opacity: 1;
}

.scene-delete-btn:hover {
    background: #e74c3c;
}

/* Selected Scene Card */
.scene-card.selected {
    border: 2px solid #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

body.dark-mode .scene-card.selected {
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.3);
}

/* Default Scene Card */
.scene-card-default .scene-card-default-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    color: #999;
}

body.dark-mode .scene-card-default .scene-card-default-image {
    background: linear-gradient(135deg, #333 0%, #2a2a2a 100%);
    color: #666;
}

/* Create Scene Button */
#createSceneBtn {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

#createSceneBtn svg {
    flex-shrink: 0;
}

/* Scene Detail Section */
.scene-detail-section {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.scene-detail-section h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

body.dark-mode .scene-detail-section h2 {
    color: #f1f5f9;
}

.scene-detail-content {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

body.dark-mode .scene-detail-content {
    background: #1e293b;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.scene-detail-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #f0f0f0;
    overflow: hidden;
}

body.dark-mode .scene-detail-image-container {
    background: #0f172a;
}

.scene-detail-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scene-detail-upload-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.btn-upload-scene {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.btn-upload-scene:hover {
    background: rgba(0, 0, 0, 0.85);
}

.scene-detail-info {
    padding: 20px;
}

.scene-detail-name h3 {
    margin: 0 0 15px 0;
    font-size: 1.4rem;
    color: #333;
}

body.dark-mode .scene-detail-name h3 {
    color: #f1f5f9;
}

.scene-detail-description {
    margin-bottom: 15px;
}

.scene-detail-description label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

body.dark-mode .scene-detail-description label {
    color: #94a3b8;
}

.scene-description-display {
    color: #555;
    line-height: 1.6;
    margin: 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    min-height: 60px;
}

body.dark-mode .scene-description-display {
    color: #cbd5e1;
    background: #0f172a;
}

.scene-description-edit {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

body.dark-mode .scene-description-edit {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

.scene-detail-creator {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 15px;
}

body.dark-mode .scene-detail-creator {
    color: #64748b;
}

.scene-detail-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.scene-detail-actions .btn-secondary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-choose-scene {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    font-size: 16px;
}

/* Scene Creator Section */
.scene-creator-section {
    padding: 20px;
}

.scene-creator-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

body.dark-mode .scene-creator-subtitle {
    color: #999;
}

#sceneForm .form-group {
    margin-bottom: 18px;
}

#sceneForm label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}

body.dark-mode #sceneForm label {
    color: #e0e0e0;
}

#sceneForm input[type="text"],
#sceneForm textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

body.dark-mode #sceneForm input[type="text"],
body.dark-mode #sceneForm textarea {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

#sceneForm input[type="text"]:focus,
#sceneForm textarea:focus {
    outline: none;
    border-color: #667eea;
}

#sceneForm textarea {
    resize: vertical;
    min-height: 80px;
}

/* Scene Upload Area */
.scene-upload-area {
    min-height: 120px;
}

.scene-upload-area .upload-placeholder {
    padding: 20px;
}

.scene-upload-area .upload-placeholder svg {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    stroke: #999;
}

/* Scene Form Actions */
.scene-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.scene-form-actions .btn-primary,
.scene-form-actions .btn-secondary {
    flex: 1;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

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

.scene-form-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.scene-form-actions .btn-secondary {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
}

body.dark-mode .scene-form-actions .btn-secondary {
    color: #ccc;
    border-color: #444;
}

.scene-form-actions .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .scene-form-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Scene Card Creator Info */
.scene-card-creator {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
    font-style: italic;
}

body.dark-mode .scene-card-creator {
    color: #777;
}

/* Scene Loading Hint */
.scene-loading-hint {
    text-align: center;
    color: #666;
    padding: 20px;
    font-size: 0.9rem;
}

body.dark-mode .scene-loading-hint {
    color: #999;
}

/* Current Scene Indicator (on companion page) */
.current-scene-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 20px;
    font-size: 0.85rem;
}

body.dark-mode .current-scene-indicator {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
}

.scene-label {
    color: #666;
}

body.dark-mode .scene-label {
    color: #999;
}

.scene-name {
    color: #667eea;
    font-weight: 600;
}

.clear-scene-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    color: #666;
    border: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: background 0.2s, color 0.2s;
}

.clear-scene-btn:hover {
    background: #e74c3c;
    color: white;
}

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

.scene-selector-content {
    background: white;
    border-radius: 15px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

body.dark-mode .scene-selector-content {
    background: #1e1e1e;
}

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

body.dark-mode .scene-selector-header {
    border-bottom-color: #333;
}

.scene-selector-header h3 {
    font-size: 1.2rem;
    color: #333;
}

body.dark-mode .scene-selector-header h3 {
    color: #e0e0e0;
}

.close-modal-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

body.dark-mode .close-modal-btn {
    background: #333;
    color: #999;
}

.close-modal-btn:hover {
    background: #e74c3c;
    color: white;
}

.scene-selector-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.scene-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.no-scenes-message {
    text-align: center;
    padding: 30px;
    color: #888;
}

.no-scenes-message p {
    margin-bottom: 5px;
}

/* Scene Selector Card */
.scene-selector-card {
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
}

body.dark-mode .scene-selector-card {
    background: #2a2a2a;
}

.scene-selector-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.scene-selector-card.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.scene-selector-image {
    width: 100%;
    height: 70px;
    background-size: cover;
    background-position: center;
    background-color: #ddd;
}

body.dark-mode .scene-selector-image {
    background-color: #333;
}

.scene-selector-info {
    padding: 10px;
}

.scene-selector-info h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .scene-selector-info h4 {
    color: #e0e0e0;
}

.scene-selector-info p {
    font-size: 0.7rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .scene-selector-info p {
    color: #999;
}

.scene-selector-footer {
    padding: 12px 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: center;
}

body.dark-mode .scene-selector-footer {
    border-top-color: #333;
}

#clearSceneModalBtn {
    padding: 8px 20px;
    font-size: 0.9rem;
}

/* Mobile Styles for Scenes */
@media (max-width: 640px) {
    .scene-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .scene-card-image {
        height: 60px;
    }

    .scene-card-info {
        padding: 8px;
    }

    .scene-selector-content {
        max-height: 90vh;
    }

    .scene-selector-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .scene-selector-image {
        height: 55px;
    }

    .current-scene-indicator {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}

/* ============================================
   AUTHENTICATION STYLES
   ============================================ */

.auth-section {
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 40px 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    position: relative;
}

body.dark-mode .auth-card {
    background: #1e1e1e;
}

.auth-card h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: #333;
    text-align: center;
}

body.dark-mode .auth-card h2 {
    color: #e0e0e0;
}

.auth-subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

body.dark-mode .auth-subtitle {
    color: #aaa;
}

.auth-card .btn-back {
    position: absolute;
    top: 15px;
    left: 15px;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #667eea;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.auth-card .btn-back:hover {
    background: rgba(102, 126, 234, 0.1);
}

.auth-card .form-group {
    margin-bottom: 20px;
}

.auth-card .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

body.dark-mode .auth-card .form-group label {
    color: #e0e0e0;
}

.auth-card .form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

body.dark-mode .auth-card .form-group input {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

.auth-card .form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.auth-card .form-group input::placeholder {
    color: #999;
}

body.dark-mode .auth-card .form-group input::placeholder {
    color: #666;
}

/* Checkbox styling for auth forms */
.checkbox-group {
    margin-top: 8px;
    margin-bottom: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.checkbox-text {
    font-size: 0.9rem;
    color: #555;
}

body.dark-mode .checkbox-text {
    color: #aaa;
}

.input-hint {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-top: 6px;
}

body.dark-mode .input-hint {
    color: #777;
}

.input-status {
    display: block;
    font-size: 0.85rem;
    margin-top: 6px;
    min-height: 20px;
}

.input-status.available {
    color: #22c55e;
}

.input-status.taken {
    color: #ef4444;
}

.input-status.checking {
    color: #888;
}

.auth-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

body.dark-mode .auth-error {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
}

.auth-card .btn-primary {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

body.dark-mode .auth-divider::before,
body.dark-mode .auth-divider::after {
    background: #444;
}

.auth-divider span {
    padding: 0 15px;
    color: #888;
    font-size: 0.85rem;
}

.auth-switch {
    text-align: center;
    color: #666;
    font-size: 0.95rem;
}

body.dark-mode .auth-switch {
    color: #aaa;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Verification Code Input */
.verify-code-group {
    text-align: center;
}

.code-inputs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}

.code-input {
    width: 60px !important;
    height: 70px;
    text-align: center;
    font-size: 1.8rem !important;
    font-weight: 700;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

body.dark-mode .code-input {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

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

.resend-code {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-top: 20px;
}

body.dark-mode .resend-code {
    color: #aaa;
}

.resend-code a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.resend-code a:hover {
    text-decoration: underline;
}

/* Sign In Prompt (for chat section when not authenticated) */
.sign-in-prompt {
    padding: 40px 20px;
    text-align: center;
}

.sign-in-prompt-content {
    max-width: 300px;
    margin: 0 auto;
}

.sign-in-prompt-content svg {
    color: #667eea;
    margin-bottom: 20px;
}

.sign-in-prompt-content h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #333;
}

body.dark-mode .sign-in-prompt-content h3 {
    color: #e0e0e0;
}

.sign-in-prompt-content p {
    color: #666;
    margin-bottom: 25px;
    font-size: 0.95rem;
    line-height: 1.5;
}

body.dark-mode .sign-in-prompt-content p {
    color: #aaa;
}

.sign-in-prompt-content .btn-primary {
    width: auto;
    padding: 12px 30px;
}

/* Profile Page Auth Updates */
.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

body.dark-mode .profile-info-row {
    border-bottom-color: #333;
}

.profile-info-row:last-of-type {
    border-bottom: none;
}

.profile-info-label {
    color: #666;
    font-size: 0.9rem;
}

body.dark-mode .profile-info-label {
    color: #aaa;
}

.profile-info-value {
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
    max-width: 60%;
    text-align: right;
    word-break: break-all;
}

body.dark-mode .profile-info-value {
    color: #e0e0e0;
}

.profile-field {
    margin-bottom: 15px;
}

.profile-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.profile-field input {
    flex: 1;
    padding-right: 80px;
}

.btn-save-name {
    position: absolute;
    right: 8px;
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-save-name:hover {
    background: #5a6fd6;
}

.profile-field-error {
    display: block;
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 6px;
    min-height: 1.2em;
}

/* Profile Picture Styles */
.profile-picture-field {
    margin-bottom: 20px;
}

.profile-picture-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-picture-container {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #f0f0f5 0%, #e8e8f0 100%);
    border: 3px solid #e0e0e8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-picture-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-picture-placeholder {
    color: #aaa;
}

.profile-picture-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-upload-picture,
.btn-remove-picture {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-upload-picture {
    background: #6c5ce7;
    color: white;
    border: none;
}

.btn-upload-picture:hover {
    background: #5a4bd1;
}

.btn-remove-picture {
    background: transparent;
    color: #888;
    border: 1px solid #ddd;
}

.btn-remove-picture:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #ef4444;
}

/* Gender Selection Styles */
.gender-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.gender-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.gender-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #6c5ce7;
    cursor: pointer;
}

.gender-label {
    font-size: 0.9rem;
    color: #555;
}

/* Dark mode */
body.dark-mode .profile-picture-container {
    background: linear-gradient(135deg, #2a2a3e 0%, #232338 100%);
    border-color: #3a3a50;
}

body.dark-mode .profile-picture-placeholder {
    color: #666;
}

body.dark-mode .btn-remove-picture {
    color: #888;
    border-color: #444;
}

body.dark-mode .btn-remove-picture:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: #ef4444;
}

/* NSFW Toggle Styles */
.nsfw-toggle-title {
    font-weight: 600;
    color: #000;
}

.nsfw-toggle-desc {
    font-size: 12px;
    color: #333;
    margin-top: 4px;
}

body.dark-mode .nsfw-toggle-title {
    color: #e0e0e0;
}

body.dark-mode .nsfw-toggle-desc {
    color: #999;
}

body.dark-mode .gender-label {
    color: #bbb;
}

.btn-logout {
    width: 100%;
    padding: 12px 20px;
    margin-top: 20px;
    background: transparent;
    border: 2px solid #ef4444;
    color: #ef4444;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, color 0.2s;
}

.btn-logout:hover {
    background: #ef4444;
    color: white;
}

.not-logged-in-text {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

body.dark-mode .not-logged-in-text {
    color: #aaa;
}

/* Header Sign In State */
.profile-btn .sign-in-text {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Mobile Styles for Auth */
@media (max-width: 480px) {
    .auth-card {
        padding: 30px 20px;
    }

    .auth-card h2 {
        font-size: 1.5rem;
        margin-top: 30px;
    }

    .code-input {
        width: 50px !important;
        height: 60px;
        font-size: 1.5rem !important;
    }

    .code-inputs {
        gap: 8px;
    }
}

/* ==========================================
   FEEDBACK BUTTON & MODAL STYLES
   ========================================== */

.feedback-btn {
    position: fixed;
    bottom: 30px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 9999;
}

.feedback-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

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

.feedback-btn svg {
    flex-shrink: 0;
}

/* Hide in immersive mode */
body.immersive-mode .feedback-btn {
    display: none;
}

/* Feedback Modal */
.feedback-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: 10000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.feedback-modal-content {
    background: white;
    border-radius: 16px;
    padding: 25px;
    max-width: 450px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.feedback-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.feedback-close:hover {
    background: #f0f0f0;
    color: #333;
}

.feedback-modal-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.4rem;
    color: #333;
}

.feedback-desc {
    color: #666;
    margin: 0 0 20px 0;
    font-size: 0.95rem;
}

/* Category buttons */
.feedback-categories {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.feedback-category {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: #f5f7ff;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    transition: all 0.2s;
}

.feedback-category:hover {
    background: #eef1ff;
    border-color: #667eea;
}

.feedback-category.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.category-icon {
    font-size: 1.2rem;
}

/* Textarea */
.feedback-textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    transition: border-color 0.2s;
    margin-bottom: 15px;
}

.feedback-textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Star rating */
.feedback-rating {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.feedback-rating > span {
    font-size: 0.9rem;
    color: #666;
}

.star-rating {
    display: flex;
    gap: 4px;
}

.star {
    background: none;
    border: none;
    font-size: 28px;
    color: #ddd;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.star:hover,
.star.active {
    color: #ffc107;
    transform: scale(1.1);
}

.star.hovered {
    color: #ffc107;
}

/* Submit button */
.feedback-submit {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
}

/* Dark mode */
body.dark-mode .feedback-modal-content {
    background: #1e1e1e;
}

body.dark-mode .feedback-modal-content h3 {
    color: #e0e0e0;
}

body.dark-mode .feedback-desc {
    color: #999;
}

body.dark-mode .feedback-category {
    background: #2a2a2a;
    color: #e0e0e0;
}

body.dark-mode .feedback-category:hover {
    background: #333;
}

body.dark-mode .feedback-category.active {
    background: #667eea;
    color: white;
}

body.dark-mode .feedback-textarea {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-mode .feedback-close {
    color: #999;
}

body.dark-mode .feedback-close:hover {
    background: #333;
    color: #e0e0e0;
}

body.dark-mode .feedback-rating > span {
    color: #999;
}

/* NSFW Age Confirmation Modal */
.nsfw-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
    backdrop-filter: blur(6px);
}

.nsfw-modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.3s ease;
    border: 2px solid #ff6b6b;
}

.nsfw-modal-content ul {
    list-style-type: none;
    padding-left: 0;
}

.nsfw-modal-content ul li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.nsfw-modal-content ul li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

body.dark-mode .nsfw-modal-content {
    background: #1e1e1e;
    border-color: #ff6b6b;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .feedback-btn {
        bottom: 25px;
        right: 15px;
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .feedback-btn span {
        display: none;
    }

    .feedback-btn {
        padding: 12px;
        border-radius: 50%;
    }

    .feedback-modal-content {
        padding: 20px;
    }

    .feedback-categories {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .feedback-category {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}
