body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f0f0f0;
}

#map-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    position: relative;
}

#map-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 100%;
}

#map-image {
    display: block;
    width: 100%;
    height: auto;
}

@media (orientation: portrait) {
    #map-container {
        min-height: 100vh;
        min-height: 100dvh;
        align-items: flex-start;
        justify-content: flex-start;
    }

    #map-wrapper {
        min-height: 100vh;
        min-height: 100dvh;
        height: 100vh;
        height: 100dvh;
        width: auto;
        max-width: none;
    }

    #map-image {
        width: auto;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
    }
}

#stations-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.station-bubble {
    display: block;
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    z-index: 50;
    width: 6%;
    /* This controls the overall size */
}

.station-label {
    font-size: 0.8em;
    line-height: 1.1;
    font-weight: 700;
    color: #ffffff;
    text-transform: none;
    letter-spacing: 0.06em;
    pointer-events: none;
    white-space: nowrap;
    margin-bottom: 0.3em;
}

.weather-circle {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    /* This creates a perfect square/circle */
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    border-radius: 50%;
    border: 0.3vw solid white;
    box-shadow: 0 0.4vw 1.2vw rgba(0, 0, 0, 0.3);
    color: white;
    font-weight: 600;
}

.weather-circle>div {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.7vw;
    /* Base font size that scales with viewport */
}

.temp-section {
    display: flex;
    align-items: center;
    gap: 0.3em;
    margin-bottom: 0.2em;
}

.temp-icon {
    width: 1.5em;
    height: 1.5em;
}

.station-temp {
    font-size: 1.6em;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.divider {
    width: 80%;
    height: 0.15em;
    background: rgba(255, 255, 255, 0.4);
    margin: 0.3em 0;
}

.wind-section {
    display: flex;
    align-items: center;
    gap: 0.3em;
}

.wind-icon {
    width: 1.3em;
    height: 1.3em;
}

.wind-data {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.station-wind-speed {
    font-size: 1.4em;
    font-weight: 700;
}

.station-wind-gust {
    font-size: 0.85em;
    font-weight: 500;
    opacity: 0.9;
}

@media (orientation: portrait) {
    .station-bubble {
        width: 10.2vh;
        height: 10.2vh;
    }

    .weather-circle {
        width: 100%;
        height: 100%;
        padding-bottom: 0;
        aspect-ratio: 1 / 1;
        border: 0.55vh solid white;
        box-shadow: 0 0.4vh 1.2vh rgba(0, 0, 0, 0.3);
    }

    .weather-circle>div {
        font-size: 1.1vh;
    }

    .station-label {
        font-size: 1em;
    }
}

.station-bubble.loading .weather-circle {
    opacity: 0.6;
}

.station-line {
    stroke: rgba(255, 255, 255, 0.95);
    stroke-width: 0.3vw;
    stroke-linecap: round;
    filter: drop-shadow(0 0 0.6vw rgba(255, 255, 255, 0.8));
    pointer-events: none;
}

/* Lift Dots */
/* Lift Dots */
.lift-dot {
    position: absolute;
    width: 1%;
    aspect-ratio: 1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: clamp(1px, 0.18vw, 4px) solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 10;
    transition: all 0.3s ease;
}

.lift-dot:hover {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 100;
}

.lift-dot.status-open {
    background-color: #2ecc71;
    /* Green */
    box-shadow: 0 0 10px #2ecc71, 0 0 20px rgba(46, 204, 113, 0.5);
}

.lift-dot.status-closed {
    background-color: #e74c3c;
    /* Red */
    box-shadow: 0 0 10px #e74c3c, 0 0 20px rgba(231, 76, 60, 0.5);
}

.lift-dot.status-hold {
    background-color: #f1c40f;
    /* Yellow */
    box-shadow: 0 0 10px #f1c40f, 0 0 20px rgba(241, 196, 15, 0.5);
}

.lift-dot.status-scheduled {
    background-color: #3498db;
    /* Blue */
    box-shadow: 0 0 10px #3498db, 0 0 20px rgba(52, 152, 219, 0.5);
}

.lift-dot.status-expected {
    background-color: #3498db;
    /* Blue */
    box-shadow: 0 0 10px #3498db, 0 0 20px rgba(52, 152, 219, 0.5);
}

/* Default purple for other statuses as requested */
.lift-dot:not(.status-open):not(.status-closed):not(.status-hold):not(.status-scheduled):not(.status-expected) {
    background-color: #9b59b6;
    /* Purple */
    box-shadow: 0 0 10px #9b59b6, 0 0 20px rgba(155, 89, 182, 0.5);
}

/* UI Controls */
#ui-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#debug-coords {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 14px;
    pointer-events: none;
    z-index: 2000;
}

.control-btn {
    background: #333;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
}

.control-btn:hover {
    background: #555;
}

.control-btn:disabled {
    background: #888;
    cursor: not-allowed;
}

/* Lifts View */
#lifts-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    z-index: 500;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.lifts-header {
    max-width: 800px;
    margin: 0 auto 20px;
    padding-top: 60px;
    /* Space for button */
}

.lifts-header h1 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

#lifts-list {
    max-width: 800px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.lift-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lift-name {
    font-weight: 600;
    color: #333;
}

.lift-area {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.lift-status {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.status-open {
    background: #e6f4ea;
    color: #1e8e3e;
}

.status-closed {
    background: #fce8e6;
    color: #d93025;
}

.status-hold {
    background: #fef7e0;
    color: #f9ab00;
}

.status-scheduled {
    background: #e8f0fe;
    color: #1a73e8;
}

.status-expected {
    background: #e8f0fe;
    color: #1a73e8;
}

.hidden {
    display: none !important;
}

#lift-legend {
    position: fixed;
    bottom: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    padding: 12px 14px;
    border-radius: 0px;
    font-size: 12px;
    z-index: 1200;
    pointer-events: none;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(1px);
}

.legend-title {
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 11px;
    color: #111;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 8px 14px;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    color: #111;
    font-weight: 700;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 1);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
}

.legend-swatch.status-open {
    background: #1e8e3e;
}

.legend-swatch.status-closed {
    background: #d93025;
}

.legend-swatch.status-hold {
    background: #f9ab00;
}

.legend-swatch.status-scheduled,
.legend-swatch.status-expected {
    background: #1a73e8;
}

.legend-swatch-default {
    background: #9b59b6;
    border-color: rgba(255, 255, 255, 0.8);
}

@media (orientation: portrait) {
    .lift-dot {
        border: 0.3vh solid white;
    }

    .legend-swatch {
        border: 0.35vh solid rgba(255, 255, 255, 0.8);
    }

    .station-line {
        stroke-width: 0.6vh;
        filter: drop-shadow(0 0 0.6vh rgba(255, 255, 255, 0.8));
    }

    #lift-legend {
        position: absolute;
        bottom: 2vh;
        left: 2vh;
    }
}