* {
    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 OVERLAY --- */
.chat-overlay {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 320px;
    max-height: 80%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px 12px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1200;
    color: #fff;
}
.chat-overlay.show { transform: translateY(0); }
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-weight: 600;
    font-size: 16px;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    font-size: 14px;
}
.chat-messages .msg {
    margin-bottom: 6px;
}
.chat-messages .msg.me { text-align: right; color: #4fc3f7; }
.chat-input {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.chat-input 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;
}
.chat-input button {
    background: #3498db;
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.chat-input button:hover { background: #2980b9; }

/* --- EDGE CURSORS --- */
.edge-n { cursor: n-resize !important; }
.edge-s { cursor: s-resize !important; }
.edge-e { cursor: e-resize !important; }
.edge-w { cursor: w-resize !important; }
.edge-ne { cursor: ne-resize !important; }
.edge-nw { cursor: nw-resize !important; }
.edge-se { cursor: se-resize !important; }
.edge-sw { cursor: sw-resize !important; }

/* --- COORDINATE DISPLAY --- */
.coord-display {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 18px;
    color: white;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    z-index: 100;
    pointer-events: none;
    user-select: none;
    min-width: 200px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.coord-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

.coord-item:last-child {
    margin-bottom: 0;
}

.coord-label {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

.coord-value {
    color: #4fc3f7;
    font-weight: 700;
    text-align: right;
}

/* --- SEARCH BAR --- */
.search-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 200;
}

.search-box {
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.search-box input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    padding: 8px 12px;
    width: 90px;
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.search-box input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #3498db;
}

.search-box button {
    background: #3498db;
    border: none;
    border-radius: 8px;
    color: white;
    padding: 8px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.search-box button:hover {
    background: #2980b9;
}

/* Hide arrows in number input */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* --- SIDEBARS --- */
.sidebar-right, .sidebar-left {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 200;
}
.sidebar-right { right: 20px; }
.sidebar-left { left: 20px; }

.tool-group {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    padding: 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.tool-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-btn:hover {
    background: #3498db;
    border-color: #3498db;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
}

.tool-btn:active {
    transform: scale(0.95);
}

.tool-group.bottom {
    margin-top: auto;
}

/* Parcel Selection Tool Active State */
.tool-btn.active {
    background: #e67e22; /* Orange for land claim mode */
    border-color: #f39c12;
    box-shadow: 0 0 20px rgba(230, 126, 34, 0.6);
}

/* Buy Panel Styles */
.buy-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    border: 2px solid #e67e22;
    border-radius: 20px;
    padding: 24px;
    color: white;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 250px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.buy-panel.hidden {
    display: none;
}

.buy-info p {
    margin-bottom: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: space-between;
}

.buy-info span {
    color: #e67e22;
    font-weight: 700;
    font-family: monospace;
    font-size: 16px;
}

#confirmBuyBtn {
    background: #e67e22;
    border: none;
    padding: 12px;
    border-radius: 10px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

#confirmBuyBtn:hover {
    background: #d35400;
    transform: translateY(-2px);
}

#confirmBuyBtn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    transform: none;
}

.cancel {
    background: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.cancel:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, 20px); }
    15% { opacity: 1; transform: translate(-50%, 0); }
    85% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -20px); }
}

.coord-item.balance .coord-value {
    color: #2ecc71;
}

/* Build Mode Styles */
.build-toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 15px 25px;
    border-radius: 60px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    z-index: 1000;
}

.brush-selector {
    display: flex;
    gap: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    justify-content: center;
}

.brush-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brush-btn:hover {
    color: white;
    transform: scale(1.1);
}

.brush-btn.active {
    color: #3498db;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
    transform: scale(1.2);
}

.build-toolbar.hidden {
    display: none;
}

.color-palette {
    display: flex;
    gap: 8px;
    padding: 0 10px;
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.color-dot:hover {
    transform: scale(1.2);
}

.color-dot.active {
    border-color: white;
    box-shadow: 0 0 15px currentColor;
    transform: scale(1.3);
}

input[type="color"].color-dot {
    padding: 0;
    -webkit-appearance: none;
    overflow: hidden;
    background: transparent;
}

input[type="color"].color-dot::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"].color-dot::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.tool-btn.danger {
    background: rgba(231, 76, 60, 0.2);
    font-size: 1.2rem;
}

.tool-btn.danger:hover {
    background: #e74c3c;
}

body.build-mode {
    cursor: crosshair !important;
}


