:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #c7d2fe;
    --accent: #f472b6;
    --background: #f8faff;
    --surface: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --success: #34d399;
    --error: #fb7185;
    --gradient: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    --shadow-sm: 0 2px 8px rgba(99, 102, 241, 0.1);
    --shadow-md: 0 4px 20px rgba(99, 102, 241, 0.15);
    --shadow-lg: 0 8px 30px rgba(99, 102, 241, 0.2);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Landing Page Styles */
.landing-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(244, 114, 182, 0.1) 0%, transparent 50%);
}

.landing-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 3rem;
}

.brand {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    width: 80px;
    height: 80px;
    background: var(--gradient);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: var(--shadow-md);
}

.logo .emoji {
    font-size: 2.5rem;
}

.brand h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-light);
}

.login-container {
    width: 100%;
    max-width: 480px;
    padding: 0 1rem;
}

.login-box {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-light);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 500;
}

.login-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--secondary);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--background);
}

.login-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.room-code-container {
    display: flex;
    gap: 0.75rem;
}

.generate-btn {
    background: var(--background);
    color: var(--primary);
    border: 2px solid var(--secondary);
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.generate-btn:hover {
    border-color: var(--primary);
    background: var(--surface);
}

.join-btn {
    width: 100%;
    background: var(--gradient);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
}

.join-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.landing-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.mood-bubbles {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    font-size: 1.5rem;
}

/* Room Page Styles */
.room-page {
    min-height: 100vh;
    padding: 1.5rem;
    background: var(--background);
}

.room-header {
    background: var(--gradient);
    padding: 2rem;
    border-radius: 20px;
    color: white;
    margin-bottom: 2rem;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-info h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.room-code {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    backdrop-filter: blur(8px);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error);
}

.status-dot.online {
    background: var(--success);
}

.room-container {
    max-width: 1200px;
    margin: 0 auto;
}

.chat-container {
    background: var(--surface);
    border-radius: 20px;
    padding: 1.5rem;
    height: calc(100vh - 300px);
    overflow-y: auto;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.chat-message {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 16px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

.own-message {
    background: var(--gradient);
    color: white;
    margin-left: auto;
    box-shadow: var(--shadow-sm);
}

.partner-message {
    background: var(--background);
    border: 1px solid var(--secondary);
    margin-right: auto;
}

.mood-form {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

.mood-selector {
    margin-bottom: 1rem;
}

.mood-selector label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 500;
}

.mood-selector select {
    width: 200px;
    padding: 0.875rem 1rem;
    border: 2px solid var(--secondary);
    border-radius: 12px;
    background: var(--background);
    font-size: 1rem;
    cursor: pointer;
}

.mood-input {
    display: flex;
    gap: 1rem;
}

.mood-input input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--secondary);
    border-radius: 12px;
    font-size: 1rem;
}

.mood-input button {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.logout-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

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

/* [Previous CSS remains the same until @keyframes fadeIn] */

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

/* Responsive Design */
@media (max-width: 768px) {
    .landing-content {
        padding: 1.5rem;
        gap: 2rem;
    }

    .brand h1 {
        font-size: 2rem;
    }

    .logo {
        width: 60px;
        height: 60px;
    }

    .login-box {
        padding: 1.5rem;
    }

    .room-code-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .generate-btn {
        width: 100%;
    }

    .room-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .room-info h2 {
        font-size: 1.5rem;
    }

    .mood-form {
        padding: 1rem;
    }

    .mood-input {
        flex-direction: column;
        gap: 0.75rem;
    }

    .mood-input button {
        width: 100%;
    }

    .mood-selector select {
        width: 100%;
    }

    .chat-container {
        height: calc(100vh - 400px);
    }

    .chat-message {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .brand h1 {
        font-size: 1.75rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .login-header h2 {
        font-size: 1.25rem;
    }

    .room-header {
        padding: 1.5rem;
    }

    .logout-btn {
        top: 1.5rem;
        right: 1.5rem;
        padding: 0.5rem 1rem;
        font-size: 0.5rem;
        position: absolute;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --text: #f8fafc;
        --text-light: #94a3b8;
        --secondary: #334155;
    }

    .login-input,
    .mood-selector select,
    .mood-input input {
        background: var(--surface);
        color: var(--text);
    }

    .generate-btn {
        background: var(--surface);
        color: var(--primary-light);
    }

    .partner-message {
        background: var(--surface);
        border-color: var(--secondary);
    }
}

/* Touch Device Optimizations */
@media (hover: none) {
    .join-btn:hover,
    .generate-btn:hover,
    .mood-input button:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }
}

/* Scrollbar Styling */
.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Message Animations */
.chat-message {
    animation: fadeIn 0.3s ease;
    position: relative;
}

.chat-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 10px;
    height: 10px;
    transform: translateY(50%) rotate(45deg);
}

.own-message::after {
    right: -5px;
    background: var(--primary-dark);
}

.partner-message::after {
    left: -5px;
    background: var(--background);
    border: 1px solid var(--secondary);
    border-top: 0;
    border-left: 0;
}

/* Focus States */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Status Indicators */
.status-dot {
    position: relative;
}

.status-dot.online::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
    }
    
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(52, 211, 153, 0);
    }
    
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    }
}