/* Chat text size override (controlled by slider, stored in localStorage) */
:root { --chat-text-size: 14px; }
#chat-messages .message-bubble {
    font-size: var(--chat-text-size) !important;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ChatGPT-Style Sidebar Layout with Avatar Support */

/* ============================================
   MODE BANNERS (Companion / Learn)
   ============================================ */
.mode-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
}
.mode-banner-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.mode-banner-companion {
    background: #fce7f3;
    color: #9d174d;
    border: 1px solid #fbcfe8;
}
.dark .mode-banner-companion {
    background: #831843;
    color: #f9a8d4;
    border-color: #9d174d;
}
.mode-banner-learn {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.dark .mode-banner-learn {
    background: #064e3b;
    color: #6ee7b7;
    border-color: #065f46;
}

/* ============================================
   GLOBAL POLISH - iPhone-like UX
   ============================================ */

/* Smooth scrolling everywhere */
html {
    scroll-behavior: smooth;
}

/* Better focus states for accessibility and visual polish */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Remove default focus outline for mouse users, keep for keyboard */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Smooth transitions for all interactive elements */
button, a, input, textarea, select {
    transition: all 0.2s ease;
}

/* Input fields - smooth focus transition */
input:focus, textarea:focus, select:focus {
    transition: all 0.2s ease, box-shadow 0.2s ease;
}

/* Disable text selection on buttons for cleaner UX */
button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent; /* Remove iOS tap highlight */
}

/* Smooth hover transitions for all links */
a {
    -webkit-tap-highlight-color: transparent;
}

/* Modern scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

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

/* Firefox scrollbar - apply to scrollable elements */
.main-sidebar,
.chat-messages,
.sidebar-section-content,
.chat-history-list,
.character-picker-modal,
textarea {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.dark .main-sidebar,
.dark .chat-messages,
.dark .sidebar-section-content,
.dark .chat-history-list,
.dark .character-picker-modal,
.dark textarea {
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Character Picker Modal Styles */
#character-picker-modal {
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

#character-picker-modal .bg-white {
    animation: slideUp 0.3s ease-out;
}

.character-picker-item {
    transition: all 0.2s ease;
    cursor: pointer;
}

.character-picker-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.character-picker-item:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.dark .character-picker-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dark .character-picker-item:active {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.character-avatar-small {
    flex-shrink: 0;
    font-size: 0.875rem;
}

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

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

/* Reset button next to send - removed header styles */

/* Character Reply Toggle Styles */
.character-reply-toggle, #bot-reply-toggle {
    appearance: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    background: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.dark .character-reply-toggle, .dark #bot-reply-toggle {
    border-color: #6b7280;
    background: #374151;
}

.character-reply-toggle:checked, #bot-reply-toggle:checked {
    background: #10b981;
    border-color: #10b981;
}

.character-reply-toggle:checked::after, #bot-reply-toggle:checked::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 1px;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Prevent body scrolling */
body {
    margin: 0;
    padding: 0;
}

/* Main layout container */
.app-container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* Unified Main Sidebar */
.main-sidebar {
    width: clamp(220px, 70%, 320px);
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 30;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
    overflow: hidden;
}

.dark .main-sidebar {
    background: #1f2937;
    border-right-color: #374151;
}

/* Minimized state - floating button only */
.main-sidebar.minimized {
    width: 0;
    border: none;
    background: transparent;
    overflow: visible;
}

/* Hide all content when minimized */
.main-sidebar.minimized .sidebar-content,
.main-sidebar.minimized .sidebar-title {
    display: none;
}

/* Show content when expanded */
.main-sidebar:not(.minimized) .sidebar-content,
.main-sidebar:not(.minimized) .sidebar-title {
    display: block;
}

/* Floating button when minimized */
.main-sidebar.minimized .daily-note-label,
.main-sidebar.minimized .daily-note-msg {
    display: none;
}

.main-sidebar.minimized .sidebar-header {
    position: fixed;
    top: 1rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 50;
}

.dark .main-sidebar.minimized .sidebar-header {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Normal header when expanded */
.main-sidebar:not(.minimized) .sidebar-header {
    position: relative;
    justify-content: space-between;
    padding: 1rem;
    width: auto;
    height: auto;
    border-radius: 0;
    box-shadow: none;
}

/* Minimize button styles */
.sidebar-minimize-btn {
    flex-shrink: 0;
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

/* Floating button when minimized */
.main-sidebar.minimized .sidebar-minimize-btn {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 8px;
}

.main-sidebar.minimized .sidebar-minimize-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

.dark .main-sidebar.minimized .sidebar-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.main-sidebar.minimized #chat-history-section::before {
    content: '💬';
    font-size: 1.5rem;
    text-align: center;
    display: block;
}

.main-sidebar.minimized #current-chat-section::before {
    content: '⚙️';
    font-size: 1.5rem;
    text-align: center;
    display: block;
}

.main-sidebar.minimized #character-library-section::before {
    content: '👤';
    font-size: 1.5rem;
    text-align: center;
    display: block;
}

/* Sidebar minimize button */
.sidebar-minimize-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.sidebar-minimize-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #374151;
    transform: translateX(-1px);
}

.sidebar-minimize-btn:active {
    transform: translateX(0) scale(0.95);
}

.dark .sidebar-minimize-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #9ca3af;
}

.dark .sidebar-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

/* Rotate arrow when minimized with smooth transition */
.sidebar-minimize-btn svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-sidebar.minimized .sidebar-minimize-btn svg {
    transform: rotate(180deg);
}

.main-sidebar:not(.minimized) .sidebar-minimize-btn svg {
    transform: rotate(0deg);
}

/* Body padding adjustment with smooth transitions */
body {
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body.has-sidebar {
    margin-left: clamp(220px, 70%, 320px);
}


/* When minimized, content takes full width */
body.has-sidebar-minimized {
    margin-left: 0;
}

body.has-sidebar-minimized .chat-input-container {
    left: 0;
}




/* Sidebar header */
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.dark .sidebar-header {
    border-bottom-color: #374151;
}

.dark .sidebar-title {
    color: #f3f4f6;
}


/* Sidebar content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.sidebar-section {
    border-bottom: 1px solid #e5e7eb;
}

.dark .sidebar-section {
    border-bottom-color: #374151;
}

.sidebar-section-header {
    padding: 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-section-header:hover {
    background: #f3f4f6;
}

.sidebar-section-header:active {
    transform: scale(0.98);
}

.dark .sidebar-section-header {
    color: #d1d5db;
    background: #111827;
    border-bottom-color: #374151;
}

.dark .sidebar-section-header:hover {
    background: #1f2937;
}

.sidebar-section-content {
    overflow-y: auto;
    transition: max-height 0.3s ease;
    background: white;
    -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
}

.dark .sidebar-section-content {
    background: #1f2937;
}

.sidebar-section-content.chat-history {
    max-height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-section-content.character-library {
    max-height: 250px;
}

.sidebar-section-content.character-setup {
    max-height: 300px;
}

.sidebar-section.collapsed .sidebar-section-content {
    max-height: 0;
    overflow: hidden;
}

/* Chat History Header */
.chat-history-header {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.dark .chat-history-header {
    border-bottom-color: #374151;
}

/* Chat history items - ChatGPT style */
.chat-history-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 2px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    group: hover;
    background: white;
}

.dark .chat-history-item {
    background: #1f2937;
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    margin: 0;
    min-height: 0;
}

.chat-history-item:hover {
    background: #f3f4f6;
    transform: translateX(2px);
}

.chat-history-item:active {
    transform: scale(0.98);
}

.dark .chat-history-item:hover {
    background: #374151;
}

.chat-history-item.active {
    background: #e0f2fe;
    border-left: 3px solid #0ea5e9;
}

.dark .chat-history-item.active {
    background: #0c4a6e;
    border-left-color: #38bdf8;
}

/* Chat content area */
.chat-content {
    flex: 1;
    min-width: 0;
    padding-right: 0.5rem;
}

.chat-title {
    font-size: 0.875rem;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    line-height: 1.25;
}

.dark .chat-title {
    color: #e5e7eb;
}

.chat-date {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.125rem;
}

.dark .chat-date {
    color: #9ca3af;
}

/* Chat actions */
.chat-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.chat-history-item:hover .chat-actions {
    opacity: 1;
}

.chat-action-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    border-radius: 4px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-action-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.dark .chat-action-btn {
    color: #9ca3af;
}

.dark .chat-action-btn:hover {
    background: #4b5563;
    color: #f3f4f6;
}

/* Expanded sections by default */
.sidebar-section.expanded .sidebar-section-content {
    max-height: none;
}

/* Character setup in sidebar */
.character-setup {
    padding: 1rem;
}

/* Character library items with avatar support */
.character-library-item {
    padding: 0.75rem 1rem;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
}

.dark .character-library-item {
    border-bottom-color: #374151;
    background: #1f2937;
}

.character-library-item:hover {
    background: #f3f4f6;
}

.dark .character-library-item:hover {
    background: #374151;
}

.character-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    flex-shrink: 0;
}

.character-avatar.has-image {
    background: none;
    overflow: hidden;
}

.character-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.character-info {
    flex: 1;
    min-width: 0;
}

.character-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .character-name {
    color: #f3f4f6;
}

.character-description {
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.125rem;
}

.dark .character-description {
    color: #9ca3af;
}

.character-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.character-library-item:hover .character-actions {
    opacity: 1;
}

.character-action-btn {
    background: none;
    border: none;
    padding: 0.375rem;
    border-radius: 4px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-action-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.dark .character-action-btn {
    color: #9ca3af;
}

.dark .character-action-btn:hover {
    background: #4b5563;
    color: #f3f4f6;
}

.character-quick-setup {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setup-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.setup-field label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
}

.dark .setup-field label {
    color: #d1d5db;
}

.setup-field input,
.setup-field textarea {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    background: white;
    color: #374151;
    resize: vertical;
}

.dark .setup-field input,
.dark .setup-field textarea {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.setup-field textarea {
    min-height: 60px;
    max-height: 120px;
}

/* Main content area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .main-content {
    background: #111827;
}

/* Chat area - structured layout */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    margin: 20px;
    margin-bottom: 20px;
    position: relative;
}

.dark .chat-container {
    background: #111827;
}

/* Floating toggle removed - using sidebar minimize button instead */

/* Chat messages with avatar support */
.message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
}

.message-avatar.user-avatar {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.message-avatar.character-avatar {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
}

.message-avatar.has-image {
    background: none;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    flex: 1;
    max-width: calc(100% - 50px);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.message-author {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.dark .message-author {
    color: #f3f4f6;
}

.message-time {
    font-size: 0.75rem;
    color: #6b7280;
}

.dark .message-time {
    color: #9ca3af;
}

.message-text {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #374151;
}

.dark .message-text {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.user-message .message-text {
    background: #3b82f6;
    border-color: #2563eb;
    color: white;
}

.dark .user-message .message-text {
    background: #1d4ed8;
    border-color: #1e40af;
    color: white !important;
}

/* Typing indicator */
.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
    animation: typing 1.5s infinite;
}

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

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

@keyframes typing {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* RP text formatting: *actions* italic, "dialogue" bold, narration plain */
.rp-action {
    font-style: italic;
    opacity: 0.82;
}
.rp-dialogue {
    font-weight: 600;
}

/* Old chat header styles removed */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
}

.dark .chat-messages {
    background: #1f2937;
    border-color: #374151;
}

.chat-input-container {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* Controls row: sidebar button, quality toggle, fullscreen button */
.input-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

.dark .chat-input-container {
    background: #1f2937;
    border-color: #374151;
}


/* Settings gear control */
.settings-gear-control {
    position: relative;
    flex-shrink: 0;
}

.settings-gear-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    width: 260px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 70vh;
    overflow-y: auto;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.settings-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Settings/control buttons */
.typing-speed-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    padding: 0.4rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

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

.typing-speed-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.typing-speed-value {
    font-weight: 600;
    color: var(--text-primary);
}

.typing-speed-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-primary);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.typing-speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.typing-speed-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.typing-speed-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Mobile menu button (sidebar tab) - hidden on desktop, visible on mobile */
.mobile-menu-button {
    display: none; /* Hidden by default, shown on mobile */
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dark .mobile-menu-button {
    background: #374151;
    border-color: #4b5563;
}

.mobile-menu-button {
    transition: all 0.2s ease;
}

.mobile-menu-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.mobile-menu-button:active {
    transform: scale(0.95) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Fullscreen toggle button */
.fullscreen-toggle-button {
    display: flex; /* Always visible */
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dark .fullscreen-toggle-button {
    background: #374151;
    border-color: #4b5563;
}

.fullscreen-toggle-button {
    transition: all 0.2s ease;
}

.fullscreen-toggle-button:hover {
    background: #e2e8f0;
}

.dark .fullscreen-toggle-button:hover {
    background: #4b5563;
}

.fullscreen-toggle-button:active {
    transform: scale(0.95) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* When chat container is fullscreen, keep button in top-right */
#chat-container-main:fullscreen .fullscreen-toggle-button {
    position: fixed;
    top: 1rem;
    right: 1rem;
}

/* CSS-based fullscreen mode for iOS and unsupported browsers */
#chat-container-main.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: calc(var(--vh, 1vh) * 100) !important; /* Use actual viewport height (fixes mobile browser chrome) */
    z-index: 9999 !important;
    background: white;
    margin: 0 !important;
    padding: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important; /* Remove any gap between elements */
}

.dark #chat-container-main.fullscreen-mode {
    background: #111827;
}

/* Ensure chat messages fills available space in fullscreen */
#chat-container-main.fullscreen-mode #chat-messages {
    flex: 1 !important;
    background: inherit; /* Match container background */
    border: none !important; /* Remove border in fullscreen */
    border-radius: 0 !important; /* Remove rounded corners in fullscreen */
    margin-bottom: 0 !important; /* Remove gap between chat and input */
}

/* Ensure input container has proper background and stays at bottom in fullscreen */
#chat-container-main.fullscreen-mode .chat-input-container {
    background: inherit; /* Match container background */
    border: none !important; /* Remove border in fullscreen */
    border-top: none !important; /* Remove top border in fullscreen */
    border-radius: 0 !important; /* Remove rounded corners in fullscreen */
    flex-shrink: 0 !important; /* Don't shrink - stay at bottom */
}

/* Mobile-specific fullscreen adjustments */
@media (max-width: 768px) {
    #chat-container-main.fullscreen-mode {
        padding: 12px !important; /* Smaller padding on mobile for more space */
    }
}

/* Fullscreen button stays in input row during fullscreen mode */
#chat-container-main.fullscreen-mode .fullscreen-toggle-button {
    /* No repositioning - stays in input-controls-row */
}

/* Hide sidebar button in fullscreen mode */
#chat-container-main.fullscreen-mode .mobile-menu-button {
    display: none !important;
}

/* Prevent body scroll when in CSS fullscreen mode */
body.chat-fullscreen-active {
    overflow: hidden !important;
}

/* Hide buttons when sidebar is open on mobile */
body.sidebar-open .mobile-menu-button,
body.sidebar-open .fullscreen-toggle-button {
    display: none !important;
}

/* Desktop - hide sidebar button, show fullscreen inline */
@media (min-width: 769px) {
    .mobile-menu-button {
        display: none !important; /* Never show sidebar button on desktop */
    }

    .fullscreen-toggle-button {
        display: flex; /* Show fullscreen on desktop */
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .mobile-menu-button {
        display: flex; /* Show sidebar button on mobile */
    }

    .fullscreen-toggle-button {
        display: flex; /* Show fullscreen button on mobile */
    }

    .input-controls-row {
        margin-bottom: 0.5rem;
    }

    /* Keep NSFW and GOD inline on mobile */
    .god-nsfw-group {
        flex-direction: row;
        gap: 0.375rem;
    }
    /* Remove body margin on mobile */
    body.has-sidebar,
    body.has-sidebar-minimized {
        margin-left: 0 !important;
    }
    
    .chat-input-container {
        left: 0 !important;
    }
    
    /* Make chat take more space on mobile with comfortable margins */
    .chat-container {
        height: calc(100vh - 48px) !important; /* Account for 16px margins */
        margin: 16px !important; /* Comfortable spacing from edges */
        margin-bottom: 16px !important;
    }
    
    .main-sidebar {
        position: fixed;
        width: 100vw;
        height: 100vh;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        z-index: 50;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
        overflow-y: auto; /* Allow scrolling of sidebar content on mobile */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    /* Make sidebar content readable on mobile */
    .main-sidebar .sidebar-content {
        padding: 1rem; /* Comfortable padding for mobile */
    }

    /* Section headers sized for mobile readability */
    .main-sidebar .sidebar-section-header {
        padding: 1rem; /* Comfortable padding */
        font-size: 0.875rem; /* 14px - readable size */
    }

    /* Section content properly sized */
    .main-sidebar .sidebar-section-content {
        font-size: 0.875rem; /* 14px - readable on mobile */
    }

    /* Upgrade widget properly spaced on mobile */
    .main-sidebar .upgrade-widget {
        margin: 1rem !important; /* Comfortable margins */
        padding: 1rem !important; /* Comfortable padding */
    }

    .main-sidebar .upgrade-widget .text-sm {
        font-size: 0.875rem !important; /* 14px - minimum readable */
    }

    .main-sidebar .upgrade-widget .text-xs {
        font-size: 0.8125rem !important; /* 13px - not too small */
        line-height: 1.4 !important; /* Better readability */
    }
    
    .main-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* Overlay for mobile */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Hidden sidebar state */
.main-sidebar.hidden {
    transform: translateX(-100%);
}

/* Smooth animations */
* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Scrollbar styling */
.sidebar-content::-webkit-scrollbar,
.sidebar-section-content::-webkit-scrollbar,
.chat-history-list::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track,
.sidebar-section-content::-webkit-scrollbar-track,
.chat-history-list::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb,
.sidebar-section-content::-webkit-scrollbar-thumb,
.chat-history-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.dark .sidebar-content::-webkit-scrollbar-thumb,
.dark .sidebar-section-content::-webkit-scrollbar-thumb,
.dark .chat-history-list::-webkit-scrollbar-thumb {
    background: #4b5563;
}

/* Smooth scrolling for chat history */
.chat-history-list {
    scroll-behavior: smooth;
}

/* Hide traditional setup panel */
.traditional-setup {
    display: none;
}

/* Character slot styling */
.character-slot {
    position: relative;
    transition: all 0.2s ease-in-out;
}

.character-slot:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.character-card {
    transition: all 0.2s ease-in-out;
}

.character-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.template-card {
    transition: all 0.2s ease-in-out;
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Collapsible sections */
.section-toggle-icon {
    transition: transform 0.2s ease;
}

.sidebar-section.collapsed .section-toggle-icon {
    transform: rotate(-90deg);
}

/* Scene Builder - Steve Jobs Style Design */
#scene-builder {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Scene Chips - Premium Button Design */
.scene-chip {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.025em;
    text-align: center;
    min-width: 0;
    white-space: nowrap;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dark .scene-chip {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border-color: #4b5563;
    color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.scene-chip:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dark .scene-chip:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    border-color: #6b7280;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.scene-chip.selected {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: #2563eb;
    color: white;
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.dark .scene-chip.selected {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    border-color: #3b82f6;
    box-shadow: 0 4px 16px rgba(29, 78, 216, 0.4);
}

.scene-chip:active {
    transform: scale(0.98);
}

/* Generate Button - Premium Gradient */
#generate-character-btn {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 600;
    letter-spacing: 0.025em;
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.25);
    position: relative;
    overflow: hidden;
}

#generate-character-btn:hover:not(:disabled) {
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.35);
    transform: translateY(-1px);
}

#generate-character-btn:disabled {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #94a3b8;
    box-shadow: none;
}

.dark #generate-character-btn:disabled {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    color: #6b7280;
}

/* Manual Setup Toggle */
#manual-setup-toggle {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.2s ease;
}

#manual-setup-toggle:hover {
    background: rgba(59, 130, 246, 0.05);
    border-radius: 6px;
    padding: 8px;
    margin: -8px;
}

.dark #manual-setup-toggle:hover {
    background: rgba(59, 130, 246, 0.1);
}

#manual-setup-toggle.expanded svg {
    transform: rotate(180deg);
}

/* Premium Input Styling */
#manual-setup-content input,
#manual-setup-content textarea {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.2s ease;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#manual-setup-content input:focus,
#manual-setup-content textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Sidebar Header Enhancement */
.sidebar-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.dark .sidebar-header {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-bottom-color: #374151;
}


/* Section Headers Enhancement */
.sidebar-section-header {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 600;
    letter-spacing: 0.025em;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.dark .sidebar-section-header {
    background: linear-gradient(135deg, #111827 0%, #0f172a 100%);
}

/* Character role badges */
.character-role-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.character-role-badge.user {
    background: #dbeafe;
    color: #1e40af;
}

.dark .character-role-badge.user {
    background: #1e3a8a;
    color: #93c5fd;
}

.character-role-badge.bot {
    background: #dcfce7;
    color: #166534;
}

.dark .character-role-badge.bot {
    background: #14532d;
    color: #86efac;
}

.character-role-badge.additional {
    background: #fef3c7;
    color: #92400e;
}

.dark .character-role-badge.additional {
    background: #78350f;
    color: #fcd34d;
}

/* Character Library Items Enhancement */
.character-library-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    margin: 4px 8px;
    padding: 12px;
}

.character-library-item:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.dark .character-library-item:hover {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Character Reply Toggle Styles */
.character-reply-toggle, #bot-reply-toggle {
    appearance: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    background: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.dark .character-reply-toggle, .dark #bot-reply-toggle {
    border-color: #6b7280;
    background: #374151;
}

.character-reply-toggle:checked, #bot-reply-toggle:checked {
    background: #10b981;
    border-color: #10b981;
}

.character-reply-toggle:checked::after, #bot-reply-toggle:checked::after {
    content: '\2713';
    position: absolute;
    top: -2px;
    left: 1px;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Enhanced UI Polish */
/* Reset button next to send button */
#reset-chat-button {
    transition: all 0.2s ease;
}

#reset-chat-button:hover {
    background-color: #ef4444 !important;
    color: white !important;
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

#reset-chat-button:active {
    transform: translateY(0) scale(0.95) !important;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2) !important;
}

/* Message animations */
.message {
    animation: slideInUp 0.3s ease-out;
}

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

/* Improved chat input */
#chat-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Send button improvements */
#send-button {
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.2);
}

#send-button:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

#send-button:active:not(:disabled) {
    transform: translateY(0) scale(0.95) !important;
    box-shadow: 0 1px 2px rgba(14, 165, 233, 0.3) !important;
}

#send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============================================
   MOBILE CHARACTER PICKER OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    /* Make modal full-screen on mobile */
    #character-picker-modal {
        padding: 0 !important;
        align-items: stretch !important;
    }

    #character-picker-modal > div {
        max-width: 100% !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    /* Header adjustments */
    #character-picker-modal .flex.items-center.justify-between {
        padding: 1rem !important;
        flex-shrink: 0; /* Keep header fixed */
    }

    #character-picker-modal h2 {
        font-size: 1.5rem !important;
    }

    /* Make close button larger for touch */
    #character-picker-close {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px;
        min-height: 44px;
    }

    /* Role assignment preview - keep horizontal, make very compact */
    #role-assignment-preview {
        padding: 0.5rem 0.75rem !important;
        flex-shrink: 0; /* Don't shrink header */
    }

    /* Keep items horizontal with minimal spacing */
    #role-assignment-preview > div {
        gap: 0.25rem !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
    }

    /* Make role items extremely compact */
    #role-assignment-preview .flex.items-center {
        gap: 0.25rem !important;
    }

    /* Smaller text on mobile */
    #role-assignment-preview .text-xs {
        font-size: 0.6rem !important;
        line-height: 1 !important;
    }

    #role-assignment-preview .text-sm {
        font-size: 0.7rem !important;
        line-height: 1.2 !important;
    }

    /* Smaller dots */
    #role-assignment-preview .w-3 {
        width: 0.4rem !important;
        height: 0.4rem !important;
    }

    /* Make arrow smaller */
    #role-assignment-preview svg {
        width: 0.75rem !important;
        height: 0.75rem !important;
    }

    /* Search bar optimization */
    #character-search {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
        padding: 0.875rem 1rem 0.875rem 3rem !important;
    }

    /* Prevent iOS zoom on input focus - all inputs need 16px minimum */
    #scenario,
    #user-persona,
    #bot-persona,
    textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    /* Chat input - fix placeholder overflow on mobile */
    #chat-input {
        font-size: 16px !important; /* Prevents iOS zoom */
    }

    #chat-input::placeholder {
        font-size: 14px !important;
    }

    /* Character grid - single column on small mobile */
    #characters-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Character cards - larger touch targets */
    .character-picker-item {
        padding: 1rem !important;
        min-height: 80px;
    }

    /* Character card content */
    .character-picker-item .character-avatar-small {
        width: 56px !important;
        height: 56px !important;
        font-size: 1.5rem !important;
    }

    .character-picker-item h4 {
        font-size: 1rem !important;
    }

    .character-picker-item p {
        font-size: 0.875rem !important;
    }

    /* Footer buttons - full width stack */
    #character-picker-modal .flex.items-center.justify-end {
        padding: 1rem !important;
        flex-direction: column-reverse !important;
        gap: 0.75rem !important;
        flex-shrink: 0; /* Keep footer fixed at bottom */
    }

    #character-picker-modal .flex.items-center.justify-end > * {
        width: 100% !important;
    }

    #character-picker-apply,
    #character-picker-cancel,
    #character-picker-clear {
        width: 100% !important;
        min-height: 44px !important;
        justify-content: center !important;
        font-size: 1rem !important;
    }

    /* Scrollable content area */
    #character-picker-modal .overflow-y-auto {
        flex: 1 1 0; /* Grow, shrink, base size 0 */
        min-height: 0; /* Allow flexbox to shrink below content size */
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Ensure the direct parent of scrollable content also allows scrolling */
    #character-picker-modal > div > div.p-6 {
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto !important;
    }
}

/* Medium mobile devices (up to 480px) */
@media (max-width: 480px) {
    /* Even larger touch targets for small phones */
    .character-picker-item {
        min-height: 88px;
        padding: 1.25rem !important;
    }

    #character-picker-modal h2 {
        font-size: 1.25rem !important;
    }

    /* Larger search on very small screens */
    #character-search {
        padding: 1rem 1rem 1rem 3.25rem !important;
    }
}

/* Tablet optimization (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    /* 2-column grid on tablets */
    #characters-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    #character-picker-modal > div {
        max-width: 90vw !important;
    }
}


/* ============================================
   SOFT UPGRADE PROMPT BANNER
   ============================================ */

.soft-upgrade-banner {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 12px 16px;
    margin: 8px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    animation: slideDown 0.3s ease-out;
    transition: opacity 0.3s ease;
}

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

.soft-upgrade-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.soft-upgrade-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    min-width: 200px;
}

.soft-upgrade-cta {
    background: white;
    color: #1d4ed8;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.soft-upgrade-cta:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.soft-upgrade-dismiss {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s ease;
}

.soft-upgrade-dismiss:hover {
    color: white;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .soft-upgrade-banner {
        margin: 4px;
        padding: 10px 12px;
    }

    .soft-upgrade-content {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .soft-upgrade-message {
        min-width: auto;
    }

    .soft-upgrade-cta {
        width: 100%;
        text-align: center;
    }

    .soft-upgrade-dismiss {
        position: absolute;
        top: 8px;
        right: 8px;
    }

    .soft-upgrade-banner {
        position: relative;
    }
}

/* ============================================
   STARTER CHARACTERS WELCOME GRID
   ============================================ */

/* ── Starter Characters Welcome ── */
.starter-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 2.5rem 1.5rem 2rem;
    text-align: center;
    min-height: 0;
}

.starter-welcome-title {
    font-size: 1.625rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.375rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    letter-spacing: -0.01em;
}

.dark .starter-welcome-title {
    color: #f1f5f9;
}

.starter-welcome-subtitle {
    font-size: 0.9375rem;
    color: #64748b;
    margin: 0 0 1.75rem 0;
}

.dark .starter-welcome-subtitle {
    color: #94a3b8;
}

/* Grid: 2 columns mobile, 4 on desktop (8 cards = 2 clean rows) */
.starter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
    width: 100%;
    max-width: 640px;
}

@media (min-width: 900px) {
    .starter-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 820px;
    }
}

@media (min-width: 769px) and (max-width: 899px) {
    .starter-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 720px;
    }
}

/* Individual card */
.starter-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.125rem 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    min-height: 48px;
    position: relative;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

.dark .starter-card {
    background: #1e293b;
    border-color: #334155;
}

.starter-card:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.15);
}

.dark .starter-card:hover {
    border-color: #3b82f6;
    background: #1e3a5f;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.25);
}

.starter-card:active {
    transform: translateY(0) scale(0.97);
}

.starter-card-emoji {
    font-size: 2rem;
    line-height: 1;
}

.starter-card-avatar {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #e2e8f0;
}

.dark .starter-card-avatar {
    border-color: #475569;
}

.starter-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.starter-card-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
}

.dark .starter-card-name {
    color: #f1f5f9;
}

.starter-card-tagline {
    font-size: 0.6875rem;
    color: #64748b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark .starter-card-tagline {
    color: #94a3b8;
}

.starter-card-badge {
    display: inline-block;
    font-size: 0.5625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin-top: 0.125rem;
}

.dark .starter-card-badge {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.2);
}

/* Footer below grid: browse all + divider + custom button */
.starter-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
    margin-top: 1.25rem;
}

.starter-browse-all {
    font-size: 0.875rem;
    font-weight: 500;
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.15s;
}

.starter-browse-all:hover {
    color: #2563eb;
    text-decoration: underline;
}

.dark .starter-browse-all {
    color: #93c5fd;
}

.dark .starter-browse-all:hover {
    color: #bfdbfe;
}

.starter-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 200px;
    color: #94a3b8;
    font-size: 0.75rem;
}

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

.dark .starter-divider::before,
.dark .starter-divider::after {
    background: #334155;
}

.starter-custom-btn {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    background: none;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 0.625rem 1.25rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.starter-custom-btn:hover {
    color: #3b82f6;
    border-color: #93c5fd;
    background: rgba(59, 130, 246, 0.04);
}

.dark .starter-custom-btn {
    color: #94a3b8;
    border-color: #475569;
}

.dark .starter-custom-btn:hover {
    color: #93c5fd;
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

/* "Create a Character" button in anonymous footer */
.starter-create-character-btn {
    font-size: 0.875rem;
    font-weight: 500;
    color: #3b82f6;
    background: none;
    border: 1px solid #3b82f6;
    border-radius: 10px;
    padding: 0.625rem 1.25rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.starter-create-character-btn:hover {
    color: #fff;
    background: #3b82f6;
}

.dark .starter-create-character-btn {
    color: #93c5fd;
    border-color: #3b82f6;
}

.dark .starter-create-character-btn:hover {
    color: #fff;
    background: #3b82f6;
}

/* Inline character describe input */
.starter-inline-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 480px;
    animation: fadeIn 0.2s ease;
}

.starter-inline-textarea {
    width: 100%;
    min-height: 80px;
    max-height: 160px;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.5;
    color: #1e293b;
    background: #fff;
    border: 1.5px dashed #cbd5e1;
    border-radius: 12px;
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.starter-inline-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    border-style: solid;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.starter-inline-textarea::placeholder {
    color: #94a3b8;
}

.dark .starter-inline-textarea {
    color: #f1f5f9;
    background: #1e293b;
    border-color: #475569;
}

.dark .starter-inline-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.dark .starter-inline-textarea::placeholder {
    color: #64748b;
}

.starter-inline-submit {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: #0ea5e9;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.2);
}

.starter-inline-submit:hover {
    background: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.starter-inline-submit:active {
    transform: translateY(0) scale(0.98);
}

.dark .starter-inline-submit {
    background: #0284c7;
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.3);
}

.dark .starter-inline-submit:hover {
    background: #0369a1;
}

.starter-inline-back {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    transition: all 0.15s;
    font-family: inherit;
}

.starter-inline-back:hover {
    color: #334155;
    background: rgba(0, 0, 0, 0.04);
}

.dark .starter-inline-back {
    color: #94a3b8;
}

.dark .starter-inline-back:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 768px) {
    .starter-inline-textarea {
        font-size: 16px !important; /* Prevents iOS zoom */
    }
}

/* Create new character card */
.starter-create-card {
    border-style: dashed;
    border-color: #cbd5e1;
    background: transparent;
}

.starter-create-card:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.04);
}

.dark .starter-create-card {
    border-color: #475569;
}

.dark .starter-create-card:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.starter-create-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    font-size: 1.5rem;
    font-weight: 300;
    flex-shrink: 0;
}

.dark .starter-create-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

/* Mobile */
@media (max-width: 768px) {
    .starter-welcome {
        padding: 1.5rem 1rem 1.25rem;
    }

    .starter-welcome-title {
        font-size: 1.25rem;
    }

    .starter-grid {
        gap: 0.625rem;
    }

    .starter-card {
        padding: 0.875rem 0.5rem 0.75rem;
        min-height: 44px;
    }

    .starter-card-avatar {
        width: 3rem;
        height: 3rem;
    }

    .starter-create-icon {
        width: 3rem;
        height: 3rem;
        font-size: 1.25rem;
    }

    .play-as-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Pulse animation for chat input after character selection */
@keyframes input-pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
    50% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3); }
}
.input-pulse {
    animation: input-pulse-glow 1s ease-in-out 2;
    border-color: #3b82f6 !important;
}

/* ============================================
   "Play as" character picker (chat area)
   ============================================ */
.play-as-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem 2rem;
    min-height: 40vh;
    animation: fadeIn 0.2s ease;
}

.play-as-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 0.25rem;
    text-align: center;
}

.dark .play-as-title {
    color: #f1f5f9;
}

.play-as-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0 0 1.5rem;
    text-align: center;
}

.dark .play-as-subtitle {
    color: #94a3b8;
}

.play-as-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
    width: 100%;
    max-width: 480px;
    margin-bottom: 1.25rem;
}

.play-as-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 0.5rem;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.play-as-card:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.04);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.dark .play-as-card {
    background: #1e293b;
    border-color: #334155;
}

.dark .play-as-card:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.play-as-avatar {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.dark .play-as-avatar {
    border-color: #475569;
}

.play-as-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 1.125rem;
    font-weight: 600;
    flex-shrink: 0;
}

.play-as-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: #334155;
    text-align: center;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark .play-as-name {
    color: #cbd5e1;
}

.play-as-skip {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.15s;
    font-family: inherit;
}

.play-as-skip:hover {
    color: #334155;
    background: rgba(0, 0, 0, 0.04);
}

.dark .play-as-skip {
    color: #94a3b8;
}

.dark .play-as-skip:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
}

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

/* ============================================
   GOD MODE TOGGLE
   ============================================ */

.god-mode-control {
    flex-shrink: 0;
}

.god-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 9999px;
    border: 1px solid var(--border-primary, #e2e8f0);
    background: var(--bg-tertiary, #f1f5f9);
    color: var(--text-muted, #94a3b8);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    line-height: 1;
}

.god-mode-btn:hover {
    border-color: #cbd5e1;
    color: #64748b;
    background: rgba(100, 116, 139, 0.06);
}

/* Active (toggled on) state -- amber/gold glow */
.god-mode-btn.god-mode-active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: #f59e0b;
    color: #fff;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4), 0 0 4px rgba(245, 158, 11, 0.2);
}

.god-mode-btn.god-mode-active:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.5), 0 0 6px rgba(245, 158, 11, 0.3);
}

.god-mode-btn.god-mode-active .god-mode-crown {
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.6));
}

/* Locked state (free/premium users) */
.god-mode-btn.god-mode-locked {
    opacity: 0.5;
    cursor: pointer;
}

.god-mode-btn.god-mode-locked:hover {
    opacity: 0.7;
    border-color: #f59e0b;
    color: #f59e0b;
}

.god-mode-lock-icon {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--bg-secondary, #fff);
    border-radius: 50%;
    padding: 1px;
}

.god-mode-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Dark mode adjustments */
.dark .god-mode-btn {
    background: var(--bg-tertiary, #374151);
    border-color: var(--border-primary, #4b5563);
    color: var(--text-muted, #6b7280);
}

.dark .god-mode-btn:hover {
    border-color: #6b7280;
    color: #9ca3af;
    background: rgba(107, 114, 128, 0.1);
}

.dark .god-mode-btn.god-mode-active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: #fbbf24;
    color: #fff;
}

.dark .god-mode-lock-icon {
    background: var(--bg-secondary, #1f2937);
}

/* Locked quality button styling */
.quality-btn-locked {
    opacity: 0.5;
}

.quality-btn-locked:hover {
    opacity: 0.7;
}

/* Mobile adjustments for god mode */
@media (max-width: 768px) {
    .god-mode-btn {
        padding: 5px 8px;
        font-size: 0.625rem;
    }

    .god-mode-btn svg.god-mode-crown {
        width: 12px;
        height: 12px;
    }
}

/* ============================================
   NSFW TOGGLE (18+)
   ============================================ */

.nsfw-control {
    flex-shrink: 0;
}

.nsfw-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 9999px;
    border: 1px solid var(--border-primary, #e2e8f0);
    background: var(--bg-tertiary, #f1f5f9);
    color: var(--text-muted, #94a3b8);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    line-height: 1;
}

.nsfw-btn:hover {
    border-color: #cbd5e1;
    color: #64748b;
    background: rgba(100, 116, 139, 0.06);
}

/* Active (toggled on) state -- red/orange glow */
.nsfw-btn.nsfw-active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #ef4444;
    color: #fff;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4), 0 0 4px rgba(239, 68, 68, 0.2);
}

.nsfw-btn.nsfw-active:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.5), 0 0 6px rgba(239, 68, 68, 0.3);
}

/* Locked state (free users) */
.nsfw-btn.nsfw-locked {
    opacity: 0.5;
    cursor: pointer;
}

.nsfw-btn.nsfw-locked:hover {
    opacity: 0.7;
    border-color: #ef4444;
    color: #ef4444;
}

.nsfw-lock-icon {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--bg-secondary, #fff);
    border-radius: 50%;
    padding: 1px;
}

.nsfw-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Dark mode adjustments */
.dark .nsfw-btn {
    background: var(--bg-tertiary, #374151);
    border-color: var(--border-primary, #4b5563);
    color: var(--text-muted, #6b7280);
}

.dark .nsfw-btn:hover {
    border-color: #6b7280;
    color: #9ca3af;
    background: rgba(107, 114, 128, 0.1);
}

.dark .nsfw-btn.nsfw-active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #f87171;
    color: #fff;
}

.dark .nsfw-lock-icon {
    background: var(--bg-secondary, #1f2937);
}

/* Mobile adjustments for NSFW toggle */
@media (max-width: 768px) {
    .nsfw-btn {
        padding: 5px 8px;
        font-size: 0.625rem;
    }
}

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

.feedback-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: var(--text-inverse);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
    z-index: 40;
}

.feedback-fab:hover {
    background: var(--accent-hover);
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Hide FAB in fullscreen mode */
.chat-fullscreen-active .feedback-fab {
    display: none;
}

.feedback-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.feedback-modal.show {
    opacity: 1;
    pointer-events: all;
}

.feedback-modal.hidden {
    display: none;
}

.feedback-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
}

.feedback-modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    width: 400px;
    max-width: calc(100vw - 48px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    transition: transform 0.2s ease;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.feedback-modal.show .feedback-modal-content {
    transform: translateY(0);
}

.feedback-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.feedback-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.feedback-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

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

.feedback-modal-body {
    padding: 16px 24px 24px;
}

.feedback-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.feedback-type-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.feedback-type-btn:hover {
    border-color: var(--border-secondary);
    color: var(--text-primary);
}

.feedback-type-btn.active {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.feedback-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.85rem;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.feedback-input:focus {
    border-color: var(--accent-primary);
}

.feedback-textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.85rem;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    min-height: 100px;
    outline: none;
    transition: border-color 0.15s ease;
    font-family: inherit;
    box-sizing: border-box;
}

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

.feedback-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    gap: 12px;
}

.feedback-user-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feedback-submit-btn {
    padding: 10px 24px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--accent-primary);
    color: var(--text-inverse);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.feedback-submit-btn:hover {
    background: var(--accent-hover);
}

.feedback-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.feedback-success {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-top: 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    color: #166534;
    font-size: 0.85rem;
    font-weight: 500;
}

.feedback-success.hidden {
    display: none;
}

@media (max-width: 768px) {
    .feedback-fab {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
    }

    .feedback-modal {
        padding: 0;
        align-items: flex-end;
        justify-content: stretch;
    }

    .feedback-modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
    }
}
