html, body { margin: 0; padding: 0; height: 100%; }
#map { width: 100%; height: 100%; }

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.92);
    border-radius: 10px;
    padding: 16px 24px;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    z-index: 10;
}
#legend {
    position: absolute;
    bottom: 32px;
    right: 10px;
    background: rgba(255,255,255,0.92);
    border-radius: 10px;
    padding: 12px 16px;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 13px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    z-index: 1;
    min-width: 230px;
}
.legend-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.legend-title h4 { margin: 0; font-size: 14px; font-weight: 600; }
.legend-about {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 0;
    background: #fff;
    color: #4b5563;
    font-weight: 600;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.legend-about:hover {
    background: #f2f5f9;
    color: #1c2430;
}
.legend-about:focus-visible {
    outline: 2px solid #6aa0ff;
    outline-offset: 2px;
}
.gradient-bar {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(to right,
    rgb(0,220,80),
    rgb(255,255,255),
    rgb(255,20,20));
    margin-bottom: 4px;
}
.gradient-labels {
    display: flex;
    justify-content: space-between;
    color: #555;
    font-size: 11px;
}
#legend .hint {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin-top: 6px;
}

#info-bar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15,15,25,0.82);
    color: #fff;
    padding: 8px 18px;
    border-radius: 22px;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 13px;
    pointer-events: none;
    z-index: 2;
    white-space: nowrap;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.15s ease;
}
#info-bar.visible {
    opacity: 1;
    visibility: visible;
}

#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 340px;
    max-width: 85vw;
    height: 100dvh;
    box-sizing: border-box;
    overflow-x: hidden;
    background: rgba(255,255,255,0.98);
    border-right: 1px solid #e6e9ef;
    box-shadow: 2px 0 18px rgba(0,0,0,0.12);
    padding: 0 18px 24px;
    font-family: system-ui, -apple-system, sans-serif;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 3;
    overflow-y: auto;
}

#sidebar.open {
    transform: translateX(0);
}

.drawer-handle {
    display: none;
    border: none;
    background: #e4e9f2;
    width: 44px;
    height: 5px;
    border-radius: 999px;
    margin: 10px auto 10px;
    cursor: pointer;
}

.drawer-handle:focus-visible {
    outline: 2px solid #6aa0ff;
    outline-offset: 3px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.98);
    padding-top: 18px;
    z-index: 1;
}

#sidebar-title {
    margin: 0;
    font-size: 18px;
}

#sidebar-body {
    transition: opacity 0.18s ease, transform 0.18s ease;
}

#sidebar-body.is-updating {
    opacity: 0;
    transform: translateY(6px);
}

#sidebar-close {
    color: #555;
    font-size: 24px;
    border: none;
    background: none;
    cursor: pointer;
    line-height: 1;
    z-index: 2;
}

#sidebar-close:hover {
    color: #111;
}

.share-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e6e9ef;
}

.share-title {
    font-size: 13px;
    font-weight: 600;
    color: #2f3742;
    margin-bottom: 8px;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.share-btn {
    border: 1px solid #d7dce5;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    text-decoration: none;
    color: #1c2430;
    background: #f7f8fb;
    cursor: pointer;
}

.share-btn:hover {
    background: #eef2f7;
}

.share-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.share-hint {
    margin-top: 8px;
    font-size: 11px;
    color: #6c7685;
}

@media (max-width: 720px) {
    #sidebar {
        --drawer-peek: 160px;
        overscroll-behavior: contain;
        touch-action: pan-y;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding-left: 16px;
        padding-right: 16px;
        top: auto;
        bottom: 0;
        height: min(75vh, 560px);
        border-right: none;
        border-top: 1px solid #e6e9ef;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        transition: transform 0.24s ease;
    }

    #sidebar.open {
        transform: translateY(0);
    }

    #sidebar.drawer-collapsed {
        transform: translateY(calc(100% - var(--drawer-peek)));
    }

    #sidebar.drawer-expanded {
        transform: translateY(0);
    }

    #sidebar.drawer-collapsed #sidebar-body {
        display: block;
        max-height: 72px;
        overflow: hidden;
        position: relative;
    }

    #sidebar.drawer-collapsed #sidebar-body::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 26px;
        background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.98));
        pointer-events: none;
    }

    #sidebar.drawer-collapsed .share-section {
        display: none;
    }

    .drawer-handle {
        display: block;
    }

    .sidebar-header {
        top: 0;
        padding-bottom: 6px;
    }
}

@media (max-width: 640px) {
    #info-bar {
        max-width: 92vw;
        white-space: normal;
        text-align: center;
        line-height: 1.3;
        padding: 8px 14px;
    }
}

.time-visual {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f4f6fa, #ffffff);
    border: 1px solid #eef1f5;
    margin-bottom: 12px;
}

.clock-block {
    flex: 1;
    text-align: center;
}

.clock-face {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 8px;
    background: radial-gradient(circle at 50% 35%, #ffffff, #f1f4f9);
    border: 1px solid #e4e9f2;
    position: relative;
    box-shadow: inset 0 0 12px rgba(0,0,0,0.05);
}

.clock-face.solar {
    background: radial-gradient(circle at 50% 35%, #fff7e8, #f8efe0);
    border-color: #f2e3c8;
}

.clock-hand {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: 0% 50%;
    background: #1c2430;
    border-radius: 2px;
}

.clock-hand.hour {
    width: 34%;
    height: 4px;
}

.clock-hand.minute {
    width: 46%;
    height: 2px;
}

.clock-center {
    width: 8px;
    height: 8px;
    background: #1c2430;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.clock-caption {
    font-size: 12px;
    color: #5a6473;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.clock-time {
    font-size: 18px;
    font-weight: 600;
    color: #10141b;
}

.clock-sub {
    font-size: 12px;
    color: #7a8596;
}

.delta-gauge {
    position: relative;
    margin: 8px 0 14px;
    padding-top: 8px;
}

.delta-track {
    height: 8px;
    border-radius: 6px;
    background: linear-gradient(90deg,
    rgb(0,220,80),
    rgb(255,255,255) 50%,
    rgb(255,20,20));
}

.delta-center {
    position: absolute;
    top: 4px;
    left: 50%;
    width: 2px;
    height: 16px;
    background: #222;
    transform: translateX(-50%);
}

.delta-marker {
    position: absolute;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #10141b;
    background: #fff;
    transform: translateX(-50%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.delta-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #7a8596;
    margin-top: 6px;
}

.delta-caption {
    margin-top: 6px;
    font-size: 12px;
    color: #434c59;
    text-align: center;
}

@media (max-width: 600px) {
    .time-visual {
        flex-direction: column;
    }

    .clock-face {
        width: 100px;
        height: 100px;
    }
}

#sidebar-body .data-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

#sidebar-body .data-row:last-child {
    border-bottom: none;
}

#sidebar-body .data-label {
    font-weight: 600;
}

#sidebar-body .explanation {
    margin-top: 15px;
    font-size: 13px;
    color: #555;
    line-height: 1.4;
}

.about {
    font-size: 13px;
    color: #2f3742;
    line-height: 1.5;
}

.about h4 {
    margin: 14px 0 6px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c7685;
}

.about p {
    margin: 0 0 10px;
}

.no-select {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}