:root {
    /* Brand — NOSICHECK teal */
    --brand-primary: #0F766E;
    --brand-secondary: #14B8A6;
    --brand-accent: #D97706;

    /* UI — semantic surfaces so dark mode is a variable swap */
    color-scheme: light;
    --bg-light: #ffffff;
    --text-dark: #111827;
    --text-muted: #6b7280;
    --text-faint: #999999;
    --surface: #ffffff;                        /* panels, bars, popups */
    --surface-2: #f3f4f6;                      /* hovers, secondary buttons, badges */
    --surface-3: #f9fafb;                      /* popup headers, insets */
    --surface-brand: #F0FDFA;                  /* brand-tinted highlights */
    --surface-translucent: rgba(255, 255, 255, 0.92);
    --border-c: #e5e7eb;
    --border-soft: #eeeeee;
    --input-border: #d1d5db;

    /* AQI (same scale as senzorvzduchu for cross-site consistency) */
    --aqi-good: #87C159;
    --aqi-moderate: #F4D35E;
    --aqi-sensitive: #F48C42;
    --aqi-unhealthy: #E64A45;
    --aqi-very-unhealthy: #8C6AB6;
    --aqi-hazardous: #7D5963;
    --aqi-no-data: #9ca3af;

    /* Report types */
    --rep-zapach: #D97706;
    --rep-kour: #4B5563;
    --rep-prach: #92610C;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    overflow: hidden;
    position: relative;
}

#map {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    touch-action: manipulation;
}
#map.picking { cursor: crosshair; }

/* Zoom +/− below the top bar row (pollutant bar / auth chip), not inside it.
   Mobile pushes further (52px) in the media block below. */
.leaflet-top.leaflet-left .leaflet-control { margin-top: 44px; }

/* ---------- Pollutant switcher ---------- */
.pollutant-bar {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top)); left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    display: flex; align-items: center; gap: 4px;
    background: var(--surface);
    padding: 5px;
    border-radius: 22px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    max-width: calc(100vw - 20px);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.pollutant-bar::-webkit-scrollbar { display: none; }
.pollutant-chip {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Familjen Grotesk', sans-serif;
    font-size: 13px; font-weight: 600;
    padding: 7px 13px;
    border-radius: 17px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.pollutant-chip:hover { background: var(--surface-2); }
.pollutant-chip.active { background: var(--brand-primary); color: white; }
.pollutant-chip.pollutant-info {
    color: var(--brand-primary);
    font-size: 14px;
    padding: 7px 11px;
    border-left: 1px solid var(--border-soft);
    border-radius: 0 17px 17px 0;
}

/* ---------- Legend ---------- */
.legend {
    position: fixed;
    top: 10px; right: 10px;
    background: var(--surface);
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 150px;
    border-left: 3px solid var(--brand-primary);
}
.legend-header {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer;
    margin-bottom: 6px;
}
.legend-title {
    font-family: 'Familjen Grotesk', sans-serif;
    font-size: 13px; font-weight: 600;
    color: var(--brand-primary);
}
.legend-content { transition: max-height 0.3s ease; overflow: hidden; max-height: 500px; }
.legend-content.collapsed { max-height: 0; }
.legend-item { display: flex; align-items: center; margin: 4px 0; font-size: 10px; }
.legend-color { width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; }

.legend-sources { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-soft); }
.legend-source-item {
    display: flex; align-items: center;
    margin: 3px 0; font-size: 9px;
    color: var(--text-muted);
    cursor: pointer; user-select: none;
    transition: opacity 0.2s;
}
.legend-source-item.disabled { opacity: 0.35; text-decoration: line-through; }
.src-dot {
    width: 10px; height: 10px; border-radius: 50%;
    margin-right: 6px; flex-shrink: 0;
    background: #9ca3af;
}
.src-sc   { border: 1px solid #888; }
.src-chmi { border: 2px solid #000; }
.src-sck  { border: 1px dashed #555; }
.src-pa   { border: 2px solid #7B2D8E; }
.src-rep  { background: var(--rep-zapach); border: 1px solid #fff; box-shadow: 0 0 0 1px var(--rep-zapach); }
.src-wind { background: linear-gradient(135deg, #93C5FD, #3B82F6); border: 1px solid #60A5FA; }
.src-emoji { font-size: 11px; line-height: 1; margin-right: 6px; flex-shrink: 0; }

/* Fire markers (fires.js divIcons) — age fade: fresh glows, old goes grey */
.fire-marker { display: block; line-height: 1; text-align: center; }
.fire-fresh  { filter: drop-shadow(0 0 4px rgba(220, 38, 38, 0.8)); }
.fire-recent { filter: none; }
.fire-old    { filter: grayscale(1); opacity: 0.55; }
.src-interp { background: linear-gradient(135deg, #87C159, #F4D35E, #E64A45); border: 1px solid #ccc; opacity: 0.7; }

/* Interp row when the metric can't be interpolated (noise) */
.legend-source-item.unavailable { opacity: 0.3; pointer-events: none; }

.legend-basemap {
    display: flex; align-items: center; gap: 4px;
    margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border-soft);
    font-size: 9px; color: var(--text-muted);
}
.basemap-btn {
    border: 1px solid var(--border-c);
    background: var(--surface);
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 9px; font-weight: 600;
    padding: 3px 7px;
    border-radius: 10px;
    cursor: pointer;
}
.basemap-btn.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
}

/* Let roads/water show through the interpolation color field */
.interp-overlay { mix-blend-mode: multiply; }

/* ---------- Wind readout (leaflet-velocity displayValues) ---------- */
.leaflet-control-velocity {
    background: var(--surface-translucent);
    padding: 4px 10px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}
/* Desktop: lift above the report button (same corner) */
.leaflet-bottom.leaflet-right .leaflet-control-velocity {
    margin: 0 10px 68px 0;
}

.legend-info-link {
    margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border-soft);
    font-size: 10px; font-weight: 600;
    color: var(--brand-primary);
    cursor: pointer; user-select: none;
}
.legend-info-link:hover { text-decoration: underline; }

/* ---------- Update indicator ---------- */
.update-indicator {
    position: fixed;
    bottom: 10px; left: 10px;
    background: var(--surface);
    padding: 6px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border: 1px solid var(--border-soft);
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 2px;
}
.update-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
.update-subtitle { font-size: 9px; color: var(--text-faint); margin-left: 16px; font-weight: 500; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-secondary); }
.status-dot.error { background: var(--aqi-unhealthy); }

/* ---------- Auth chip ---------- */
.auth-chip {
    position: fixed;
    top: 10px; left: 54px;   /* right of the zoom control */
    background: var(--surface);
    padding: 6px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border: 1px solid var(--border-soft);
    font-size: 11px;
    color: var(--text-muted);
}
.auth-chip a { color: var(--brand-primary); font-weight: 600; text-decoration: none; cursor: pointer; }
.auth-chip a:hover { text-decoration: underline; }

/* ---------- Report button + hint ---------- */
.report-btn {
    position: fixed;
    bottom: 20px; right: 20px;
    z-index: 1000;
    background: var(--brand-accent);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 12px 20px;
    font-family: 'Familjen Grotesk', sans-serif;
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.report-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }
.report-btn.active { background: var(--brand-primary); }

.report-hint {
    position: fixed;
    bottom: 74px; right: 20px;
    z-index: 1000;
    background: var(--brand-primary);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    max-width: 260px;
    display: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.report-hint a { color: #A7F3D0; }

/* ---------- Popups ---------- */
.leaflet-popup-content-wrapper {
    background: var(--surface);
    color: var(--text-dark);
    border-radius: 8px;
    padding: 0;
    border: none;
    font-family: 'Inter', sans-serif;
    min-width: 250px;
}
.popup-header {
    background: var(--surface-3);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-soft);
    border-radius: 8px 8px 0 0;
    font-family: 'Familjen Grotesk', sans-serif;
    font-weight: 600; font-size: 14px;
}
.popup-content-body { padding: 15px; }
.popup-hero { text-align: center; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.popup-pm-value {
    font-size: 32px; font-weight: 700; line-height: 1; margin-bottom: 4px;
    font-family: 'Familjen Grotesk', sans-serif;
}
.popup-detail {
    font-size: 12px; color: var(--text-muted);
    margin: 4px 0;
    display: flex; justify-content: space-between; align-items: center;
}
.popup-detail.main-label { justify-content: center; color: var(--text-muted); font-size: 13px; }
.popup-source {
    margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border-soft);
    font-size: 10px; color: var(--text-faint);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.popup-wind { font-size: 11px; color: var(--text-muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.popup-wind .arrow { display: inline-block; font-size: 14px; color: var(--brand-primary); }
.popup-photos { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.popup-photos img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; cursor: pointer; }

/* ---------- Report markers ---------- */
.report-marker { background: transparent; border: none; }
.report-marker .pin {
    width: 26px; height: 26px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.report-marker .pin span { transform: rotate(45deg); font-size: 13px; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(17, 24, 39, 0.55);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    padding: 14px;
}
.modal {
    background: var(--surface);
    border-radius: 12px;
    max-width: 440px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    padding: 20px;
}
.modal h2 {
    font-family: 'Familjen Grotesk', sans-serif;
    font-size: 18px; color: var(--brand-primary);
    margin-bottom: 14px;
}
.modal label { display: block; font-size: 12px; font-weight: 600; margin: 12px 0 4px; color: var(--text-dark); }
.modal input[type="text"], .modal input[type="email"], .modal input[type="password"],
.modal select, .modal textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--input-border);
    background: var(--surface);
    color: var(--text-dark);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
}
.modal textarea { resize: vertical; min-height: 64px; }
.modal input[type="range"] { width: 100%; }
.range-value { font-size: 12px; color: var(--brand-primary); font-weight: 600; text-align: center; margin-top: 2px; }
.type-row { display: flex; gap: 8px; margin-top: 4px; }
.type-btn {
    flex: 1;
    padding: 8px 4px;
    border: 2px solid var(--border-c);
    border-radius: 8px;
    background: var(--surface);
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.type-btn.selected { border-color: var(--brand-primary); background: var(--surface-brand); color: var(--brand-primary); }
.modal .btn-row { display: flex; gap: 8px; margin-top: 18px; }
.btn {
    flex: 1;
    padding: 10px;
    border: none; border-radius: 8px;
    font-family: 'Familjen Grotesk', sans-serif;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
}
.btn-primary { background: var(--brand-primary); color: white; }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-secondary { background: var(--surface-2); color: var(--text-dark); }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:disabled { background: #9ca3af; cursor: not-allowed; }
.modal .error-msg { color: var(--aqi-unhealthy); font-size: 12px; margin-top: 10px; display: none; }
.modal .terms-row {
    display: flex; align-items: flex-start; gap: 8px;
    margin-top: 14px;
    font-size: 12px; font-weight: 400; line-height: 1.45;
    color: var(--text-muted);
    cursor: pointer;
}
.modal .terms-row input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; }
.modal .terms-row a { color: var(--brand-primary); }
.info-legal {
    margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--border-soft);
    font-size: 11px; line-height: 1.6; color: var(--text-muted);
}
.info-legal a { color: var(--brand-primary); text-decoration: none; }
.info-legal a:hover { text-decoration: underline; }
.modal .switch-link { font-size: 12px; margin-top: 12px; text-align: center; color: var(--text-muted); }
.modal .switch-link a { color: var(--brand-primary); cursor: pointer; font-weight: 600; }

/* ---------- Info / methodology modal ---------- */
.info-lead {
    font-size: 13px; line-height: 1.55;
    background: var(--surface-brand);
    border-left: 3px solid var(--brand-primary);
    border-radius: 0 8px 8px 0;
    padding: 10px 12px;
    margin-bottom: 12px;
}
.info-sec { margin: 8px 0; border: 1px solid var(--border-c); border-radius: 8px; padding: 8px 10px; }
.info-sec summary {
    font-family: 'Familjen Grotesk', sans-serif;
    font-size: 13px; font-weight: 600;
    color: var(--text-dark);
    cursor: pointer; user-select: none;
}
.info-sec[open] summary { color: var(--brand-primary); margin-bottom: 6px; }
.info-sec p { font-size: 12px; line-height: 1.5; color: var(--text-muted); margin: 6px 0; }
.info-sec a { color: var(--brand-primary); }
.info-table { width: 100%; border-collapse: collapse; font-size: 11px; margin: 6px 0; }
.info-table th { text-align: left; color: var(--text-dark); padding: 3px 4px; border-bottom: 1px solid var(--border-c); }
.info-table td { padding: 4px; border-bottom: 1px solid var(--border-soft); color: var(--text-muted); vertical-align: top; line-height: 1.4; }

/* ---------- Radar time chip (visible only while the radar layer is on) ---------- */
.radar-clock {
    position: fixed;
    /* left rail, above .update-indicator; on mobile also above the auth chip
       (which drops to bottom-left there) — see the mobile override below */
    left: 10px; bottom: calc(56px + env(safe-area-inset-bottom));
    z-index: 900;                 /* above the map panes, below legend/modals */
    background: var(--surface-translucent);
    color: var(--text-dark);
    border: 1px solid var(--border-c);
    border-radius: 8px;
    padding: 3px 10px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;   /* animation ticks without jitter */
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 80px; left: 50%;
    transform: translateX(-50%);
    background: var(--brand-primary);
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 3000;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    text-align: center;
}
.toast.error { background: var(--aqi-unhealthy); }

/* ---------- Screen-reader / crawler only ---------- */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Photo lightbox (above modal 2000, below toast 3000) ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2500;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}
.lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
.lightbox-close {
    position: absolute;
    top: calc(8px + env(safe-area-inset-top));
    right: 16px;
    background: none;
    border: none;
    color: white;
    font-size: 38px;
    line-height: 1;
    cursor: pointer;
    padding: 6px 10px;
}

/* ---------- Welcome / post-submit modal content ---------- */
.welcome-icon { font-size: 42px; text-align: center; margin-bottom: 4px; }
.welcome-text { font-size: 13px; color: var(--text-dark); line-height: 1.55; margin: 10px 0 4px; }
.success-note { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.popup-source .report-share { color: var(--brand-primary); text-decoration: none; font-weight: 600; }

/* ---------- Popup actions: confirm + comments ---------- */
.popup-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    font-size: 11px;
}
.popup-actions a { color: var(--brand-primary); text-decoration: none; font-weight: 600; }
.popup-actions a.confirmed { color: var(--text-muted); pointer-events: none; }
.popup-comments {
    margin-top: 6px;
    border-top: 1px solid var(--border-soft);
    padding-top: 6px;
    max-height: 180px;
    overflow-y: auto;
}
.comment { font-size: 11px; margin-bottom: 6px; line-height: 1.4; }
.comment-when { color: var(--text-muted); font-size: 10px; margin-left: 4px; }
.comment-del { color: var(--aqi-unhealthy); text-decoration: none; margin-left: 4px; }
.comment-flag { color: var(--text-muted); text-decoration: none; margin-left: 4px; opacity: 0.7; }
.comment-empty, .comment-loading { font-size: 11px; color: var(--text-muted); }
.comment-empty a { color: var(--brand-primary); }
.comment-form { display: flex; gap: 4px; margin-top: 6px; }
.comment-form input {
    flex: 1;
    font-size: 11px;
    padding: 5px 8px;
    border: 1px solid var(--border-c);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-dark);
}
.comment-form .comment-send { font-size: 11px; padding: 5px 10px; }

/* ---------- Profile menu + Moje hlášení + Hlídané okolí ---------- */
.profile-menu { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.profile-btn { text-align: left; text-decoration: none; }
.mr-row {
    border-bottom: 1px solid var(--border-soft);
    padding: 8px 0;
    font-size: 12px;
}
.mr-head { font-weight: 600; }
.mr-desc { color: var(--text-muted); font-style: italic; margin-top: 2px; }
.mr-actions { margin-top: 4px; font-size: 11px; }
.mr-actions a { color: var(--brand-primary); text-decoration: none; font-weight: 600; }
.mr-actions a.mr-del { color: var(--aqi-unhealthy); }
.badge {
    display: inline-block;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 8px;
    margin-left: 4px;
}
.badge-ok { background: #ecfdf5; color: #047857; }
.badge-warn { background: #fef2f2; color: #b91c1c; }
.watch-row .watch-del { float: right; color: var(--aqi-unhealthy); text-decoration: none; font-weight: 700; }
#myReportsList, #watchList { max-height: 45vh; overflow-y: auto; }

/* ---------- Reports view switch (pins vs. heat) ---------- */
.reports-mode {
    display: flex;
    gap: 4px;
    margin: 2px 0 4px 18px;   /* indent under the "Hlášení občanů" row */
}
.reports-mode-btn,
.reports-period-btn {
    border: 1px solid var(--border-c);
    background: var(--surface);
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    cursor: pointer;
}
.reports-mode-btn.active,
.reports-period-btn.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
}

/* ---------- Popup chart: range switch + forecast note ---------- */
.chart-range {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-bottom: 6px;
}
.chart-range-btn {
    border: 1px solid var(--border-c);
    background: var(--surface);
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    cursor: pointer;
}
.chart-range-btn.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
}
/* The forecast is a model, not a measurement — it gets the muted treatment the
   sensor readings above it deliberately do not have. */
.chart-fc-note {
    margin-bottom: 10px;
    padding: 6px 8px;
    border-left: 2px solid var(--border-c);
    background: var(--surface-3);
    border-radius: 0 4px 4px 0;
    font-size: 10.5px;
    line-height: 1.45;
    color: var(--text-muted);
}
.chart-fc-note strong { color: var(--text-dark); font-weight: 600; }

/* ---------- Dark mode ----------
   Toggled by app.js via <html data-theme="dark"> (nc_theme in localStorage,
   default follows the OS). Pure variable swap + a few Leaflet/UA overrides. */
html[data-theme="dark"] {
    color-scheme: dark;
    --bg-light: #111827;
    --text-dark: #e5e7eb;
    --text-muted: #9ca3af;
    --text-faint: #6b7280;
    --surface: #1f2937;
    --surface-2: #374151;
    --surface-3: #111827;
    --surface-brand: #113a35;
    --surface-translucent: rgba(31, 41, 55, 0.92);
    --border-c: #374151;
    --border-soft: #2b3544;
    --input-border: #4b5563;
}

/* ČHMÚ legend dot: black ring vanishes on a dark panel */
html[data-theme="dark"] .src-chmi { border-color: #e5e7eb; }

/* Leaflet chrome (zoom buttons, attribution, popup bubble) */
html[data-theme="dark"] .leaflet-bar a {
    background: var(--surface);
    color: var(--text-dark);
    border-bottom-color: var(--border-c);
}
html[data-theme="dark"] .leaflet-bar a:hover { background: var(--surface-2); }
html[data-theme="dark"] .leaflet-control-attribution {
    background: var(--surface-translucent);
    color: var(--text-muted);
}
html[data-theme="dark"] .leaflet-control-attribution a { color: #7dd3fc; }
html[data-theme="dark"] .leaflet-popup-tip { background: var(--surface); }

/* Status badges keep their meaning, darker palette */
html[data-theme="dark"] .badge-ok { background: #064e3b; color: #6ee7b7; }
html[data-theme="dark"] .badge-warn { background: #7f1d1d; color: #fca5a5; }

/* The interp field multiplies into invisibility on dark tiles — additive there.
   Keyed on the BASEMAP (body class from setBasemap), not the UI theme. */
body.basemap-dark .interp-overlay { mix-blend-mode: screen; }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
    /* Pollutant bar stays centered and shrink-to-fit (like desktop);
       the base rule caps it at 100vw - 20px with horizontal scroll */
    .pollutant-chip { font-size: 12px; padding: 7px 11px; }
    .leaflet-top.leaflet-left .leaflet-control { margin-top: 52px; }
    /* top is set by layoutLegend() in app.js (below the measured bar); 62px is the no-JS fallback */
    .legend { top: 62px; right: 10px; left: auto; min-width: 120px; padding: 8px 10px; max-width: 60vw; }
    .legend-content:not(.collapsed) { max-height: calc(100dvh - 140px); overflow-y: auto; }
    .legend-title { font-size: 11px; }
    .legend-item { font-size: 9px; margin: 3px 0; }
    .legend-color { width: 10px; height: 10px; margin-right: 6px; }

    /* Bottom-left stack (small → large): update pill, auth chip, wind readout.
       Bottom-right belongs to the report button alone. */
    .update-indicator {
        bottom: calc(8px + env(safe-area-inset-bottom)); left: 8px;
        flex-direction: row; align-items: center; gap: 5px;
        padding: 4px 9px; border-radius: 10px;
    }
    .update-label { display: none; }              /* dot + time says it */
    .update-row { font-size: 10px; gap: 5px; }
    .update-subtitle { margin-left: 0; font-size: 9px; }
    .update-subtitle::before { content: '· '; color: #d1d5db; }

    .auth-chip {
        top: auto; left: 8px;
        bottom: calc(40px + env(safe-area-inset-bottom));
        padding: 5px 10px; font-size: 11px;
    }
    /* above the auth chip (bottom 40px + ~26px height) in the bottom-left stack */
    .radar-clock { left: 8px; bottom: calc(74px + env(safe-area-inset-bottom)); }
    .auth-hint { display: none; }                 /* rate-limit hint is in the modal anyway */

    /* above the report button (bottom 14px + ~44px height), right rail —
       the left rail is taken by the update pill / auth chip / radar clock */
    .leaflet-bottom.leaflet-right .leaflet-control-velocity {
        margin: 0 10px calc(60px + env(safe-area-inset-bottom)) 0;
        font-size: 10px;
        max-width: 70vw;
        white-space: normal;
    }

    .report-btn {
        bottom: calc(14px + env(safe-area-inset-bottom)); right: 10px;
        padding: 11px 16px; font-size: 14px;
    }
    .report-hint { bottom: calc(64px + env(safe-area-inset-bottom)); right: 10px; }

    /* Attribution: readable but out of the way of the button */
    .leaflet-bottom.leaflet-right .leaflet-control-attribution {
        font-size: 9px;
        margin-right: 158px;
        background: var(--surface-translucent);
    }
}

/* ---------- ČHMÚ warning slider (alerts.js) ----------
   Anchored to the left edge, mid-height: the only strip of chrome-free screen
   (pollutant bar owns the top, legend the right, update/auth/report the bottom).
   Two states, both driven from JS: .open = card in, .retracted = tab out. With
   neither class both sit off-canvas, so nothing flashes before the first slide. */
.nc-alert {
    position: fixed;
    left: 0;
    top: 46%;
    z-index: 1100;                                  /* over the legend, under modals */
    --lvl: #eab308;
    --lvl-soft: #fef9c3;
}
.nc-alert.lvl-3 { --lvl: #ea580c; --lvl-soft: #ffedd5; }
.nc-alert.lvl-4 { --lvl: #dc2626; --lvl-soft: #fee2e2; }

.nc-alert-card {
    position: relative;
    display: flex; align-items: flex-start; gap: 10px;
    width: max-content;
    max-width: min(330px, calc(100vw - 60px));
    padding: 11px 32px 11px 12px;
    background: var(--surface);
    border-left: 5px solid var(--lvl);
    border-radius: 0 14px 14px 0;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    transform: translateX(-108%);
    opacity: 0;
    transition: transform 0.62s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}
.nc-alert.open .nc-alert-card { transform: translateX(0); opacity: 1; }
.nc-alert-card:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }

/* Smog is the one warning this map's own sensors can corroborate — tint it. */
.nc-alert.is-smog .nc-alert-card {
    background: linear-gradient(100deg, var(--lvl-soft) 0%, var(--surface) 65%);
}

.nc-alert-icon {
    flex: 0 0 auto;
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--lvl-soft);
    font-size: 17px; line-height: 1;
}
.nc-alert.lvl-4 .nc-alert-icon { animation: ncAlertPulse 2.4s ease-in-out 3; }
@keyframes ncAlertPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
    50%      { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); }
}

.nc-alert-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nc-alert-kicker {
    font-size: 9.5px; font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--lvl);
}
.nc-alert-title {
    font-family: 'Familjen Grotesk', sans-serif;
    font-size: 14px; font-weight: 600; line-height: 1.25;
    color: var(--text-dark);
}
.nc-alert-meta { font-size: 11px; color: var(--text-muted); }
.nc-alert-more { font-size: 10.5px; font-weight: 600; color: var(--brand-primary); margin-top: 1px; }

.nc-alert-x {
    position: absolute; top: 3px; right: 3px;
    width: 24px; height: 24px;
    border: 0; border-radius: 6px;
    background: transparent;
    color: var(--text-faint);
    font-size: 19px; line-height: 1;
    cursor: pointer;
}
.nc-alert-x:hover { background: var(--surface-2); color: var(--text-dark); }

.nc-alert-tab {
    position: absolute; left: 0; top: 50%;
    display: flex; align-items: center; gap: 3px;
    padding: 7px 9px 7px 6px;
    background: var(--surface);
    border: 0; border-left: 4px solid var(--lvl);
    border-radius: 0 11px 11px 0;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    font-size: 15px; line-height: 1;
    cursor: pointer;
    transform: translate(-115%, -50%);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.nc-alert.retracted .nc-alert-tab { transform: translate(0, -50%); }
.nc-alert-tab b { font-size: 10px; font-weight: 700; color: var(--lvl); }

/* Detail modal rows */
.nc-alert-scope { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.nc-alert-item {
    border-left: 4px solid var(--lvl);
    background: var(--surface-3);
    border-radius: 0 8px 8px 0;
    padding: 10px 12px;
    margin-bottom: 10px;
    --lvl: #eab308;
}
.nc-alert-item.lvl-3 { --lvl: #ea580c; }
.nc-alert-item.lvl-4 { --lvl: #dc2626; }
.nc-alert-item-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.nc-alert-chip {
    font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: #fff; background: var(--lvl);
    padding: 2px 6px; border-radius: 999px;
}
.nc-alert-item-when { font-size: 11px; color: var(--text-muted); margin: 3px 0 6px; }
.nc-alert-item p { font-size: 12px; line-height: 1.5; margin-bottom: 5px; color: var(--text-dark); }
.nc-alert-instr, .nc-alert-where { color: var(--text-muted); }
.nc-alert-src { font-size: 11px; color: var(--text-muted); line-height: 1.5; margin-top: 12px; }
.nc-alert-src a { color: var(--brand-primary); }

html[data-theme="dark"] .nc-alert.lvl-2 { --lvl-soft: #423613; }
html[data-theme="dark"] .nc-alert.lvl-3 { --lvl-soft: #4a2410; }
html[data-theme="dark"] .nc-alert.lvl-4 { --lvl-soft: #4c1d1d; }

@media (prefers-reduced-motion: reduce) {
    .nc-alert-card, .nc-alert-tab { transition-duration: 0.01ms; }
    .nc-alert.lvl-4 .nc-alert-icon { animation: none; }
}

@media (max-width: 768px) {
    .nc-alert { top: 50%; }
    .nc-alert-card { max-width: calc(100vw - 52px); padding: 10px 30px 10px 10px; }
    .nc-alert-title { font-size: 13px; }
    .nc-alert-meta { font-size: 10.5px; }
}
