@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;700&display=swap');

* {
    -webkit-tap-highlight-color: transparent;
    outline: 0;
    -webkit-user-select: none;
    user-select: none;
}

#canvas {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.centergui {
    height: 60px;
    justify-content: center;
    width: 100%;
    border-bottom-left-radius: 5px;
}

body {
    margin: 0;
}

#toolMenu {
    display: flex;
}

#toolMenu {
    font-size: 17px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    position: absolute;
    top: 0px;
    left: 0px;
    /* width: 100vw; */
    /* width: calc(100vw - 300px); */
    height: 61px;
    /* padding: 5px; */
    display: flex;
    justify-content: flex-start;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    user-select: none;
    justify-content: left;
    border-bottom-right-radius: 5px;
    flex-wrap: wrap;
    height: fit-content;
}

.centergui .submenu {
    border-bottom-left-radius: 5px;
}

.menu-button-div {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    margin: 15px;
}

.menu-button,
.centergui .menu-button {
    color: red;
    border: none;
    font-size: 2rem;
}

.all-gui {
    width: 100%;
    position: relative;
}

.selectedPlacable {
    -webkit-box-shadow: 0px 0px 30px 0px rgba(173, 173, 173, 1);
    -moz-box-shadow: 0px 0px 30px 0px rgba(173, 173, 173, 1);
    box-shadow: 0px 0px 30px 0px rgba(173, 173, 173, 1);
}

#fullscreenDiv {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none;
}

#minimapCanvas {
    position: absolute;
    /* image-rendering: pixelated; */
}

.chatContainer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 365px;
    pointer-events: none; /* để canvas vẫn kéo được */
    z-index: 50;
}

/* input vẫn nhận click */
.chatContainer .chat {
    pointer-events: auto;
}

.chat {
    position: absolute;
    left: 0px;
    bottom: 0px;
    width: 365px;
    height: 28px;
    border: none;
    outline: none;
    color: white;
    padding: 2px 6px;
    caret-color: white;
    background: rgba(34, 34, 34, 0.25);
    border-radius: 4px;
    font-weight: 900;
    font-family: 'Ubuntu', sans-serif;
    font-size: 30px; /* px => cố định */
    line-height: 40px;
    opacity: 0;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.8),
        1px -1px 0 rgba(0, 0, 0, 0.8),
        -1px 1px 0 rgba(0, 0, 0, 0.8),
        1px 1px 0 rgba(0, 0, 0, 0.8);
}

.chat-div {
    position: absolute;
    left: 0px;
    bottom: 34px; /* px thay vì rem */
    width: 565px;
    height: 560px; /* px thay vì rem */
    display: flex;
    flex-direction: column-reverse;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0);
    font-weight: 900;
    font-family: 'Ubuntu', sans-serif;
    pointer-events: none; /* để không cản thao tác game */
}

.chat-message {
    color: white;
    font-size: 30px; /* px => cố định */
    line-height: 40px;
    margin: 2px 0;
    overflow-wrap: break-word;
    width: 100%;
    user-select: none;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.8),
        1px -1px 0 rgba(0, 0, 0, 0.8),
        -1px 1px 0 rgba(0, 0, 0, 0.8),
        1px 1px 0 rgba(0, 0, 0, 0.8);
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.leaderboard-div {
    position: fixed;
    right: 0; /* 👈 cố định sát mép phải */
    width: 400px; /* 👈 luôn 400px */
    transition:
        left 0.2s linear,
        opacity 0.2s linear;
    opacity: 1;
    top: -1px;
    width: 400px;
    height: 100vh;
    background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.4));
    display: flex;
    justify-content: start;
    align-items: center;
    flex-direction: column;
    padding: 0px;
    color: white;
    overflow-y: auto;
    overflow-x: hidden;
    user-select: none;
    font-family: 'Ubuntu', sans-serif;
}

.hide {
    left: 1600px !important;
    opacity: 0;
}

.leaderboard-div::-webkit-scrollbar {
    width: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.leaderboard-div::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.rainbow {
    animation: colorRotate 4s linear 0s infinite;
}

@keyframes colorRotate {
    0% {
        color: hsl(180, 100%, 50%);
    }
    50% {
        color: hsl(216, 100%, 50%);
    }
    100% {
        color: hsl(180, 100%, 50%);
    }
}

.lb-group {
    background: transparent;
    padding: 5px;
    display: flex;
    justify-content: start;
    align-items: center;
    flex-direction: column;
    margin: 0px;
    width: 500px;
}

.lb-name {
    font-size: 2rem;
    margin-bottom: 0.065rem;
    margin-top: 0.2rem;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.8),
        1px -1px 0 rgba(0, 0, 0, 0.8),
        -1px 1px 0 rgba(0, 0, 0, 0.8),
        1px 1px 0 rgba(0, 0, 0, 0.8);
}

.lb-players {
    margin: 5px;
    font-size: 1.5rem;
    display: flex;
    justify-content: start;
    align-items: center;
    flex-direction: column;

    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.6),
        1px -1px 0 rgba(0, 0, 0, 0.6),
        -1px 1px 0 rgba(0, 0, 0, 0.6),
        1px 1px 0 rgba(0, 0, 0, 0.6);
}

.lb-players div {
    margin: 1.5px;
    cursor: pointer;
    background: transparent;
    padding: 0px;
    transition:
        all 0.1s linear,
        padding 0.1s linear;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.lb-players div:hover {
    background: rgba(255, 255, 255, 0.3);
    padding: 6px;
}

.hideLB {
    left: 100% !important;
    opacity: 0;
}

.hideChat {
    left: -175px !important;
    opacity: 0;
}

/* =========================
   Name overlay (enter name)
   ========================= */

.name-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9999;
}

.name-modal {
    width: 320px;
    background: rgba(20, 20, 20, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 14px;
    color: white;
    font-family: 'Ubuntu', sans-serif;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.name-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 10px;
}

.name-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.25);
    color: white;
    outline: none;
    font-size: 14px;
}

.name-btn {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: rgba(70, 120, 255, 0.9);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.name-btn:active {
    transform: translateY(1px);
}

.name-hint {
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.8;
}

/* ✅ Name overlay (fixed size, not affected by canvas zoom) */
.name-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
}

.name-card {
    width: 33.333vw; /* luôn 1/3 màn hình */
    max-width: none;
    font-size: clamp(14px, 1.2vw, 22px);
    background: rgba(24, 24, 24, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1em;
    padding: 1.2em;
    font-family: 'Ubuntu', sans-serif;
    color: white;
    box-shadow: 0 1em 3em rgba(0, 0, 0, 0.35);
}

.name-title {
    font-weight: 700;
    font-size: 1.4em;
    margin-bottom: 0.8em;
}

.name-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.8em 1em;
    border-radius: 0.8em;
    border: 1px solid rgba(255, 255, 255, 0.12);
    outline: none;
    background: rgba(0, 0, 0, 0.25);
    color: white;
    font-size: 1em;
    caret-color: white;
}

.name-btn {
    margin-top: 0.8em;
    width: 100%;
    padding: 0.8em 1em;
    border-radius: 0.8em;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 1em;
    background: rgba(53, 40, 224, 0.9);
    color: white;
}

.name-hint {
    margin-top: 0.6em;
    font-size: 0.8em;
    opacity: 0.75;
}

.lb-players div:first-child {
    font-size: 2.5rem;
    font-weight: 700;
    color: gold;
    text-shadow: 0 0 10px gold;
}
