/* Tiedotepalkki */
.site-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2500;
    background: linear-gradient(90deg, #b91c1c, #dc2626);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    pointer-events: auto;
}

.site-alert-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    line-height: 1.45;
    font-size: 14px;
    font-weight: 600;
}

.site-alert-title {
    flex: 0 0 auto;
    background: rgba(255,255,255,0.18);
    padding: 4px 8px;
    border-radius: 6px;
}

#site-alert-text {
    flex: 1 1 0;
    min-width: 62px;
}

.site-alert-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: rgba(255,255,255,0.14);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.site-alert-close:hover {
    background: rgba(255,255,255,0.24);
}

.site-alert-close:focus-visible {
    outline: 2px solid rgba(255,255,255,0.95);
    outline-offset: 2px;
}

body.has-site-alert #top-left-mobile-buttons {
    top: 52px;
}

body.has-site-alert #toggle-mobile-ui-btn,
body.has-site-alert #info-button-mobile {
    top: 62px;
}

body.has-site-alert #left-panel-container,
body.has-site-alert #right-panel-container {
    padding-top: 60px;
}

@media (max-width: 768px) {
    .site-alert-inner {
        padding: 9px 12px;
        font-size: 13px;
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }
}

body.dark-theme .site-alert {
    background: linear-gradient(90deg, #7f1d1d, #991b1b);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Leaflet pane varmistus */
.leaflet-radarPane-pane {
    z-index: 450 !important;
    pointer-events: none;
}


/* General Body and HTML Styles */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    background-color: #f0f2f5;
    overflow: hidden;
    font-size: 14px;
}

/* Map Container */
#mapid {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Main Container for all UI elements */
#main-container {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Info Panel Modal */
.info-panel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.info-panel-content {
    background-color: white;
    padding: 20px 30px;
    border-radius: 10px;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    line-height: 1.6;
}

.info-panel-content h2, .info-panel-content h3 {
    color: #007bff;
    border-bottom: 2px solid #007bff;
    padding-bottom: 5px;
}

.info-panel-content ul {
    list-style-type: disc;
    padding-left: 20px;
}

.info-panel-content li {
    margin-bottom: 8px;
}

.info-panel-content details.info-accordion {
    border: 1px solid #d6e4f5;
    border-radius: 8px;
    background: #f8fbff;
    margin: 10px 0;
    overflow: hidden;
}

.info-panel-content details.info-accordion summary {
    cursor: pointer;
    padding: 12px 14px;
    font-weight: 700;
    color: #007bff;
    list-style: none;
    user-select: none;
}

.info-panel-content details.info-accordion summary::-webkit-details-marker {
    display: none;
}

.info-panel-content details.info-accordion summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.2s ease;
}

.info-panel-content details.info-accordion[open] summary::before {
    transform: rotate(90deg);
}

.info-panel-content details.info-accordion ul {
    margin: 0;
    padding: 0 20px 14px 38px;
}

.info-panel-content details.info-accordion li:last-child {
    margin-bottom: 0;
}

.info-panel-content .close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #555;
    transition: color 0.2s ease;
}

.info-panel-content .close-button:hover {
    color: #dc3545;
}

/* Action Buttons */
.action-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-align: center;
    text-align-last: center;
}

.action-button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.action-button:active {
    background-color: #004085;
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}


.action-button.is-active {
    background-color: #1e88e5;
    box-shadow: 0 0 0 2px rgba(30,136,229,0.26), 0 2px 5px rgba(0,0,0,0.2);
}

/* Dropdowns */
#city-zoom-dropdown-desktop,
#city-zoom-dropdown-mobile {
    appearance: auto;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    text-align: center;
    text-align-last: center;
}

#city-zoom-dropdown-desktop option,
#city-zoom-dropdown-mobile option {
    text-align: left;
}

/* Mobile Buttons */
#top-left-mobile-buttons {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    pointer-events: auto;
}

#info-button-mobile {
    position: fixed;
    top: 55px;
    right: 10px;
    background-color: #28a745;
    pointer-events: auto;
}

#info-button-mobile.active {
    background-color: #dc3545;
}

/* Opacity Containers */
#radar-opacity-container h4, #lightning-opacity-container h4 {
    margin-top: 0;
    color: #007bff;
    font-size: 1em;
    text-align: center;
}

#radar-opacity-container label, #lightning-opacity-container label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85em;
}

#radar-opacity, #lightning-opacity, #radar-opacity-mobile, #lightning-opacity-mobile {
    width: 100%;
    height: 8px;
    border-radius: 50%;
    background: #d3d3d3;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
}

#radar-opacity::-webkit-slider-thumb, #lightning-opacity::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

#radar-opacity::-moz-range-thumb, #lightning-opacity::-moz-range-thumb, #radar-opacity-mobile::-moz-range-thumb, #lightning-opacity-mobile::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

/* Heatline PRO aikajana (korvaa liukusäätimen) */
#time-slider-container {
    padding: 10px 12px;
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    max-width: 980px;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    pointer-events: auto;
}

#heatline-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 220px;
}

#heatline-bigtime{
    font-weight: 800;
    color: #000;
    font-size: 1.35em;
    letter-spacing: 0.2px;
    line-height: 1.05;
}

#heatline-status{
    font-size: 0.85em;
    color: #111;
    opacity: 0.9;
}

#heatline-range{
    font-size: 0.80em;
    color: #111;
    opacity: 0.85;
}

#heatline-right{
    flex: 1;
    display: flex;
    align-items: center;
}

#heatline-bars{
    width: 100%;
    height: 11px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 1px;
    align-items: stretch;
    cursor: pointer;
    user-select: none;
    touch-action: pan-y;
}

.heatline-seg{
    height: 100%;
    border-radius: 2px;
    outline: 1px solid rgba(0,0,0,0.30);
    transition: opacity 0.2s ease;
}

/* TRENDIVÄRIT - salamamäärän muutos */
.heatline-seg[data-trend="down"] {
    background: rgba(144, 238, 144, 0.35); /* vaaleanvihreä */
}

.heatline-seg[data-trend="up"] {
    background: rgba(220, 53, 69, 0.35); /* punainen */
}

.heatline-seg[data-trend="stable"] {
    background: rgba(255, 255, 224, 0.35); /* vaaleankeltainen */
}

.heatline-seg[data-trend="empty"] {
    background: rgba(128, 128, 128, 0.35); /* harmaa - ei salamoita */
}

.heatline-seg.is-selected {
    outline: 2px solid #007bff;
    background: rgba(120, 120, 120, 0.65) !important;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.28);
    filter: none;
}

#heatline-tooltip{
    position: absolute;
    bottom: 43px;
    right: 12px;
    max-width: 360px;
    background: rgba(0,0,0,0.88);
    color: #fff;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.82em;
    line-height: 1.35;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    display: none;
    pointer-events: none;
}

/* Tumma teema */
body.dark-theme #time-slider-container{
    background: rgba(68, 68, 68, 0.75) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
}
body.dark-theme #heatline-bigtime,
body.dark-theme #heatline-status,
body.dark-theme #heatline-range{
    color: #ffffff !important;
}

/* Tumma teema - trendivärit */
body.dark-theme .heatline-seg[data-trend="down"] {
    background: rgba(0, 255, 0, 0.2); /* vihreä */
}

body.dark-theme .heatline-seg[data-trend="up"] {
    background: rgba(255, 0, 0, 0.2); /* punainen */
}

body.dark-theme .heatline-seg[data-trend="stable"] {
    background: rgba(255, 255, 0, 0.2); /* keltainen */
}

body.dark-theme .heatline-seg[data-trend="empty"] {
    background: rgba(128, 128, 128, 0.35); /* tummahko harmaa - ei salamoita */
}

body.dark-theme .heatline-seg.is-selected {
    outline: 2px solid #64b5f6;
    background: rgba(68, 68, 68, 0.95) !important;
    box-shadow: 0 0 0 2px rgba(100,181,246,0.35);
    filter: none;
}

/* Latausbanneri */
#loading-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    min-width: 240px;
    max-width: 320px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 16px 20px;
    z-index: 2000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.loader-content {
    width: 100%;
    text-align: center;
}

.loader-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

.lightning-symbol {
    font-size: 24px;
    color: #FFD93D;
}

.loader-main-message {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.loader-message {
    color: #FFD93D;
    font-size: 14px;
    margin: 4px 0 8px 0;
    min-height: 20px;
}

.progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 8px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.2s ease;
    border-radius: 2px;
}

.progress-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    margin-top: 4px;
    font-family: monospace;
    text-align: center;
    width: 100%;
}

/* Data-indikaattori */
.data-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.data-indicator.visible {
    opacity: 1 !important;
}

.data-indicator.visible.is-updating .indicator-dot {
    animation: dataIndicatorPulse 1s ease-in-out infinite;
}

.data-indicator.visible:not(.is-updating) .indicator-dot {
    animation: none;
}

.indicator-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #4CAF50;
    box-shadow: 0 0 10px #4CAF50;
}

.indicator-text {
    display: inline-block;
    font-size: 11px;
    color: #555;
    white-space: nowrap;
    font-weight: normal;
}

@keyframes dataIndicatorPulse {
    0% { transform: scale(1); opacity: 0.55; }
    50% { transform: scale(1.35); opacity: 1; }
    100% { transform: scale(1); opacity: 0.55; }
}

/* Tumma teema */
body.dark-theme {
    background-color: #121212; 
    color: #ffffff;
}

body.dark-theme #left-panel-container,
body.dark-theme #right-panel-container {
    background-color: rgba(68, 68, 68, 0.95) !important;
    color: #ffffff !important;
}

body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4,
body.dark-theme p,
body.dark-theme span,
body.dark-theme li {
    color: #ffffff !important;
}

body.dark-theme .indicator-dot {
    background-color: #4CAF50;
    box-shadow: 0 0 15px #4CAF50;
}

body.dark-theme .indicator-text {
    color: #ccc;
}

/* Theme Toggle */
.theme-toggle-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.theme-label {
    font-size: 0.8em;
}

.theme-switch {
    position: relative;
    width: 42px;
    height: 22px;
}

.theme-switch input {
    opacity: 0;
}

.slider {
    position: absolute;
    inset: 0;
    background: #777;
    border-radius: 22px;
    cursor: pointer;
    transition: 0.3s;
}

.slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.theme-switch input:checked + .slider {
    background: #2196f3;
}

.theme-switch input:checked + .slider::before {
    transform: translateX(20px);
}

body.dark-theme #mapid {
    filter: brightness(0.7) contrast(1.1) saturate(0.9);
}

body.dark-theme button,
body.dark-theme .btn,
body.dark-theme .btn-primary,
body.dark-theme input[type="button"],
body.dark-theme select {
    background-color: #333333 !important;
    color: #ffffff !important;
    border: 1px solid #555555 !important;
}

body.dark-theme button:hover {
    background-color: #444444 !important;
}

body.dark-theme input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

body.dark-theme input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: #444444 !important;
    border-radius: 4px;
    border: 1px solid #555555;
}

body.dark-theme input[type="range"]::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: #444444 !important;
    border-radius: 4px;
    border: 1px solid #555555;
}

body.dark-theme input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #ffffff !important;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

body.dark-theme input[type="range"]::-moz-range-thumb {
    height: 18px;
    width: 18px;
    border: none;
    border-radius: 50%;
    background: #ffffff !important;
    cursor: pointer;
}

body.dark-theme #time-slider-container {
    background: rgba(68, 68, 68, 0.6) !important; 
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme #time-slider-container p,
body.dark-theme #time-slider-container span {
    color: #ffffff !important;
}

body.dark-theme .info-panel-content {
    background-color: #222222 !important;
    color: #ffffff !important;
}

body.dark-theme .info-panel-content h2,
body.dark-theme .info-panel-content h3,
body.dark-theme .info-panel-content p,
body.dark-theme .info-panel-content li,
body.dark-theme .info-panel-content span,
body.dark-theme .info-panel-content strong {
    color: #ffffff !important;
}

body.dark-theme .info-panel-content .close-button {
    color: #ffffff !important;
}

body.dark-theme .info-panel-content h2, 
body.dark-theme .info-panel-content h3 {
    border-bottom: 2px solid #2196f3 !important;
    color: #2196f3 !important;
}

body.dark-theme #loading-overlay {
    background: rgba(20, 20, 20, 0.95);
    border-color: rgba(33, 150, 243, 0.2);
}

body.dark-theme .lightning-symbol {
    color: #2196f3;
}

body.dark-theme .loader-message {
    color: #2196f3;
}

body.dark-theme .progress-bar {
    background: linear-gradient(90deg, #2196f3, #64b5f6);
}

/* Piilota mobiilissa */
@media (max-width: 768px) {
    .data-indicator {
        display: none !important;
    }
}


/* Salamakehitys (24 h) */
.l24h-card { position: relative; margin: 0 0 8px 0; padding: 10px 10px 8px 10px; border: 1px solid rgba(0,0,0,0.08); border-radius: 12px; background: #fff; }
.l24h-bars { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end; height: 120px; padding: 12px 6px 0 6px; border-radius: 10px; }
.l24h-bar { position: relative; border-radius: 4px; background: rgba(0, 123, 255, 0.25); cursor: pointer; outline: none; }
.l24h-bar--selected { background: rgba(0, 123, 255, 1); }
.l24h-bar--peak { background: rgba(0, 92, 191, 1); }
.l24h-topnums { height: 22px; margin: 2px 6px 0 6px; display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end; pointer-events: none; }
.l24h-topnum { justify-self: center; font-size: 12px; color: #0a3b7a; font-weight: 600; white-space: nowrap; }
.l24h-axis { margin: 8px 6px 0 6px; display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; color: #666; font-size: 12px; }
.l24h-axis > span { justify-self: center; }
.l24h-legend {
    margin: 8px 6px 0 6px;
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}

/* Selitteen merkki on pieni pylväs, ei havaintopallukka */
.l24h-dot {
    width: 14px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
    margin-right: 6px;
    vertical-align: -2px;
}

.l24h-dot--selected {
    background: rgba(0, 123, 255, 1);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.16);
}

.l24h-dot--peak {
    background: rgba(0, 92, 191, 1);
}
.l24h-tooltip { position: absolute; top: 6px; left: 10px; padding: 4px 6px; font-size: 12px; border-radius: 10px; background: rgba(20,20,20,0.92); color: #fff; pointer-events: none; opacity: 0; transform: translateY(-4px); transition: opacity 120ms ease, transform 120ms ease; z-index: 3; max-width: 260px; white-space: nowrap; }
.l24h-tooltip.is-visible { opacity: 1; transform: translateY(0); }

/* DESKTOP STYLES */
@media (min-width: 769px) {
    body {
        display: flex;
        flex-direction: row;
        height: 100vh;
        overflow: hidden;
    }

    #main-container {
        display: flex;
        pointer-events: none;
    }

    #info-button-mobile, #top-left-mobile-buttons {
        display: none !important;
    }

    #left-panel-container {
        display: flex;
        flex-direction: column;
        width: 300px;
        height: 100%;
        background-color: rgba(255, 255, 255, 0.95);
        box-shadow: 3px 0 10px rgba(0,0,0,0.1);
        z-index: 10;
        padding: 15px;
        box-sizing: border-box;
        pointer-events: auto;
        overflow-y: auto;
        position: relative;
    }

    #page-title {
        color: #007bff;
        font-size: 1.6em;
        text-align: center;
        margin-top: 0;
    }

    #desktop-buttons-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }

    #radar-opacity-container {
        margin-top: 20px;
    }
    
    #lightning-opacity-container {
        margin-top: 10px;
    }


    #visitor-counter-panel {
        margin-top: auto;
        padding-top: 14px;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .visitor-counter-inner {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        font-size: 12px;
        line-height: 1.35;
        color: #4b5563;
        word-break: break-word;
    }

    .visitor-counter-inner a {
        color: #4b5563;
        text-decoration: none;
    }

    .visitor-counter-inner a:hover {
        text-decoration: underline;
    }

    body.dark-theme #visitor-counter-panel {
        border-top-color: rgba(255, 255, 255, 0.10);
    }

    body.dark-theme .visitor-counter-inner,
    body.dark-theme .visitor-counter-inner a {
        color: #d1d5db;
    }

    #right-panel-container {
        display: flex;
        flex-direction: column;
        width: 280px;
        height: 100%;
        background-color: rgba(255, 255, 255, 0.95);
        box-shadow: -3px 0 10px rgba(0,0,0,0.1);
        z-index: 10;
        padding: 15px;
        box-sizing: border-box;
        margin-left: auto;
        pointer-events: auto;
        overflow-y: auto;
    }
    
    #right-panel-container p, #right-panel-container li {
        font-size: 0.9em;
    }

    #statistics-container {
        margin-bottom: 0;
    }
    
    #statistics-container h3 {
        color: #333;
        font-size: 1.1em;
        margin-top: 0;
        border-bottom: 2px solid #007bff;
        padding-bottom: 5px;
    }
    
    #lightning-statistics {
        margin-bottom: 10px;
    }
    
    #lightning-statistics h4 {
        color: #333;
        font-size: 1em;
        margin: 10px 0 5px 0;
        border-bottom: 2px solid #007bff; 
        padding-bottom: 3px;
    }
    
    #lightning-statistics ul {
        list-style-type: none;
        padding: 0;
        margin: 0;
    }
    
    #lightning-statistics li {
        margin-bottom: 5px;
    }
    
    #lightning-legend {
        padding-top: 0;
        margin-top: 10px;
    }

    #time-slider-container {
        width: 50%;
        max-width: 800px;
    }
    
    #toggle-mobile-ui-btn {
        display: none !important;
    }
    
    .info-text-desktop {
        display: block !important;
    }
    
    .desktop-only {
        display: block !important;
    }
    
    .mobile-only {
        display: none !important;
    }
    
    /* Piilota heatmap-palkit live-tilassa desktopilla */
    body.live-mode #heatline-bars {
        display: none !important;
    }
    
    body.live-mode #heatline-right {
        flex: 0;
    }
    
    /* LIVE-TILASSA: vain kello keskellä, kaikki muu piilotettu */
    body.live-mode #heatline-left {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        min-width: auto !important;
        width: 100%;
    }
    
    body.live-mode #heatline-bigtime {
        font-size: 1.2em !important;
        font-weight: 700;
        white-space: nowrap;
        margin: 0;
        text-align: center;
        width: 100%;
    }
    
    /* Piilotetaan päivän salamat live-tilassa */
    body.live-mode #daily-total-simple {
        display: none !important;
    }
    
    /* Piilotetaan aikaväli live-tilassa */
    body.live-mode #heatline-range {
        display: none !important;
    }
    
    /* Säädetään koko containerin asettelua live-tilassa */
    body.live-mode #time-slider-container {
        justify-content: center;
    }
    
    /* Tumma teema - live-tilan värit */
    body.dark-theme.live-mode #heatline-bigtime {
        color: #ffffff;
    }
}

/* MOBILE STYLES */
@media (max-width: 768px) {
    #main-container {
        display: block;
    }

    #left-panel-container {
        display: none;
    }
    
    #right-panel-container {
        display: none;
    }

    .info-text-desktop {
        display: none !important;
    }
    
    .info-panel-modal .info-panel-content {
        max-width: 90%;
        width: 90%;
        height: 90vh;
        padding: 15px 20px;
        box-sizing: border-box;
    }
    
    #statistics-container-mobile,
    #mobile-opacity-container,
    #lightning-legend-mobile {
        display: block !important;
        padding-top: 10px;
        border-top: 1px solid #ccc;
        margin-top: 15px;
    }
    
    #lightning-legend-mobile {
        padding-top: 10px;
        border-top: 1px solid #ccc;
        margin-top: 15px;
    }

    /* Piilotetaan yläosan napit, info-nappi ja copyright piilotetussa tilassa */
    .hidden-ui #top-left-mobile-buttons,
    .hidden-ui #info-button-mobile,
    .hidden-ui #copyright-notice {
        display: none !important;
    }

    /* Toggle-nappi pysyy näkyvillä (jotta käyttöliittymän saa takaisin) */
    .hidden-ui #toggle-mobile-ui-btn {
        display: block !important;
        background-color: #28a745;
    }

    /* Heatmap pysyy näkyvillä piilotetussa tilassa */
    .hidden-ui #time-slider-container {
        display: flex !important;
    }

    /* Toggle-napin perustyyli */
    #toggle-mobile-ui-btn {
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 500;
        background-color: #6c757d;
        color: white;
        pointer-events: auto;
    }
    
    #info-button-mobile {
        position: fixed;
        top: 55px;
        right: 10px;
        background-color: #28a745;
        pointer-events: auto;
    }
    
    /* Copyright-teksti */
    #copyright-notice {
        position: absolute;
        bottom: 10px;
        left: 10px;
        z-index: 1000;
        padding: 2px 5px;
        font-size: 11px;
        border-radius: 3px;
        pointer-events: none;
        font-family: Arial, sans-serif;
    }
    
    /* HEATMAP - keskitetty */
    #time-slider-container {
        width: 40% !important;
        padding: 6px 8px !important;
    }
    
    /* Keskitetään koko heatline-left */
    #heatline-left {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        width: 100% !important;
        min-width: auto !important;
        gap: 2px !important;
    }
    
    /* Keskitetään kaikki tekstit */
    #heatline-bigtime,
    #daily-total-simple,
    #heatline-range {
        text-align: center !important;
        width: 100% !important;
    }
    
    /* Piilotetaan heatmap-palkit */
    #heatline-bars {
        display: none !important;
    }
    
    /* Säädetään heatline-right */
    #heatline-right {
        display: flex !important;
        flex: 0;
        min-width: 0;
    }
    
    /* Pienennetään fontteja */
    #heatline-bigtime {
        font-size: 0.9em !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    #daily-total-simple {
        font-size: 0.65em !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    #heatline-range {
        font-size: 0.6em !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }
    
    #loading-overlay {
        min-width: 200px;
        padding: 12px 16px;
    }
    
    .lightning-symbol {
        font-size: 20px;
    }
    
    .loader-main-message {
        font-size: 14px;
    }
    
    .loader-message {
        font-size: 12px;
    }
   
    #heatline-range {
        display: none !important;
    }

}
/* Tilastojen sisennys */
#statistics-container div[style*="margin-left:8px"] {
    margin-top: 2px;
    margin-bottom: 2px;
}

#statistics-container p {
    margin: 2px 0;
}

#statistics-container h4 {
    margin-bottom: 5px;
}

#statistics-container .fa-crown {
    margin-right: 3px;
}

/* Tilastojen piilotus */
.stat-section {
    margin-bottom: 2px;
    border-bottom: 1px solid rgba(0, 123, 255, 0.1);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    padding: 2px 0;
    user-select: none;
}

.stat-header:hover {
    background-color: rgba(0, 123, 255, 0.05);
    border-radius: 3px;
}

.toggle-icon {
    font-size: 10px;
    width: 14px;
    text-align: center;
    color: #007bff;
    display: inline-block;
    line-height: 1;
}

.section-title {
    margin-left: 2px;
    font-weight: bold;
    font-size: 0.9em;
}

.stat-content {
    transition: all 0.2s ease;
    overflow: hidden;
    margin-top: 0;
    padding-top: 0;
}

/* Tumma teema tilastoille */
.dark-theme .stat-header:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dark-theme .toggle-icon {
    color: #f39c12;
}

.dark-theme .section-title {
    color: #ffffff;
}

/* Poistetaan tyhjät rivit */
#update-info p, 
#update-info-mobile p,
#lightning-statistics p,
#lightning-statistics-mobile p,
#lightning-statistics li,
#lightning-statistics-mobile li {
    margin: 0;
    padding: 0;
    line-height: 1.22;
}

#update-info, 
#update-info-mobile,
#lightning-statistics ul,
#lightning-statistics-mobile ul {
    margin: 0;
    padding: 0;
}

/* Selite */
#lightning-legend p,
#lightning-legend-mobile p {
    margin: 2px 0;
    padding: 0;
    line-height: 1.22;
}

#lightning-legend,
#lightning-legend-mobile {
    margin: 5px 0 0 0;
    padding: 0;
}

#lightning-statistics h4,
#lightning-statistics-mobile h4,
#lightning-legend h4,
#lightning-legend-mobile h4 {
    margin: 8px 0 2px 0;
}


#loading-overlay .loader-retry-btn {
    pointer-events: auto;
}

/* Dark mode fix: Salamakehitys (24 h) */
body.dark-theme .l24h-card {
    background: #333333;
    border-color: rgba(255,255,255,0.10);
}

body.dark-theme .l24h-topnum {
    color: #8fc2ff;
}

body.dark-theme .l24h-axis,
body.dark-theme .l24h-legend {
    color: #c7d0d9;
}

body.dark-theme .l24h-tooltip {
    background: rgba(0,0,0,0.92);
    color: #fff;
}


.hourly-trend-empty {
    margin: 8px 6px 0 6px;
    padding: 10px 12px;
    border-top: 1px solid rgba(0,123,255,0.15);
    color: #666;
    font-size: 12px;
    text-align: center;
}

.hourly-trend-panel {
    margin: 8px 6px 0 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,123,255,0.15);
}

.hourly-trend-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.hourly-trend-panel__controls {
    display: flex;
    align-items: center;
    gap: 3px;
}

.hourly-trend-nav-btn,
.hourly-trend-close-btn {
    background: none;
    border: none;
    font-size: 12px;
    cursor: pointer;
    color: #007bff;
    padding: 0 8px;
}

.hourly-trend-close-btn {
    font-size: 14px;
    padding-left: 10px;
}

.hourly-trend-current-hour {
    font-weight: bold;
    color: #007bff;
    min-width: 44px;
    text-align: center;
}

/* Rakeet live-laatikko */
.hail-live-overlay {
    display: none;
}

body.live-mode .hail-live-overlay:not([hidden]) {
    display: block;
}

.hail-live-overlay {
    position: fixed;
    top: 12px;
    left: 312px;
    width: 210px;
    z-index: 710;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.16);
    padding: 10px;
    box-sizing: border-box;
}

.hail-live-overlay__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.hail-live-overlay.is-collapsed .hail-live-overlay__header {
    margin-bottom: 0;
}

.hail-live-overlay__title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #333;
}

.hail-live-overlay__collapse-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    background: rgba(30,136,229,0.08);
    color: #1e88e5;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
}

.hail-live-overlay__collapse-toggle:hover {
    background: rgba(30,136,229,0.14);
}

.hail-live-overlay__body {
    display: block;
}

.hail-live-overlay.is-collapsed .hail-live-overlay__body {
    display: none;
}

.hail-live-overlay__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    cursor: pointer;
    user-select: none;
    margin-bottom: 6px;
}

.hail-live-overlay__updated {
    font-size: 0.8rem;
    color: #555;
}

.hail-live-overlay__toggle input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #1e88e5;
}

.hail-live-overlay.is-active {
    border-color: rgba(30,136,229,0.38);
    box-shadow: 0 10px 24px rgba(30,136,229,0.20);
}

body.dark-theme .hail-live-overlay {
    background: rgba(34, 34, 34, 0.96);
    border-color: rgba(255,255,255,0.08);
}

body.dark-theme .hail-live-overlay__title,
body.dark-theme .hail-live-overlay__toggle,
body.dark-theme .hail-live-overlay__updated {
    color: #fff;
}

body.dark-theme .hail-live-overlay__collapse-toggle {
    border-color: rgba(255,255,255,0.12);
    background: rgba(30,136,229,0.16);
    color: #8ec7ff;
}

@media (max-width: 768px) {
    .hail-live-overlay {
        display: none !important;
    }

}


#lightning-24h-overlay {
    display: none;
}

@media (min-width: 769px) {
    #lightning-24h-overlay {
        display: block !important;
        position: fixed;
        top: 12px;
        right: 300px;
        width: 266px;
        max-height: calc(100vh - 24px);
        overflow: auto;
        z-index: 700;
        pointer-events: auto;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(0,0,0,0.08);
        border-radius: 12px;
        box-shadow: 0 10px 24px rgba(0,0,0,0.16);
        padding: 10px;
        box-sizing: border-box;
    }

    .lightning-24h-overlay__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 6px;
    }

    .lightning-24h-overlay__title {
        font-size: 0.92rem;
        font-weight: 700;
        color: #333;
    }

    .lightning-24h-overlay__toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        padding: 0;
        border: 1px solid rgba(0,0,0,0.08);
        border-radius: 8px;
        background: rgba(0,123,255,0.08);
        color: #007bff;
        font-size: 18px;
        line-height: 1;
        cursor: pointer;
        flex: 0 0 auto;
    }

    .lightning-24h-overlay__toggle:hover {
        background: rgba(0,123,255,0.14);
    }

    #lightning-24h-overlay .l24h-card {
        margin-bottom: 0;
        padding: 8px 8px 6px 8px;
        border-radius: 10px;
    }

    #lightning-24h-overlay .l24h-bars {
        height: 84px;
        gap: 2px;
        padding: 8px 4px 0 4px;
    }

    #lightning-24h-overlay .l24h-topnums {
        height: 18px;
        margin: 2px 4px 0 4px;
        gap: 2px;
    }

    #lightning-24h-overlay .l24h-topnum,
    #lightning-24h-overlay .l24h-axis,
    #lightning-24h-overlay .l24h-legend,
    #lightning-24h-overlay .hourly-trend-empty,
    #lightning-24h-overlay .hourly-trend-panel,
    #lightning-24h-overlay #hourly-trend-container {
        font-size: 11px;
    }

    #lightning-24h-overlay .l24h-axis {
        margin: 6px 4px 0 4px;
        gap: 2px;
    }

    #lightning-24h-overlay .l24h-legend {
        margin: 6px 4px 0 4px;
        gap: 10px;
    }

    #lightning-24h-overlay.is-collapsed {
        width: 266px;
        padding-bottom: 10px;
        overflow: hidden;
    }

    #lightning-24h-overlay.is-collapsed .lightning-24h-overlay__header {
        margin-bottom: 0;
    }

    #lightning-24h-overlay.is-collapsed .lightning-24h-overlay__body {
        display: none;
    }
}

body.dark-theme .hourly-trend-empty {
    color: #ccc;
    border-top-color: rgba(255,255,255,0.12);
}

body.dark-theme .hourly-trend-panel {
    border-top-color: rgba(255,255,255,0.12);
}

body.dark-theme .hourly-trend-nav-btn,
body.dark-theme .hourly-trend-close-btn,
body.dark-theme .hourly-trend-current-hour,
body.dark-theme .lightning-24h-overlay__title {
    color: #64b5f6 !important;
}

body.dark-theme #lightning-24h-overlay {
    background: rgba(34, 34, 34, 0.96);
    border-color: rgba(255,255,255,0.08);
}

body.dark-theme .lightning-24h-overlay__title {
    color: #fff;
}

body.dark-theme .lightning-24h-overlay__toggle {
    border-color: rgba(255,255,255,0.12);
    background: rgba(100,181,246,0.14);
    color: #64b5f6;
}


/* Keskiarvot / min - kevyt B-versio */
.avg-inline-block {
    margin: 6px 0 8px 0;
    padding: 6px 0 2px 0;
    border-top: 1px solid rgba(0,123,255,0.15);
}

.avg-inline-title {
    margin: 0 0 6px 0;
    font-weight: 700;
    color: #007bff;
    font-size: 13px;
}

.avg-inline-group {
    margin: 0 0 6px 0;
}

.avg-inline-group-title {
    margin: 0 0 2px 0;
    font-size: 12px;
    font-weight: 700;
    color: #444;
}

.avg-inline-values {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 12px;
    line-height: 1.45;
    color: #333;
}

.avg-inline-values span {
    white-space: nowrap;
}

.avg-inline-values strong {
    font-weight: 700;
}

body.dark-theme .avg-inline-block {
    border-top-color: rgba(255,255,255,0.12);
}

body.dark-theme .avg-inline-title {
    color: #64b5f6;
}

body.dark-theme .avg-inline-group-title,
body.dark-theme .avg-inline-values {
    color: #ffffff;
}

@media (max-width: 768px) {
    .avg-inline-values {
        gap: 6px 12px;
        font-size: 12px;
    }
}

/* Tallennetut omat sijainnit */
.saved-location-div-icon {
    background: transparent !important;
    border: 0 !important;
}

.saved-location-div-icon span {
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #ffca28;
    color: #111;
    border: 2px solid #111;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    font-size: 17px;
    line-height: 1;
}

body.dark-theme .saved-location-div-icon span {
    background: #ffd54f;
    color: #111;
    border-color: #000;
}

.saved-location-div-icon > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
    pointer-events: auto;
}

.saved-location-div-icon .saved-location-emoji {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    color: #111;
    border: 2px solid #111;
    font-size: 20px;
    line-height: 1;
}

.saved-location-div-icon small {
    display: block;
    max-width: 72px;
    margin-top: -2px;
    padding: 1px 4px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #fff;
    color: #111;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

body.dark-theme .saved-location-div-icon small {
    background: #222;
    color: #fff;
    border-color: #fff;
}

/* v4.09: 24 h salamakehitys näkyy vain, jos salamoita on */
#lightning-24h-overlay.is-empty {
    display: none !important;
}

.hourly-trend-bars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    align-items: end;
    height: 58px;
    margin-top: 6px;
}

.hourly-trend-bar {
    border: 0;
    border-radius: 4px;
    background: rgba(0,123,255,0.35);
    min-height: 4px;
    cursor: pointer;
}

.hourly-trend-bar--active {
    background: rgba(0,123,255,0.95);
}

.hourly-trend-axis,
.hourly-trend-values {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    font-size: 11px;
    color: #555;
    text-align: center;
}

.hourly-trend-values {
    color: #0a3b7a;
    font-weight: 700;
}

body.dark-theme .hourly-trend-axis,
body.dark-theme .hourly-trend-values {
    color: #fff !important;
}

/* v4.09: tallennetut sijainnit vanhan version tyyliin */
.saved-location-div-icon,
.custom-div-icon {
    background: transparent !important;
    border: 0 !important;
}

.saved-location-old-icon {
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
    font-size: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}

.saved-location-old-icon .saved-location-emoji {
    display: block !important;
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    font-size: 24px !important;
    line-height: 1 !important;
}

.saved-location-old-label {
    background: white;
    color: black;
    border: 1px solid #333;
    border-radius: 3px;
    padding: 0 4px;
    font-size: 9px;
    font-weight: bold;
    white-space: nowrap;
    margin-top: -2px;
    text-transform: uppercase;
    max-width: 78px;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-theme .saved-location-old-label {
    background: #222;
    color: #fff;
    border-color: #fff;
}

/* v4.09: Salamakehitys 24 h - tiivis analyysipaneeli */
#lightning-24h-overlay.is-empty {
    display: none !important;
}

#salamat24h-meta {
    margin: 6px 0 10px 0 !important;
}

.l24h-summary-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(0,123,255,0.18);
    border-radius: 12px;
    background: rgba(0,123,255,0.055);
    color: #111;
}

.l24h-summary-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 12px;
    color: #0d6efd;
    font-size: 28px;
}

.l24h-summary-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    line-height: 1.25;
    font-size: 14px;
}

.l24h-summary-text strong {
    color: #0d6efd;
}

#salamat24h-topnums,
#salamat24h-axis,
#lightning-24h-overlay .l24h-legend,
#lightning-24h-overlay .l24h-tooltip {
    display: none !important;
}

#salamat24h-bars.l24h-bars,
#lightning-24h-overlay .l24h-bars {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    padding: 0 !important;
    gap: 5px !important;
    align-items: stretch !important;
}

.l24h-row {
    display: grid;
    grid-template-columns: 58px minmax(80px, 1fr) 34px;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #111;
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.l24h-row:hover {
    background: rgba(0,123,255,0.07);
}

.l24h-row--selected {
    border-color: #0d6efd;
    background: rgba(0,123,255,0.095);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.12);
}

.l24h-row__label {
    font-weight: 700;
    white-space: nowrap;
}

.l24h-row__track {
    position: relative;
    display: block;
    height: 13px;
    overflow: hidden;
    border-radius: 5px;
    background: rgba(0,0,0,0.055);
}

.l24h-row__fill {
    display: block;
    height: 100%;
    min-width: 8px;
    border-radius: inherit;
    background: linear-gradient(90deg, #0d6efd, #0b5ed7);
}

.l24h-row__value {
    justify-self: end;
    font-weight: 800;
    color: #111;
}

#hourly-trend-empty {
    margin: 10px 0 0 0;
    padding: 8px 10px;
    border-top: 1px solid rgba(0,123,255,0.15);
    color: #555;
    font-size: 12px;
}

#hourly-trend-panel {
    margin: 10px 0 0 0;
    padding-top: 10px;
    border-top: 1px solid rgba(0,123,255,0.15);
}

.hourly-trend-panel__header {
    margin-bottom: 8px;
}

.hourly-trend-panel__controls {
    display: flex;
    align-items: center;
    margin-left: auto;
}

#prev-hour-btn,
#next-hour-btn,
#close-hour-trend-btn {
    display: none !important;
}

.l24h-selected-card {
    padding: 10px 12px;
    border: 1px solid rgba(0,123,255,0.20);
    border-radius: 12px;
    background: rgba(0,123,255,0.055);
}

.l24h-selected-title {
    margin-bottom: 8px;
    font-weight: 800;
    font-size: 14px;
}

.l24h-selected-title strong,
.l24h-selected-stats strong {
    color: #0d6efd;
}

.l24h-selected-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 13px;
}

.hourly-trend-title {
    margin: 10px 0 6px 0;
    font-weight: 800;
    font-size: 14px;
}

.hourly-trend-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hourly-trend-row {
    display: grid;
    grid-template-columns: 50px minmax(70px, 1fr) 28px;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 3px 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.hourly-trend-row__label {
    font-weight: 600;
    white-space: nowrap;
}

.hourly-trend-row__track {
    display: block;
    height: 12px;
    overflow: hidden;
    border-radius: 5px;
    background: rgba(0,0,0,0.055);
}

.hourly-trend-row__fill {
    display: block;
    height: 100%;
    min-width: 8px;
    border-radius: inherit;
    background: linear-gradient(90deg, #0d6efd, #0b5ed7);
}

.hourly-trend-row__value {
    justify-self: end;
    font-weight: 800;
}

.hourly-trend-empty-inline {
    color: #555;
    font-size: 12px;
    padding: 6px 0;
}

body.dark-theme .l24h-summary-card,
body.dark-theme .l24h-selected-card {
    background: rgba(100,181,246,0.10);
    border-color: rgba(100,181,246,0.24);
    color: #fff;
}

body.dark-theme .l24h-summary-text strong,
body.dark-theme .l24h-summary-icon,
body.dark-theme .l24h-selected-title strong,
body.dark-theme .l24h-selected-stats strong {
    color: #64b5f6 !important;
}

body.dark-theme .l24h-row {
    color: #fff;
}

body.dark-theme .l24h-row:hover {
    background: rgba(100,181,246,0.10);
}

body.dark-theme .l24h-row--selected {
    border-color: #64b5f6;
    background: rgba(100,181,246,0.14);
    box-shadow: 0 0 0 2px rgba(100,181,246,0.16);
}

body.dark-theme .l24h-row__track,
body.dark-theme .hourly-trend-row__track {
    background: rgba(255,255,255,0.09);
}

body.dark-theme .l24h-row__value,
body.dark-theme .hourly-trend-row__value,
body.dark-theme .hourly-trend-title,
body.dark-theme .hourly-trend-empty-inline {
    color: #fff !important;
}

body.dark-theme #hourly-trend-empty,
body.dark-theme #hourly-trend-panel {
    border-top-color: rgba(255,255,255,0.12);
}

/* v4.09: PEKE-debug-paneeli ruudulla */
#peke-debug-panel {
    position: fixed !important;
    left: 12px !important;
    bottom: 12px !important;
    width: min(430px, calc(100vw - 24px)) !important;
    max-height: min(72vh, 620px) !important;
    z-index: 99999 !important;
    pointer-events: auto !important;
    background: rgba(18, 24, 33, 0.94) !important;
    color: #fff !important;
    border: 1px solid rgba(100, 181, 246, 0.45) !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 30px rgba(0,0,0,0.42) !important;
    overflow: hidden !important;
    font: 12px/1.35 Consolas, 'Segoe UI', Arial, sans-serif !important;
    backdrop-filter: blur(8px) !important;
}

#peke-debug-panel * {
    box-sizing: border-box !important;
}

.peke-debug-panel__header {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    background: rgba(0, 123, 255, 0.22) !important;
    border-bottom: 1px solid rgba(100,181,246,0.28) !important;
}

.peke-debug-panel__header strong {
    font-size: 13px !important;
    color: #fff !important;
}

.peke-debug-panel__version {
    margin-right: auto !important;
    opacity: 0.8 !important;
    color: #dbeafe !important;
}

#peke-debug-toggle,
#peke-debug-clear {
    border: 1px solid rgba(255,255,255,0.22) !important;
    border-radius: 7px !important;
    background: rgba(255,255,255,0.08) !important;
    color: #fff !important;
    padding: 3px 7px !important;
    cursor: pointer !important;
    font-size: 12px !important;
}

.peke-debug-panel__status {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 3px !important;
    padding: 10px !important;
    background: rgba(0,0,0,0.18) !important;
    border-bottom: 1px solid rgba(255,255,255,0.10) !important;
}

.peke-debug-status-row {
    display: grid !important;
    grid-template-columns: 165px 1fr !important;
    gap: 8px !important;
    align-items: baseline !important;
    min-height: 18px !important;
    color: #f8fafc !important;
}

.peke-debug-status-row__label {
    color: #93c5fd !important;
    white-space: nowrap !important;
}

.peke-debug-status-row__value {
    color: #fff !important;
    font-weight: 700 !important;
    overflow-wrap: anywhere !important;
}

.peke-debug-panel__body {
    max-height: 170px !important;
    overflow: auto !important;
    padding: 8px 10px !important;
    background: rgba(0,0,0,0.12) !important;
}

.peke-debug-row {
    margin: 0 0 3px 0 !important;
    color: rgba(255,255,255,0.82) !important;
    white-space: pre-wrap !important;
}

.peke-debug-row--warn {
    color: #facc15 !important;
}

.peke-debug-row--info {
    color: #bfdbfe !important;
}

#peke-debug-panel.is-collapsed .peke-debug-panel__status,
#peke-debug-panel.is-collapsed .peke-debug-panel__body,
#peke-debug-panel.is-collapsed #peke-debug-clear {
    display: none !important;
}

@media (max-width: 768px) {
    #peke-debug-panel {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        width: auto !important;
        max-height: 65vh !important;
    }

    .peke-debug-status-row {
        grid-template-columns: 145px 1fr !important;
    }
}



/* v4.09: Salamakehitys 24 h takaisin pystypylväsmalliksi */
#lightning-24h-overlay.is-empty {
    display: none !important;
}

.l24h-meta-compact {
    display: grid;
    gap: 3px;
    margin: 6px 0 8px 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(0,123,255,0.06);
    border: 1px solid rgba(0,123,255,0.14);
    color: #222;
    font-size: 12px;
    line-height: 1.25;
}

.l24h-meta-compact strong {
    color: #0d6efd;
}

#salamat24h-topnums {
    display: grid !important;
}

#salamat24h-axis {
    display: grid !important;
}

#salamat24h-bars.l24h-bars,
#lightning-24h-overlay #salamat24h-bars.l24h-bars,
#lightning-24h-overlay .l24h-bars.l24h-bars--columns {
    display: grid !important;
    grid-auto-flow: initial !important;
    grid-auto-columns: initial !important;
    flex-direction: initial !important;
    height: 112px !important;
    gap: 3px !important;
    align-items: end !important;
    padding: 10px 5px 0 5px !important;
    border-radius: 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.035), rgba(0,0,0,0.015));
}

#lightning-24h-overlay .l24h-topnums {
    height: 18px !important;
    margin: 2px 5px 0 5px !important;
    gap: 3px !important;
    align-items: end;
    pointer-events: none;
}

#lightning-24h-overlay .l24h-topnum {
    justify-self: center;
    align-self: end;
    min-height: 12px;
    color: #0a3b7a;
    font-size: 10px !important;
    font-weight: 800;
    line-height: 1;
}

#lightning-24h-overlay .l24h-axis {
    display: grid !important;
    margin: 7px 5px 0 5px !important;
    gap: 3px !important;
    color: #555;
    font-size: 9px !important;
    line-height: 1;
}

#lightning-24h-overlay .l24h-axis > span {
    justify-self: center;
    transform: rotate(-45deg);
    transform-origin: top center;
    white-space: nowrap;
}

.l24h-bar {
    position: relative;
    display: flex;
    align-items: end;
    justify-content: center;
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 4px 4px 2px 2px;
    background: rgba(0,0,0,0.045);
    cursor: pointer;
    outline: 1px solid rgba(0,0,0,0.08);
    overflow: hidden;
}

.l24h-bar:disabled {
    cursor: default;
    opacity: 0.55;
}

.l24h-bar__fill {
    display: block;
    width: 100%;
    min-height: 0;
    border-radius: 4px 4px 2px 2px;
    background: linear-gradient(180deg, #5aa9ff, #0d6efd);
    transition: height 0.18s ease, filter 0.18s ease;
}

.l24h-bar[data-empty="1"]::after {
    content: "";
    width: 4px;
    height: 4px;
    margin-bottom: 1px;
    border-radius: 50%;
    background: rgba(120,120,120,0.45);
}

.l24h-bar:hover:not(:disabled) .l24h-bar__fill {
    filter: brightness(1.12);
}

.l24h-bar--peak .l24h-bar__fill {
    background: linear-gradient(180deg, #0052b8, #003f8f);
}

.l24h-bar--selected {
    outline: 2px solid #007bff !important;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.18);
    background: rgba(0,123,255,0.08);
}

#lightning-24h-overlay .l24h-legend {
    display: flex !important;
}

.l24h-row,
.l24h-summary-card {
    display: none !important;
}

body.dark-theme .l24h-meta-compact {
    background: rgba(100,181,246,0.10);
    border-color: rgba(100,181,246,0.22);
    color: #fff;
}

body.dark-theme .l24h-meta-compact strong {
    color: #64b5f6 !important;
}

body.dark-theme #lightning-24h-overlay .l24h-topnum {
    color: #8fc2ff;
}

body.dark-theme #lightning-24h-overlay .l24h-axis {
    color: #d7dde6;
}

body.dark-theme #salamat24h-bars.l24h-bars,
body.dark-theme #lightning-24h-overlay #salamat24h-bars.l24h-bars,
body.dark-theme #lightning-24h-overlay .l24h-bars.l24h-bars--columns {
    background: linear-gradient(to top, rgba(255,255,255,0.055), rgba(255,255,255,0.02));
}

body.dark-theme .l24h-bar {
    background: rgba(255,255,255,0.07);
    outline-color: rgba(255,255,255,0.08);
}

body.dark-theme .l24h-bar[data-empty="1"]::after {
    background: rgba(200,200,200,0.35);
}

body.dark-theme .l24h-bar__fill {
    background: linear-gradient(180deg, #64b5f6, #1976d2);
}

body.dark-theme .l24h-bar--peak .l24h-bar__fill {
    background: linear-gradient(180deg, #90caf9, #42a5f5);
}

body.dark-theme .l24h-bar--selected {
    outline-color: #64b5f6 !important;
    box-shadow: 0 0 0 2px rgba(100,181,246,0.20);
    background: rgba(100,181,246,0.12);
}


/* v4.09: 24 h pylväskaavion mahtuminen ja tasatuntien akseli */
@media (min-width: 769px) {
    #lightning-24h-overlay {
        width: 286px;
        right: 292px;
    }

    #lightning-24h-overlay.is-collapsed {
        width: 286px;
    }
}

#lightning-24h-overlay .l24h-card {
    overflow: hidden;
}

#salamat24h-bars.l24h-bars,
#lightning-24h-overlay #salamat24h-bars.l24h-bars,
#lightning-24h-overlay .l24h-bars.l24h-bars--columns {
    width: 100% !important;
    box-sizing: border-box;
    gap: 2px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
}

#lightning-24h-overlay .l24h-topnums {
    gap: 2px !important;
    margin-left: 4px !important;
    margin-right: 4px !important;
}

#lightning-24h-overlay .l24h-topnum {
    font-size: 9px !important;
}

#lightning-24h-overlay .l24h-axis {
    gap: 2px !important;
    margin: 6px 4px 0 4px !important;
    overflow: hidden;
}

#lightning-24h-overlay .l24h-axis > span {
    transform: none !important;
    font-size: 9px !important;
    max-width: 12px;
    overflow: hidden;
    text-align: center;
    justify-self: center;
}

#lightning-24h-overlay .l24h-axis-label--muted {
    opacity: 0.45;
}


/* v4.09: Salamakehitys 24 h - akselilla tunnit 3 tunnin välein */
#lightning-24h-overlay .l24h-axis-label--muted {
    opacity: 0.45;
    font-weight: 700;
}


/* v4.09: Salamakehitys 24 h -yhteenvedon numerot normaalin tekstin värillä */
.l24h-meta-compact strong {
    color: #111 !important;
}

body.dark-theme .l24h-meta-compact strong {
    color: #ffffff !important;
}


/* v4.09: vain salamamäärä mustalla, muut korostukset sinisellä */
.l24h-meta-compact strong {
    color: #0d6efd !important;
}

.l24h-meta-compact .l24h-total-value,
.l24h-meta-compact .l24h-peak-value {
    color: #111 !important;
}

body.dark-theme .l24h-meta-compact strong {
    color: #64b5f6 !important;
}

body.dark-theme .l24h-meta-compact .l24h-total-value,
body.dark-theme .l24h-meta-compact .l24h-peak-value {
    color: #ffffff !important;
}


/* v4.09: Vaalean teeman heatmap-segmentit selkeämmiksi.
   Tummaan teemaan ei kosketa. */
body:not(.dark-theme) .heatline-seg[data-trend="down"] {
    background: rgba(144, 238, 144, 0.35);
}

body:not(.dark-theme) .heatline-seg[data-trend="up"] {
    background: rgba(220, 53, 69, 0.35);
}

body:not(.dark-theme) .heatline-seg[data-trend="stable"] {
    background: rgba(255, 255, 224, 0.35);
}

body:not(.dark-theme) .heatline-seg[data-trend="empty"] {
    background: rgba(128, 128, 128, 0.35);
}


/* v4.09: Salamakehitys 24 h - tuntivalinnan tyhjennys */
.l24h-clear-selection-btn {
    margin-top: 8px;
    width: 100%;
    border: 1px solid rgba(0,123,255,0.25);
    border-radius: 8px;
    background: rgba(0,123,255,0.08);
    color: #0d6efd;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 6px;
    cursor: pointer;
}

.l24h-clear-selection-btn:hover {
    background: rgba(0,123,255,0.14);
}

body.dark-theme .l24h-clear-selection-btn {
    border-color: rgba(100,181,246,0.30);
    background: rgba(100,181,246,0.12);
    color: #64b5f6;
}

body.dark-theme .l24h-clear-selection-btn:hover {
    background: rgba(100,181,246,0.18);
}


/* v4.09: Tunnin trendi - malli 10 */
.l24h-selected-card--model10 {
    display: block;
}

.l24h-selected-main {
    margin: 5px 0 4px 0;
    font-size: 13px;
    color: #111;
}

.l24h-selected-main strong {
    color: #111 !important;
}

.l24h-selected-peak {
    margin-top: 6px;
    font-size: 12px;
    color: #333;
}

.l24h-selected-peak strong {
    color: #0d6efd !important;
}

.hourly-trend-list--model10 {
    gap: 3px;
}

.hourly-trend-row--peak {
    background: rgba(0,123,255,0.07);
    border-radius: 6px;
    padding-left: 4px;
    padding-right: 4px;
}

.hourly-trend-row--peak .hourly-trend-row__fill {
    background: linear-gradient(90deg, #0052b8, #0d6efd);
}

.hourly-trend-row--peak .hourly-trend-row__value {
    color: #0d6efd;
}

body.dark-theme .l24h-selected-main,
body.dark-theme .l24h-selected-main strong {
    color: #ffffff !important;
}

body.dark-theme .l24h-selected-peak {
    color: #ffffff;
}

body.dark-theme .l24h-selected-peak strong {
    color: #64b5f6 !important;
}

body.dark-theme .hourly-trend-row--peak {
    background: rgba(100,181,246,0.12);
}

body.dark-theme .hourly-trend-row--peak .hourly-trend-row__fill {
    background: linear-gradient(90deg, #42a5f5, #90caf9);
}

body.dark-theme .hourly-trend-row--peak .hourly-trend-row__value {
    color: #64b5f6 !important;
}


/* v4.09: Tunnin trendin valitun tunnin kortti tiiviimmäksi */
.l24h-selected-card--model10 {
    padding: 8px 9px !important;
}

.l24h-selected-card--model10 .l24h-selected-title {
    margin-bottom: 4px;
    font-size: 12px !important;
    line-height: 1.2;
}

.l24h-selected-main {
    margin: 3px 0 3px 0 !important;
    font-size: 12px !important;
    line-height: 1.25;
}

.l24h-selected-card--model10 .l24h-selected-stats {
    gap: 5px 8px !important;
    font-size: 11px !important;
    line-height: 1.25;
}

.l24h-selected-peak {
    margin-top: 4px !important;
    font-size: 11px !important;
    line-height: 1.25;
}

.l24h-clear-selection-btn {
    margin-top: 6px !important;
    padding: 4px 6px !important;
    font-size: 11px !important;
    line-height: 1.2;
    border-radius: 6px;
}

.hourly-trend-title {
    margin: 8px 0 4px 0 !important;
    font-size: 12px !important;
}

.hourly-trend-row {
    grid-template-columns: 43px minmax(60px, 1fr) 24px !important;
    gap: 6px !important;
    font-size: 11px !important;
    padding: 2px 0 !important;
}

.hourly-trend-row__track {
    height: 10px !important;
}

.hourly-trend-row__label,
.hourly-trend-row__value {
    font-size: 11px !important;
}


/* v4.09: Poistetaan Keskiarvot-osio Ukkosaktiivisuus nyt / päivän tilastoista */
.avg-inline-block {
    display: none !important;
}

/* Varmistus, jos keskiarvot ovat jossain versiossa erillisillä id:illä ilman avg-inline-blockia */
#today-visible-average-5,
#today-visible-average-15,
#today-visible-average-30,
#today-finland-average-5,
#today-finland-average-15,
#today-finland-average-30,
#today-visible-average-5-mobile,
#today-visible-average-15-mobile,
#today-visible-average-30-mobile,
#today-finland-average-5-mobile,
#today-finland-average-15-mobile,
#today-finland-average-30-mobile {
    display: none !important;
}


/* v4.09: Paikallinen ukkostilanne */
.local-storm-card {
    margin-left: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    background: rgba(0,123,255,0.07);
    border: 1px solid rgba(0,123,255,0.14);
    font-size: 12px;
    line-height: 1.25;
}

.local-storm-card p {
    margin: 0 0 3px 0;
}

.local-storm-card p:last-child {
    margin-bottom: 0;
}

.local-storm-target {
    margin-bottom: 5px !important;
    color: #0d6efd;
}

.local-storm-card--mobile {
    margin-left: 0;
}

body.dark-theme .local-storm-card {
    background: rgba(100,181,246,0.10);
    border-color: rgba(100,181,246,0.22);
    color: #fff;
}

body.dark-theme .local-storm-target {
    color: #64b5f6;
}


/* v4.09: Paikallisen ukkostilanteen ratas osion sisällä */
.stat-header--with-action {
    display: flex;
    align-items: center;
    gap: 6px;
}



.local-storm-settings-inline {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 6px 0;
}

.local-storm-settings-inline--mobile {
    margin: 0 0 8px 0;
}

.local-storm-settings-toggle {
    margin-left: auto;
    border: 1px solid rgba(0,123,255,0.20);
    border-radius: 6px;
    background: rgba(255,255,255,0.78);
    color: #0d6efd;
    font-size: 16px;
    line-height: 1;
    padding: 2px 7px 4px 7px;
    cursor: pointer;
}

.local-storm-settings-toggle:hover {
    background: rgba(0,123,255,0.10);
}

.local-storm-settings-toggle.is-open {
    background: rgba(0,123,255,0.16);
    border-color: rgba(0,123,255,0.40);
}

.local-storm-settings-panel {
    margin: 0 0 7px 0;
    padding: 7px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.58);
    border: 1px solid rgba(0,123,255,0.16);
}

.local-storm-settings-title {
    margin: 0 0 5px 0 !important;
    font-weight: 700;
    color: #084298;
}

.local-storm-radius-label {
    display: block;
    margin: 0 0 5px 0;
    font-weight: 700;
    color: #084298;
}

.local-storm-radius-slider {
    width: 100%;
    margin: 0;
}

.local-storm-mobile-heading {
    display: flex;
    align-items: center;
    gap: 6px;
}

body.dark-theme 

.local-storm-settings-inline {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 6px 0;
}

.local-storm-settings-inline--mobile {
    margin: 0 0 8px 0;
}

.local-storm-settings-toggle {
    background: rgba(255,255,255,0.08);
    border-color: rgba(100,181,246,0.30);
    color: #90caf9;
}

body.dark-theme .local-storm-settings-toggle:hover {
    background: rgba(100,181,246,0.14);
}

body.dark-theme .local-storm-settings-toggle.is-open {
    background: rgba(100,181,246,0.22);
    border-color: rgba(100,181,246,0.60);
    color: #ffffff;
}

body.dark-theme .local-storm-settings-panel {
    background: rgba(255,255,255,0.05);
    border-color: rgba(100,181,246,0.24);
}

body.dark-theme .local-storm-settings-title,
body.dark-theme .local-storm-radius-label {
    color: #90caf9;
}


/* v4.09: Paikallisen ukkostilanteen oma sijaintivalikko */
.local-storm-location-control {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 5px 0;
    font-size: 12px;
    font-weight: 700;
    color: #0d6efd;
}

.local-storm-location-control[hidden] {
    display: none !important;
}

.local-storm-location-select {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid rgba(0,123,255,0.25);
    border-radius: 6px;
    background: rgba(255,255,255,0.85);
    color: #084298;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 6px;
}

body.dark-theme .local-storm-location-control {
    color: #64b5f6;
}

body.dark-theme .local-storm-location-select {
    background: rgba(255,255,255,0.08);
    border-color: rgba(100,181,246,0.30);
    color: #ffffff;
}


/* v4.09: Kompakti paikkakuntahaku ja pikavalinnat */
.city-picker {
    position: relative;
    width: 100%;
}

#desktop-buttons-container .city-picker {
    width: auto;
    min-width: 132px;
}

.city-picker-toggle {
    width: 100%;
    min-width: 128px;
    padding-left: 9px;
    padding-right: 9px;
}

.city-picker-panel {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 4px);
    left: 0;
    width: min(245px, 84vw);
    padding: 7px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.98);
    color: #222;
    box-shadow: 0 8px 24px rgba(0,0,0,0.28);
    border: 1px solid rgba(0,0,0,0.12);
}

.city-picker-mobile .city-picker-panel {
    position: fixed;
    top: 318px;
    left: 8px;
    width: min(260px, calc(100vw - 16px));
    max-height: calc(100vh - 336px);
    overflow-y: auto;
}

.city-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    margin-bottom: 5px;
    border-radius: 6px;
    border: 1px solid #cfd6dd;
    font-size: 0.86em;
    line-height: 1.15;
}

.city-picker-group {
    margin-top: 5px;
}

.city-picker-title {
    margin: 0 0 3px 2px;
    font-size: 0.66em;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.city-picker-buttons,
.city-picker-results {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.city-picker-option {
    border: 1px solid rgba(0,123,255,0.25);
    background: #eef6ff;
    color: #0b4f8a;
    border-radius: 999px;
    padding: 4px 7px;
    cursor: pointer;
    font-size: 0.76em;
    line-height: 1.15;
}

.city-picker-option:hover {
    background: #d9ecff;
}

.city-picker-saved-option {
    background: #fff7db;
    border-color: rgba(180,130,0,0.35);
    color: #6f5200;
}

.city-picker-empty {
    padding: 4px 2px;
    color: #666;
    font-size: 0.78em;
}

body.dark-mode .city-picker-panel {
    background: rgba(31, 38, 46, 0.98);
    color: #f2f2f2;
    border-color: rgba(255,255,255,0.15);
}

body.dark-mode .city-search-input {
    background: #111820;
    color: #f2f2f2;
    border-color: #43505d;
}

body.dark-mode .city-picker-title,
body.dark-mode .city-picker-empty {
    color: #cfd6dd;
}

body.dark-mode .city-picker-option {
    background: #17314b;
    color: #d9ecff;
    border-color: rgba(100,170,255,0.30);
}

body.dark-mode .city-picker-option:hover {
    background: #214667;
}

body.dark-mode .city-picker-saved-option {
    background: #4b3b16;
    color: #ffe6a1;
    border-color: rgba(255,210,100,0.30);
}

/* v4.09: Paikallisen ukkostilanteen etäisyysmittari */
.local-distance-measure {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin: 5px 0 7px 0;
}

.local-distance-measure-btn {
    border: 1px solid rgba(13,110,253,0.35);
    border-radius: 6px;
    background: rgba(13,110,253,0.12);
    color: #084298;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 7px;
    line-height: 1.1;
    cursor: pointer;
}

.local-distance-measure-btn:hover {
    background: rgba(13,110,253,0.18);
}


.local-distance-measure-btn.is-active {
    background: rgba(13,110,253,0.24);
    border-color: rgba(13,110,253,0.58);
    box-shadow: 0 0 0 2px rgba(13,110,253,0.10);
}

body.dark-theme .local-distance-measure-btn.is-active {
    background: rgba(100,181,246,0.28);
    border-color: rgba(100,181,246,0.58);
    box-shadow: 0 0 0 2px rgba(100,181,246,0.12);
}

.local-distance-measure-btn--secondary {
    background: rgba(108,117,125,0.10);
    border-color: rgba(108,117,125,0.30);
    color: #495057;
}

.local-distance-measure-btn[hidden] {
    display: none !important;
}

.local-distance-measure-status {
    flex: 1 1 100%;
    margin: 1px 0 0 0 !important;
    padding: 4px 6px;
    border-radius: 6px;
    background: rgba(255,255,255,0.58);
    border: 1px solid rgba(13,110,253,0.16);
    color: #084298;
    font-size: 11px;
    font-weight: 700;
    white-space: pre-line;
}

.local-distance-measure-status.is-error {
    background: rgba(220,53,69,0.10);
    border-color: rgba(220,53,69,0.28);
    color: #842029;
}

body.dark-theme .local-distance-measure-btn {
    background: rgba(100,181,246,0.14);
    border-color: rgba(100,181,246,0.35);
    color: #e3f2fd;
}

body.dark-theme .local-distance-measure-btn:hover {
    background: rgba(100,181,246,0.22);
}

body.dark-theme .local-distance-measure-btn--secondary {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.22);
    color: #f1f3f5;
}

body.dark-theme .local-distance-measure-status {
    background: rgba(255,255,255,0.08);
    border-color: rgba(100,181,246,0.24);
    color: #e3f2fd;
}

body.dark-theme .local-distance-measure-status.is-error {
    background: rgba(220,53,69,0.18);
    border-color: rgba(255,99,132,0.42);
    color: #ffd7df;
}

.leaflet-container.is-distance-measuring {
    cursor: crosshair;
}

.distance-measure-label span {
    display: inline-block;
    min-width: 56px;
    padding: 2px 5px;
    border-radius: 8px;
    background: rgba(13, 110, 253, 0.88);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.85);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    text-shadow: 0 1px 1px rgba(0,0,0,0.35);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* v4.09: mobiilin etäisyysmittari vasemman paneelin painikkeena */
.distance-measure-panel-btn {
    text-align: center;
    text-align-last: center;
}

.distance-measure-panel-btn.is-active {
    background-color: #0056b3;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.28), 0 2px 5px rgba(0,0,0,0.2);
}

body.dark-theme .distance-measure-panel-btn.is-active {
    background-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(100,181,246,0.34), 0 2px 5px rgba(0,0,0,0.25);
}

/* v4.09: Mobiilin vasemman paneelin painikkeet hieman tiiviimmiksi */
@media (max-width: 768px) {
    #top-left-mobile-buttons {
        gap: 3px;
        padding: 8px;
    }

    #top-left-mobile-buttons .action-button,
    #top-left-mobile-buttons select.action-button,
    #top-left-mobile-buttons .city-picker-toggle {
        font-size: 11px;
        padding: 4px 6px;
        min-height: 28px;
        line-height: 1.1;
    }

    #top-left-mobile-buttons select.action-button {
        height: 30px;
    }
}

.distance-measure-label--forecast span {
    min-width: 88px;
    background: rgba(255, 193, 7, 0.92);
    color: #111111;
    border-color: rgba(255,255,255,0.9);
    text-shadow: none;
}

/* Pieni paikkakunta-/sijaintihypyn tilailmoitus: näkyy kartan yläkeskellä eikä estä käyttöä. */
.map-jump-status {
    position: fixed;
    top: 78px;
    left: 50%;
    z-index: 1200;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(20, 28, 38, 0.90);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -4px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.map-jump-status.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 768px) {
    .map-jump-status {
        top: 68px;
        left: 50%;
        padding: 7px 12px;
        font-size: 12px;
        transform: translate(-50%, -4px);
    }

    .map-jump-status.is-visible {
        transform: translate(-50%, 0);
    }
}

.action-button:disabled,
.action-button.is-disabled {
    cursor: not-allowed;
    opacity: 0.45;
    filter: grayscale(0.5);
}


.storm-watch-card {
  margin-left: 16px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 4px 6px;
}

.storm-watch-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}


.storm-watch-item {
  margin: 0;
  line-height: 1.22;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(20, 33, 61, 0.10);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.storm-watch-item--lahiisku {
  background: rgba(220, 53, 69, 0.24);
  border-color: rgba(220, 53, 69, 0.38);
  border-left: 4px solid rgba(220, 53, 69, 0.98);
}

.storm-watch-item--lahella {
  background: rgba(255, 140, 0, 0.14);
  border-color: rgba(255, 140, 0, 0.24);
  border-left: 4px solid rgba(255, 140, 0, 0.84);
}

.storm-watch-item--seurattava {
  background: rgba(255, 193, 7, 0.16);
  border-color: rgba(255, 193, 7, 0.26);
  border-left: 4px solid rgba(214, 158, 0, 0.82);
}

.storm-watch-item--kaukana {
  background: rgba(120, 145, 170, 0.12);
  border-color: rgba(120, 145, 170, 0.22);
  border-left: 4px solid rgba(120, 145, 170, 0.70);
}

.storm-watch-item--rauhallinen {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(20, 33, 61, 0.10);
  border-left: 4px solid rgba(148, 163, 184, 0.70);
}

body.dark-theme .storm-watch-item {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

body.dark-theme .storm-watch-item--lahiisku {
  background: rgba(220, 53, 69, 0.34);
  border-color: rgba(255, 99, 132, 0.48);
  border-left-color: rgba(255, 99, 132, 1);
}

body.dark-theme .storm-watch-item--lahella {
  background: rgba(255, 140, 0, 0.22);
  border-color: rgba(255, 170, 70, 0.30);
  border-left-color: rgba(255, 170, 70, 0.94);
}

body.dark-theme .storm-watch-item--seurattava {
  background: rgba(255, 193, 7, 0.22);
  border-color: rgba(255, 214, 102, 0.30);
  border-left-color: rgba(255, 214, 102, 0.94);
}

body.dark-theme .storm-watch-item--kaukana {
  background: rgba(120, 145, 170, 0.20);
  border-color: rgba(148, 163, 184, 0.24);
  border-left-color: rgba(148, 163, 184, 0.90);
}

body.dark-theme .storm-watch-item--rauhallinen {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.10);
  border-left-color: rgba(148, 163, 184, 0.76);
}


.storm-watch-item__heading {
  margin: 0;
  font-weight: 600;
  font-size: 0.84rem;
}

.storm-watch-item__line {
  margin: 0;
  font-size: 0.84rem;
}


.storm-watch-item + .storm-watch-item {
  margin-top: 1px;
}

.storm-watch-empty {
  margin: 0;
  opacity: 0.85;
}


.storm-watch-item--empty {
    opacity: 0.8;
}


/* v4.09: Paikallinen ukkostilanne 5/10/15/30 min vertailut */
.local-storm-periods {
    margin: 0 0 6px 0;
}

.local-storm-period-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 3px 0;
}

.local-storm-period-row:last-child {
    margin-bottom: 0;
}

.local-storm-period-label {
    color: inherit;
    white-space: nowrap;
}

.local-storm-period-row strong {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

body.dark-theme .local-storm-period-label {
    color: inherit;
}


.high-load-notice {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2450;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.high-load-notice-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    line-height: 1.45;
    font-size: 13px;
    font-weight: 500;
}

.high-load-notice-title {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.14);
    padding: 3px 8px;
    border-radius: 6px;
}

body.has-high-load-notice #top-left-mobile-buttons {
    top: 42px;
}

body.has-high-load-notice #toggle-mobile-ui-btn,
body.has-high-load-notice #info-button-mobile {
    top: 52px;
}

body.has-site-alert.has-high-load-notice #top-left-mobile-buttons {
    top: 94px;
}

body.has-site-alert.has-high-load-notice #toggle-mobile-ui-btn,
body.has-site-alert.has-high-load-notice #info-button-mobile {
    top: 104px;
}

@media (max-width: 768px) {
    .high-load-notice-inner {
        padding: 8px 12px;
        font-size: 12px;
    }
}
