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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: #e0e0e0;
}

.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.container {
    background: #16213e;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 800px;
    margin: 20px;
    border: 1px solid #0f3460;
}

/* Home screen split layout */
.home-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    background: #16213e;
}

.home-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    background: #1e3a5f;
}

.home-right {
    flex: 1;
    padding: 60px;
    background: #0d1b2a;
    overflow-y: auto;
}

.home-right h2 {
    color: #ff6b9d;
    margin-bottom: 30px;
    font-size: 2em;
}

.rules-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.rule-item {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.rule-number {
    background: #ff6b9d;
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
}

.rule-text {
    flex: 1;
}

.rule-text strong {
    color: #ffffff;
    font-size: 1.1em;
    display: block;
    margin-bottom: 8px;
}

.rule-text p {
    color: #d0d0d0;
    line-height: 1.6;
}

.win-conditions {
    margin-top: 30px;
    padding: 20px;
    background: #1e3a5f;
    border-radius: 10px;
    border-left: 4px solid #ff6b9d;
}

.win-conditions p {
    color: #ffffff;
    margin: 10px 0;
    font-size: 1.05em;
}

.vote-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.vote-actions button {
    flex: 1;
}

@media (max-width: 968px) {
    .home-layout {
        flex-direction: column;
    }
    
    .home-left,
    .home-right {
        width: 100%;
        min-height: 50vh;
    }
    
    .home-left {
        padding: 40px 20px;
    }
    
    .home-right {
        padding: 40px 20px;
    }
}

/* Split panel layout for game screens */
.game-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    background: #0d1b2a;
}

.game-sidebar {
    width: 280px;
    background: #1a1a2e;
    border-right: 2px solid #2a5080;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 2px solid #2a5080;
    background: #1e3a5f;
}

.sidebar-header h3 {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 1.3em;
}

.game-players-list {
    padding: 15px;
    overflow-y: auto;
}

.game-player-item {
    background: #1e3a5f;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #ff6b9d;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game-player-item.current-turn {
    border-left-color: #f39c12;
    background: #2a4158;
}

.game-player-item.eliminated {
    opacity: 0.5;
    border-left-color: #95a5a6;
}

.game-player-item.is-imposter {
    border-left-color: #e74c3c;
}

.game-player-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.95em;
}

.game-main {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #16213e;
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .game-layout {
        flex-direction: column;
    }
    
    .game-sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 2px solid #2a5080;
    }
    
    .game-main {
        padding: 20px;
    }
}

.title {
    font-size: 3em;
    text-align: center;
    color: #3498db;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: #d0d0d0;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.input-group {
    margin-bottom: 20px;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

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

textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.button-group-inline {
    display: flex;
    gap: 10px;
    flex-direction: row;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: #555;
    color: white;
}

.btn-secondary:hover {
    background: #666;
}

.btn-skip {
    background: #95a5a6;
    color: white;
}

.btn-skip:hover {
    background: #7f8c8d;
}

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

.room-code-display {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-radius: 15px;
    color: white;
}

.room-code {
    font-size: 3em;
    letter-spacing: 5px;
    margin: 10px 0;
}

.players-section {
    margin: 30px 0;
}

.players-section h3 {
    color: #ffffff;
    margin-bottom: 15px;
}

.players-list {
    background: #1e3a5f;
    border-radius: 10px;
    padding: 15px;
    min-height: 100px;
}

.player-item {
    padding: 10px;
    background: #1e3a5f;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.player-name {
    font-weight: 600;
    color: #ffffff;
}

.ready-badge {
    background: #27ae60;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    margin-left: 10px;
}

.not-ready-badge {
    background: #95a5a6;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    margin-left: 10px;
}

.host-badge {
    background: #3498db;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
}

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

.round-info {
    font-size: 1.2em;
    font-weight: 600;
    color: #3498db;
}

.word-display {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 20px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-display.imposter {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.turn-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #1e3a5f;
    border-radius: 10px;
}

.descriptions-section {
    margin: 20px 0;
}

.descriptions-section h3 {
    color: #ffffff;
    margin-bottom: 15px;
}

.descriptions-list {
    background: #1e3a5f;
    border-radius: 10px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.description-item {
    background: #1e3a5f;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.description-player {
    font-weight: 600;
    color: #3498db;
    margin-bottom: 5px;
}

.description-text {
    color: #ffffff;
}

.description-input {
    margin-top: 20px;
}

.description-input textarea {
    margin-bottom: 10px;
}

.voting-section {
    margin: 30px 0;
}

.voting-section h3 {
    color: #ffffff;
    margin-bottom: 15px;
}

.voting-list {
    display: grid;
    gap: 10px;
}

.vote-button {
    padding: 15px;
    background: #1e3a5f;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    font-size: 16px;
    font-weight: 600;
}

.vote-button:hover {
    border-color: #3498db;
    background: #1e3a5f;
}

.vote-button.selected {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border-color: #3498db;
}

.winner-text {
    text-align: center;
    font-size: 3em;
    margin-bottom: 20px;
}

.winner-text.crew-win {
    color: #27ae60;
}

.winner-text.imposter-win {
    color: #e74c3c;
}

.game-over-info {
    background: #1e3a5f;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.game-over-info p {
    margin: 10px 0;
    font-size: 1.1em;
    color: #ffffff;
}

.game-over-info strong {
    color: #3498db;
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #f44336;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    display: none;
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

.toast.show {
    display: block;
}

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

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    .title {
        font-size: 2em;
    }

    .room-code {
        font-size: 2em;
    }

    .word-display {
        font-size: 1.5em;
        padding: 20px;
    }
}
/* Lobby Layout */
.lobby-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    background: #16213e;
}

.lobby-left {
    flex: 1;
    padding: 40px;
    border-right: 2px solid #0f3460;
    overflow-y: auto;
}

.lobby-right {
    width: 400px;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.lobby-right h3 {
    color: #e94560;
    margin-bottom: 15px;
}

.lobby-chat-messages {
    flex: 1;
    overflow-y: auto;
    background: #0f3460;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #16213e;
    border-radius: 8px;
    border-left: 3px solid #e94560;
}

.chat-message-player {
    font-weight: 600;
    color: #e94560;
    font-size: 0.9em;
    margin-bottom: 4px;
}

.chat-message-text {
    color: #e0e0e0;
    font-size: 0.95em;
}

.lobby-chat-input {
    display: flex;
    gap: 10px;
}

.lobby-chat-input input {
    flex: 1;
}



@media (max-width: 768px) {
    .lobby-layout {
        flex-direction: column;
    }
    
    .lobby-left {
        border-right: none;
        border-bottom: 2px solid #0f3460;
    }
    
    .lobby-right {
        width: 100%;
        height: 300px;
    }
}

/* Readable placeholder text */
input[type="text"]::placeholder,
textarea::placeholder {
    color: #a0a0a0;
}

/* Room Settings */
.room-settings {
    background: linear-gradient(135deg, #1e3a5f 0%, #2a4158 100%);
    padding: 25px;
    border-radius: 15px;
    margin: 20px 0;
    border: 2px solid #2a5080;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.room-settings h3 {
    color: #ff6b9d;
    margin-bottom: 20px;
    font-size: 1.2em;
    text-align: center;
}

.setting-item {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(13, 27, 42, 0.4);
    border-radius: 8px;
}

.setting-item label {
    color: #ffffff;
    font-weight: 500;
    font-size: 1em;
    display: flex;
    align-items: center;
}

.setting-item input[type="number"] {
    width: 80px;
    padding: 8px 12px;
    background: #0f3460;
    color: #ffffff;
    border: 2px solid #2a5080;
    border-radius: 8px;
    font-size: 1em;
    text-align: center;
    font-weight: bold;
}

.setting-item input[type="number"]:focus {
    border-color: #ff6b9d;
    outline: none;
}

.setting-item input[type="checkbox"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #ff6b9d;
}

.room-settings .btn {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    font-weight: 600;
}

/* Join Screen Layout */
.join-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    background: #0d1b2a;
}

.join-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    background: #1e3a5f;
}

.join-right {
    flex: 1;
    padding: 40px;
    background: #16213e;
    overflow-y: auto;
    border-left: 2px solid #2a5080;
}

.join-right h3 {
    color: #ff6b9d;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.public-lobbies-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.lobby-card {
    background: linear-gradient(135deg, #1e3a5f 0%, #2a4158 100%);
    padding: 18px 20px;
    border-radius: 12px;
    border-left: 5px solid #ff6b9d;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.lobby-card:hover {
    background: linear-gradient(135deg, #2a4158 0%, #3a5168 100%);
    transform: translateX(8px);
    box-shadow: 0 5px 15px rgba(255, 107, 157, 0.3);
}

.lobby-card-code {
    font-size: 1.8em;
    font-weight: bold;
    color: #ff6b9d;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.lobby-card-info {
    color: #d0d0d0;
    font-size: 1em;
    display: flex;
    gap: 15px;
}

.lobby-card-empty {
    text-align: center;
    color: #d0d0d0;
    padding: 60px 40px;
    background: rgba(30, 58, 95, 0.3);
    border-radius: 12px;
    border: 2px dashed #2a5080;
}

@media (max-width: 968px) {
    .join-layout {
        flex-direction: column;
    }
    
    .join-left,
    .join-right {
        width: 100%;
        min-height: 50vh;
    }
}

/* Back to menu button specific styling */
#backToMenuBtn {
    margin-top: 15px;
    background: linear-gradient(135deg, #5a6c7d 0%, #4a5c6d 100%);
    border: 2px solid #2a5080;
}

#backToMenuBtn:hover {
    background: linear-gradient(135deg, #6a7c8d 0%, #5a6c7d 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(90, 108, 125, 0.4);
}