@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ==================== UI LAYER ==================== */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#ui-layer>* {
    pointer-events: auto;
}

/* ==================== TOP BAR ==================== */
#top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 20px;
}

/* Player Info Panel */
#player-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 16px;
    backdrop-filter: blur(10px);
}

#player-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

#player-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#player-name {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

#player-level {
    color: #a5b4fc;
    font-size: 11px;
}

/* Stats Bars */
.stat-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.stat-bar {
    height: 14px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 7px;
    overflow: hidden;
    position: relative;
}

.stat-bar .fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.3s ease;
}

.stat-bar.hp .fill {
    background: linear-gradient(90deg, #ef4444, #f87171);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.stat-bar.xp .fill {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.stat-bar .label {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    color: #fff;
    font-weight: 600;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

/* Currency Panel */
#currency-panel {
    display: flex;
    gap: 16px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 16px;
    backdrop-filter: blur(10px);
}

.currency {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.currency .icon {
    font-size: 16px;
}

.currency.gold .value {
    color: #fbbf24;
}

.currency.gems .value {
    color: #a78bfa;
}

/* Room Info */
#room-info {
    position: absolute;
    top: 70px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Online Counter */
#online-counter {
    position: absolute;
    top: 70px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: #4ade80;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

#online-counter::before {
    content: '●';
    margin-right: 6px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ==================== SKILL BAR ==================== */
#skill-bar {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 8px 12px;
    backdrop-filter: blur(10px);
}

.skill-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #2d2d3a, #1a1a24);
    border: 2px solid #3f3f50;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.skill-btn:hover {
    background: linear-gradient(145deg, #3d3d4a, #2a2a34);
    transform: translateY(-3px);
    border-color: #5f5f70;
}

.skill-btn:active {
    transform: translateY(0);
}

.skill-btn .icon {
    font-size: 22px;
}

.skill-btn .key {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 9px;
    color: #888;
    font-weight: 600;
}

.skill-btn.cooldown {
    opacity: 0.5;
    pointer-events: none;
}

.skill-btn.cooldown::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
}

/* ==================== CHAT BOX ==================== */
#chat-box {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.3s;
}

#chat-box:hover {
    background: rgba(0, 0, 0, 0.75);
}

#chat-messages {
    height: 80px;
    overflow-y: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    background: transparent;
}

.chat-msg {
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    animation: slideIn 0.2s ease-out;
    border: none;
    color: #fff;
}

.chat-msg.system {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
    font-style: italic;
    border: none;
}

.chat-msg .sender {
    font-weight: 600;
    color: #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#chat-input {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-family: inherit;
    font-size: 12px;
    outline: none;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
}

#chat-input:focus {
    background: rgba(0, 0, 0, 0.5);
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ==================== MINIMAP ==================== */
#minimap {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 150px;
    height: 150px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
}

#minimap-canvas {
    width: 100%;
    height: 100%;
}

/* ==================== LOGIN MODAL ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(145deg, #1e1e2e, #2a2a3e);
    padding: 40px 50px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.8) translateY(30px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin-bottom: 8px;
    font-size: 32px;
    color: #fff;
    font-weight: 700;
}

.modal-content .subtitle {
    color: #a5b4fc;
    font-size: 14px;
    margin-bottom: 30px;
}

.modal-content input {
    width: 280px;
    padding: 16px 20px;
    border: 2px solid #3f3f50;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    background: #1a1a24;
    color: #fff;
    transition: border-color 0.2s;
}

.modal-content input::placeholder {
    color: #6b7280;
}

.modal-content input:focus {
    border-color: #3b82f6;
}

.modal-content button {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

.modal-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
}

.modal-content button:active {
    transform: translateY(0);
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* ==================== TOOLTIP ==================== */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    pointer-events: none;
    z-index: 200;
    white-space: nowrap;
}

/* ==================== DAMAGE NUMBERS ==================== */
.damage-number {
    position: absolute;
    font-size: 18px;
    font-weight: 700;
    color: #ef4444;
    text-shadow: 2px 2px 0 #000;
    animation: damageFloat 1s ease-out forwards;
    pointer-events: none;
}

@keyframes damageFloat {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-40px);
        opacity: 0;
    }
}

/* ==================== PARTY SYSTEM ==================== */
#party-panel {
    position: absolute;
    top: 130px;
    left: 20px;
    width: 200px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px;
    backdrop-filter: blur(5px);
    display: none;
}

#party-header {
    font-size: 14px;
    font-weight: 700;
    color: #a5b4fc;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#party-leave-btn {
    font-size: 10px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
}

.party-member {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 12px;
    color: #fff;
}

.party-member:last-child {
    border-bottom: none;
}

.party-member .level {
    color: #fbbf24;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 4px;
    border-radius: 4px;
}

/* Party Invite Popup */
#party-invite {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid #6366f1;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    min-width: 250px;
    align-items: center;
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#party-invite.hidden {
    display: none;
}

#party-invite h3 {
    font-size: 16px;
    color: #fff;
    margin: 0;
}

#party-invite p {
    font-size: 12px;
    color: #cbd5e1;
    margin: 0;
}

.invite-actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.invite-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.1s;
}

.invite-btn:hover {
    transform: translateY(-2px);
}

.invite-btn.accept {
    background: #22c55e;
    color: white;
}

.invite-btn.decline {
    background: #ef4444;
    color: white;
}