* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center; */
    padding: 20px;
}

.chat-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 500px;
    margin: 0 auto; /* จัดกลางด้วย margin */
    display: none;
    flex-direction: column;
    /* overflow: hidden; */
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.chat-header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.connection-status {
    font-size: 0.9rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff4757;
    transition: background 0.3s ease;
}

.status-dot.connected {
    background: #2ed573;
}

.messages-container {
    /* flex: 1; */
    padding: 20px;    
    max-height: 50vh;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.sent {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    text-align: right;
}

.message.received {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    margin-right: auto;
}

.message.system {
    background: #e3f2fd;
    color: #1976d2;
    text-align: center;
    margin: 0 auto;
    font-style: italic;
    font-size: 0.9rem;
}

.message-time {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 5px;
}

.input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    outline: none;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.message-input:focus {
    border-color: #667eea;
}

.send-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.send-button:hover {
    transform: scale(1.05);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.controls {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.control-button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.control-button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.control-button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Responsive */
@media (max-width: 480px) {
    .chat-container {
        height: 100vh;
        border-radius: 0;
    }
    
    body {
        padding: 0;
    }
}

.game-container {
    width: 100%;
    height: 80vh;
    position: relative;
    display: none;
    /* margin: 20px; */
}

#whoAmI {
    background: #6a0429;
    color: white;
    margin-top: 20px;
    margin-bottom: 20px;
}

#playersTurn {
    background: #28720d;
    color: white;
    margin-top: 20px;
    margin-bottom: 20px;
}

canvas {
    touch-action: auto !important;
}