/* Make the map take up the full browser window */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: sans-serif;
    background-color: #1a1a1a;
}

/* The main viewport for the map */
#map-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
}

#map-viewport:active {
    cursor: grabbing;
}

/* Generic container for a layer of tiles */
.tile-pane {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    will-change: transform; /* Hint to the browser for optimization */
}

/* Individual map tiles */
.tile {
    position: absolute;
    width: 256px;
    height: 256px;
    user-select: none;
    -webkit-user-drag: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    will-change: opacity;
}

.tile.loaded {
    opacity: 1;
}

/* UI elements */
#ui-container {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#ruler-tool-btn {
    padding: 8px 12px;
    border: none;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#ruler-tool-btn.active {
    background-color: #007bff;
}

#distance-display {
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 5px;
    font-size: 14px;
    min-height: 18px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Ruler visuals */
#ruler-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 500;
}

.ruler-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #ff4500;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.ruler-line {
    position: absolute;
    height: 3px;
    background-color: #ff4500;
    transform-origin: left center;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}