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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

/* Lobby Screen */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    color: white;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header h2 {
    font-size: 1.8rem;
    font-weight: 300;
}

.user-name {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.user-list {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1rem;
    backdrop-filter: blur(10px);
}

.user-item {
    background: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.5rem;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-weight: 500;
}

.user-item:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.no-users {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    padding: 2rem;
}

/* Chat Screen */
#chatScreen {
    padding: 0;
}

.chat-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.partner-name {
    font-size: 1.2rem;
    font-weight: 600;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    min-width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.end-chat-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.end-chat-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px); /* Account for header */
}

.emoji-bar {
    flex-shrink: 0;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: 0.5rem;
    padding: 0.375rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.split-container {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    height: 900px; /* Double the height */
    margin: 0 0.5rem 0.5rem 0.5rem;
    gap: 0.5rem; /* Space between panels instead of divider */
}

.left-panel {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    background: white;
}

.right-panel {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    background: white; /* Same background as left panel */
}



.input-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: white;
    height: 100%;
}

.typing-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: white; /* Same background as input section */
    height: 100%;
    overflow-y: auto;
}

/* Emoji Bar Styles - White theme */

.emoji-strip {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.25rem 0;
    gap: 0.25rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.emoji-strip::-webkit-scrollbar {
    height: 2px;
}

.emoji-strip::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 1px;
}

.emoji-strip::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 1px;
}

.emoji-strip::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

.emoji-btn {
    flex-shrink: 0;
    font-size: 1.8rem;
    padding: 0.6rem 0.9rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 3.3rem;
    height: 3.3rem;
}

.emoji-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: scale(1.1);
}

.emoji-btn:active {
    background: #dee2e6;
    transform: scale(0.95);
}

#messageInput {
    flex: 1;
    width: 100%;
    font-size: 2rem;
    line-height: 1.4;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    resize: none;
    outline: none;
    font-family: inherit;
    background: #f8f9fa;
    transition: all 0.3s ease;
    min-height: 200px; /* Double the min height */
    max-height: 500px; /* Double the max height */
    overflow-y: auto;
}

.partner-typing {
    flex: 1;
    font-size: 1.8rem;
    line-height: 1.4;
    color: #333;
    padding: 1rem;
    background: #f8f9fa; /* Same style as input */
    border-radius: 12px; /* Same border radius as input */
    border: 2px solid #e9ecef; /* Same border style as input */
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-y: auto;
    min-height: 200px; /* Double the min height */
    max-height: 500px; /* Double the max height */
}


#messageInput:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .screen {
        padding: 5px;
    }
    
    .chat-content {
        height: calc(100vh - 50px); /* Smaller header on mobile */
    }
    
    .chat-header {
        padding: 0.5rem;
    }
    
    .partner-name {
        font-size: 1rem;
    }
    
    .left-panel, .right-panel {
        min-width: 120px; /* Smaller minimum width */
    }
    
    .input-section, .typing-display {
        padding: 0.5rem; /* Less padding */
    }
    
    .emoji-bar {
        padding: 0.2rem;
        margin: 0.3rem;
    }
    
    .split-container {
        margin: 0 0.3rem 0.3rem 0.3rem;
        height: 600px; /* Double the mobile height */
        gap: 0.3rem;
    }
    
    .emoji-btn {
        font-size: 1.5rem; /* 1.5x larger emojis */
        padding: 0.3rem 0.6rem;
        min-width: 2.7rem;
        height: 2.7rem;
    }
    
    #messageInput {
        font-size: 1.2rem; /* Smaller input text */
        padding: 0.5rem;
        min-height: 120px; /* Double the mobile min height */
        max-height: 300px; /* Double the mobile max height */
    }
    
    .partner-typing {
        font-size: 1.2rem; /* Smaller partner text */
        padding: 0.5rem;
        min-height: 120px; /* Double the mobile min height */
        max-height: 300px; /* Double the mobile max height */
    }
    
}

@media (max-width: 480px) {
    .chat-content {
        height: calc(100vh - 45px); /* Even smaller header */
    }
    
    .chat-header {
        padding: 0.4rem;
    }
    
    .partner-name {
        font-size: 0.9rem;
    }
    
    .left-panel, .right-panel {
        min-width: 100px; /* Even smaller minimum width */
    }
    
    .input-section, .typing-display {
        padding: 0.3rem; /* Even less padding */
    }
    
    .emoji-bar {
        padding: 0.1rem;
        margin: 0.2rem;
    }
    
    .split-container {
        margin: 0 0.2rem 0.2rem 0.2rem;
        height: 500px; /* Double the phone height */
        gap: 0.2rem;
    }
    
    .emoji-btn {
        font-size: 1.35rem; /* 1.5x larger emojis */
        padding: 0.15rem 0.45rem;
        min-width: 2.25rem;
        height: 2.25rem;
    }
    
    #messageInput {
        font-size: 1rem; /* Smaller input text */
        padding: 0.4rem;
        min-height: 100px; /* Double the phone min height */
        max-height: 240px; /* Double the phone max height */
    }
    
    .partner-typing {
        font-size: 1rem; /* Smaller partner text */
        padding: 0.4rem;
        min-height: 100px; /* Double the phone min height */
        max-height: 240px; /* Double the phone max height */
    }
    
    
    .end-chat-btn, .theme-toggle {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
}

/* Dark Theme (Darcula-inspired) */
body.dark-theme {
    background: linear-gradient(135deg, #2b2b2b 0%, #1e1e1e 100%);
}

.dark-theme .screen {
    background: transparent;
}

/* Lobby Screen - Dark */
.dark-theme .header {
    color: #ffffff;
}

.dark-theme .user-name {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.dark-theme .user-list {
    background: rgba(60, 60, 60, 0.8);
    border: 1px solid #555555;
}

.dark-theme .user-item {
    background: #4a4a4a;
    color: #ffffff;
    border: 1px solid #666666;
}

.dark-theme .user-item:hover {
    background: #5a5a5a;
    border-color: #777777;
}

.dark-theme .no-users {
    color: rgba(255, 255, 255, 0.6);
}

/* Chat Screen - Dark */
.dark-theme .chat-container {
    background: #2b2b2b;
}

.dark-theme .chat-header {
    background: #3c3c3c;
    border-bottom: 1px solid #555555;
}

.dark-theme .partner-name {
    color: #ffffff;
}

.dark-theme .theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.dark-theme .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.dark-theme .end-chat-btn {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.dark-theme .end-chat-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.dark-theme .left-panel {
    background: #2b2b2b;
}

.dark-theme .right-panel {
    background: #2b2b2b; /* Same as left panel */
}

.dark-theme .input-section {
    background: #2b2b2b;
}

.dark-theme .typing-display {
    background: #2b2b2b; /* Same as input section */
}

/* Emoji Bar - Dark */
.dark-theme .emoji-bar {
    background: #3c3c3c;
    border: 1px solid #555555;
}

.dark-theme .emoji-strip::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

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

.dark-theme .emoji-strip::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.dark-theme .emoji-btn {
    background: #4a4a4a;
    border: 1px solid #666666;
}

.dark-theme .emoji-btn:hover {
    background: #5a5a5a;
    border-color: #777777;
}

.dark-theme .emoji-btn:active {
    background: #666666;
}

.dark-theme #messageInput {
    background: #3c3c3c;
    color: #ffffff;
    border: 2px solid #555555;
}

.dark-theme #messageInput:focus {
    border-color: #6c7ae0;
    background: #4a4a4a;
    box-shadow: 0 0 0 3px rgba(108, 122, 224, 0.2);
}

.dark-theme .partner-typing {
    background: #3c3c3c;
    color: #ffffff;
    border: 1px solid #555555;
}


/* Theme toggle icon update */
.dark-theme .theme-toggle {
    content: '☀️';
}
}