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

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

#gameCanvas {
    display: block;
}

/* --- MENU OVERLAY (Glassmorphism) --- */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.menu-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.menu-content {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    width: 500px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    color: white;
}

.menu-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 5px 10px;
}

.tab-btn:hover {
    color: white;
}

.tab-btn.active {
    color: white;
    border-bottom: 2px solid #3498db;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h2 {
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 700;
}

/* Profile Panel */
.profile-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, #3498db, #8e44ad);
    border-radius: 20px;
}

.stats p {
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.8);
}

.stats span {
    color: white;
    font-weight: 600;
}

/* Settings Panel */
.setting-item {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

input[type="range"] {
    accent-color: #3498db;
}

/* Map Panel */
ul {
    list-style: none;
}

li {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.green {
    background: #2f7a46;
}

.dot.black {
    background: #1a1a1a;
}

.dot.grey {
    background: #4a4a4a;
}

.menu-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.menu-footer span {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
}

/* --- FRIEND SIDEBAR --- */
.friend-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    padding: 20px;
    box-sizing: border-box;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: white;
}

.friend-sidebar.show {
    transform: translateX(0);
}

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

.friend-header h3 {
    margin: 0;
    font-size: 20px;
    color: #fff;
}

.friend-list {
    flex: 1;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

.friend-list li {
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.friend-list li:hover {
    background: rgba(255, 255, 255, 0.1);
}

.add-friend {
    display: flex;
    gap: 8px;
}

.add-friend input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
}

.add-friend button {
    background: #3498db;
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.add-friend button:hover {
    background: #2980b9;
}

/* Close button */
.close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

/* --- CHAT TAB BAR --- */
.chat-tab-bar {
    display: flex;
    gap: 2px;
    padding: 4px 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}
.chat-tab-bar::-webkit-scrollbar { display: none; }
.chat-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
}
.chat-tab:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}
.chat-tab.active {
    color: #4fc3f7;
    background: rgba(79,195,247,0.1);
}
.chat-tab .tab-close {
    font-size: 9px;
    color: rgba(255,255,255,0.3);
    margin-left: 2px;
    cursor: pointer;
    line-height: 1;
}
.chat-tab .tab-close:hover {
    color: #e74c3c;
}

/* --- CHAT SYSTEM --- */
.chat-container,
#chat-container {
    position: fixed !important;
    bottom: 20px !important;
    top: auto !important;
    right: 100px !important;
    width: 280px !important;
    max-height: 200px !important;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 300 !important;
    overflow: hidden !important;
    transform: none !important;
}

.chat-container.collapsed {
    max-height: 0;
    border: none;
    background: none;
    backdrop-filter: none;
    box-shadow: none;
    overflow: visible;
}

.chat-container.collapsed .chat-tab-bar,
.chat-container.collapsed .chat-messages-list,
.chat-container.collapsed .chat-input-row {
    display: none;
}

.chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    max-height: 200px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    display: none;
}
.chat-messages-list.active {
    display: block;
}

.chat-messages-list::-webkit-scrollbar {
    width: 4px;
}

.chat-messages-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.chat-msg {
    margin-bottom: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.3;
    word-break: break-word;
    animation: chatFadeIn 0.25s ease;
    font-family: 'Courier New', 'Press Start 2P', monospace;
    color: #e0e0e0;
}

.chat-msg .chat-name {
    font-weight: 700;
    margin-right: 4px;
}

.chat-msg .chat-text {
    opacity: 0.9;
}

.chat-input-row {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-input-row input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    padding: 5px 8px;
    font-size: 12px;
    outline: none;
    font-family: 'Courier New', monospace;
    transition: border-color 0.2s;
}

.chat-input-row input:focus {
    border-color: #4fc3f7;
}

.chat-input-row button {
    background: #4fc3f7;
    border: none;
    border-radius: 6px;
    color: #000;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-input-row button:hover {
    background: #29b6f6;
    transform: scale(1.05);
}

.chat-toggle-btn {
    display: flex;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    border: 2px solid #4fc3f7;
    border-radius: 50%;
    color: #4fc3f7;
    cursor: pointer;
    font-size: 20px;
    align-items: center;
    justify-content: center;
    z-index: 301;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-toggle-btn:hover {
    background: #4fc3f7;
    color: #000000;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(79, 195, 247, 0.6);
}

@keyframes chatFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}