* { 
    box-sizing: border-box; 
    user-select: none; 
    -webkit-tap-highlight-color: transparent; 
}

body { 
    margin: 0; 
    overflow: hidden; 
    font-family: Arial, sans-serif; 
    background: #87CEEB; 
}

canvas { 
    display: block; 
}

/* ================= MÀN HÌNH ĐĂNG NHẬP ================= */
#login-screen {
    position: absolute; 
    width: 100%; 
    height: 100dvh; 
    background: rgba(0,0,0,0.85);
    display: flex; 
    justify-content: center; 
    align-items: center; 
    z-index: 1000; 
    color: white;
}

.auth-box {
    background: #222; 
    padding: 25px; 
    border-radius: 12px; 
    width: 90%; 
    max-width: 320px;
    border: 2px solid #444; 
    box-shadow: 0 0 20px rgba(0,0,0,0.8); 
    text-align: center;
}

.auth-box h2 { 
    color: #ffcc00; 
    margin-top: 0; 
    text-shadow: 0 0 10px #ffcc00;
}

.auth-tabs { 
    display: flex; 
    margin-bottom: 15px; 
    border-bottom: 1px solid #555; 
}

.auth-tab { 
    flex: 1; 
    padding: 10px; 
    cursor: pointer; 
    color: #888; 
    font-weight: bold; 
}

.auth-tab.active { 
    color: #fff; 
    border-bottom: 3px solid #ff3333; 
}

.input-group { 
    position: relative; 
    margin-bottom: 15px; 
}

.input-group input {
    width: 100%; 
    padding: 12px; 
    border-radius: 8px; 
    border: 1px solid #555; 
    background: #333; 
    color: white; 
    font-size: 15px;
}

#toggle-password {
    position: absolute; 
    right: 10px; 
    top: 50%; 
    transform: translateY(-50%);
    cursor: pointer; 
    font-size: 18px; 
    color: #aaa;
}

#submit-btn {
    width: 100%; 
    padding: 12px; 
    font-size: 16px; 
    background: #ff3333; 
    color: white;
    border: none; 
    border-radius: 8px; 
    font-weight: bold; 
    cursor: pointer;
}

#submit-btn:active { 
    background: #cc0000; 
}

#error-msg { 
    color: #ff4444; 
    font-size: 13px; 
    margin-top: 10px; 
    min-height: 15px; 
}

/* ================= GIAO DIỆN TRONG GAME ================= */
#ui-layer { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    pointer-events: none; 
    display: none; 
}

/* BXH & Chat */
#leaderboard { 
    position: absolute; 
    top: 10px; 
    left: 10px; 
    background: rgba(0,0,0,0.5); 
    color: white; 
    padding: 10px; 
    border-radius: 5px; 
    font-size: 12px; 
    min-width: 120px; 
}

#leaderboard h3 { 
    margin: 0 0 5px 0; 
    color: #ffcc00; 
    font-size: 14px; 
}

#chat-box { 
    position: absolute; 
    top: 10px; 
    right: 10px; 
    width: 170px; 
    pointer-events: auto; 
}

#chat-messages { 
    height: 90px; 
    overflow-y: auto; 
    background: rgba(0,0,0,0.5); 
    color: white; 
    padding: 5px; 
    font-size: 11px; 
    border-radius: 5px; 
    margin-bottom: 5px; 
}

#chat-input { 
    width: 100%; 
    padding: 6px; 
    border-radius: 5px; 
    border: none; 
    font-size: 12px; 
}

/* Nút Cài Đặt */
#settings-btn {
    position: absolute; 
    top: 10px; 
    left: 50%; 
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6); 
    color: white; 
    border: 2px solid #fff; 
    border-radius: 50%;
    width: 45px; 
    height: 45px; 
    font-size: 22px; 
    pointer-events: auto; 
    cursor: pointer;
}

/* Nút Đấm & Thủ */
.action-btn {
    position: absolute; 
    border-radius: 50%; 
    border: 3px solid #fff;
    color: white; 
    font-weight: bold; 
    pointer-events: auto; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    transition: transform 0.1s;
}

#attack-btn { 
    bottom: 30px; 
    right: 30px; 
    width: 85px; 
    height: 85px; 
    background: radial-gradient(circle, #ff4444, #aa0000); 
    font-size: 18px; 
}

#defend-btn { 
    bottom: 130px; 
    right: 40px; 
    width: 65px; 
    height: 65px; 
    background: radial-gradient(circle, #44aaff, #0055aa); 
    font-size: 24px; 
}

.action-btn:active { 
    transform: scale(0.9); 
}

/* Joystick */
#joystick-zone { 
    position: absolute; 
    bottom: 20px; 
    left: 20px; 
    width: 120px; 
    height: 120px; 
    pointer-events: auto; 
    transition: transform 0.1s;
}

/* ================= BẢNG CÀI ĐẶT ================= */
#settings-modal {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100dvh; 
    background: rgba(0,0,0,0.8);
    display: none; 
    justify-content: center; 
    align-items: center; 
    z-index: 500;
}

.settings-box {
    background: #2c2c2c; 
    color: white; 
    padding: 20px; 
    border-radius: 10px; 
    width: 85%; 
    max-width: 300px; 
    border: 1px solid #555;
}

.settings-box h3 { 
    margin-top: 0; 
    color: #ffcc00; 
    text-align: center; 
    font-size: 16px;
}

.setting-item { 
    margin-bottom: 15px; 
}

.setting-item label { 
    display: block; 
    margin-bottom: 5px; 
    font-size: 14px; 
}

.setting-item input[type="range"] { 
    width: 100%; 
    cursor: pointer; 
}

#close-settings { 
    width: 100%; 
    padding: 10px; 
    background: #007bff; 
    color: white; 
    border: none; 
    border-radius: 5px; 
    font-weight: bold; 
    margin-top: 10px; 
    cursor: pointer;
}