/* --- WORLD MAP SYSTEM (CLASH OF KINGS STYLE) --- */
#world-map-wrapper {
    position: fixed;
    top: 60px;
    /* Di bawah resource bar */
    left: 0;
    width: 100vw;
    height: calc(100vh - 120px);
    /* Di atas bottom nav */
    overflow: hidden;
    background: #0d1b2a;
    display: none; /* Hidden by default */
    z-index: 4000;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

#world-map-wrapper::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

#world-map-content {
    position: relative;
    width: 100000px;
    /* 1000x1000 grid, tiap tile 100px */
    height: 100000px;
    background-image:
        linear-gradient(rgba(100, 80, 50, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100, 80, 50, 0.15) 1px, transparent 1px),
        url('../assets/grass/grass.png'); 
    background-color: #c2a679; /* Warna tanah pasir/rumput kering sesuai gambar */
    background-size: 100px 100px, 100px 100px, 512px 512px;
    background-repeat: repeat;
}

.map-tile {
    position: absolute;
    width: 100px;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.map-tile.player-castle {
    z-index: 10;
}

.map-tile img,
.map-tile svg {
    width: 80%;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.5));
}

.map-tile .player-name {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-top: 2px;
    border: 1px solid var(--cok-gold);
    white-space: nowrap;
}

.map-tile .coord-label {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.6rem;
    color: rgba(255, 215, 0, 0.3);
}

#map-coords-hud {
    position: fixed;
    bottom: 160px; /* Moved up to avoid overlap with central button */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: gold;
    padding: 6px 20px;
    border-radius: 20px;
    border: 1.5px solid var(--cok-gold);
    z-index: 4500;
    font-weight: bold;
    font-family: 'Outfit', sans-serif;
    display: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    pointer-events: none;
}

/* --- TROOP DEPLOYMENT RANGE INPUT (PREMIUM SLIDER) --- */
.march-range {
    -webkit-appearance: none;
    appearance: none;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    height: 10px;
    outline: none;
}

.march-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 10px;
    cursor: pointer;
    background: linear-gradient(to right, #d4af37 0%, #b8860b var(--percent, 0%), #1a1a1a var(--percent, 0%));
    border-radius: 10px;
    border: 1px solid #444;
}

.march-range::-webkit-slider-thumb {
    height: 22px;
    width: 22px;
    border-radius: 50%;
    background: #fdfdfd;
    background: radial-gradient(circle at 30% 30%, #fff, #d4af37 70%, #b8860b 100%);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -7px;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.6), inset 0 0 5px rgba(0, 0, 0, 0.5);
    border: 2px solid #000;
}

.march-range::-moz-range-track {
    width: 100%;
    height: 10px;
    cursor: pointer;
    background: #1a1a1a;
    border-radius: 10px;
    border: 1px solid #444;
}

.march-range::-moz-range-thumb {
    height: 22px;
    width: 22px;
    border-radius: 50%;
    background: #d4af37;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.8);
    border: 2px solid #000;
}

.march-range:active::-webkit-slider-thumb {
    background: #fff;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.9);
}

.march-unit {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    filter: drop-shadow(0 2px 10px rgba(0,0,0,0.8));
    transform: translate(-50%, -50%);
}

.march-unit.gathering img,
.march-unit.conquering img {
    opacity: 0.4;
    transform: scale(0.6);
    filter: grayscale(0.5);
}

.map-tile.resource-tile img,
.map-tile.resource-tile svg {
    width: 70%;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

.map-tile.resource-tile .res-lv {
    position: absolute;
    top: -10px;
    background: #27ae60;
    color: white;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: bold;
}

.monster-tile img {
    width: 60%;
    animation: monsterFloat 3s infinite ease-in-out;
}

@keyframes monsterFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.monster-unit {
    filter: drop-shadow(0 0 10px purple);
    animation: monsterPulse 2s infinite ease-in-out;
}

@keyframes monsterPulse {
    0%, 100% { 
        filter: drop-shadow(0 0 5px var(--glow-color, purple)) brightness(1.1);
        transform: scale(1);
    }
    50% { 
        filter: drop-shadow(0 0 20px var(--glow-color, purple)) brightness(1.4);
        transform: scale(1.05);
    }
}

.march-status {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #00ff00;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    border: 1px solid #00ff00;
    font-family: monospace;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.map-ctrl-btn {
    position: relative;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--cok-gold);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
}

.map-ctrl-btn:hover {
    background: var(--cok-gold);
    transform: scale(1.1);
    color: black;
}

.map-ctrl-btn .ctrl-label {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.55rem;
    color: gold;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 1);
    pointer-events: none;
    white-space: nowrap;
}

.march-status-item {
    cursor: pointer;
    pointer-events: auto;
}

.march-status-item:hover {
    filter: brightness(1.2);
}


/* --- RADIAL ACTION MENU --- */
.radial-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    pointer-events: auto;
}

.radial-menu-container {
    position: absolute;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radial-button {
    position: absolute;
    width: 55px;
    height: 55px;
    background: radial-gradient(circle at center, rgba(30, 20, 10, 0.95), rgba(10, 5, 0, 1));
    border: 2px solid gold;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.6rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8), inset 0 0 10px rgba(212,175,55,0.3);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10001;
    text-transform: uppercase;
    font-weight: bold;
}

.radial-button:hover {
    transform: scale(1.15) !important;
    background: gold;
    color: black;
    box-shadow: 0 0 20px gold;
}

.radial-button .icon {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.radial-center-glow {
    position: absolute;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(212,175,55,0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: radialPulse 2s infinite ease-in-out;
    pointer-events: none;
}

@keyframes radialPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 0.8; }
}

@keyframes radialPopIn {
    from { transform: scale(0) rotate(-45deg); opacity: 0; }
    to { transform: scale(1) rotate(0); opacity: 1; }
}

.radial-button {
    animation: radialPopIn 0.3s forwards;
}