/* Global Reset & Fonts */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    /* Prevent selection while dragging */
    -webkit-user-drag: none;
}

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Prevent native scrolling */
    font-family: 'Indie Flower', cursive;
    background-color: #222;
    color: #fff;
}

/* Game Container - Viewport */
#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

#game-container:active {
    cursor: grabbing;
}

/* World Map - The scrollable area */
#world-map {
    width: 2560px;
    height: 1800px;
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    background-color: #f0f0f0;
    background-image: url('Site%20background/Game%20Background@2x.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

/* Grid Container */
#grid-container {
    display: grid;
    grid-template-columns: repeat(4, 640px);
    grid-template-rows: repeat(5, 360px);
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.grid-tile {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Fog Layer */
#fog-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 2560px;
    height: 1800px;
    pointer-events: none;
    /* Let clicks pass through to map */
    z-index: 10;
}

/* Character */
#character {
    position: absolute;
    width: 50px;
    height: 80px;
    z-index: 5;
    transition: transform 0.1s linear;
    /* Smooth movement update */
    pointer-events: none;
}

#character img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Collectibles */
.gold-pile {
    position: absolute;
    width: 70px;
    height: 70px;
    z-index: 4;
    cursor: pointer;
    /* Removed gold circle styles */
    animation: bounce 2s infinite;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gold-pile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Project Markers */
.project-marker {
    position: absolute;
    width: 120px;
    height: 120px;
    z-index: 4;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: shimmer 3s infinite;
}

.project-marker img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
}

@keyframes shimmer {
    0% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    }
}

/* UI Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through except on children */
    z-index: 20;
}

#ui-layer>* {
    pointer-events: auto;
}

/* Minimap */
#minimap-container {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 150px;
    height: 150px;
}

#minimap {
    width: 100%;
    height: 100%;
    /* New Minimap Background */
    background-image: url('Map%20elements/Minimap%20with%20character.svg');
    background-size: 100% 100%;
    border-radius: 50%;
}

#minimap-border {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 3px solid #333;
    border-radius: 50%;
    pointer-events: none;
}

/* About Button */
#about-btn-container {
    position: absolute;
    top: 200px;
    right: 35px;
    cursor: pointer;
}

#about-btn {
    width: 120px;
}

/* Gem Counter (formerly Gold Counter) */
#gold-counter {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 20px;
    font-size: 28px;
    /* Larger text */
    font-weight: bold;
    color: #fff;
    /* Use the SVG background */
    background: url('Gems/Gem%20Counter.svg') no-repeat center center;
    background-size: contain;
    width: 200px;
    /* Slightly wider to accommodate */
    height: 80px;
    /* Larger */
    display: flex;
    justify-content: center;
    align-items: center;
    padding-left: 60px;
    /* Push text to the right of the gem icon in the SVG */
    padding-top: 10px;
    /* Slight adjustment */
    text-shadow: 1px 1px 2px #000;
    border: none;
    border-radius: 0;
}

/* Controls */
#controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    /* Horizontal alignment */
    gap: 40px;
    /* Space between Arrows and Action Buttons */
    align-items: flex-end;
    /* Align to the bottom so E/R match arrows */
}

#d-pad {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.control-row {
    display: flex;
    gap: 5px;
}

.control-btn {
    width: 60px;
    height: 60px;
    cursor: pointer;
    transition: transform 0.1s;
}

.control-btn:active,
.control-btn.active {
    transform: scale(0.9);
}

.action-buttons {
    margin-top: 0;
    gap: 20px;
}

/* Notifications */
#notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    color: black;
    border: 4px solid black;
    padding: 20px 40px;
    font-size: 32px;
    font-weight: bold;
    z-index: 100;
    border-radius: 10px;
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.2);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

/* Modals */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    pointer-events: auto;
}

#modal-content {
    background: white;
    width: 80%;
    max-width: 900px;
    height: 80%;
    max-height: 700px;
    padding: 40px;
    border: 4px solid black;
    position: relative;
    overflow-y: auto;
    color: black;
    box-shadow: 20px 20px 0 rgba(255, 255, 255, 0.1);
}

#modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #controls {
        transform: scale(0.8);
        left: 10px;
        bottom: 10px;
    }

    #minimap-container {
        transform: scale(0.7);
        top: 10px;
        right: 10px;
    }
}