body {
    margin: 0;
    padding: 0;
    background: #222;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Segoe UI', Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
#gameContainer {
    position: relative;
    width: 900px;
    display: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
canvas {
    background: #111;
    display: block;
    margin: 0 auto;
    border: 2px solid #444;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0,0,0.5);
    position: relative;
    z-index: 1;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
#ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
#player-stats {
    position: absolute;
    top: 0;
    left: -220px;
    background: rgba(0,0,0,0.7);
    padding: 10px;
    border-radius: 5px;
    color: white;
    width: 200px;
    pointer-events: auto;
    cursor: move;
    z-index: 1;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
#inventory {
    position: absolute;
    top: 100px;
    left: 850px;
    background: rgba(0,0,0,0.7);
    padding: 10px;
    border-radius: 5px;
    color: white;
    width: 200px;
    pointer-events: auto;
    cursor: move;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
#construction {
    position: absolute;
    top: 250px;
    left: 850px;
    background: rgba(0,0,0,0.7);
    padding: 10px;
    border-radius: 5px;
    color: white;
    width: 200px;
    pointer-events: auto;
    cursor: move;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
#inventory button, #construction button {
    margin: 4px;
    padding: 6px 12px;
    background: #555;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    position: relative;
    transition: background 0.2s;
    pointer-events: auto;
    width: 100%;
    text-align: center;
}
#inventory button:hover, #construction button:hover {
    background: #777;
}
#inventory button .key-label, #construction button .key-label {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 11px;
    color: #ff0;
}
.player-info {
    margin: 8px 0;
    font-size: 14px;
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.player-info:last-child {
    border-bottom: none;
}
.player-info .name {
    font-weight: bold;
    font-size: 16px;
    color: #ddd;
    margin-bottom: 5px;
}
.hp-bar, .mana-bar {
    width: 150px;
    height: 8px;
    background: #333;
    border: 1px solid #555;
    margin: 4px 0;
    border-radius: 2px;
}
.hp-bar div, .mana-bar div {
    height: 100%;
    border-radius: 1px;
}
.hp-bar div {
    background: #e44;
}
.mana-bar div {
    background: #44e;
}
.status, .casting {
    color: #aaa;
    font-size: 12px;
    margin-top: 4px;
}
#target-selection {
    position: absolute;
    top: 0;
    right: -180px;
    background: rgba(0,0,0,0.0);
    padding: 8px;
    border-radius: 5px;
    color: white;
    font-size: 14px;
    width: 150px;
    pointer-events: auto;
    cursor: move;
    z-index: 1;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
#last-spell {
    color: #ff0;
}
#selected-target {
    color: #0ff;
}
#spells {
    position: absolute;
    bottom: -60px;
    left: 0;
    width: 850px;
    background: rgba(0,0,0,0.7);
    padding: 8px;
    border-radius: 5px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    pointer-events: auto;
    cursor: move;
    z-index: 1;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
#spells button, #inventory button {
    margin: 4px;
    padding: 6px 12px;
    background: #555;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    position: relative;
    transition: background 0.2s;
    pointer-events: auto;
}
#spells button:hover, #inventory button:hover {
    background: #777;
}
#spells button .key-label, #inventory button .key-label {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 11px;
    color: #ff0;
}

#settings-container {
    position: absolute;
    top: 150px;
    left: -220px;
    background: rgba(0,0,0,0.7);
    padding: 8px;
    border-radius: 5px;
    pointer-events: auto;
    cursor: move;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.settings-button button {
    padding: 6px 12px;
    background: #555;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    width: 100%;
    text-align: center;
}

.settings-button button:hover {
    background: #777;
}

#return-button {
    position: absolute;
    top: 350px;
    left: -220px;
    background: rgba(0,0,0,0.7);
    padding: 8px;
    border-radius: 5px;
    pointer-events: auto;
    cursor: move;
    z-index: 1;
}

#return-button button {
    padding: 6px 12px;
    background: #555;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

#return-button button:hover {
    background: #777;
}
#feedback {
    position: absolute;
    bottom: 60px;
    left: 0;
    color: #ff0;
    font-size: 14px;
    background: rgba(0,0,0,0.7);
    padding: 5px 10px;
    border-radius: 3px;
    pointer-events: none;
    z-index: 2;
}
#chat-container {
    position: absolute;
    right: -280px;
    top: 0;
    width: 260px;
    height: 300px;
    background: rgba(0,0,0,0.7);
    border-radius: 5px;
    color: white;
    pointer-events: auto;
    cursor: move;
    z-index: 1;
    display: flex;
    flex-direction: column;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
#chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    font-size: 14px;
}
#chat-input-container {
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}
#chat-input {
    width: 90%;
    padding: 5px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 3px;
    color: white;
    font-size: 14px;
    margin: 0 auto;
    display: block;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}
.chat-message {
    margin-bottom: 5px;
    word-wrap: break-word;
}
.chat-message .name {
    color: #ff0;
    font-weight: bold;
}
#nameModal, #keybindModal, #characterModal, #antiAliasingModal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
#nameModal .modal-content, #keybindModal .modal-content, #characterModal .modal-content, #antiAliasingModal .modal-content {
    background: #333;
    padding: 20px;
    border-radius: 5px;
    text-align: center;
    color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

#characterModal .modal-content {
    min-width: 600px;
}

#antiAliasingModal .modal-content {
    min-width: 400px;
    text-align: left;
}

.anti-aliasing-settings {
    margin: 20px 0;
}

.setting-group {
    margin: 15px 0;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 5px;
}

.setting-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.setting-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.setting-group select {
    padding: 5px;
    margin: 5px 0;
    width: 100%;
    background: #444;
    color: white;
    border: none;
    border-radius: 3px;
}

.setting-description {
    color: #ccc;
    font-size: 12px;
    line-height: 1.4;
    margin: 10px 0 0 0;
    font-style: italic;
}
#nameModal input, #keybindModal select, #keybindModal input {
    padding: 8px;
    margin: 10px 0;
    width: 200px;
    border: none;
    border-radius: 3px;
    background: #444;
    color: white;
}
#nameModal button, #keybindModal button {
    padding: 8px 16px;
    background: #555;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    margin: 5px;
    transition: background 0.2s;
}
#nameModal button:hover, #keybindModal button:hover {
    background: #777;
}
@media (max-width: 1200px) {
    #gameContainer {
        width: 900px;
    }
    #player-stats {
        top: 650px;
        left: 0;
        width: 100%;
    }
    #inventory {
        top: 750px;
        left: 0;
        width: 100%;
        justify-content: center;
    }
    #target-selection {
        top: -50px;
        right: 0;
    }
    #spells {
        bottom: 0;
        width: 100%;
    }
    #settings-container {
        bottom: -40px;
        left: 50%;
    }
    #feedback {
        bottom: 80px;
    }
}
@media (max-width: 900px) {
    #gameContainer {
        width: 100%;
    }
    canvas {
        width: 100%;
        height: auto;
    }
    #spells button, #inventory button {
        padding: 4px 8px;
        font-size: 12px;
    }
    #spells button .key-label, #inventory button .key-label {
        font-size: 10px;
    }
    .settings-button button, #return-button button {
        padding: 4px 8px;
        font-size: 12px;
    }
}
.keybind-settings {
    margin: 15px 0;
    text-align: left;
}

.character-selection {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.character-option {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    text-align: center;
    min-width: 140px;
    flex: 1;
    max-width: 160px;
}

.character-option:hover {
    background: rgba(255,255,255,0.2);
    border-color: #4CAF50;
    transform: translateY(-2px);
}

.character-option.selected {
    background: rgba(76,175,80,0.3);
    border-color: #4CAF50;
}

.character-preview {
    width: 60px;
    height: 60px;
    border-radius: 5px;
    margin-bottom: 10px;
    border: 2px solid #555;
}

.character-option h3 {
    margin: 10px 0 5px 0;
    color: #fff;
    font-size: 16px;
}

.character-option p {
    margin: 0;
    color: #ccc;
    font-size: 12px;
    line-height: 1.4;
}
.modal-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}
.modal-buttons button {
    padding: 8px 16px;
    background: #555;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
}
.modal-buttons button:hover {
    background: #777;
}
.auth-tabs {
    display: flex;
    margin-bottom: 15px;
}
.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    background: #444;
    transition: background 0.2s;
}
.auth-tab.active {
    background: #555;
}
.auth-form {
    display: none;
}
.auth-form.active {
    display: block;
}
.error-message {
    color: #ff4444;
    margin: 10px 0;
    font-size: 14px;
}

/* Admin Menu Styles */
#admin-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 20px;
    color: white;
    width: 300px;
    pointer-events: auto;
    cursor: move;
    z-index: 1000;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.admin-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #ffd700;
    padding-bottom: 10px;
}

.admin-menu-header h3 {
    margin: 0;
    color: #ffd700;
    font-size: 18px;
}

.admin-close-btn {
    background: #e44;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-close-btn:hover {
    background: #c33;
}

.admin-menu-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-btn {
    padding: 12px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-align: left;
}



.teleport-btn {
    background: linear-gradient(135deg, #4e4, #3c3);
    color: white;
}

.teleport-btn:hover {
    background: linear-gradient(135deg, #3c3, #2a2);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(68, 228, 68, 0.3);
}

.online-btn {
    background: linear-gradient(135deg, #44e, #33c);
    color: white;
}

.online-btn:hover {
    background: linear-gradient(135deg, #33c, #22a);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(68, 68, 228, 0.3);
}

#admin-button {
    position: absolute;
    top: 10px;
    right: 10px;
    pointer-events: auto;
    z-index: 100;
    cursor: move;
}

.admin-toggle-btn {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #333;
    border: none;
    border-radius: 25px;
    padding: 10px 20px;
    cursor: move;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.admin-toggle-btn:hover {
    background: linear-gradient(135deg, #ffb700, #ff9500);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
}

/* Admin Modal Styles */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.admin-modal-content {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 30px;
    color: white;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #ffd700;
    padding-bottom: 10px;
}

.admin-modal-header h3 {
    margin: 0;
    color: #ffd700;
    font-size: 20px;
}

.admin-modal-close {
    background: #e44;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
}

.admin-modal-close:hover {
    background: #c33;
}

.admin-modal-body {
    margin-bottom: 20px;
}

.admin-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.admin-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.admin-modal-btn.primary {
    background: #4e4;
    color: white;
}

.admin-modal-btn.primary:hover {
    background: #3c3;
}

.admin-modal-btn.secondary {
    background: #666;
    color: white;
}

.admin-modal-btn.secondary:hover {
    background: #555;
}

.admin-modal-btn.danger {
    background: #e44;
    color: white;
}

.admin-modal-btn.danger:hover {
    background: #c33;
}

/* Online List Styles */
.online-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #444;
    border-radius: 5px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
}

.online-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    border-left: 3px solid #4e4;
}

.online-player.offline {
    border-left-color: #e44;
    opacity: 0.6;
}

.online-player-name {
    font-weight: bold;
    color: #ddd;
}

.online-player-status {
    font-size: 12px;
    color: #aaa;
}

.online-player-actions {
    display: flex;
    gap: 5px;
}

.online-player-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    background: #555;
    color: white;
}

.online-player-btn:hover {
    background: #777;
}

.online-player-btn.teleport {
    background: #4e4;
}

.online-player-btn.teleport:hover {
    background: #3c3;
}

.online-player-btn.summon {
    background: #44e;
}

.online-player-btn.summon:hover {
    background: #33c;
}

.online-player-btn.kick {
    background: #e44;
}

.online-player-btn.kick:hover {
    background: #c33;
} 