<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/* UPDATED 16/7/25 12:30 947183 */

/* Modern Canva-Style Design with Lora Font &amp; Burgundy Accent - FIXED MODAL SYSTEM */
:root {
    /* Neutral Base Colors */
    --neutral-50: #FAFAFA;
    --neutral-100: #F5F5F5;
    --neutral-200: #EEEEEE;
    --neutral-300: #E0E0E0;
    --neutral-400: #BDBDBD;
    --neutral-500: #9E9E9E;
    --neutral-600: #757575;
    --neutral-700: #616161;
    --neutral-800: #424242;
    --neutral-900: #212121;
    
    /* Burgundy Accent */
    --burgundy-50: #FDF2F2;
    --burgundy-100: #FCE8E8;
    --burgundy-200: #FBBDBD;
    --burgundy-300: #F87C7C;
    --burgundy-400: #EF4444;
    --burgundy-500: #DC2626;
    --burgundy-600: #B91C1C;
    --burgundy-700: #991B1B;
    --burgundy-800: #7F1D1D;
    --burgundy-900: #8B3A3A;
    
    /* Semantic Colors */
    --primary: var(--burgundy-700);
    --primary-light: var(--burgundy-500);
    --primary-dark: var(--burgundy-800);
    --surface: #FFFFFF;
    --surface-2: var(--neutral-50);
    --surface-3: var(--neutral-100);
    --background: var(--neutral-50);
    --text-primary: var(--neutral-900);
    --text-secondary: var(--neutral-600);
    --text-tertiary: var(--neutral-500);
    --border: var(--neutral-200);
    --border-light: var(--neutral-100);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Typography */
    --font-family: 'Lora', serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Spacing Scale - Consolidated */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Radius Scale - Simplified */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

    /* Modal System Variables */
    --modal-backdrop: rgba(0, 0, 0, 0.4);
    --modal-max-width: 42rem;
    --modal-max-width-small: 28rem;
    --modal-padding: var(--space-xl);
    --modal-gap: var(--space-lg);
    --modal-header-height: 4rem;
    
    /* Install banner height for positioning */
    --install-banner-height: 0px;
}

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

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    font-weight: var(--font-weight-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* Modal close functionality - ensure only one modal is open */
body.modal-open {
    overflow: hidden;
}

/* Container */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border-radius: 0;
    overflow: hidden;
}

/* Install Banner - Simplified */
.install-banner {
    background: var(--primary);
    color: white;
    padding: var(--space-sm) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    position: relative;
    z-index: 1002;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.install-banner.hidden {
    display: none;
}

.install-content {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    min-width: 0;
}

.install-icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    padding: var(--space-xs);
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.install-text {
    flex: 1;
    min-width: 0;
}

.install-title {
    font-weight: var(--font-weight-semibold);
    font-size: 0.875rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.install-description {
    font-size: 0.75rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.install-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.install-button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.install-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.install-button.primary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary);
    border-color: transparent;
}

.install-button.primary:hover {
    background: white;
}

.install-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    line-height: 1;
    flex-shrink: 0;
}

.install-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Header - REDESIGNED */
.header {
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
    color: var(--text-primary);
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-light);
    position: relative;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Header Top Row - Title and Buttons */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

/* Header Title Section */
.header-title {
    flex: 1;
    min-width: 0; /* Allow shrinking */
}

.header h1 {
    font-size: 1.75rem;
    font-weight: var(--font-weight-bold);
    color: var(--primary);
    margin: 0 0 var(--space-xs) 0;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
    font-style: italic;
    margin: 0;
}

/* Header Buttons Container - NEW LAYOUT: 3 rows, 2 columns */
.header-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: var(--space-xs);
    min-width: 140px;
    max-width: 180px;
    flex-shrink: 0;
}

/* Button positioning in the new 3x2 grid:
   Row 1: Profile (spans 2 columns)
   Row 2: Journal, Letters
   Row 3: New Chat, Voice
*/
#profile-button {
    grid-column: 1 / -1; /* Span both columns */
    grid-row: 1;
}

#journal-button {
    grid-column: 1;
    grid-row: 2;
}

#letters-button {
    grid-column: 2;
    grid-row: 2;
}

#new-conversation-button {
    grid-column: 1;
    grid-row: 3;
}

#voice-settings-button {
    grid-column: 2;
    grid-row: 3;
}

/* Status - REPOSITIONED */
.status {
    align-self: center;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-weight: var(--font-weight-medium);
    margin-top: var(--space-xs);
}

/* Voice Slider Container - REPOSITIONED */
.voice-slider-container {
    position: absolute;
    right: 0;
    top: calc(100% + var(--space-sm));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    gap: var(--space-sm);
    min-width: 140px;
    z-index: 1003;
    transform: translateY(-10px);
    opacity: 0;
    transition: var(--transition);
}

.voice-slider-container.expanded {
    transform: translateY(0);
    opacity: 1;
}

.voice-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    z-index: 1002;
    display: none;
    pointer-events: auto;
}

.voice-settings-overlay.active {
    display: block;
}

/* Unified Button System */
.btn {
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: 2.5rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Button Variants */
.btn--primary {
    background: var(--primary);
    color: white;
}

.btn--primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

/* Ensure conversation modal buttons have same color as profile modal */
.modal-content--small .btn--primary,
#keep-context-button,
#complete-reset-button {
    background: var(--burgundy-700) !important;
    color: white !important;
}

.modal-content--small .btn--primary:hover:not(:disabled),
#keep-context-button:hover:not(:disabled),
#complete-reset-button:hover:not(:disabled) {
    background: var(--burgundy-800) !important;
}

.btn--secondary {
    background: var(--surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn--secondary:hover:not(:disabled) {
    background: var(--surface-3);
    border-color: var(--primary);
    color: var(--primary);
}

.btn--danger {
    background: var(--burgundy-500);
    color: white;
}

.btn--danger:hover:not(:disabled) {
    background: var(--burgundy-600);
}

/* Button Sizes */
.btn--small {
    padding: 8px 16px;
    font-size: 0.75rem;
    min-height: 2rem;
}

/* Header Buttons - UPDATED for new layout */
.btn--header,
.profile-button,
.voice-settings-button,
.new-conversation-button,
.journal-button,
.letters-button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    text-align: center;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn--header:hover,
.profile-button:hover,
.voice-settings-button:hover,
.new-conversation-button:hover,
.journal-button:hover,
.letters-button:hover {
    background: var(--surface-2);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

/* Voice settings specific styling */
.btn--header#voice-settings-button,
.voice-settings-button {
    /* Always visible now */
}

.btn--header#voice-settings-button.expanded,
.voice-settings-button.expanded {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.voice-range {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--neutral-200);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.voice-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.voice-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.voice-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.voice-range::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.voice-options {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family);
    margin-top: var(--space-xs);
}

/* Chat Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--background);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.message {
    margin-bottom: var(--space-xl);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-light);
    background: var(--surface);
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.user .message-avatar {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.assistant .message-avatar {
    background: var(--surface-2);
    color: var(--primary);
    border-color: var(--border);
}

.message-content {
    max-width: 70%;
    padding: var(--space-lg) var(--space-xl);
    border-radius: var(--radius-2xl);
    line-height: 1.6;
    font-size: 0.9375rem;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.user .message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

.assistant .message-content {
    background: var(--surface);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: var(--space-xs);
    text-align: right;
    font-weight: var(--font-weight-medium);
}

.user .message-time {
    text-align: left;
}

/* Input Area */
.input-area {
    padding: var(--space-xl);
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: var(--space-md);
    align-items: flex-end;
}

.input-group {
    flex: 1;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.message-input {
    width: 100%;
    min-height: 52px;
    max-height: 120px;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    font-size: 0.875rem;
    font-family: var(--font-family);
    resize: none;
    outline: none;
    transition: var(--transition);
    background: var(--surface);
    line-height: 1.4;
    box-sizing: border-box;
    vertical-align: bottom;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.message-input::-webkit-scrollbar {
    display: none;
}

.message-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 58, 58, 0.1);
}

.message-input::placeholder {
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
}

.action-button {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: var(--radius-xl);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    box-shadow: var(--shadow);
    box-sizing: border-box;
}

.mic-icon {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
    transition: var(--transition);
}

.action-button:hover .mic-icon {
    transform: scale(1.1);
}

.action-button:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.action-button:disabled {
    background: var(--neutral-300);
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

.voice-button.listening {
    background: var(--burgundy-500);
    animation: pulse 1.5s infinite;
}

.voice-button.speaking {
    background: var(--burgundy-400);
    animation: pulse 1.5s infinite;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

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

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
    opacity: 0.8;
}

.typing-indicator .message-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-light);
    background: var(--surface-2);
    color: var(--primary);
    overflow: hidden;
}

.typing-dots {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-lg) var(--space-xl);
    background: var(--surface);
    border-radius: var(--radius-2xl);
    border-bottom-left-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

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

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

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

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: var(--space-2xl) var(--space-xl);
    color: var(--text-secondary);
    animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.welcome-message h2 {
    color: var(--primary);
    margin-bottom: var(--space-lg);
    font-weight: var(--font-weight-bold);
    font-size: 1.875rem;
    letter-spacing: -0.025em;
}

.welcome-message p {
    font-size: 1rem;
    line-height: 1.7;
    max-width: 28rem;
    margin: 0 auto;
    color: var(--text-secondary);
}

/* ========================================
   UNIFIED MODAL SYSTEM - FIXED CLOSING BEHAVIOR
   ======================================== */

/* Modal Backdrop - Enhanced to ensure only one modal is active */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-backdrop);
    backdrop-filter: blur(4px);
    z-index: 1000;
    overflow-y: auto;
    padding: var(--space-lg);
}

.modal.active {
    display: block;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ensure all other modals are hidden when one is active */
.modal.active ~ .modal {
    display: none !important;
}

/* Modal Content Container - CONSISTENT POSITIONING */
.modal-content {
    background: var(--surface);
    margin: calc(160px + var(--install-banner-height)) auto var(--space-xl) auto;
    border-radius: var(--radius-xl);
    max-width: var(--modal-max-width);
    box-shadow: var(--shadow-xl);
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(85vh - var(--install-banner-height));
}

/* Small Modal Variant - CONSISTENT POSITIONING */
.modal-content--small {
    max-width: var(--modal-max-width-small);
    margin: calc(160px + var(--install-banner-height)) auto var(--space-xl) auto;
}

/* Modal Header */
.modal-header {
    background: var(--primary);
    color: white;
    padding: var(--space-lg) var(--modal-padding);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: var(--modal-header-height);
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-weight: var(--font-weight-bold);
    font-size: 1.5rem;
}

.modal-header--small h2 {
    font-size: 1.1rem;
    font-weight: var(--font-weight-semibold);
}

/* Modal Close Button */
.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Modal Body */
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--modal-padding);
}

/* Modal Actions (Sticky Footer) - Unified for all modals */
.modal-actions {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    padding: 20px;
    border-top: 1px solid var(--border-light);
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    justify-content: center;
    align-items: stretch;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    flex-shrink: 0;
}

.modal-actions .btn {
    width: 100%;
    min-width: auto;
    flex: none;
}

/* Form System within Modals */
.form-section {
    margin-bottom: var(--space-2xl);
}

.form-section:last-of-type {
    margin-bottom: var(--space-xl);
}

.form-section h3 {
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-light);
}

.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: var(--font-family);
    transition: var(--transition);
    background: var(--surface);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 58, 58, 0.1);
}

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

.form-row {
    display: flex;
    gap: var(--space-lg);
}

.form-row .form-group {
    flex: 1;
}

/* Profile Photo Section */
.profile-photo-section {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.profile-photo-upload {
    position: relative;
    display: inline-block;
    margin-bottom: var(--space-md);
}

.profile-photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: var(--surface-2);
    color: var(--text-tertiary);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.profile-photo-preview:hover {
    border-color: var(--primary);
    background: var(--surface-3);
}

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

.profile-photo-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.profile-photo-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
}

/* Checkbox System */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.checkbox-item {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.checkbox-item:hover {
    background: var(--surface-3);
    border-color: var(--primary);
}

.checkbox-item input[type="checkbox"] {
    margin-right: var(--space-sm);
    width: auto;
    accent-color: var(--primary);
}

.checkbox-item.checked {
    background: var(--burgundy-50);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: var(--font-weight-medium);
}

/* Conversation Modal Specific Styles */
.conversation-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.conversation-option {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.conversation-option:hover {
    border-color: var(--primary);
    background: var(--burgundy-50);
    transform: translateY(-1px);
}

.conversation-option.selected {
    border-color: var(--primary) !important;
    background: var(--burgundy-50) !important;
}

.option-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.option-content {
    flex: 1;
}

.option-title {
    font-weight: var(--font-weight-semibold);
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.option-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.conversation-summary {
    text-align: center;
    margin-bottom: var(--space-lg);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Unified Notification System */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1004;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
    min-width: 280px;
}

.notification.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Notification Types */
.notification.success {
    background: #27ae60;
    color: white;
}

.notification.error {
    background: #e74c3c;
    color: white;
}

.notification.info {
    background: #3498db;
    color: white;
}

.notification.warning {
    background: #f39c12;
    color: white;
}

.notification.muted {
    background: #95a5a6;
    color: white;
}

/* Notification Content */
.notification-content {
    flex: 1;
    line-height: 1.4;
}

/* Notification Dismiss Button */
.notification-dismiss {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.notification-dismiss:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   JOURNAL &amp; LETTERS INTERFACE
   ======================================== */

/* Journal/Letters Header */
.journal-header,
.letters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.journal-stats,
.letters-stats {
    display: flex;
    gap: var(--space-lg);
}

.stats-item {
    text-align: center;
}

.stats-number {
    display: block;
    font-size: 1.5rem;
    font-weight: var(--font-weight-bold);
    color: var(--primary);
    line-height: 1;
}

.stats-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: var(--space-xs);
}

/* Journal/Letters Lists */
.journal-list,
.letters-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Entry/Letter Items */
.journal-entry-item,
.letter-item {
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: var(--transition);
    cursor: pointer;
}

.journal-entry-item:hover,
.letter-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Entry/Letter Headers */
.entry-header,
.letter-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-md);
}

.entry-header h3,
.letter-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    line-height: 1.3;
}

.entry-meta,
.letter-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.mood {
    background: var(--surface);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    white-space: nowrap;
}

.date {
    white-space: nowrap;
}

/* Entry/Letter Previews */
.entry-preview,
.letter-preview {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-md);
    font-size: 0.875rem;
}

/* Entry/Letter Actions */
.entry-actions,
.letter-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    margin-top: auto;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.empty-state p:first-child {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
}

.empty-state p:last-child {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Form Styling for Journal/Letters */
.form-help {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
    line-height: 1.4;
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ======================================== */

/* Mobile Breakpoint (up to 768px) */
@media (max-width: 768px) {
    .container {
        height: 100vh;
        height: 100dvh;
    }
    
    /* Install banner adjustments */
    .install-banner {
        padding: var(--space-xs) var(--space-md);
        font-size: 0.8125rem;
    }
    
    .install-title {
        font-size: 0.8125rem;
    }
    
    .install-description {
        font-size: 0.7rem;
    }
    
    .install-button {
        padding: 4px var(--space-sm);
        font-size: 0.7rem;
    }
    
    .install-close {
        width: 20px;
        height: 20px;
        font-size: 0.75rem;
    }
    
    /* Header adjustments - IMPROVED */
    .header {
        padding: var(--space-md) var(--space-lg);
        gap: var(--space-sm);
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header-subtitle {
        font-size: 0.75rem;
    }
    
    .header-buttons {
        min-width: 120px;
        max-width: 140px;
        gap: 4px;
    }
    
    .btn--header,
    .profile-button,
    .voice-settings-button,
    .new-conversation-button,
    .journal-button,
    .letters-button {
        padding: 4px 8px;
        font-size: 0.7rem;
        min-height: 28px;
    }
    
    .voice-slider-container {
        min-width: 120px;
        padding: var(--space-sm);
        right: 0;
    }
    
    .status {
        font-size: 0.7rem;
        margin-top: 0;
    }
    
    /* Chat area adjustments */
    .messages {
        padding: var(--space-lg);
    }
    
    .input-area {
        padding: var(--space-lg);
        gap: var(--space-md);
    }
    
    .message-input {
        padding: var(--space-md) var(--space-lg);
        font-size: 0.875rem;
        min-height: 52px;
    }
    
    .action-button {
        width: 52px;
        height: 52px;
        font-size: 1.25rem;
    }
    
    .message-content {
        max-width: 85%;
        padding: var(--space-md) var(--space-lg);
    }
    
    /* Modal adjustments - CONSISTENT ACROSS ALL MODALS */
    .modal {
        padding: var(--space-md);
    }
    
    .modal-content {
        margin: calc(130px + var(--install-banner-height)) auto var(--space-md) auto;
        border-radius: var(--radius-lg);
        max-height: calc(90vh - var(--install-banner-height));
    }
    
    .modal-content--small {
        margin: calc(130px + var(--install-banner-height)) auto var(--space-md) auto;
    }
    
    .modal-body {
        padding: var(--space-xl);
    }
    
    .modal-actions {
        padding: 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .welcome-message {
        padding: var(--space-xl) var(--space-lg);
    }
    
    /* Typing indicator adjustments */
    .typing-indicator {
        padding-left: var(--space-lg);
        padding-right: var(--space-lg);
    }
    
    /* Notification adjustments */
    .notification {
        top: 10px;
        left: 10px;
        right: 10px;
        transform: translateY(-10px);
        max-width: none;
        min-width: auto;
    }
    
    .notification.active {
        transform: translateY(0);
    }

    /* Journal/Letters Mobile Responsiveness */
    .journal-header,
    .letters-header {
        flex-direction: column;
        gap: var(--space-md);
        align-items: stretch;
    }

    .journal-stats,
    .letters-stats {
        justify-content: space-around;
    }

    .entry-header,
    .letter-header {
        flex-direction: column;
        gap: var(--space-xs);
        align-items: flex-start;
    }

    .entry-meta,
    .letter-meta {
        flex-wrap: wrap;
    }

    .entry-actions,
    .letter-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .journal-list,
    .letters-list {
        max-height: 300px;
    }

    .stats-number {
        font-size: 1.25rem;
    }

    .stats-label {
        font-size: 0.7rem;
    }
}

/* Small Mobile Breakpoint (up to 480px) */
@media (max-width: 480px) {
    /* Even more compact install banner */
    .install-banner {
        padding: var(--space-xs);
        gap: var(--space-xs);
    }
    
    .install-description {
        display: none;
    }
    
    .install-button {
        padding: 2px var(--space-xs);
        font-size: 0.65rem;
    }
    
    .install-close {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
    }
    
    /* Header adjustments - IMPROVED */
    .header {
        padding: var(--space-sm) var(--space-md);
    }
    
    .header h1 {
        font-size: 1.375rem;
    }
    
    .header-subtitle {
        font-size: 0.7rem;
    }
    
    .header-buttons {
        min-width: 100px;
        max-width: 120px;
        gap: 3px;
    }
    
    .btn--header,
    .profile-button,
    .voice-settings-button,
    .new-conversation-button,
    .journal-button,
    .letters-button {
        padding: 3px 6px;
        font-size: 0.65rem;
        min-height: 26px;
    }
    
    .voice-slider-container {
        min-width: 100px;
        font-size: 0.7rem;
    }
    
    .status {
        font-size: 0.65rem;
    }
    
    /* Input area adjustments */
    .input-area {
        padding: var(--space-md);
        gap: var(--space-sm);
    }
    
    .message-input {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.8125rem;
        min-height: 44px;
    }
    
    .action-button {
        width: 44px;
        height: 44px;
        font-size: 1.125rem;
    }
    
    /* Modal adjustments - CONSISTENT ACROSS ALL MODALS */
    .modal-content {
        margin: calc(110px + var(--install-banner-height)) auto var(--space-sm) auto;
        max-height: calc(95vh - var(--install-banner-height));
    }
    
    .modal-content--small {
        margin: calc(110px + var(--install-banner-height)) auto var(--space-sm) auto;
    }
    
    .modal-actions {
        padding: 20px;
    }
    
    /* Typing indicator adjustments */
    .typing-indicator {
        padding-left: var(--space-md);
        padding-right: var(--space-md);
    }

    /* Journal/Letters 480px Responsiveness */
    .journal-entry-item,
    .letter-item {
        padding: var(--space-md);
    }

    .entry-header h3,
    .letter-header h3 {
        font-size: 1rem;
    }

    .entry-preview,
    .letter-preview {
        font-size: 0.8125rem;
    }

    .mood {
        font-size: 0.7rem;
        padding: 2px var(--space-xs);
    }

    .date {
        font-size: 0.7rem;
    }

    .empty-state p:first-child {
        font-size: 1.25rem;
    }

    .journal-stats,
    .letters-stats {
        gap: var(--space-sm);
    }

    .stats-item {
        flex: 1;
    }
}

/* Extra Small Mobile Breakpoint (up to 360px) */
@media (max-width: 360px) {
    /* Minimal install banner */
    .install-text {
        display: none;
    }
    
    .install-content {
        justify-content: center;
    }
    
    /* Header adjustments - IMPROVED */
    .header {
        padding: var(--space-sm) var(--space-md);
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header-buttons {
        min-width: 90px;
        max-width: 100px;
    }
    
    .btn--header,
    .profile-button,
    .voice-settings-button,
    .new-conversation-button,
    .journal-button,
    .letters-button {
        font-size: 0.6rem;
        padding: 2px 4px;
        min-height: 24px;
    }
    
    .voice-slider-container {
        min-width: 90px;
    }
    
    /* Status adjustments */
    .status {
        font-size: 0.7rem;
        margin-top: var(--space-xs);
    }
    
    /* Input area adjustments */
    .input-area {
        padding: var(--space-sm);
        gap: var(--space-xs);
    }
    
    .message-input {
        padding: var(--space-sm);
        font-size: 0.75rem;
        min-height: 40px;
    }
    
    .action-button {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* Modal adjustments - CONSISTENT ACROSS ALL MODALS */
    .modal-content {
        margin: calc(100px + var(--install-banner-height)) auto var(--space-xs) auto;
    }
    
    .modal-content--small {
        margin: calc(100px + var(--install-banner-height)) auto var(--space-xs) auto;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0F0F0F;
        --surface: #171717;
        --surface-2: #262626;
        --surface-3: #404040;
        --text-primary: #FAFAFA;
        --text-secondary: #D4D4D4;
        --text-tertiary: #A3A3A3;
        --border: #404040;
        --border-light: #262626;
    }
}

/* ========================================
   MODAL ANIMATIONS - TRIPLED FADE DURATION
   ======================================== */

/* Modal fade in animation - tripled from 0.3s to 0.9s */
.modal.active {
    display: block;
    animation: fadeIn 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal content slide in animation - tripled from 0.3s to 0.9s */
.modal-content {
    background: var(--surface);
    margin: calc(160px + var(--install-banner-height)) auto var(--space-xl) auto;
    border-radius: var(--radius-xl);
    max-width: var(--modal-max-width);
    box-shadow: var(--shadow-xl);
    animation: slideIn 0.9s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(85vh - var(--install-banner-height));
}

/* Keyframes remain the same, just slower execution */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Update the base modal transition - tripled from 0.2s to 0.6s */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-backdrop);
    backdrop-filter: blur(4px);
    z-index: 1000;
    overflow-y: auto;
    padding: var(--space-lg);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   MODAL BACKDROP TRANSITION FIX (EXISTING)
   ======================================== */

/* Override modal backdrop transitions during modal switching */
.modal.transitioning {
    transition: none !important;
    animation: none !important;
}

/* When body has modal-open class, ensure backdrop stays solid */
body.modal-open .modal {
    background: var(--modal-backdrop) !important;
    opacity: 1 !important;
}

/* Prevent backdrop fade-out during transitions */
body.modal-open .modal:not(.active) {
    background: var(--modal-backdrop) !important;
    opacity: 1 !important;
    pointer-events: none; /* Disable clicks on hidden modal but keep backdrop */
}

/* Ensure the active modal is always fully visible */
body.modal-open .modal.active {
    background: var(--modal-backdrop) !important;
    opacity: 1 !important;
    pointer-events: auto;
}

/* Force backdrop to never animate when transitioning */
.modal-transitioning .modal {
    transition: none !important;
    animation: none !important;
    background: var(--modal-backdrop) !important;
    opacity: 1 !important;
}
</pre></body></html>